Repository navigation
Conversation
jhackshaw
force-pushed
the
fix/interactions-thinking-level
branch
from
November 1, 2026 22:25
f778049 to
022c17f
Compare
jhackshaw
force-pushed
the
fix/interactions-thinking-level
branch
from
November 2, 2026 17:16
022c17f to
315e77b
Compare
build_generation_config skipped thinking_config, so an agent's thinking_level was dropped without a warning whenever use_interactions_api was on. Map types.ThinkingLevel onto the interactions API's generation_config.thinking_level, which every supported google-genai release declares. An unspecified level is left out, leaving the choice to the model.
jhackshaw
force-pushed
the
fix/interactions-thinking-level
branch
from
November 2, 2026 19:43
315e77b to
f24a937
Compare
copybara-service Bot
pushed a commit
that referenced
this pull request
Nov 2, 2026
Merge #7926 With use_interactions_api, thinking_config.thinking_level is now sent as the interactions generation_config thinking_level (minimal, low, medium or high) instead of being dropped; THINKING_LEVEL_UNSPECIFIED is still left out. As on the generate_content path, a level the model does not support now gets the API's 400 instead of being silently ignored. Fixes #7924 PiperOrigin-RevId: 1012342059
Collaborator
|
Thank you @jhackshaw for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit c20b90a. Closing this PR as the changes are now in the main branch. |
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.
Send the thinking config on the interactions API.
build_generation_configdroppedthinking_configand logged nothing. Nowthinking_levelandinclude_thoughtsare sent,thinking_budgetlogs a warning, and non-streaming responses keep their thought summaries.Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
With
Gemini(use_interactions_api=True), nothing fromthinking_configreaches the request:thinking_levelis dropped, so the model thinks at its default level, and an unsupported level is accepted instead of returning a 400.include_thoughtsis dropped, so summaries never come back.thinking_budgetis dropped without the warning that unsupported sampling parameters get.The non-streaming path also discarded
ThoughtStep.summary, so summaries only reached SSE mode.Solution:
thinking_level→generation_config['thinking_level'], lowercased.THINKING_LEVEL_UNSPECIFIEDis skipped.include_thoughts→generation_config['thinking_summaries'](True→"auto",False→"none").thinking_budgethas no interactions equivalent, so it gets a one-time warning like the sampling parameters.ThoughtStep.summarytext becomes aPart(text=..., thought=True), as_handle_thought_summarydoes for streaming.No version check is needed: both fields are on
interactions.GenerationConfigParamin every supported google-genai release (>= 2.30).Testing Plan
Unit Tests:
New tests in
tests/unittests/models/test_interactions_utils.pycover the level and summaries mapping, the budget warning, and non-streaming summary parts.Without the fix, 10 of these fail.
Manual End-to-End (E2E) Tests:
An
LlmAgentongemini-3.8-flash(Vertex AI) withuse_interactions_api=Trueandthinking_level=HIGH. ADK's DEBUG request log:Generation Configmain{}{"thinking_level": "high"}Checklist