gen_ai.choice log reports gen_ai.system=gemini for OpenAI and Groq models through LiteLlm
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend, observability
Hướng nghiên cứu
Bắt đầu tại src/google/adk/telemetry/tracing.py, đặc biệt là _inference_system_name, _resolve_gen_ai_system_name và hai vị trí gọi gen_ai.choice được liên kết trong issue. So sánh cách span và log choice xác định gen_ai.system khi LiteLLM trả về model_version không có tiền tố của nhà cung cấp; dùng bản tái hiện với mock_response để kiểm tra OpenAI và Groq. Hoàn tất khi các log choice báo cùng nhà cung cấp với span tương ứng và trường hợp Anthropic hiện có vẫn hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🔴 Required Information
Describe the Bug:
with ADK_TELEMETRY_SCHEMA_VERSION_OPT_IN=1 the gen_ai.choice log says gen_ai.system=gemini for openai/gpt-4o and groq/llama-3.1-8b-instant through LiteLlm. the span and the system/user message logs for the same call say openai and groq. anthropic comes out fine
_inference_system_name looks at llm_response.model_version first (tracing.py#L1521-L1531). litellm gives that back without the provider prefix (gpt-4o) so _resolve_gen_ai_system_name finds no provider and falls back to gemini (#L1461-L1475). both choice log call sites go through it (#L1364, #L1424)
Steps to Reproduce:
pip install google-adk litellm- run this (no api key needed, it uses litellm's
mock_response)
import asyncio
import os
os.environ["ADK_TELEMETRY_SCHEMA_VERSION_OPT_IN"] = "1"
from opentelemetry import _logs, trace
from opentelemetry.sdk._logs import LoggerProvider
from opentelemetry.sdk._logs.export import InMemoryLogRecordExporter, SimpleLogRecordProcessor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
spans, logs = InMemorySpanExporter(), InMemoryLogRecordExporter()
tp = TracerProvider()
tp.add_span_processor(SimpleSpanProcessor(spans))
trace.set_tracer_provider(tp)
lp = LoggerProvider()
lp.add_log_record_processor(SimpleLogRecordProcessor(logs))
_logs.set_logger_provider(lp)
from google.adk.agents import Agent
from google.adk.models.lite_llm import LiteLlm
from google.adk.runners import InMemoryRunner
from google.genai import types
async def run(model_id):
spans.clear()
logs.clear()
model = LiteLlm(model=model_id, mock_response="hi", api_key="unused")
runner = InMemoryRunner(agent=Agent(name="a", model=model), app_name="p")
session = await runner.session_service.create_session(app_name="p", user_id="u")
msg = types.Content(role="user", parts=[types.Part(text="hello")])
async for _ in runner.run_async(user_id="u", session_id=session.id, new_message=msg):
pass
await runner.close()
span = next(s for s in spans.get_finished_spans() if s.name.startswith("generate_content"))
print(model_id)
print(" span gen_ai.system:", span.attributes.get("gen_ai.system"))
for r in logs.get_finished_logs():
rec = r.log_record
print(" ", rec.event_name, "gen_ai.system:", rec.attributes.get("gen_ai.system"))
for m in ("openai/gpt-4o", "groq/llama-3.1-8b-instant", "anthropic/claude-sonnet-4-5"):
asyncio.run(run(m))
Expected Behavior:
gen_ai.choice has the same gen_ai.system as the span, so openai and groq here
Observed Behavior:
openai/gpt-4o
span gen_ai.system: openai
gen_ai.system.message gen_ai.system: openai
gen_ai.user.message gen_ai.system: openai
gen_ai.choice gen_ai.system: gemini
groq/llama-3.1-8b-instant
span gen_ai.system: groq
gen_ai.system.message gen_ai.system: groq
gen_ai.user.message gen_ai.system: groq
gen_ai.choice gen_ai.system: gemini
anthropic/claude-sonnet-4-5
span gen_ai.system: anthropic
gen_ai.system.message gen_ai.system: anthropic
gen_ai.user.message gen_ai.system: anthropic
gen_ai.choice gen_ai.system: anthropic
Environment Details:
- ADK Library Version (pip show google-adk): 2.12.0 (main at 77a74f0)
- Desktop OS: macOS
- Python Version (python -V): 3.12.15
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: openai/gpt-4o and groq/llama-3.1-8b-instant via litellm
mock_response
🟡 Optional Information
Regression:
havent checked older versions
falling back to the configured model id (what the span uses) when model_version has no provider prefix would fix it i think. can send a PR
- Ngôn ngữ chính
- Python
- Star
- 21.9k
- Fork
- 4.2k
- Merge trung bình
- 3 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/adk-python
-
LiteLlm with SSE streaming records the answer twice in gen_ai.output.messagesCó thể đã có người làm @surajksharma07 đã nhận 1 ngày trước. Đang mởmodels
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
google/adk-python#7630 · 11 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Update opentelemetry-api and opentelemetry-sdk to 1.44.0Có thể đã có người làm @llalitkumarrr đã nhận 15 ngày trước. Đang mởrequest clarification tracing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
google/adk-python#7433 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 4 ngày
-
CI Mypy Check flags an existing streaming_utils.py error as new because the PR run reuses the baseline's mypy cacheCó thể đã có người làm @DeanChensj đã nhận 17 ngày trước. Đang mởneeds review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
google/adk-python#7409 · 1 bình luận · 2 người được giao ·
Maintainer thường phản hồi trong vòng 4 ngày
-
A2aAgentExecutor sends the raw exception text to the A2A caller when the run failsCó thể đã có người làm @sanketpatil06 đã nhận 18 ngày trước. Đang mởa2a request clarification
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
google/adk-python#7385 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Please support mermaid 12 (inbuild elk) in `adk web`Có thể đã có người làm @sanketpatil06 đã nhận 18 ngày trước. Đang mởneeds review web
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
google/adk-python#7381 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của google/adk-python
Issue tương tự
-
[Resource]: LoreĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
hesreallyhim/awesome-claude-code#3234 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openminion/openminion#376 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: ☹︎ Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
posit-dev/great-tables#1028 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
integration: apple_tv
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
home-assistant/core#188282 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A "since" range is worded as a career: "the past two seasons" says "regular season career (2025 on)"Đang mởP4: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
jeffknupp/association#538 ·