gen_ai.choice log reports gen_ai.system=gemini for OpenAI and Groq models through LiteLlm
Los mantenedores suelen responder en 4 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend, observability
Línea de trabajo
Empieza en src/google/adk/telemetry/tracing.py, especialmente en _inference_system_name, _resolve_gen_ai_system_name y los dos puntos de llamada a gen_ai.choice vinculados en el issue. Compara cómo determinan el span y el registro de choice gen_ai.system cuando LiteLLM devuelve un model_version sin prefijo de proveedor; usa la reproducción con mock_response para comprobar OpenAI y Groq. El trabajo estará terminado cuando los registros de choice indiquen el mismo proveedor que el span correspondiente y el caso existente de Anthropic siga funcionando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔴 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
- Lenguaje dominante
- Python
- Estrellas
- 21.9k
- Forks
- 4.2k
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 6
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de google/adk-python
-
LiteLlm with SSE streaming records the answer twice in gen_ai.output.messagesPosiblemente ocupada @surajksharma07 la tomó hace 1 día. Abiertomodels
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/adk-python#7630 · 7 comentarios · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
Update opentelemetry-api and opentelemetry-sdk to 1.44.0Posiblemente ocupada @llalitkumarrr la tomó hace 15 días. Abiertorequest clarification tracing
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
google/adk-python#7433 · 5 comentarios · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
CI Mypy Check flags an existing streaming_utils.py error as new because the PR run reuses the baseline's mypy cachePosiblemente ocupada @DeanChensj la tomó hace 17 días. Abiertoneeds review
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
google/adk-python#7409 · 1 comentario · 2 asignados ·
Los mantenedores suelen responder en 4 días
-
A2aAgentExecutor sends the raw exception text to the A2A caller when the run failsPosiblemente ocupada @sanketpatil06 la tomó hace 18 días. Abiertoa2a request clarification
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
google/adk-python#7385 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 4 días
-
Please support mermaid 12 (inbuild elk) in `adk web`Posiblemente ocupada @sanketpatil06 la tomó hace 18 días. Abiertoneeds review web
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
google/adk-python#7381 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 4 días
Todos los issues de google/adk-python
Issues similares
-
style: article/section 📝 system: cloud.rc ☁️ system: security 🔐
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
uabrc/uabrc.github.io#1262 ·
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
NCAR/miles-credit#526 ·
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 76/100
conda/conda-lock#957 ·
Los mantenedores suelen responder en 1 día
-
Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
aws-samples/sample-per-model-bedrock#464 ·
Los mantenedores suelen responder en 1 día