Skip to content

Commit 8aacf55

Browse files
fix(anthropic): Stop unpacking output arrays (#8160)
The specific problem this fixes is text output parts that are JSON. These are returned when the user of the `anthropic` package provides a custom JSON schema to the model request. The product cannot render this format for `gen_ai.response.text`.
1 parent 84934fe commit 8aacf55

2 files changed

Lines changed: 154 additions & 134 deletions

File tree

‎sentry_sdk/integrations/anthropic.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,10 @@ def _set_output_data(
710710

711711
if len(output_messages["response"]) > 0:
712712
set_data_normalized(
713-
span, SPANDATA.GEN_AI_RESPONSE_TEXT, output_messages["response"]
713+
span,
714+
SPANDATA.GEN_AI_RESPONSE_TEXT,
715+
output_messages["response"],
716+
unpack=False,
714717
)
715718

716719
if input_tokens is not None:

0 commit comments

Comments
 (0)