otelMiddleware: captureContent drops image/audio/video/document parts, recording only '[image]' placeholders
Los mantenedores suelen responder en 1 día
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Summary
With captureContent: true, otelMiddleware replaces every non-text content part with a placeholder string before writing gen_ai.input.messages / langfuse.observation.input. A vision call's recorded input reads:
[{"role":"user","content":"Describe this reference image. [image]"}]
The image is gone from the trace. For vision classification this is the part you most need when debugging. For example: why did the model call this image an illustration? You can see the model's answer but not what it looked at.
Root cause
serializeContent (packages/ai/src/middlewares/otel.ts:185) flattens each message to one string. Image, audio, video and document parts become '[image]', '[audio]' and so on, and source is discarded:
case 'image':
parts.push('[image]')
break
The result is written as { role, content: string } (line ~584), so there is nowhere to put a structured part even if one survived.
There is no way to work around this from outside the middleware:
attributeEnricherruns before thecaptureContentblock, so anything it sets ongen_ai.input.messagesgets overwritten.redactonly ever sees the already-flattened string.
Proposal
Keep content parts structured in gen_ai.input.messages, following the OTel GenAI semconv parts shape, which PostHog, Langfuse and Datadog all render:
text→{ type: 'text', content }image/audio/video/documentwithsource.type === 'url'→{ type: 'uri', modality, uri: source.value, mime_type? }source.type === 'data'(inline base64) → keep the placeholder by default, since it would blowmaxContentLengthand span attribute limits. Optionally add an opt-in hook (e.g.serializePart?: (part) => unknown) so an app can upload the blob and substitute a URL.
redact should still apply to the text parts.
If changing the attribute shape is too breaking for 0.x, an opt-in structuredContent: true flag would also work.
Version
@tanstack/ai 0.58.0 (current main has the same code).
I'm happy to open a PR.
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.1k
- Forks
- 340
- Merge medio
- 2 d 7 h
- PR fusionados (30 d)
- 175
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 TanStack/ai
-
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
signin with openaiAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
update elevenlabsPosiblemente ocupada @tombeckenham la tomó hace 1 día. Abiertohas-pr waiting-on: maintainer
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
TanStack/ai#1564 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
onAfterToolCall failure records a second, contradictory result for a successful server toolPosiblemente ocupada @AlemTuzlak la tomó hace 2 días. Abiertohas-pr waiting-on: maintainer
TanStack/ai#1558 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
SSE and NDJSON response streams drain unread sources without backpressurePosiblemente ocupada @tombeckenham la tomó hace 2 días. Abiertohas-pr waiting-on: maintainer
TanStack/ai#1556 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/ai
Issues similares
-
bug via-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pingdotgg/t3code#14452 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
solana-foundation/program-examples#747 · 1 comentario ·
Los mantenedores suelen responder en 9 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
remotion-dev/remotion#11847 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openwatersio/slackwater#355 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
melgarafael/DeskcommCRM#1998 · 3 comentarios ·
Los mantenedores suelen responder en 1 día