Skip to content

Commit 9c52cd6

Browse files
committed
fix(anthropic) make result content blocks more resilient
1 parent 2616601 commit 9c52cd6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ def _sentry_patched_create_common(f, *args, **kwargs):
215215
input_tokens=input_tokens,
216216
output_tokens=output_tokens,
217217
content_blocks=[
218-
(
219-
content_block.to_dict()
220-
if hasattr(content_block, "to_dict")
221-
else content_block.model_dump()
222-
)
218+
{
219+
"type": "text",
220+
"text": content_block.text,
221+
}
223222
for content_block in result.content
223+
if hasattr(content_block, "text")
224224
],
225225
finish_span=True,
226226
)

0 commit comments

Comments
 (0)