fix(providers): omit temperature for sonnet 5

Add sonnet-5 to the Anthropic omit-temperature model families and cover adaptive, enabled, and non-thinking request paths.

Fixes #4683
This commit is contained in:
Hamb_y
2026-07-03 15:48:46 +08:00
committed by GitHub
parent b19a744110
commit 00cc0da530
2 changed files with 22 additions and 2 deletions
+4 -2
View File
@@ -545,10 +545,12 @@ class AnthropicProvider(LLMProvider):
max_tokens = max(1, max_tokens)
thinking_enabled = bool(reasoning_effort) and reasoning_effort.lower() != "none"
# Several Anthropic models (opus-4-7, opus-4-8, fable) deprecated the
# Several Anthropic models (opus-4-7, opus-4-8, sonnet-5, fable) deprecated the
# `temperature` parameter — the API returns 400 if it is present.
_model_lower = model_name.lower()
omit_temperature = any(m in _model_lower for m in ("opus-4-7", "opus-4-8", "fable"))
omit_temperature = any(
m in _model_lower for m in ("opus-4-7", "opus-4-8", "sonnet-5", "fable")
)
kwargs: dict[str, Any] = {
"model": model_name,