From e300ae7aa6a50ec0f71c01dc3b7291f4111a3f90 Mon Sep 17 00:00:00 2001 From: George Weale Date: Wed, 5 Aug 2026 22:02:54 -0700 Subject: [PATCH] fix: resolve Claude 5 model names to the Claude LLM class Co-authored-by: George Weale PiperOrigin-RevId: 960059516 --- src/google/adk/models/__init__.py | 5 ++++- src/google/adk/models/anthropic_llm.py | 2 +- tests/unittests/models/test_anthropic_llm.py | 3 ++- tests/unittests/models/test_models.py | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/google/adk/models/__init__.py b/src/google/adk/models/__init__.py index 5541bd56..6756b20d 100644 --- a/src/google/adk/models/__init__.py +++ b/src/google/adk/models/__init__.py @@ -67,7 +67,10 @@ _LAZY_PROVIDERS: dict[str, tuple[list[str], str]] = { # Gemma 3 only (function-calling workarounds). Gemma 4+ resolves to Gemini. 'Gemma': ([r'gemma-.*'], 'gemma_llm'), 'ApigeeLlm': ([r'apigee\/.*'], 'apigee_llm'), - 'Claude': ([r'claude-3-.*', r'claude-.*-4.*'], 'anthropic_llm'), + 'Claude': ( + [r'claude-3-.*', r'claude-.*-4.*', r'claude-.*-5.*'], + 'anthropic_llm', + ), 'Gemma3Ollama': ([r'ollama/gemma3.*'], 'gemma_llm'), 'OpenAILlm': ( [r'gpt-.*', r'o\d+-.*'], diff --git a/src/google/adk/models/anthropic_llm.py b/src/google/adk/models/anthropic_llm.py index 12097213..cdcfb70a 100644 --- a/src/google/adk/models/anthropic_llm.py +++ b/src/google/adk/models/anthropic_llm.py @@ -735,7 +735,7 @@ class AnthropicLlm(BaseLlm): @classmethod @override def supported_models(cls) -> list[str]: - return [r"claude-3-.*", r"claude-.*-4.*"] + return [r"claude-3-.*", r"claude-.*-4.*", r"claude-.*-5.*"] def _resolve_model_name(self, model: Optional[str]) -> str: if not model: diff --git a/tests/unittests/models/test_anthropic_llm.py b/tests/unittests/models/test_anthropic_llm.py index 4b3cdd68..841cc166 100644 --- a/tests/unittests/models/test_anthropic_llm.py +++ b/tests/unittests/models/test_anthropic_llm.py @@ -142,9 +142,10 @@ def test_claude_anthropic_client_creation_with_full_resource_name(): def test_supported_models(): models = Claude.supported_models() - assert len(models) == 2 + assert len(models) == 3 assert models[0] == r"claude-3-.*" assert models[1] == r"claude-.*-4.*" + assert models[2] == r"claude-.*-5.*" function_declaration_test_cases = [ diff --git a/tests/unittests/models/test_models.py b/tests/unittests/models/test_models.py index 2d4febb5..73dada90 100644 --- a/tests/unittests/models/test_models.py +++ b/tests/unittests/models/test_models.py @@ -48,6 +48,8 @@ def test_match_gemini_family(model_name): 'claude-3-sonnet@20240229', 'claude-sonnet-4@20250514', 'claude-opus-4@20250514', + 'claude-opus-5@default', + 'claude-sonnet-5@default', ], ) def test_match_claude_family(model_name):