Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return empty string when content is blocked for Gemini #2313

Merged
merged 4 commits into from
Feb 3, 2024

Conversation

JosselinSomervilleRoberts
Copy link
Contributor

No description provided.

Copy link
Collaborator

@yifanmai yifanmai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually can we return something like {"predictions": null} instead, so that we can distinguish between actual and "placeholder" empty predictions?

Then later on you can do

if response["predictions"] is None:
    return RequestResult(
        success=False,
        cached=False,
        error="Response was empty due to content moderation filter",
        completions=[],
        embedding=[],
        error_flags=ErrorFlags(is_retriable=False, is_fatal=False),
        request_time=response["request_time"],
        request_datetime=response["request_datetime"],
    )

which matches what we do for Palmyra and will produce the "WARNING: Non-fatal error treated as empty completion" warning log message here.

@yifanmai yifanmai merged commit 9c12470 into main Feb 3, 2024
6 checks passed
@yifanmai yifanmai deleted the joss-fix-gemini branch February 3, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants