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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/language_model/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ impl LanguageModelRequest {
top_p: None,
top_k: None,
}),
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.

}]),
}
}

Expand Down
Loading