File tree Expand file tree Collapse file tree
sentry_sdk/integrations/openai_agents Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 get_start_span_function ,
44 set_data_normalized ,
55 normalize_message_roles ,
6- truncate_and_annotate_messages ,
76)
87from sentry_sdk .consts import OP , SPANDATA
98from sentry_sdk .scope import should_send_default_pii
@@ -63,17 +62,12 @@ def invoke_agent_span(
6362
6463 if len (messages ) > 0 :
6564 normalized_messages = normalize_message_roles (messages )
66- scope = sentry_sdk .get_current_scope ()
67- messages_data = truncate_and_annotate_messages (
68- normalized_messages , span , scope
65+ set_data_normalized (
66+ span ,
67+ SPANDATA .GEN_AI_REQUEST_MESSAGES ,
68+ normalized_messages ,
69+ unpack = False ,
6970 )
70- if messages_data is not None :
71- set_data_normalized (
72- span ,
73- SPANDATA .GEN_AI_REQUEST_MESSAGES ,
74- messages_data ,
75- unpack = False ,
76- )
7771
7872 _set_agent_data (span , agent )
7973
Original file line number Diff line number Diff line change 66 normalize_message_roles ,
77 set_data_normalized ,
88 normalize_message_role ,
9- truncate_and_annotate_messages ,
109)
1110from sentry_sdk .consts import SPANDATA , SPANSTATUS , OP
1211from sentry_sdk .integrations import DidNotEnable
@@ -172,16 +171,12 @@ def _set_input_data(
172171 }
173172 )
174173
175- normalized_messages = normalize_message_roles (request_messages )
176- scope = sentry_sdk .get_current_scope ()
177- messages_data = truncate_and_annotate_messages (normalized_messages , span , scope )
178- if messages_data is not None :
179- set_data_normalized (
180- span ,
181- SPANDATA .GEN_AI_REQUEST_MESSAGES ,
182- messages_data ,
183- unpack = False ,
184- )
174+ set_data_normalized (
175+ span ,
176+ SPANDATA .GEN_AI_REQUEST_MESSAGES ,
177+ normalize_message_roles (request_messages ),
178+ unpack = False ,
179+ )
185180
186181
187182def _set_output_data (span : "sentry_sdk.tracing.Span" , result : "Any" ) -> None :
You can’t perform that action at this time.
0 commit comments