fix(ollama-cloud): capability-gate reasoning_effort + real disable semantics (salvage #51482) - #65723
Merged
Merged
Conversation
… semantics
Three follow-up fixes to the salvaged reasoning_effort support, all verified
live against ollama.com /v1/chat/completions + /api/show on deepseek-v4-pro,
gemma3, and qwen3-coder:
1. Capability-gate on /api/show 'thinking'. The original ignored the
supports_reasoning flag and emitted reasoning_effort for every model. Now
gated: only models whose native /api/show capabilities list contains
'thinking' (deepseek-v4 yes; gemma3 / qwen3-coder no) get reasoning_effort.
Mirrors the LM Studio pattern — capability resolved once per (model,
base_url) in run_agent._supports_reasoning_extra_body via a cached probe
(hermes_cli.models.ollama_model_supports_thinking), threaded into the
profile hook as supports_reasoning. No live HTTP in the per-request path.
2. Disable actually disables. Ollama Cloud defaults to thinking ON and IGNORES
the extra_body.thinking:{type:disabled} shape (verified: still returned
reasoning). The only working off switch is top-level reasoning_effort:'none'.
The salvaged code returned ({}, {}) for enabled:false / effort:none, leaving
thinking ON. Now emits {'reasoning_effort': 'none'}.
3. Omit unrecognized effort. The original forwarded any unknown string verbatim
including 'minimal' (a real Hermes effort level). Ollama Cloud rejects
unrecognized values with a hard HTTP 400 (accepted set: low/medium/high/
max/none), so forwarding 'minimal' would break the request. Now omitted.
Core touches (run_agent.py, hermes_cli/models.py) add the capability probe;
the plugin profile only consumes the resolved flag. 24/24 profile tests green;
194 provider/transport tests unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ollama Cloud reasoning is now capability-gated, has a working off switch, and never sends values the API rejects.
Salvage of the follow-up half of #51482 by @kshitijk4poor (the base commit by @s010mn already landed on main as
221cd6024; this picks the remaining correctness fixes, authorship preserved).Changes
plugins/model-providers/ollama-cloud/__init__.py(@kshitijk4poor):reasoning_effortonly sent to models whose native/api/showcapabilities includethinking; non-thinking models (gemma3, qwen3-coder) get nothingextra_body.thinking:{disabled}; the only real off switch is top-levelreasoning_effort:"none", now emitted onenabled:falseminimaland unknowns now omitted instead of forwarded verbatimrun_agent.py+hermes_cli/models.py(@kshitijk4poor): cached per-(model, base_url) capability probe (ollama_model_supports_thinking), mirrors the LM Studio pattern — no live HTTP in the per-request pathultrain the max-clamp tuple (from feat(reasoning): add max and ultra effort levels #62650) alongside the PR's gating/disable/omit fixesValidation
reasoning_effortsent anywayenabled: falsereasoning_effort: "none"ultramaxTargeted:
test_ollama_cloud_profile.py(24),test_run_agent.py+test_models.py(515) — all pass. E2E via real plugin discovery: gate-off/clamp/disable/omit all verified.Closes #51482. Contributor's original fixes were live-verified against ollama.com per the PR body.
Infographic