| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
message_to_generate_content_response() and the streaming message_start handler never read the Anthropic Message.model field, so every LlmResponse AnthropicLlm produced had model_version=None. Other first-party model wrappers (google_llm, lite_llm, apigee_llm) already set this from their respective API responses; AnthropicLlm was the one path where it stayed null, which meant DatabaseSessionService- persisted events and the gen_ai.response.model telemetry attribute had no way to tell which resolved Claude snapshot served a turn. Set model_version=message.model in the non-streaming path. On the streaming path, thread event.message.model through to every yielded LlmResponse, partials included, matching lite_llm.py's parity between partial and final responses. Add real assertions on model_version for both paths (non-streaming and streaming, partial and final), not just the mock plumbing needed to give MagicMock.model a string value. Fixes google#6847
| Back | FazBrowse Home | New Git URL |
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
AnthropicLlm never sets LlmResponse.model_version. The Anthropic API
returns the resolved model snapshot on every response (Message.model), but
neither the non-streaming nor the streaming path reads it. Every other model
wrapper (google_llm.py, lite_llm.py, apigee_llm.py) already populates
this field.
Solution:
Set model_version=message.model in message_to_generate_content_response(),
and thread event.message.model through the streaming path to every yielded
LlmResponse, partials included, matching lite_llm.py's parity there.
Testing Plan
Unit Tests:
Added two tests that assert on model_version directly (not just mock
plumbing): one for the non-streaming response, one covering both a partial
and the final streaming response.
Manual End-to-End (E2E) Tests:
Run against the live Anthropic API by building and running package locally in an existing application.
Checklist