mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(anthropic): drop hardcoded _is_claude_4_8_model helper per project convention
greptile flagged the new hardcoded name helper as a discouraged pattern. the suffix-strip fix in _model_map_lookup_candidates already covers the primary path: with the bare claude-opus-4-8 entry resolved, the supports_adaptive_thinking flag is found and the name fallback isn't reached. dropping the helper and its targeted test; the suffix-strip regression coverage stays.
This commit is contained in:
parent
21aec374d9
commit
d4c1815401
2 changed files with 3 additions and 33 deletions
|
|
@ -272,20 +272,6 @@ class AnthropicModelInfo(BaseLLMModelInfo):
|
|||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _is_claude_4_8_model(model: str) -> bool:
|
||||
"""Check if the model is a Claude 4.8 model (Opus 4.8)."""
|
||||
model_lower = model.lower()
|
||||
return any(
|
||||
v in model_lower
|
||||
for v in (
|
||||
"opus-4-8",
|
||||
"opus_4_8",
|
||||
"opus-4.8",
|
||||
"opus_4.8",
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _supports_sampling_params(model: str) -> bool:
|
||||
"""Claude 4.7+ (Opus 4.7/4.8, Fable 5) removed sampling params: the API
|
||||
|
|
@ -425,11 +411,9 @@ class AnthropicModelInfo(BaseLLMModelInfo):
|
|||
model, "supports_adaptive_thinking"
|
||||
):
|
||||
return True
|
||||
return (
|
||||
AnthropicModelInfo._is_claude_4_6_model(model)
|
||||
or AnthropicModelInfo._is_claude_4_7_model(model)
|
||||
or AnthropicModelInfo._is_claude_4_8_model(model)
|
||||
)
|
||||
return AnthropicModelInfo._is_claude_4_6_model(
|
||||
model
|
||||
) or AnthropicModelInfo._is_claude_4_7_model(model)
|
||||
|
||||
def is_effort_used(
|
||||
self, optional_params: Optional[dict], model: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -1506,17 +1506,3 @@ class TestVertexVersionSuffixModelResolution:
|
|||
)
|
||||
is True
|
||||
)
|
||||
|
||||
def test_is_claude_4_8_model_recognizes_suffix_and_provider_prefix(self):
|
||||
from litellm.llms.anthropic.common_utils import AnthropicModelInfo
|
||||
|
||||
assert AnthropicModelInfo._is_claude_4_8_model("claude-opus-4-8") is True
|
||||
assert (
|
||||
AnthropicModelInfo._is_claude_4_8_model("claude-opus-4-8@default") is True
|
||||
)
|
||||
assert (
|
||||
AnthropicModelInfo._is_claude_4_8_model("vertex_ai/claude-opus-4-8@default")
|
||||
is True
|
||||
)
|
||||
assert AnthropicModelInfo._is_claude_4_8_model("claude-opus-4-7") is False
|
||||
assert AnthropicModelInfo._is_claude_4_8_model("claude-opus-4-5") is False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue