Skip to content

Commit 8e5fe8a

Browse files
authored
Merge pull request #4067 from omChauhanDev/fix-gemini3-flash-thinking-default
fix: default thinking config for Gemini 3+ Flash models
2 parents d07eebf + fa982a0 commit 8e5fe8a

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

changelog/4067.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- GoogleLLMService now applies a low-latency thinking default (`thinking_level="minimal"`) for Gemini 3+ Flash models.

src/pipecat/services/google/llm.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,20 @@ def _build_generation_params(
369369

370370
def _maybe_unset_thinking_budget(self, generation_params: Dict[str, Any]):
371371
try:
372-
# There's no way to introspect on model capabilities, so
373-
# to check for models that we know default to thinkin on
374-
# and can be configured to turn it off.
375-
if not self._settings.model.startswith("gemini-2.5-flash"):
376-
return
377-
# If we have an image model, we don't use a budget either.
372+
# If we have an image model, we don't apply a thinking default.
378373
if "image" in self._settings.model:
379374
return
380375
# If thinking_config is already set, don't override it.
381376
if "thinking_config" in generation_params:
382377
return
383-
generation_params.setdefault("thinking_config", {})["thinking_budget"] = 0
378+
# Apply model-aware low-latency thinking defaults.
379+
# Gemini 2.5 Flash: disable thinking via thinking_budget.
380+
# Gemini 3+ Flash: use minimal thinking via thinking_level.
381+
model = self._settings.model
382+
if model.startswith("gemini-2.5-flash"):
383+
generation_params["thinking_config"] = {"thinking_budget": 0}
384+
elif model.startswith("gemini-3") and "flash" in model:
385+
generation_params["thinking_config"] = {"thinking_level": "minimal"}
384386
except Exception as e:
385387
logger.error(f"Failed to unset thinking budget: {e}")
386388

0 commit comments

Comments
 (0)