Skip to content

fix: preserve Anthropic model version in streaming and non-streaming responses - #6852

Open
aaravxsingh15 wants to merge 1 commit into
google:mainfrom
aaravxsingh15:fix/anthropic-model-version
Open

fix: preserve Anthropic model version in streaming and non-streaming responses#6852
aaravxsingh15 wants to merge 1 commit into
google:mainfrom
aaravxsingh15:fix/anthropic-model-version

Conversation

@aaravxsingh15

Copy link
Copy Markdown

Description

Populates LlmResponse.model_version for Anthropic responses using the resolved
model returned by the Anthropic API.

  • Set model_version from message.model for non-streaming responses.
  • Capture the resolved model from message_start for streaming responses.
  • Include the resolved model in the final aggregated streaming response.
  • Add regression tests covering both response paths.

Fixes #6847.

Testing plan

  • python -m pytest tests/unittests/models/test_anthropic_llm.py -q
  • python -m pytest tests/unittests/models/test_anthropic_llm.py -k "model_version" -q
  • python -m ruff check src/google/adk/models/anthropic_llm.py

@google-cla

google-cla Bot commented Aug 22, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnthropicLlm never populates LlmResponse.model_version

2 participants