{{ message }}
Repository navigation
fix(provider): serialize Gemini thinking levels correctly - #9899
Merged
RC-CHN merged 1 commit intoSep 4, 2026
Merged
Conversation
buyun14
pushed a commit
to buyun14/AstrBot
that referenced
this pull request
Sep 3, 2026
RC-CHN
approved these changes
Sep 4, 2026
10 tasks done
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.

Gemini 3 thinking levels are currently assigned through a class-level fallback on
types.ThinkingConfig. On the first request this can leave the Pydantic instance without a serializedthinking_level, while also mutating SDK class state for later requests. In addition, Gemini 3.7 Flash does not acceptMINIMALand should use its supportedMEDIUMfallback.Modifications / 改动点
Pass
types.ThinkingLeveldirectly to theThinkingConfigconstructor so every request serializes its own value.Keep case-insensitive validation for Gemini 3 models.
Use
MEDIUMwhen Gemini 3.7 receivesMINIMALor another unsupported value; retain the existingHIGHfallback for other Gemini 3 variants.Add regressions proving two consecutive requests both serialize
HIGHand Gemini 3.7 mapsMINIMALtoMEDIUM.This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
No dependency or API-schema change is introduced. This PR intentionally does not add a Gemini-local retry for empty
STOPresponses: #7104 already handles empty model output in the shared runner, and another provider-local retry would multiply retry attempts.Checklist / 检查清单
requirements.txtandpyproject.toml.Summary by Sourcery
Fix Gemini thinking-level serialization and validation across supported Gemini 3 models.
Bug Fixes:
Tests: