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 for supports_reasoning check added in 68f48476598b4fa4aef51d95f1c708c51f150d73

Ishaan Jaffdc6161535a00
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 6cdde8ea4b1..569a05d8ad8 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
@@ -465,7 +465,6 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
params["includeThoughts"] = True
if thinking_budget is not None and isinstance(thinking_budget, int):
params["thinkingBudget"] = thinking_budget
-
return params
def map_response_modalities(self, value: list) -> list:
@@ -618,7 +617,12 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
optional_params = self._add_tools_to_optional_params(
optional_params, [_tools]
)
- if supports_reasoning(model):
+
+ ######################################################################################
+ # If the model supports reasoning and `thinkingConfig` is not set as yet
+ # we should set it to includeThoughts
+ ######################################################################################
+ if supports_reasoning(model) and "thinkingConfig" not in optional_params:
optional_params["thinkingConfig"] = (
VertexGeminiConfig._map_reasoning_effort_to_thinking_budget(
non_default_params.get("reasoning_effort")
diff --git a/tests/llm_translation/test_gemini.py b/tests/llm_translation/test_gemini.py
index 15ee7505edb..08caf5b6147 100644
--- a/tests/llm_translation/test_gemini.py
+++ b/tests/llm_translation/test_gemini.py
@@ -329,7 +329,7 @@ def test_gemini_thinking_budget_0():
"thinking": {"type": "enabled", "budget_tokens": 0},
},
)
- print(raw_request)
+ print(json.dumps(raw_request, indent=4, default=str))
assert "0" in json.dumps(raw_request["raw_request_body"])