Skip to content

Commit 6ac14ef

Browse files
committed
refactor(anthropic): use transform_anthropic_content_part directly
Replace generic transform_content_part with the Anthropic-specific transform_anthropic_content_part function for better performance and clarity since we know Anthropic uses its own format with source dicts.
1 parent 0c3034b commit 6ac14ef

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sentry_sdk/integrations/anthropic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
normalize_message_roles,
1212
truncate_and_annotate_messages,
1313
get_start_span_function,
14-
transform_content_part,
14+
transform_anthropic_content_part,
1515
)
1616
from sentry_sdk.consts import OP, SPANDATA, SPANSTATUS
1717
from sentry_sdk.integrations import _check_minimum_version, DidNotEnable, Integration
@@ -127,7 +127,7 @@ def _transform_anthropic_content_block(
127127
content_block: "dict[str, Any]",
128128
) -> "dict[str, Any]":
129129
"""
130-
Transform an Anthropic content block using the shared transform_content_part function,
130+
Transform an Anthropic content block using the Anthropic-specific transformer,
131131
with special handling for Anthropic's text-type documents.
132132
"""
133133
# Handle Anthropic's text-type documents specially (not covered by shared function)
@@ -139,8 +139,8 @@ def _transform_anthropic_content_block(
139139
"text": source.get("data", ""),
140140
}
141141

142-
# Use shared transformation for standard formats
143-
result = transform_content_part(content_block)
142+
# Use Anthropic-specific transformation
143+
result = transform_anthropic_content_part(content_block)
144144
return result if result is not None else content_block
145145

146146

0 commit comments

Comments
 (0)