Skip to content

fix: only send think=false to Ollama, not all custom providers - #11520

Open
vominh1919 wants to merge 1 commit into
NousResearch:mainfrom
vominh1919:fix-think-ollama-only
Open

fix: only send think=false to Ollama, not all custom providers#11520
vominh1919 wants to merge 1 commit into
NousResearch:mainfrom
vominh1919:fix-think-ollama-only

Conversation

@vominh1919

Copy link
Copy Markdown
Contributor

Problem

When reasoning_effort: none is set, Hermes sends extra_body["think"] = false to every custom provider endpoint. The think parameter is Ollama-specific and is rejected with HTTP 422 by non-Ollama providers (Mistral, Fireworks, Together.ai, vLLM).

Fix

Gate think=false behind Ollama detection using the same pattern as _is_ollama_glm_backend():

  • self._ollama_num_ctx is set (auto-detected Ollama)
  • OR base_url contains ollama
  • OR base_url contains :11434 (Ollama default port)

Fixes #11237

The `think` parameter is Ollama-specific. Sending it to other custom
providers (Mistral, Fireworks, Together.ai, vLLM) causes HTTP 422.
Fix: gate behind Ollama detection.
Fixes NousResearch#11237
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/ollama Ollama / local models labels Apr 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix with #12914 for #11237 — both scope think=False to Ollama endpoints only. This PR uses _is_ollama_glm_backend() pattern, #12914 may differ in detection approach.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating the provider-specific request field. The underlying bug remains on current main, but this branch predates the provider-profile request path.

Problems

  • run_agent.py:5328-5331 now only forwards to agent.chat_completion_helpers.build_api_kwargs(). Registered custom providers take the profile path, which calls CustomProfile.build_api_kwargs_extras() at agent/transports/chat_completions.py:562-594.
  • The live unconditional assignment is now plugins/model-providers/custom/__init__.py:52-58; it still sends extra_body["think"] = False for every disabled custom endpoint.
  • tests/plugins/model_providers/test_custom_profile.py:51-64 currently asserts that unconditional behavior and does not cover a non-Ollama custom URL.

Suggested changes

  • Salvage the guard into CustomProfile.build_api_kwargs_extras(), using the base_url and ollama_num_ctx context already passed by the transport (agent/transports/chat_completions.py:565-573).
  • Add positive Ollama and negative remote-custom-provider regression cases there.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/ollama Ollama / local models sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: think=False incorrectly sent to all provider=custom endpoints, not just Ollama

3 participants