Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(gemini): return enabled thinking content by default

Kris Xia7ca035f310f8
diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
index d8b1e7ba17c..69fe5678de9 100644
--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
@@ -949,7 +949,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
# For Gemini 3+ models, use thinkingLevel instead of thinkingBudget
if model and VertexGeminiConfig._is_gemini_3_or_newer(model):
if thinking_enabled:
- if thinking_budget is None or thinking_budget == 0:
+ if thinking_budget == 0:
params["includeThoughts"] = False
else:
params["includeThoughts"] = True
diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py
index bd07bec900f..d2788408e09 100644
--- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py
+++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py
@@ -1185,6 +1185,18 @@ def test_vertex_ai_map_thinking_param_with_budget_tokens_0():
}
+def test_vertex_ai_map_thinking_param_without_budget_tokens_for_gemini_3():
+ v = VertexGeminiConfig()
+ result = v.map_openai_params(
+ non_default_params={"thinking": {"type": "enabled"}},
+ optional_params={},
+ model="gemini-3.5-flash",
+ drop_params=False,
+ )
+
+ assert result["thinkingConfig"] == {"includeThoughts": True}
+
+
def test_vertex_ai_map_tools():
v = VertexGeminiConfig()
optional_params = {}