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

Add support for passing safety settings to Google AI #186

Merged
merged 5 commits into from
Oct 28, 2024

Conversation

elliotb
Copy link
Contributor

@elliotb elliotb commented Oct 2, 2024

This implements a new field on ChatGoogleAI for setting the safety settings for content filtering, following the documentation at https://ai.google.dev/gemini-api/docs/safety-settings#web and https://ai.google.dev/api/generate-content#v1beta.SafetySetting

Based on your comment at #142 (comment) I kept this as a simple list of maps, rather than introducing a struct and associated changesets, on the basis that the LLM will validate the settings.

I've added support for serializing the config, which should be backwards compatible as deserializing maps without the safety settings field will construct a model with the safety settings set to an empty list, which then wouldn't be added to the request as the list is empty.

@brainlid
Copy link
Owner

Nice! Thanks!

❤️💛💙💜

@brainlid brainlid merged commit f7bed98 into brainlid:main Oct 28, 2024
1 check passed
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