You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ai): keep multimodal parts structured in otel gen_ai.input.messages (#1527)
captureContent flattened image/audio/video/document parts to '[image]'
placeholders, dropping the media reference from traces. Array content now
serializes to OTel GenAI semconv parts: text (redacted), uri for URL
sources, file for provider handles. Inline data and data: URLs keep the
placeholder. Span events stay flat strings.
Closes#1525
`otelMiddleware` with `captureContent: true` now keeps multimodal parts structured in `gen_ai.input.messages` (OTel GenAI part shapes). URL media becomes a `uri` part and provider file handles become a `file` part, so traces show what the model looked at. Inline base64 data still records a `[image]`-style placeholder.
Copy file name to clipboardExpand all lines: docs/advanced/otel.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,14 @@ If `redact` throws, the middleware writes the literal sentinel `"[redaction_fail
142
142
143
143
Accumulated assistant text (the `gen_ai.choice` event) is capped at `maxContentLength` characters (default `100 000`); longer completions are truncated with a trailing `"…"` marker.
144
144
145
-
Multimodal content (images, audio, video, documents) is represented as placeholder strings (`[image]`, `[audio]`, ...) to preserve message order without dumping binary data onto spans. Use `onSpanEnd` if you need richer multimodal capture.
145
+
Multimodal messages (images, audio, video, documents) keep their parts in `gen_ai.input.messages`, in the OTel GenAI part shapes:
146
+
147
+
- Text: `{ "type": "text", "content": "..." }`. `redact` runs on it.
- Inline base64 data or a `data:` URL: a `[image]` text placeholder, so the bytes do not go onto the span.
151
+
152
+
Span events stay flat strings, with the same placeholders for every media part (`look at this [image]`).
146
153
147
154
Prompt/system/user message events fire from `onConfig` at the start of every iteration, which means the full conversation history (as the adapter will re-send it) is re-emitted on each iteration span. This mirrors what the provider actually sees on the wire.
0 commit comments