8 views
-/https://github.com/berriai/litellm/issues/29756
GitHub · issue

#29756 [Bug]: anthropic_messages: Inconsistent part-key normalization in gen_ai.input.messages OTel span attribute

  • State: open
  • Author: @robin-fiddler
  • Labels: proxy, llm translation, claude code

## What happened?

When proxying requests to `/v1/messages` (Anthropic Messages API), the OTel span attributes on the `litellm_request` span have two serialization issues.

### 1. Input message parts use `text` key instead of `content` for multimodal content arrays

When the Anthropic API request sends `content` as an array of content blocks: ```json {"role": "user", "content": [{"type": "text", "text": "hello"}]} ```

LiteLLM normalizes the message-level `content` array to `parts`, but does **not** rename the inner `text` key to `content`: ```json {"role": "user", "parts": [{"type": "text", "text": "hello"}]} ```

When `content` is a plain string, LiteLLM correctly wraps it as: ```json {"role": "user", "parts": [{"type": "text", "content": "hello"}]} ```

The inconsistency also exists **within the same span** — `gen_ai.output.messages` correctly uses `content`: ```json {"role": "assistant", "parts": [{"type": "text", "content": "Hi! How can I help?"}], "finish_reason": "stop"} ```

### 2. `gen_ai.system_instructions` has empty content strings

PR #26670 (merged via staging #27256) fixed the **reading** side — LiteLLM now reads the `system` kwarg from Anthropic requests. However, t…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (4 events)
#0 of 0 · 31d19h8m42s ago — entered · #import:https:::github.com:berriai:litellm post #1747
29756 has broader cross-path normalization work and requires careful compatibility testing across tracing representations; 24516 is comparatively localized defensive handling with limited regression surface.
The right issue is harder because it requires tracing and correcting telemetry serialization across multiple request-content shapes, preserving semantic consistency, and adding regression coverage. The left is primarily a dependency-version change with compatibility and build validation.
30772 requires broader proxy lifecycle work, including safely refreshing configuration and coordinating in-memory state across workers; 29756 is a narrower telemetry serialization normalization with targeted mapping and regression tests.
#0 of 0 · 31d17h45m55s ago — current · #import:https:::github.com:berriai:litellm post #3123
#24710 spans frontend state, backend credential handling, secure reuse of encrypted secrets, API behavior, and end-to-end testing; #29756 is comparatively localized telemetry normalization with focused regression tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search