Skip to content

Commit dc61615

Browse files
committed
fix for supports_reasoning check added in 68f4847
1 parent de6b08e commit dc61615

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ def _map_thinking_param(
465465
params["includeThoughts"] = True
466466
if thinking_budget is not None and isinstance(thinking_budget, int):
467467
params["thinkingBudget"] = thinking_budget
468-
469468
return params
470469

471470
def map_response_modalities(self, value: list) -> list:
@@ -618,7 +617,12 @@ def map_openai_params( # noqa: PLR0915
618617
optional_params = self._add_tools_to_optional_params(
619618
optional_params, [_tools]
620619
)
621-
if supports_reasoning(model):
620+
621+
######################################################################################
622+
# If the model supports reasoning and `thinkingConfig` is not set as yet
623+
# we should set it to includeThoughts
624+
######################################################################################
625+
if supports_reasoning(model) and "thinkingConfig" not in optional_params:
622626
optional_params["thinkingConfig"] = (
623627
VertexGeminiConfig._map_reasoning_effort_to_thinking_budget(
624628
non_default_params.get("reasoning_effort")

tests/llm_translation/test_gemini.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def test_gemini_thinking_budget_0():
329329
"thinking": {"type": "enabled", "budget_tokens": 0},
330330
},
331331
)
332-
print(raw_request)
332+
print(json.dumps(raw_request, indent=4, default=str))
333333
assert "0" in json.dumps(raw_request["raw_request_body"])
334334

335335

0 commit comments

Comments
 (0)