Skip to content
Closed
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
12 changes: 10 additions & 2 deletions run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -6780,13 +6780,21 @@ def _build_api_kwargs(self, api_messages: list) -> dict:
options["num_ctx"] = self._ollama_num_ctx
extra_body["options"] = options

# Ollama / custom provider: pass think=false when reasoning is disabled.
# Ollama-only: pass think=false when reasoning is disabled.
# Ollama does not recognise the OpenRouter-style `reasoning` extra_body
# field, so we use its native `think` parameter instead.
# This prevents thinking-capable models (Qwen3, etc.) from generating
# <think> blocks and producing empty-response errors when the user has
# set reasoning_effort: none.
if self.provider == "custom" and self.reasoning_config and isinstance(self.reasoning_config, dict):
# NOTE: guard on Ollama/local endpoints only — cloud custom providers
# (Mistral, Fireworks, Together.ai, vLLM remote, etc.) reject the
# `think` parameter with HTTP 422.
_is_ollama_endpoint = (
"ollama" in self._base_url_lower
or ":11434" in self._base_url_lower
or is_local_endpoint(self.base_url or "")
)
if _is_ollama_endpoint and self.reasoning_config and isinstance(self.reasoning_config, dict):
_effort = (self.reasoning_config.get("effort") or "").strip().lower()
_enabled = self.reasoning_config.get("enabled", True)
if _effort == "none" or _enabled is False:
Expand Down