Skip to content

fix(models): resolve Claude 5 model names in the LLM registry - #6558

Open
asjad3 wants to merge 3 commits into
google:mainfrom
asjad3:claude-5-model-resolution
Open

fix(models): resolve Claude 5 model names in the LLM registry#6558
asjad3 wants to merge 3 commits into
google:mainfrom
asjad3:claude-5-model-resolution

Conversation

@asjad3

@asjad3 asjad3 commented Aug 3, 2026

Copy link
Copy Markdown

Link to Issue or Description of Change

Problem:

LLMRegistry.resolve() can't find a Claude class for the Claude 5 models, so they can't
be used with ADK at all:

>>> from google.adk import models
>>> models.LLMRegistry.resolve("claude-opus-5")
ValueError: Model claude-opus-5 not found.

Claude models require the anthropic package.
Install it with: pip install google-adk[extensions]
Or: pip install anthropic>=0.43.0

The anthropic package was installed the whole time — the model name simply doesn't match
either of the registered patterns. supported_models() returns [r"claude-3-.*", r"claude-.*-4.*"], and claude-opus-5 / claude-sonnet-5 / claude-fable-5 contain no
-4, so re.fullmatch fails for all of them and resolution falls through to the
"not found" branch — whose hint sends the user to install a package they already have.

Everything else lands correctly: claude-sonnet-4-5, claude-haiku-4-5,
claude-sonnet-4-6, claude-opus-4-6/4-7/4-8 all match claude-.*-4.*. It's specifically
the 5 series that has no pattern.

Solution:

Added a third pattern, r"claude-.*-5.*", alongside the existing two, in both places the
list is declared — AnthropicLlm.supported_models() and the _LAZY_PROVIDERS entry in
models/__init__.py, which have to agree.

I kept the existing version-gated shape rather than collapsing everything to claude-.*.
A single broad pattern would swallow names like claude-nonexistent-model-xyz, and
test_helpful_error_for_claude_without_extensions relies on an unmatched claude-* name
still reaching the install-hint branch.

The class itself needs no other change — AnthropicLlm already handles the 5-series
surface (the docstrings cover effort="xhigh" and adaptive thinking), so it was only ever
the registry lookup standing in the way.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Extended test_match_claude_family with the 4.5/4.6/4.7/4.8 and 5-series names, and
updated test_supported_models for the third pattern.

tests/unittests/models/test_models.py
tests/unittests/models/test_anthropic_llm.py    149 passed

With the test changes kept and the two source files reverted, the four cases that pin the
fix fail and nothing else does:

FAILED test_models.py::test_match_claude_family[claude-opus-5]
FAILED test_models.py::test_match_claude_family[claude-sonnet-5]
FAILED test_models.py::test_match_claude_family[claude-fable-5]
FAILED test_anthropic_llm.py::test_supported_models
4 failed, 145 passed

pyink --check and isort --check-only are clean on all four files.

Manual End-to-End (E2E) Tests:

Resolution before and after, no network or API key needed:

from google.adk import models
for m in ["claude-opus-5", "claude-sonnet-5", "claude-fable-5", "claude-opus-5-20260101"]:
    print(m, "->", models.LLMRegistry.resolve(m).__name__)

before: ValueError: Model claude-opus-5 not found. (same for each)
after: every one resolves to Claude


Written with AI assistance (Claude Code); I reviewed the change and ran everything above.

supported_models() only covered claude-3-* and claude-*-4*, so claude-opus-5,
claude-sonnet-5 and claude-fable-5 never matched and LLMRegistry.resolve()
failed with a message telling the user to install a package they already have.

Added a claude-*-5* pattern in both places the list is declared.
@google-cla

google-cla Bot commented Aug 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@adk-bot adk-bot added the models [Component] This issue is related to model support label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models [Component] This issue is related to model support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants