File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 truncate_and_annotate_messages ,
1111 transform_openai_content_part ,
1212)
13+ from sentry_sdk .ai ._openai_completions_api import _get_system_instructions
1314from sentry_sdk .consts import SPANDATA
1415from sentry_sdk .integrations import DidNotEnable , Integration
1516from sentry_sdk .scope import should_send_default_pii
@@ -129,6 +130,15 @@ def _input_callback(kwargs: "Dict[str, Any]") -> None:
129130 else :
130131 # For chat, look for the 'messages' parameter
131132 messages = kwargs .get ("messages" , [])
133+
134+ system_instructions = _get_system_instructions (messages )
135+ set_data_normalized (
136+ span ,
137+ SPANDATA .GEN_AI_SYSTEM_INSTRUCTIONS ,
138+ system_instructions ,
139+ unpack = False ,
140+ )
141+
132142 if messages :
133143 scope = sentry_sdk .get_current_scope ()
134144 messages = _convert_message_parts (messages )
You can’t perform that action at this time.
0 commit comments