fix(models): resolve Claude 5 model names in the LLM registry - #6558
Open
asjad3 wants to merge 3 commits into
Open
fix(models): resolve Claude 5 model names in the LLM registry#6558asjad3 wants to merge 3 commits into
asjad3 wants to merge 3 commits into
Conversation
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.
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Problem:
LLMRegistry.resolve()can't find aClaudeclass for the Claude 5 models, so they can'tbe used with ADK at all:
The
anthropicpackage was installed the whole time — the model name simply doesn't matcheither of the registered patterns.
supported_models()returns[r"claude-3-.*", r"claude-.*-4.*"], andclaude-opus-5/claude-sonnet-5/claude-fable-5contain no-4, sore.fullmatchfails 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-8all matchclaude-.*-4.*. It's specificallythe 5 series that has no pattern.
Solution:
Added a third pattern,
r"claude-.*-5.*", alongside the existing two, in both places thelist is declared —
AnthropicLlm.supported_models()and the_LAZY_PROVIDERSentry inmodels/__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, andtest_helpful_error_for_claude_without_extensionsrelies on an unmatchedclaude-*namestill reaching the install-hint branch.
The class itself needs no other change —
AnthropicLlmalready handles the 5-seriessurface (the docstrings cover
effort="xhigh"and adaptive thinking), so it was only everthe registry lookup standing in the way.
Testing Plan
Unit Tests:
Extended
test_match_claude_familywith the 4.5/4.6/4.7/4.8 and 5-series names, andupdated
test_supported_modelsfor the third pattern.With the test changes kept and the two source files reverted, the four cases that pin the
fix fail and nothing else does:
pyink --checkandisort --check-onlyare clean on all four files.Manual End-to-End (E2E) Tests:
Resolution before and after, no network or API key needed:
before:
ValueError: Model claude-opus-5 not found.(same for each)after: every one resolves to
ClaudeWritten with AI assistance (Claude Code); I reviewed the change and ran everything above.