feat: support configurable safety_settings on ChatVertexAI#576
Draft
pinetops wants to merge 1 commit into
Draft
Conversation
`ChatGoogleAI` exposes a `safety_settings` field that is passed through to the API as `safetySettings`, but `ChatVertexAI` had no equivalent — callers could not set Vertex AI harm-category thresholds, so the provider defaults always applied. Add a `safety_settings` field to `ChatVertexAI` (default `[]`), mirroring `ChatGoogleAI`: cast it, and conditionally add it to the request body as `safetySettings`. Default `[]` is a no-op (the empty list is not added), so existing behaviour is unchanged; callers who need to tune harm thresholds (e.g. a stricter or more permissive filter for their domain) can now do so. Adds tests mirroring the ChatGoogleAI safety-settings tests: present settings are sent, an empty list is omitted.
Owner
|
Hi @pinetops! I see the PR is still a draft. Please let me know when it's ready. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ChatGoogleAIexposes asafety_settingsfield passed through to the API assafetySettings, butChatVertexAIhas no equivalent — callers can't set Vertex AI harm-category thresholds, so the provider defaults always apply.This adds a
safety_settingsfield toChatVertexAI(default[]), mirroringChatGoogleAI:@create_fieldssafetySettingsBehaviour
Default
[]is a no-op (an empty list is not added to the request), so existing behaviour is unchanged. Callers who need to tune harm thresholds — e.g. a stricter or more permissive filter for their domain — can now do so:Test
Mirrors the existing
ChatGoogleAIsafety-settings tests: present settings are sent assafetySettings; an empty list is omitted.chat_vertex_ai_test.exspasses (41 tests).