Skip to content

feat(llm): Gemini thinking_level/thinking_budget support for flash-thinking models#1710

Merged
bug-ops merged 1 commit intomainfrom
gemini-thinking-level
Mar 13, 2026
Merged

feat(llm): Gemini thinking_level/thinking_budget support for flash-thinking models#1710
bug-ops merged 1 commit intomainfrom
gemini-thinking-level

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 13, 2026

Summary

  • Add GeminiThinkingLevel enum (Minimal/Low/Medium/High, lowercase serde matching Gemini API) and GeminiThinkingConfig struct (thinkingLevel/thinkingBudget/includeThoughts, camelCase) to zeph-llm
  • GeminiProvider gains builder methods with_thinking_level(), with_thinking_budget() (fallible, validates -1/0/1..=32768), with_include_thoughts()
  • GeminiConfig in zeph-core gains thinking_level, thinking_budget, include_thoughts optional fields
  • Thinking config wired at all three construction sites (primary, orchestrator, router)
  • --init wizard adds thinking_level select prompt in the Gemini section
  • Covers both Gemini 3+ (thinkingLevel string) and Gemini 2.5 (thinkingBudget integer) APIs

Configuration

[llm.gemini]
model = "gemini-2.5-flash-thinking"
thinking_level = "medium"   # minimal | low | medium | high (Gemini 3+)
thinking_budget = 1024      # -1=dynamic, 0=off, 1-32768 (Gemini 2.5)
include_thoughts = false    # include thinking summaries in response

Test plan

  • ThinkingLevel serializes to correct lowercase strings (all 4 variants round-trip)
  • GeminiThinkingConfig serializes with camelCase field names
  • skip_serializing_if omits thinking_config from JSON when all fields are None
  • Builder methods wire through to make_gen_config()
  • with_thinking_budget() rejects out-of-range values (-2, 32769) with LlmError
  • Budget edge values 0 (disable) and -1 (dynamic) pass through correctly
  • TOML config parse tests for GeminiConfig.thinking_level/thinking_budget in zeph-core
  • 5366 tests pass, 0 failures

Closes #1652.

@github-actions github-actions Bot added enhancement New feature or request documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes core zeph-core crate size/L Large PR (201-500 lines) and removed enhancement New feature or request labels Mar 13, 2026
…h-thinking models

Add GeminiThinkingLevel enum (Minimal/Low/Medium/High, lowercase serde),
GeminiThinkingConfig struct (thinkingLevel/thinkingBudget/includeThoughts,
camelCase per Gemini API spec), and wire into GeminiProvider at all three
construction sites (primary, orchestrator, router).

GeminiConfig gains thinking_level, thinking_budget, and include_thoughts
optional fields. with_thinking_budget() is fallible and validates the
value is in {-1} ∪ [0, 32768]. --init wizard adds a thinking_level
select prompt in the Gemini section.

Covers both Gemini 3+ (thinkingLevel string) and Gemini 2.5
(thinkingBudget integer) APIs. 19 new unit tests added (5359 total).

Closes #1652.
@bug-ops bug-ops force-pushed the gemini-thinking-level branch from 4e9c90c to 866aeb1 Compare March 13, 2026 23:20
@bug-ops bug-ops enabled auto-merge (squash) March 13, 2026 23:20
@github-actions github-actions Bot added the enhancement New feature or request label Mar 13, 2026
@bug-ops bug-ops merged commit a927677 into main Mar 13, 2026
15 checks passed
@bug-ops bug-ops deleted the gemini-thinking-level branch March 13, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

research(llm): Gemini thinking_level parameter support for flash-thinking models

1 participant