Skip to content

feat: add thinkingLevel and thinkingBudget config for Gemini models#1110

Merged
brendan-kellam merged 5 commits intomainfrom
brendan/gemini-thinking-config-SOU-893
Apr 13, 2026
Merged

feat: add thinkingLevel and thinkingBudget config for Gemini models#1110
brendan-kellam merged 5 commits intomainfrom
brendan/gemini-thinking-config-SOU-893

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam commented Apr 13, 2026

Summary

  • Adds thinkingLevel and thinkingBudget parameters to the GoogleGenerativeAILanguageModel and GoogleVertexLanguageModel schema definitions, allowing per-model thinking configuration.
  • thinkingLevel (enum: minimal, low, medium, high) controls reasoning depth for Gemini 3 models. thinkingBudget (integer, -1 for dynamic) sets the thinking token budget for Gemini 2.5 models.
  • Wires the new config through to the AI SDK provider options for both google-generative-ai and google-vertex providers.
  • Deprecates the GOOGLE_VERTEX_THINKING_BUDGET_TOKENS env var in favor of the new per-model config, with env var fallback for backward compatibility.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added thinkingLevel (minimal|low|medium|high) and thinkingBudget (integer, -1 = dynamic) model config options for Google Generative AI and Google Vertex providers.
  • Breaking Changes

    • Removed GOOGLE_VERTEX_INCLUDE_THOUGHTS — thoughts are always included.
    • Deprecated GOOGLE_VERTEX_THINKING_BUDGET_TOKENS in favor of per-model thinkingBudget.

Add per-model thinking configuration for Google Generative AI and Google
Vertex providers. `thinkingLevel` controls reasoning depth for Gemini 3
models, and `thinkingBudget` sets the thinking token budget for Gemini
2.5 models. Deprecates the GOOGLE_VERTEX_THINKING_BUDGET_TOKENS env var
in favor of the new per-model config (with fallback).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown

mintlify bot commented Apr 13, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
sourcebot 🟢 Ready View Preview Apr 13, 2026, 10:46 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@github-actions

This comment has been minimized.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2f360e6c-cac6-4e09-a9dc-2f428faa03d7

📥 Commits

Reviewing files that changed from the base of the PR and between 3efe2ac and 8204819.

📒 Files selected for processing (1)
  • docs/docs/configuration/language-model-providers.mdx

Walkthrough

Adds per-model Google thinking options (thinkingLevel, thinkingBudget), updates schemas and TypeScript types, makes GOOGLE_VERTEX_THINKING_BUDGET_TOKENS optional/deprecated and removes GOOGLE_VERTEX_INCLUDE_THOUGHTS, and updates chat runtime to source thinking config from model config (with env fallback for vertex).

Changes

Cohort / File(s) Summary
Changelog & Docs
CHANGELOG.md, docs/docs/configuration/language-model-providers.mdx, docs/snippets/schemas/v3/*
Documented new thinkingLevel and thinkingBudget options for Google providers; noted deprecation/removal of related env vars; added examples.
Schema sources
packages/schemas/src/v3/index.schema.ts, packages/schemas/src/v3/languageModel.schema.ts, docs/snippets/schemas/v3/index.schema.mdx, docs/snippets/schemas/v3/languageModel.schema.mdx, schemas/v3/languageModel.json
Added optional thinkingLevel (enum: `minimal
Type definitions
packages/schemas/src/v3/index.type.ts, packages/schemas/src/v3/languageModel.type.ts
Added optional properties `thinkingLevel?: "minimal"
Environment schema
packages/shared/src/env.server.ts
Made GOOGLE_VERTEX_THINKING_BUDGET_TOKENS optional and marked deprecated; removed GOOGLE_VERTEX_INCLUDE_THOUGHTS from env validation.
Runtime/chat logic
packages/web/src/features/chat/utils.server.ts
Populates providerOptions.thinkingConfig from per-model config (thinkingBudget, thinkingLevel) for Google providers; sets includeThoughts: true; retains env fallback for vertex thinkingBudget.

Sequence Diagram(s)

sequenceDiagram
  participant ChatUtil as Chat Utility
  participant Env as Environment
  participant ProviderSDK as Google Provider SDK

  ChatUtil->>ChatUtil: Read model config (thinkingLevel/thinkingBudget)
  ChatUtil->>Env: If google-vertex and thinkingBudget missing -> read GOOGLE_VERTEX_THINKING_BUDGET_TOKENS
  ChatUtil->>ProviderSDK: Build providerOptions { includeThoughts: true, thinkingLevel?, thinkingBudget? }
  ProviderSDK->>ProviderSDK: Initialize request with thinkingConfig
  ProviderSDK->>ProviderSDK: Execute API call
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • msukkari
  • Ferexx
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add thinkingLevel and thinkingBudget config for Gemini models' directly and clearly summarizes the main feature addition in the changeset—adding two new configuration properties for Gemini models.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan/gemini-thinking-config-SOU-893

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@brendan-kellam brendan-kellam merged commit ae4513e into main Apr 13, 2026
8 checks passed
@brendan-kellam brendan-kellam deleted the brendan/gemini-thinking-config-SOU-893 branch April 13, 2026 22:54
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