Problem
When using Ollama as a local LLM backend with Hermes Agent, reasoning/thinking models (e.g. sorc/qwen3.5-claude-4.6-opus-q4:9b, deepseek-r1) return empty responses.
Root Cause
Ollama's OpenAI-compatible API handles reasoning models differently from other providers:
- Reasoning models return
content: (empty string) in the chat completion response
- The actual model output is placed in a separate
reasoning field
- Hermes Agent's chat_completions transport only reads
content, so it silently drops the response
- The agent appears to hang or return blank answers
This affects all reasoning/thinking models on Ollama, including:
sorc/qwen3.5-claude-4.6-opus-q4:9b
deepseek-r1 (all sizes)
qwen3.5 with thinking enabled
- Any model with
thinking support in Ollama
Solution
Two changes are needed:
1. Config change (~/.hermes/config.yaml)
Add reasoning_effort: none to the agent section:
agent:
reasoning_effort: none
2. Transport layer patch
The file agent/transports/chat_completions.py needs an Ollama-specific block in the build_kwargs function (after the LM Studio block, before extra_body assembly):
# Ollama: send reasoning_effort to disable thinking for reasoning models
# that return empty content (Ollama puts reasoning in separate field)
_base_url = params.get("base_url") or ""
_is_local = "127.0.0.1" in _base_url or "localhost" in _base_url or "::1" in _base_url
if _is_local and reasoning_config is not None and isinstance(reasoning_config, dict):
_ollama_effort = reasoning_config.get("effort", "none") or "none"
if _ollama_effort in {"none", "minimal", "low", "medium", "high"}:
api_kwargs["reasoning_effort"] = _ollama_effort
This detects local Ollama endpoints and sends reasoning_effort: "none" which tells Ollama to disable the thinking/reasoning mode and return normal content responses.
Verification
After applying both changes:
- Reasoning models return proper
content instead of empty strings
- The
reasoning field in the response is empty (as expected with reasoning_effort: none)
- All existing non-reasoning models continue to work unchanged
Environment
- Ollama: Latest (local, http://127.0.0.1:11434/v1)
- Hermes Agent: Latest
- Hardware: RTX 3060 12GB
- Models tested:
sorc/qwen3.5-claude-4.6-opus-q4:9b, granite-code:8b
References
Problem
When using Ollama as a local LLM backend with Hermes Agent, reasoning/thinking models (e.g.
sorc/qwen3.5-claude-4.6-opus-q4:9b,deepseek-r1) return empty responses.Root Cause
Ollama's OpenAI-compatible API handles reasoning models differently from other providers:
content:(empty string) in the chat completion responsereasoningfieldcontent, so it silently drops the responseThis affects all reasoning/thinking models on Ollama, including:
sorc/qwen3.5-claude-4.6-opus-q4:9bdeepseek-r1(all sizes)qwen3.5with thinking enabledthinkingsupport in OllamaSolution
Two changes are needed:
1. Config change (
~/.hermes/config.yaml)Add
reasoning_effort: noneto the agent section:2. Transport layer patch
The file
agent/transports/chat_completions.pyneeds an Ollama-specific block in thebuild_kwargsfunction (after the LM Studio block, before extra_body assembly):This detects local Ollama endpoints and sends
reasoning_effort: "none"which tells Ollama to disable the thinking/reasoning mode and return normalcontentresponses.Verification
After applying both changes:
contentinstead of empty stringsreasoningfield in the response is empty (as expected withreasoning_effort: none)Environment
sorc/qwen3.5-claude-4.6-opus-q4:9b,granite-code:8bReferences