Skip to content

fix(ai): send LOW to disable thinking on gemini-3.7-flash - #8383

Open
jingtao-wisdomgraph wants to merge 3 commits into
earendil-works:mainfrom
jingtao-wisdomgraph:fix/google-disabled-thinking-from-catalog
Open

fix(ai): send LOW to disable thinking on gemini-3.7-flash#8383
jingtao-wisdomgraph wants to merge 3 commits into
earendil-works:mainfrom
jingtao-wisdomgraph:fix/google-disabled-thinking-from-catalog

Conversation

@jingtao-wisdomgraph

@jingtao-wisdomgraph jingtao-wisdomgraph commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Problem

Disabling thinking on gemini-3.7-flash fails every call:

400 INVALID_ARGUMENT
Thinking level MINIMAL is not supported for this model. Please retry with other thinking level.

getDisabledThinkingConfig sends thinkingLevel: MINIMAL for anything matching
isGemini3FlashModel. Google has since raised that floor for 3.7-flash — checked against
generativelanguage.googleapis.com on 2026-08-19:

thinkingLevel gemini-3.7-flash gemini-3.6-flash
MINIMAL 400 INVALID_ARGUMENT 200
LOW / MEDIUM / HIGH 200 200
omitted 200 200

Change

The flash branch of getDisabledThinkingConfig now picks LOW for the versions that dropped
MINIMAL, in both Google adapters. Per-version, not family-wide: 3.6-flash still takes MINIMAL,
and moving the whole family up would cost the others their lowest setting.

Tests

Three cases in google-thinking-level-map.test.ts, which already owned the opposite direction
(which level is sent when thinking is requested); its helpers only needed their two arguments
made optional. They assert the thinkingConfig actually put on the wire, so they need no API
key, and against the current code they fail with
expected { thinkingLevel: 'MINIMAL' } to deeply equal { thinkingLevel: 'LOW' }.

Live API, patched adapter:

gemini-3.7-flash   sent {"thinkingLevel":"LOW"}       -> 200
gemini-3.6-flash   sent {"thinkingLevel":"MINIMAL"}   -> 200

packages/ai: 24 failed / 970 passed, against 25 failed / 966 passed on main — same failure
set (Ollama, z.ai, qwen), none related.

Note

The id predicates here (isGemini3FlashModel and friends) duplicate the ones in
scripts/generate-models.ts, which independently records the same capability as
thinkingLevelMapgemini-3.1-pro-preview carries {off: null, minimal: null, low: "LOW", …}
while getDisabledThinkingConfig re-derives LOW from a regex. Reading the catalog on this path
would remove the second source of truth, but that is a larger change than this fix needs and is
left for you to decide on.

getDisabledThinkingConfig picked the level from an id regex, so gemini-3.7-flash
got MINIMAL — which Google rejects with 400 INVALID_ARGUMENT on every call. The
catalog already records what each model supports, but the adapter never read it,
so a correction there could not reach the request.

Read thinkingLevelMap via getSupportedThinkingLevels instead, and mark 3.7-flash
as not supporting minimal. Behaviour-preserving for every other Google model —
compared old vs new across all 22 in the catalog, identical.
Self-review of the first commit found two problems. It defined the same
ascending-levels constant in both Google adapters — new duplication, in a change
whose whole point was removing a duplicated regex — and wrapped a 7-element array
in a Set. getSupportedThinkingLevels already returns ascending order, so neither
was needed: the lookup now lives once in google-shared.ts as
lowestSupportedThinkingLevel and each adapter is three lines.

Adds four cases to google-thinking-level-map.test.ts, which already owned the
opposite direction (which level is sent when thinking IS requested) and whose
helpers only needed their two knobs made optional. They assert the thinkingConfig
actually put on the wire, so they need no API key.
Reverts the catalog-driven rewrite from the previous commits in favour of the
smallest change that fixes the bug. getDisabledThinkingConfig keeps its existing
shape; only the flash branch learns that the floor moved.

Google dropped MINIMAL for gemini-3.7-flash — sending it returns 400
INVALID_ARGUMENT on every call. gemini-3.6-flash still accepts it, so the
predicate is per-version rather than family-wide.

Verified against the live API: MINIMAL 400s, LOW/MEDIUM/HIGH and omitting the
field all return 200.
@jingtao-wisdomgraph jingtao-wisdomgraph changed the title fix(ai): derive Gemini's disabled-thinking level from the catalog fix(ai): send LOW to disable thinking on gemini-3.7-flash Aug 20, 2026
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.

1 participant