Repository navigation
Conversation
✅ Deploy Preview for theagentrouter canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| @@ -608,7 +608,7 @@ func isGeminiFlashModel(model internalapi.RequestModel) bool { | |||
| // - "none" → ThinkingLevelMinimal (Gemini Flash only) | |||
| // - "low" → ThinkingLevelLow | |||
| // - "medium" → ThinkingLevelMedium for Flash, ThinkingLevelHigh for Pro | |||
There was a problem hiding this comment.
gemini 3.1 pro preview supports medium thinking according to the doc you linked[1]. We should update to the a more accurate representation of what's available
There was a problem hiding this comment.
Good catch, thanks. Per the thinking-levels table, gemini-3.1-pro-preview lists low/medium/high while gemini-3-pro-preview lists only low/high. Pushed b7826ec: medium now maps to ThinkingLevelMedium for Flash and 3.1 Pro, and only falls back to ThinkingLevelHigh for Gemini 3 Pro. Doc comment and tests updated (3.1 Pro → medium, 3 Pro preview → high).
There was a problem hiding this comment.
Update: added the missing DCO sign-off to my commit, so the fix is now ff8a740 (same change as the earlier b7826ec).
b7826ec to
ff8a740
Compare
|
Rebased onto current main. The medium-thinking mapping for 3.1 Pro from your review is already in this branch. Ready for another look. |
ff8a740 to
4664127
Compare
| // Gemini 3 Pro only lists "low" and "high"; Flash and Gemini 3.1 Pro also list "medium". | ||
| // https://ai.google.dev/gemini-api/docs/thinking#thinking-levels | ||
| func supportsMediumThinkingLevel(model internalapi.RequestModel) bool { | ||
| return !strings.Contains(strings.ToLower(model), "gemini-3-pro") |
There was a problem hiding this comment.
nit: gemini-3.1-flash-lite-image also does not support medium
There was a problem hiding this comment.
Good catch, thanks. The thinking-levels table lists gemini-3.1-flash-lite-image with only minimal and high, so medium now falls back to ThinkingLevelHigh there, same as Gemini 3 Pro. Pushed 0e3ab35 with a test case and updated the doc comments.
4664127 to
0e3ab35
Compare
|
/retest |
mapReasoningEffortToThinkingLevel rejected reasoning_effort "high" for any Gemini 3 model whose name does not contain "flash", so a Chat Completions request against gemini-3-pro with reasoning_effort: high failed with an invalid request body error before reaching Vertex. The guard was carried over from the "none" case, where it is right because only Flash supports the minimal thinking level. Google's thinking docs list high as a supported level for every Gemini 3 model and as the default for the Pro models, and the function already maps "medium" on Pro to ThinkingLevelHigh. Map "high" to ThinkingLevelHigh for all models and cover the Pro case in both the unit table and the generation config table. AI assistance: Claude was used to help find the mismatch and draft the change; it was reviewed and tested locally. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: AlSh007 <alok44170@gmail.com>
…ini 3.1 Pro Gemini 3 Pro only lists low/high thinking levels, but Gemini 3.1 Pro (like Flash) also supports medium. Only fall back to high for Gemini 3 Pro. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: AlSh007 <85677626+AlSh007@users.noreply.github.com>
….1 Flash-Lite Image gemini-3.1-flash-lite-image lists only minimal and high thinking levels, so medium has no equivalent there, as with Gemini 3 Pro. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: AlSh007 <85677626+AlSh007@users.noreply.github.com>
0e3ab35 to
4654253
Compare
|
@aabchoo this is rebased onto current main (it was 7 commits behind) and the translator tests pass locally. Your review comments are addressed: medium now maps to Since the push, CodeQL, Precommit and Build and Test are waiting on |
|
@aabchoo thanks for enabling auto-merge. I updated the branch to current main (merge commit 94e5b55) so it's no longer behind. Since that push came from my fork, CodeQL, Precommit and Build and Test are waiting on |
Description
mapReasoningEffortToThinkingLevelrejectsreasoning_effort: "high"for any Gemini 3 model whose name does not containflash. A Chat Completions request againstgemini-3-prowithreasoning_effort: "high"therefore fails withinvalid reasoning effort: ... reasoning effort 'high' is only supported for Gemini Flash modelsbefore it reaches Vertex, while the same request withmediumsucceeds and is sent asthinking_level: high.The guard looks carried over from the
nonecase, where it is correct because only Flash supports theminimalthinking level. Forhighit is not: Google's thinking docs [1] listhighas a supported level for every Gemini 3 model and as the default level forgemini-3-pro-previewandgemini-3.1-pro-preview, the Vertex OpenAI compatibility guide [2] does not restrict it, and the function's own doc comment already says"high" → ThinkingLevelHighwithout a model restriction.This change maps
hightoThinkingLevelHighfor all models and adds the Pro case toTestMapReasoningEffortToThinkingLeveland to theopenAIReqToGeminiGenerationConfigtable. The new rows fail on main with the error above and pass with the fix.go test ./internal/translator/passes.AI usage: I used Claude Code [3] to help find the mismatch and draft the change; I reviewed the code and ran the tests locally.
Related Issues/PRs (if applicable)
The guard was introduced in #1844, whose
hightest only coversgemini-3-flash.1: https://ai.google.dev/gemini-api/docs/thinking
2: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/start/get-started-with-gemini-3#openai-example
3: https://claude.com/claude-code