Skip to content

Fix gemini thinking config with empty budget#441

Merged
KaQuMiQ merged 1 commit into
mainfrom
feature/gemini_thinking
Oct 3, 2025
Merged

Fix gemini thinking config with empty budget#441
KaQuMiQ merged 1 commit into
mainfrom
feature/gemini_thinking

Conversation

@KaQuMiQ
Copy link
Copy Markdown
Collaborator

@KaQuMiQ KaQuMiQ commented Oct 3, 2025

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 3, 2025

Walkthrough

  • pyproject.toml: Incremented project version from 0.87.7 to 0.87.8.
  • src/draive/gemini/generating.py: In _prepare_request_config, thinking_config.include_thoughts is now set to True only if thinking_budget, cast to int, is greater than 0; previously it was always True. Other thinking_config fields remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The pull request contains no author-provided description, so there is no information to assess the context or rationale behind the changes. Because the description is entirely absent rather than explicitly off-topic, it cannot be judged as passing. It fails to convey any meaningful detail about the change. Please provide a brief description summarizing what the change does and why it was introduced so reviewers can better understand the context and intent of this pull request.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title accurately reflects the primary change, which is adjusting the Gemini thinking configuration to handle empty budgets by gating thought inclusion. It is concise, clear, and directly related to the main code modification in generating.py. A teammate scanning the history will immediately understand the core fix without ambiguity.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/gemini_thinking

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78b9087 and 8052b80.

📒 Files selected for processing (2)
  • pyproject.toml (1 hunks)
  • src/draive/gemini/generating.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
{pyproject.toml,pyrightconfig.json}

📄 CodeRabbit inference engine (AGENTS.md)

Use Ruff, Bandit, and Pyright (strict) via make lint

Files:

  • pyproject.toml
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use Python 3.12+ features and syntax across the codebase
Format code exclusively with Ruff (make format); do not use other formatters
Skip module-level docstrings

Files:

  • src/draive/gemini/generating.py
src/draive/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/draive/**/*.py: Import Haiway symbols directly (from haiway import State, ctx)
Use ctx.scope(...) to bind scoped Disposables and active State; avoid global state
Route all logs through ctx.log_debug/info/warn/error; do not use print
Use latest, most strict typing syntax (Python 3.12+), with strict typing only for public APIs
Avoid loose Any except at explicit third‑party boundaries
Prefer explicit attribute access with static types; avoid dynamic getattr except at narrow boundaries
Prefer Mapping/Sequence/Iterable in public types over dict/list/set
Use final where applicable; avoid inheritance and prefer composition
Use precise unions (|) and narrow with match/isinstance; avoid cast unless provably safe and localized
Model immutable data/config and facades with haiway.State; provide ergonomic classmethods like .of(...)
Avoid in-place mutation; use State.updated(...) or functional builders to produce new instances
Access active state via haiway.ctx inside async scopes (ctx.scope(...))
Use @statemethod for public state methods that dispatch on the active instance
Log around generation calls, tool dispatch, and provider requests/responses without leaking secrets; prefer structured/concise messages
Add metrics via ctx.record where applicable
All I/O is async; keep boundaries async and use ctx.spawn for detached tasks
Use structured concurrency and valid coroutine usage; rely on haiway/asyncio; avoid custom threading
Construct multimodal content with MultimodalContent.of(...) and compose blocks explicitly
Use ResourceContent/ResourceReference for media/data blobs
Wrap custom types/data within ArtifactContent; use hidden when needed
Add NumPy-style docstrings for public symbols with Parameters/Returns/Raises and rationale when non-obvious
Avoid docstrings on internal helpers; keep names self-explanatory
Keep docstrings high-quality; mkdocstrings pulls them into API reference
Never log secrets or full request bodies containing keys/tokens

Files:

  • src/draive/gemini/generating.py
src/draive/{openai,anthropic,mistral,gemini,vllm,ollama,bedrock,cohere}/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/draive/{openai,anthropic,mistral,gemini,vllm,ollama,bedrock,cohere}/**/*.py: Provider-specific feature modules live under their respective provider directories
Translate provider/SDK errors into typed exceptions; do not raise bare Exception and preserve context
Use environment variables for credentials and resolve via helper functions like getenv_str

Files:

  • src/draive/gemini/generating.py
🔇 Additional comments (2)
pyproject.toml (1)

8-8: LGTM! Version bump is appropriate.

The patch version increment from 0.87.7 to 0.87.8 correctly follows semantic versioning for this bug fix.

src/draive/gemini/generating.py (1)

652-658: Casting Safe
The cast(int, config.thinking_budget) is type-safe given thinking_budget: int | Missing and the preceding MISSING guard; no changes needed.


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.

@KaQuMiQ KaQuMiQ merged commit 749ac11 into main Oct 3, 2025
5 checks passed
@KaQuMiQ KaQuMiQ deleted the feature/gemini_thinking branch October 3, 2025 11:39
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