Tests: add Anthropic Bedrock normalization cases; Reasoning: include Sonnet 4.5 dot variant and Bedrock dotted cases; Simplify Anthropic prefix stripping\n\n- add normalization tests for anthropic.claude-4-5 and us.anthropic.claude-4-5 (incl. bedrock path)\n- add reasoning_effort tests for sonnet 4.5 dash & dot, and bedrock dotted forms\n- include 'claude-sonnet-4.5*' pattern in REASONING_EFFORT_PATTERNS\n\nNo _lc helper present; no '*' handling in normalization to remove\n\nCo-authored-by: openhands <openhands@all-hands.dev>

This commit is contained in:
enyst 2025-10-21 14:37:41 +00:00
parent c433da0570
commit 4b9ce8ddf6
2 changed files with 14 additions and 7 deletions

View File

@ -31,16 +31,14 @@ def normalize_model_name(model: str) -> str:
# No '/', keep the whole raw name (we do not support provider:model)
name = raw
# Collapse only Anthropic Bedrock-style dot prefixes and remove the vendor token entirely.
# Collapse only Anthropic Bedrock-style dotted vendor and remove the vendor token entirely.
# Examples:
# 'anthropic.claude-*' -> 'claude-*'
# 'us.anthropic.claude-*' -> 'claude-*'
if '.' in name:
tokens = name.split('.')
if 'anthropic' in tokens:
idx = tokens.index('anthropic')
if idx + 1 < len(tokens):
name = '.'.join(tokens[idx + 1 :])
if name.startswith('anthropic.'):
name = name[len('anthropic.') :]
elif '.anthropic.' in name:
name = name.split('.anthropic.', 1)[1]
if name.endswith('-gguf'):
name = name[: -len('-gguf')]
@ -120,7 +118,9 @@ REASONING_EFFORT_PATTERNS: list[str] = [
'gpt-5*',
# DeepSeek reasoning family
'deepseek-r1-0528*',
# Anthropic Sonnet/Haiku 4.5 variants
'claude-sonnet-4-5*',
'claude-sonnet-4.5*',
'claude-haiku-4-5*',
]

View File

@ -24,6 +24,9 @@ from openhands.llm.model_features import (
'claude-3-5-sonnet-20241022-v2',
),
('', ''),
('anthropic.claude-4-5-20250929-v1', 'claude-4-5-20250929-v1'),
('us.anthropic.claude-4-5-20250929-v1', 'claude-4-5-20250929-v1'),
('bedrock/us.anthropic.claude-4-5-20250929-v1:0', 'claude-4-5-20250929-v1'),
(None, ''), # type: ignore[arg-type]
],
)
@ -207,6 +210,10 @@ def test_function_calling_models(model):
'o3-mini',
'o4-mini',
'gemini-2.5-flash',
'claude-sonnet-4-5',
'claude-sonnet-4.5',
'us.anthropic.claude-sonnet-4-5-20250929-v1',
'us.anthropic.claude-sonnet-4.5-20250929-v1',
'gemini-2.5-pro',
'gpt-5',
'gpt-5-mini-2025-08-07',