Skip to content

Commit e7128e3

Browse files
committed
refactor(pydantic-ai): Use shared get_modality_from_mime_type from ai/utils
Replace manual mime_type.split('/')[0] logic with the shared get_modality_from_mime_type function for consistent modality detection.
1 parent 1546a07 commit e7128e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sentry_sdk/integrations/pydantic_ai/spans/ai_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
normalize_message_roles,
55
set_data_normalized,
66
truncate_and_annotate_messages,
7+
get_modality_from_mime_type,
78
)
89
from sentry_sdk.consts import OP, SPANDATA
910
from sentry_sdk.utils import safe_serialize
@@ -118,7 +119,9 @@ def _set_input_messages(span: "sentry_sdk.tracing.Span", messages: "Any") -> Non
118119
content.append(
119120
{
120121
"type": "blob",
121-
"modality": item.media_type.split("/")[0],
122+
"modality": get_modality_from_mime_type(
123+
item.media_type
124+
),
122125
"mime_type": item.media_type,
123126
"content": BLOB_DATA_SUBSTITUTE,
124127
}

0 commit comments

Comments
 (0)