11import sys
2+ import json
23import time
34from functools import wraps
45from collections .abc import Iterable
@@ -273,16 +274,16 @@ def _set_responses_api_input_data(
273274 and explicit_instructions is not None
274275 and _is_given (explicit_instructions )
275276 ):
276- set_data_normalized (
277- span ,
277+ span .set_data (
278278 SPANDATA .GEN_AI_SYSTEM_INSTRUCTIONS ,
279- [
280- {
281- "type" : "text" ,
282- "content" : explicit_instructions ,
283- }
284- ],
285- unpack = False ,
279+ json .dumps (
280+ [
281+ {
282+ "type" : "text" ,
283+ "content" : explicit_instructions ,
284+ }
285+ ]
286+ ),
286287 )
287288
288289 set_data_normalized (span , SPANDATA .GEN_AI_OPERATION_NAME , "responses" )
@@ -309,11 +310,9 @@ def _set_responses_api_input_data(
309310 instructions_text_parts += _transform_system_instructions (system_instructions )
310311
311312 if len (instructions_text_parts ) > 0 :
312- set_data_normalized (
313- span ,
313+ span .set_data (
314314 SPANDATA .GEN_AI_SYSTEM_INSTRUCTIONS ,
315- instructions_text_parts ,
316- unpack = False ,
315+ json .dumps (instructions_text_parts ),
317316 )
318317
319318 if isinstance (messages , str ):
@@ -365,11 +364,9 @@ def _set_completions_api_input_data(
365364
366365 system_instructions = _get_system_instructions_completions (messages )
367366 if len (system_instructions ) > 0 :
368- set_data_normalized (
369- span ,
367+ span .set_data (
370368 SPANDATA .GEN_AI_SYSTEM_INSTRUCTIONS ,
371- _transform_system_instructions (system_instructions ),
372- unpack = False ,
369+ json .dumps (_transform_system_instructions (system_instructions )),
373370 )
374371
375372 if isinstance (messages , str ):
0 commit comments