Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion plugins/model-providers/custom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ def build_api_kwargs_extras(
options["num_ctx"] = ollama_num_ctx
extra_body["options"] = options

# Disable thinking when reasoning is turned off
# Reasoning / thinking support for custom providers (vLLM, Ollama, etc.)
if reasoning_config and isinstance(reasoning_config, dict):
_effort = (reasoning_config.get("effort") or "").strip().lower()
_enabled = reasoning_config.get("enabled", True)
if _effort == "none" or _enabled is False:
extra_body["think"] = False
else:
# Pass through thinking enabled — vLLM/Ollama use this to
# enable chain-of-thought reasoning on compatible models.
extra_body["think"] = True
# Pass through effort level if specified
if _effort and _effort not in ("none", ""):
extra_body["reasoning_effort"] = _effort

return extra_body, {}

Expand Down
5 changes: 5 additions & 0 deletions run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4989,6 +4989,11 @@ def _supports_reasoning_extra_body(self) -> bool:
opts = self._lmstudio_reasoning_options_cached()
# "off-only" (or absent) means no real reasoning capability.
return any(opt and opt != "off" for opt in opts)
# Custom/vLLM/Ollama providers: pass through reasoning if user
# explicitly configured it. The CustomProfile.build_api_kwargs_extras()
# handles the wire format (think=True/False + reasoning_effort).
if (self.provider or "").strip().lower() in ("custom", "ollama", "vllm", "local"):
return True
if "openrouter" not in self._base_url_lower:
return False
if "api.mistral.ai" in self._base_url_lower:
Expand Down