otelMiddleware: captureContent drops image/audio/video/document parts, recording only '[image]' placeholders
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 3.1k
- Fork
- 340
- Merge medio
- 2g 10h
- PR unite (30g)
- 169
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/ai
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
I maintainer di solito rispondono entro 1 giorno
-
withPersistence re-appends stored tool results on an interrupt resume (snapshot ids never match stored id-less tool messages)Forse già presa @tombeckenham l’ha presa oggi. Apertawaiting-on: maintainer
TanStack/ai#1580 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
signin with openaiApertahas-pr waiting-on: maintainer
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
TanStack/ai#1572 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
update elevenlabsForse già presa @tombeckenham l’ha presa 2 giorni fa. Apertahas-pr waiting-on: maintainer
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
TanStack/ai#1564 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
area/frontend good first issue kind/cooldown
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
voidzero-dev/oxc-angular-compiler#511 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
langchain-ai/deepagentsjs#898 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
anomalyco/models.dev#8509 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug documentation P2 UI/UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno