feat(gemini): add Gemini 3 model constants and thinking_level support#1520
Open
EinarasGar wants to merge 2 commits into0xPlaygrounds:mainfrom
Open
feat(gemini): add Gemini 3 model constants and thinking_level support#1520EinarasGar wants to merge 2 commits into0xPlaygrounds:mainfrom
EinarasGar wants to merge 2 commits into0xPlaygrounds:mainfrom
Conversation
Add model constants for Gemini 3 series: - GEMINI_3_FLASH_PREVIEW - GEMINI_3_1_FLASH_LITE_PREVIEW Add `thinking_level` field to `ThinkingConfig` for Gemini 3 models, which use `thinkingLevel` (string: "minimal", "low", "medium", "high") instead of Gemini 2.5's `thinkingBudget` (integer). These fields are mutually exclusive and cannot be set in the same request. Make `thinking_budget` optional (`Option<u32>`) so users can set either field depending on their model family. Both fields are skipped during serialization when `None`, so existing Gemini 2.5 configurations continue to work unchanged.
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
GEMINI_3_FLASH_PREVIEW,GEMINI_3_1_FLASH_LITE_PREVIEW)thinking_level: Option<String>field toThinkingConfigfor Gemini 3 models, which usethinkingLevel("minimal", "low", "medium", "high") instead of Gemini 2.5'sthinkingBudgetthinking_budgetoptional (Option<u32>) so users can set either field depending on their model familyContext
Gemini 3 models (released March 2026) use a different parameter for controlling reasoning depth. Per the Gemini 3 Developer Guide,
thinking_levelandthinking_budgetare mutually exclusive and cannot be set in the same request.Both fields use
skip_serializing_if = "Option::is_none"so existing Gemini 2.5 configurations that setthinking_budgetviaadditional_paramsJSON continue to work unchanged.Example usage
Test plan
gemini-3-flash-preview— reasoning events emitted correctlygemini-2.5-flash— thinking budget still works as beforecargo buildpasses