Repository navigation
Conversation
…on lacks provider LiteLLM returns model_version without a provider prefix (e.g. gpt-4o for openai/gpt-4o). _inference_system_name preferred that bare id, so gen_ai.choice fell back to gemini while the span correctly used openai/groq. Prefer the agent-configured model id when model_version does not identify a provider. Fixes google#7631.
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.
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):
2. Or, if no issue exists, describe the change:
Problem:
With
ADK_TELEMETRY_SCHEMA_VERSION_OPT_IN=1,gen_ai.choicelogs reportgen_ai.system=geminifor LiteLLM models such asopenai/gpt-4oandgroq/llama-3.1-8b-instant, while the span and system/user message logs correctly reportopenai/groq. Anthropic is unaffected because bareclaude-*ids already resolve via the Anthropic pattern.Root cause:
_inference_system_namepreferredllm_response.model_version. LiteLLM returns that without a provider prefix (e.g.gpt-4o), so_resolve_gen_ai_system_namefalls back to Gemini.Solution:
When
model_versiondoes not itself identify agen_ai.systemprovider (no Gemini match, no Anthropic pattern, no<provider>/<model>prefix), fall back to the agent-configured request model id (the same id the span already uses). Added_model_identifies_gen_ai_systemto share that check with the resolution rules.Testing Plan
Unit Tests:
New
test_choice_log_system_name_when_model_version_lacks_providercovers openai/gpt-4o, groq/llama-3.1-8b-instant, anthropic, and gemini whenmodel_versionis a bare id.Red/green: the new openai/groq cases failed on main (
geminivs expected provider) and pass with the fix.Manual End-to-End (E2E) Tests:
Not run (repro in #7631 uses LiteLLM
mock_response; covered by the unit regression above).Checklist
Additional context
N/A