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

assistant: Fix safety settings for google_ai #20178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FedorBuben
Copy link

Sometimes Gemini API's safety filter blocks code, considering it dangerous content. This happens quite often. The bug has been described in some comments under #18561. Here is an example prompt for Gemini Flash.
In Zed:
error_prompt_zed
In Google AI Studio:
error_prompt_google

Disabling the DangerousContent category for the filter solves the problem

Release Notes:

  • N/A

Copy link

cla-bot bot commented Nov 4, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @FedorBuben on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

safety_settings: None,
safety_settings: Some(vec![google_ai::SafetySetting {
category: google_ai::HarmCategory::DangerousContent,
threshold: google_ai::HarmBlockThreshold::BlockNone,
Copy link
Member

Choose a reason for hiding this comment

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

Not blocking any dangerous content seems like the wrong choice for a default.

Copy link
Author

Choose a reason for hiding this comment

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

Should there be an option for adjusting the filter settings?

HarmCategory::DangerousContent is one of the 5 categories. The filter currently blocks content in all other categories.

From Gemini API Docs:

The Gemini API's adjustable safety filters cover the following categories:
Category Description
Harassment Negative or harmful comments targeting identity and/or protected attributes.
Hate speech Content that is rude, disrespectful, or profane.
Sexually explicit Contains references to sexual acts or other lewd content.
Dangerous Promotes, facilitates, or encourages harmful acts.
Civic integrity Election-related queries.

@FedorBuben
Copy link
Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 4, 2024
Copy link

cla-bot bot commented Nov 4, 2024

The cla-bot has been summoned, and re-checked this pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants