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 _map_reasoning_effort_to_thinking_level for all gemini 3 family

Sameer Kankute5885c4a58818
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 cf3461a9960..d248d2862e8 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
@@ -759,6 +759,9 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
"gemini-3-flash-preview" in model.lower()
or "gemini-3-flash" in model.lower()
)
+ is_gemini31pro = model and (
+ "gemini-3.1-pro-preview" in model.lower()
+ )
if reasoning_effort == "minimal":
if is_gemini3flash:
return {"thinkingLevel": "minimal", "includeThoughts": True}
@@ -767,7 +770,10 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
elif reasoning_effort == "low":
return {"thinkingLevel": "low", "includeThoughts": True}
elif reasoning_effort == "medium":
+ if is_gemini31pro or is_gemini3flash:
return {"thinkingLevel": "medium", "includeThoughts": True}
+ else:
+ return {"thinkingLevel": "high", "includeThoughts": True}
elif reasoning_effort == "high":
return {"thinkingLevel": "high", "includeThoughts": True}
elif reasoning_effort == "disable":