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]

feat(ollama): set 'think' to False when reasoning effort is not high/medium/low (#15763)

Kowyo1fcadd6c05a3
diff --git a/litellm/llms/ollama/chat/transformation.py b/litellm/llms/ollama/chat/transformation.py
index b740eb122fd..9c8700daf83 100644
--- a/litellm/llms/ollama/chat/transformation.py
+++ b/litellm/llms/ollama/chat/transformation.py
@@ -188,7 +188,7 @@ class OllamaChatConfig(BaseConfig):
if model.startswith("gpt-oss"):
optional_params["think"] = value
else:
- optional_params["think"] = True
+ optional_params["think"] = value in {"low", "medium", "high"}
### FUNCTION CALLING LOGIC ###
if param == "tools":
## CHECK IF MODEL SUPPORTS TOOL CALLING ##
diff --git a/litellm/llms/ollama/completion/transformation.py b/litellm/llms/ollama/completion/transformation.py
index b476e5c8a63..b02662233bd 100644
--- a/litellm/llms/ollama/completion/transformation.py
+++ b/litellm/llms/ollama/completion/transformation.py
@@ -183,7 +183,7 @@ class OllamaConfig(BaseConfig):
if model.startswith("gpt-oss"):
optional_params["think"] = value
else:
- optional_params["think"] = True
+ optional_params["think"] = value in {"low", "medium", "high"}
elif param == "response_format" and isinstance(value, dict):
if value["type"] == "json_object":
optional_params["format"] = "json"