fix: treat reasoning_effort="none" as thinking disabled and route gemma to Gemini provider
- Do not send reasoning_effort="none" to APIs (prevents 400 on gemma/Gemini) - Treat "none" as thinking disabled in thinking_style, Kimi, and reasoning_content backfill paths - Fix Anthropic extended thinking not respecting "none" - Fix Azure OpenAI temperature suppression and reasoning body for "none" - Fix Codex reasoning body for "none" - Add "gemma" keyword to Gemini ProviderSpec for correct auto routing
This commit is contained in:
@@ -570,7 +570,7 @@ class OpenAICompatProvider(LLMProvider):
|
||||
# DashScope accepts none/minimum/low/medium/high/xhigh; "minimal" 400s.
|
||||
wire_effort = "minimum"
|
||||
|
||||
if wire_effort:
|
||||
if wire_effort and semantic_effort != "none":
|
||||
kwargs["reasoning_effort"] = wire_effort
|
||||
|
||||
# Provider-specific thinking parameters.
|
||||
@@ -579,7 +579,7 @@ class OpenAICompatProvider(LLMProvider):
|
||||
# The mapping is driven by ProviderSpec.thinking_style so that adding
|
||||
# a new provider never requires touching this function.
|
||||
if spec and spec.thinking_style and reasoning_effort is not None:
|
||||
thinking_enabled = semantic_effort != "minimal"
|
||||
thinking_enabled = semantic_effort not in ("none", "minimal")
|
||||
extra = _THINKING_STYLE_MAP.get(spec.thinking_style, lambda _: None)(thinking_enabled)
|
||||
if extra:
|
||||
kwargs.setdefault("extra_body", {}).update(extra)
|
||||
@@ -589,7 +589,7 @@ class OpenAICompatProvider(LLMProvider):
|
||||
# so that OpenRouter-style names like "moonshotai/kimi-k2.5" are handled
|
||||
# identically to bare names like "kimi-k2.5".
|
||||
if reasoning_effort is not None and _is_kimi_thinking_model(model_name):
|
||||
thinking_enabled = semantic_effort != "minimal"
|
||||
thinking_enabled = semantic_effort not in ("none", "minimal")
|
||||
kwargs.setdefault("extra_body", {}).update(
|
||||
{"thinking": {"type": "enabled" if thinking_enabled else "disabled"}}
|
||||
)
|
||||
@@ -609,9 +609,9 @@ class OpenAICompatProvider(LLMProvider):
|
||||
# thinking happened on that turn").
|
||||
thinking_active = (
|
||||
(spec and spec.thinking_style and reasoning_effort is not None
|
||||
and semantic_effort != "minimal")
|
||||
and semantic_effort not in ("none", "minimal"))
|
||||
or (reasoning_effort is not None and _is_kimi_thinking_model(model_name)
|
||||
and semantic_effort != "minimal")
|
||||
and semantic_effort not in ("none", "minimal"))
|
||||
)
|
||||
if thinking_active:
|
||||
for msg in kwargs["messages"]:
|
||||
|
||||
Reference in New Issue
Block a user