Skip to content
Merged
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
11 changes: 10 additions & 1 deletion plugins/model-providers/custom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
Ollama instances and OpenAI-compatible reasoning endpoints (GLM-5.2 on
Volcengine ARK, vLLM, llama.cpp). Key quirks:
- ollama_num_ctx → extra_body.options.num_ctx (local context window)
- reasoning_config disabled → extra_body.think = False
- reasoning_config disabled → top-level reasoning_effort="none"
(Ollama /v1/chat/completions ignores think=False — ollama#14820)
+ extra_body.think = False for /api/chat and proxies
- reasoning_config enabled + effort → top-level reasoning_effort
(the native OpenAI-compatible format GLM/ARK expect; unset omits it
so the endpoint's server default applies)
Expand Down Expand Up @@ -53,6 +55,13 @@ def build_api_kwargs_extras(
_effort = (reasoning_config.get("effort") or "").strip().lower()
_enabled = reasoning_config.get("enabled", True)
if _effort == "none" or _enabled is False:
# Ollama's /v1/chat/completions silently ignores
# extra_body.think (only /api/chat honours it — ollama#14820)
# but respects the top-level reasoning_effort field, so both
# are needed to actually stop a thinking-capable model from
# reasoning (#25758). Endpoints that recognize neither simply
# ignore them.
top_level["reasoning_effort"] = "none"
extra_body["think"] = False
elif _effort:
top_level["reasoning_effort"] = _effort
Expand Down
1 change: 1 addition & 0 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# Auto-extracted from noreply emails + manual overrides
AUTHOR_MAP = {
"75556242+webtecnica@users.noreply.github.com": "webtecnica", # PR #63360 salvage (nous: restore inference-api base_url)
"skosarevivan@yandex.ru": "Epoxidex", # PR #29820 salvage (ollama: top-level reasoning_effort=none; #25758)
"changhyun.min@gmail.com": "minchang", # PR #42231 salvage (providers: add Upstage Solar)
"neo@neodeMac-mini.local": "neo-claw-bot", # PR #58465 salvage (moa: drop empty user turns from advisory view)
"2024104039@mails.szu.edu.cn": "pixel4039", # PR #64420 salvage (streaming: retry zero-chunk streams)
Expand Down
14 changes: 10 additions & 4 deletions tests/plugins/model_providers/test_custom_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,26 @@ def test_no_reasoning_config_emits_nothing(self, custom_profile):
assert tl == {}

def test_disabled_sends_think_false(self, custom_profile):
"""enabled=False → extra_body.think = False (Ollama thinking-off flag)."""
"""enabled=False → reasoning_effort='none' top-level + think=False.

Both fields are required: Ollama's /v1/chat/completions silently
ignores extra_body.think (only /api/chat honours it — ollama#14820)
but respects top-level reasoning_effort (#25758). think=False stays
for proxies and the native /api/chat path.
"""
eb, tl = custom_profile.build_api_kwargs_extras(
reasoning_config={"enabled": False}, model="glm-5.2"
)
assert eb == {"think": False}
assert tl == {}
assert tl == {"reasoning_effort": "none"}

def test_effort_none_sends_think_false(self, custom_profile):
"""effort='none' is the disable alias → think=False, no effort."""
"""effort='none' is the disable alias → same dual emission."""
eb, tl = custom_profile.build_api_kwargs_extras(
reasoning_config={"enabled": True, "effort": "none"}, model="glm-5.2"
)
assert eb == {"think": False}
assert tl == {}
assert tl == {"reasoning_effort": "none"}

@pytest.mark.parametrize(
"effort", ["minimal", "low", "medium", "high", "xhigh", "max"]
Expand Down
Loading