mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
fix(anthropic): cap budget->effort at "high" when model lacks "xhigh" support
_translate_legacy_thinking_for_adaptive_model mapped budget_tokens >= 24000 to "xhigh" for all adaptive-thinking models. claude-opus-4-6 and claude-sonnet-4-6 support high/medium/low/max but not xhigh, so those requests failed with "This model does not support effort level 'xhigh'". Only claude-opus-4-7 (and later models) expose xhigh. Use AnthropicConfig._supports_effort_level(model, "xhigh") — the same per-model lookup already used by _validate_effort_for_model — to decide the cap. Fall back to "high" when xhigh is absent from the model map. Fixes #27168
This commit is contained in:
parent
850fe595ac
commit
a1ce7d9dac
1 changed files with 9 additions and 1 deletions
|
|
@ -179,9 +179,17 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig):
|
|||
if not isinstance(thinking, dict) or thinking.get("type") != "enabled":
|
||||
return
|
||||
|
||||
from litellm.llms.anthropic.chat.transformation import AnthropicConfig
|
||||
|
||||
budget = int(thinking.get("budget_tokens") or 0)
|
||||
if budget >= 24000:
|
||||
effort = "xhigh"
|
||||
# Only use "xhigh" when the model actually supports it (e.g. claude-opus-4-7).
|
||||
# claude-opus-4-6 and claude-sonnet-4-6 support high/medium/low/max but not xhigh.
|
||||
effort = (
|
||||
"xhigh"
|
||||
if AnthropicConfig._supports_effort_level(model, "xhigh")
|
||||
else "high"
|
||||
)
|
||||
elif budget >= 10000:
|
||||
effort = "high"
|
||||
elif budget >= 5000:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue