Skip to content

Add Gemini 4 thinking levels, with xhigh for Hydrogen and Neon - #195

Merged
wch merged 5 commits into
mainfrom
gemini-4-thinking-profiles
Nov 21, 2026
Merged

wch merged 5 commits into
mainfrom
gemini-4-thinking-profiles

Conversation

@wch

@wch wch commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

This PR adds thinking levels for Gemini 4 Argon, Carbon, Hydrogen and Neon, and upgrades the AI SDK packages so Hydrogen and Neon can use xhigh. Before this, the four models weren't recognized as Gemini variants, so they had no thinking levels, and Databricks and OpenCode excluded them from discovery.

What changed

  • Variant recognition. findGeminiVariantDonor (ai-config/src/model-capabilities/gemini-variant.ts) parses the four names, so suffixed ids (gemini-4-argon-cyber-permissive) and later versions (gemini-4.1-neon) inherit their entries.
  • Thinking levels. ai-config's VARIANT_ENTRIES, the bridge's INTERACTIONS_PROFILES and the generateContent rules used by Databricks and OpenCode give all four models low, medium and high, and Hydrogen and Neon also xhigh. All four reject minimal. The levels come from Google's model docs, checked 2026-11-20.
  • AI SDK upgrade. ai and every @ai-sdk/* package move to the newest releases on @ai-sdk/provider 4.0.38 and provider-utils 5.0.81 that meet min-release-age=7, including @ai-sdk/google 4.0.121. @ai-sdk/google before 4.0.119 rejects thinkingLevel: "xhigh" without sending a request. Newer Google releases pin newer exact provider versions, and Assistant requires a single copy of each, so all the SDK packages move together. @ai-sdk/google-vertex 5.0.141 requires google-auth-library 11, whose only breaking change is a Node 22 minimum, which Assistant already requires.

What to watch for

The SDK upgrade affects every provider, not only Gemini. Assistant's side of the upgrade, including @ai-sdk/mcp, is in a draft PR on posit-dev/assistant (branch gemini-4-thinking-levels).

Testing

  • A new wire test (ai-provider-bridge/src/model-clients/__tests__/gemini-xhigh-wire.test.ts) drives the bridge's option builders through @ai-sdk/google and checks that xhigh reaches the request body on both the Interactions API and generateContent.
  • New inheritance cases for Gemini 4 ids in the ai-config and bridge tests.
  • The full suite, type checks, formatting and lint passed on ca9eee7, the head of this branch. They weren't re-run before opening this PR.

wch added 5 commits November 20, 2026 18:39
Recognize argon, carbon, hydrogen, and neon as Gemini variants so suffixed ids and later versions inherit. All four take low/medium/high and reject minimal. Hydrogen and Neon also document xhigh, but @ai-sdk/google before 4.0.124 rejects it in provider options, so it is not advertised yet.
Argon, Carbon, Hydrogen, and Neon take low/medium/high on generateContent, so Databricks and OpenCode can route them natively instead of excluding them from discovery. xhigh for Hydrogen and Neon waits on @ai-sdk/google 4.0.124.
Move ai and every @ai-sdk/* package to the newest releases that share @ai-sdk/provider 4.0.38 and provider-utils 5.0.81 and satisfy min-release-age=7. @ai-sdk/google 4.0.121 accepts thinkingLevel xhigh (added in 4.0.119). @ai-sdk/google-vertex 5.0.141 requires google-auth-library 11, so the bridge moves to ^11.3.4 to keep one copy; v11's only breaking change is a Node 22 floor, which Assistant already requires.
Advertise and send xhigh on the Interactions API, Vertex, and generateContent. A wire test drives the bridge's option builders through @ai-sdk/google and asserts xhigh reaches the request body on both APIs.
@wch
wch merged commit 425dc9e into main Nov 21, 2026
4 checks passed
@wch
wch deleted the gemini-4-thinking-profiles branch November 21, 2026 03:59
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