Skip to content

Honor reasoning effort for Gemini 3 and 4 - #2300

Open
arnabnandy7 wants to merge 1 commit into
embabel:mainfrom
arnabnandy7:fix/geminiReasoningEffort
Open

arnabnandy7 wants to merge 1 commit into
embabel:mainfrom
arnabnandy7:fix/geminiReasoningEffort

Conversation

@arnabnandy7

Copy link
Copy Markdown
Collaborator

Fixes #2278

The native Google GenAI converter ignored LlmOptions.withReasoningEffort, so callers could not lower the thinking level on Gemini 3 and 4.

The converter now sends LOW, MEDIUM, and HIGH as thinkingLevel. Explicit effort takes precedence over request and catalog token budgets, and can be combined with thought extraction. The selected model determines which levels it accepts. Gemini 2.5 continues to use token budgets.

Updated the thinking documentation and added regression tests for option conversion and the generated Gemini request.

Validation

mvn -pl :embabel-agent-google-genai-autoconfigure -am "-Dtest=GoogleGenAiOptionsConverterTest,GoogleGenAiToolResponseRequestTest" "-Dsurefire.failIfNoSpecifiedTests=false" test
mvn -pl :embabel-agent-google-genai-autoconfigure -am "-DskipTests" package

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@arnabnandy7 arnabnandy7 self-assigned this Nov 27, 2026

@tschuehly tschuehly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 On gemini-3.6-flash, withoutThinking().withReasoningEffort(LOW) builds a request with thinkingLevel: LOW and no budget. This model supports turning thinking off, so it should send thinkingBudget: 0 and omit the level. Please handle opt-out before effort on models that can disable thinking, and assert both fields in the built request. Please coordinate with @azanux on the overlapping converter change.

@arnabnandy7

Copy link
Copy Markdown
Collaborator Author

🤖 On gemini-3.6-flash, withoutThinking().withReasoningEffort(LOW) builds a request with thinkingLevel: LOW and no budget. This model supports turning thinking off, so it should send thinkingBudget: 0 and omit the level. Please handle opt-out before effort on models that can disable thinking, and assert both fields in the built request. Please coordinate with @azanux on the overlapping converter change.

Thanks @tschuehly. I confirmed that withoutThinking().withReasoningEffort(LOW) currently sends thinkingLevel: LOW on Gemini 3.6 Flash.

@azanux, since #2279 already covers the converter change, could we handle opt-out precedence there? For models that can disable thinking, the request should send thinkingBudget: 0 and omit thinkingLevel. A request-level test can check both fields. Once that’s covered in #2279, I can close this PR.

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.

ReasoningEffort is ignored by Google GenAI, so Gemini 3 and 4 thinking cannot be lowered

2 participants