File tree Expand file tree Collapse file tree
sentry_sdk/integrations/openai_agents/spans Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from sentry_sdk .consts import OP , SPANDATA
1111from sentry_sdk .scope import should_send_default_pii
1212from sentry_sdk .traces import StreamedSpan
13- from sentry_sdk .tracing_utils import has_span_streaming_enabled
13+ from sentry_sdk .tracing_utils import (
14+ has_span_streaming_enabled ,
15+ should_truncate_gen_ai_input ,
16+ )
1417from sentry_sdk .utils import safe_serialize
1518
1619from ..consts import SPAN_ORIGIN
@@ -80,9 +83,9 @@ def invoke_agent_span(
8083 client = sentry_sdk .get_client ()
8184 scope = sentry_sdk .get_current_scope ()
8285 messages_data = (
83- normalized_messages
84- if client .options . get ( "stream_gen_ai_spans" , False )
85- else truncate_and_annotate_messages ( normalized_messages , span , scope )
86+ truncate_and_annotate_messages ( normalized_messages , span , scope )
87+ if should_truncate_gen_ai_input ( client .options )
88+ else normalized_messages
8689 )
8790 if messages_data is not None :
8891 set_data_normalized (
You can’t perform that action at this time.
0 commit comments