personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix thinking_budget=0 not disabling Gemini thinking

When callers passed thinking_budget=0, the falsy check `if thinking_budget
and thinking_budget > 0` would skip setting ThinkingConfig entirely. Without
an explicit config, Gemini applies its own default thinking budget (~23K
tokens), consuming nearly the entire output budget and truncating extraction
responses at ~800 tokens despite a 24K limit.

Change the condition to `if thinking_budget is not None` so that
thinking_budget=0 explicitly sets ThinkingConfig(thinking_budget=0),
properly disabling thinking and preserving the full output budget.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+4 -2
+4 -2
think/providers/google.py
··· 137 137 if json_output: 138 138 config_args["response_mime_type"] = "application/json" 139 139 140 - # Only enable thinking if explicitly requested with a positive budget 141 - if thinking_budget and thinking_budget > 0: 140 + # Set thinking config when caller explicitly specified a budget. 141 + # thinking_budget=0 must explicitly disable thinking (not omit config), 142 + # otherwise Gemini applies its own default budget consuming output tokens. 143 + if thinking_budget is not None: 142 144 config_args["thinking_config"] = types.ThinkingConfig( 143 145 thinking_budget=thinking_budget 144 146 )