@@ -422,14 +422,12 @@ def on_llm_start(
422422 }
423423 for prompt in prompts
424424 ]
425-
426- if normalized_messages is not None :
427- set_data_normalized (
428- span ,
429- SPANDATA .GEN_AI_REQUEST_MESSAGES ,
430- normalized_messages ,
431- unpack = False ,
432- )
425+ set_data_normalized (
426+ span ,
427+ SPANDATA .GEN_AI_REQUEST_MESSAGES ,
428+ normalized_messages ,
429+ unpack = False ,
430+ )
433431
434432 def on_chat_model_start (
435433 self : "SentryLangchainCallback" ,
@@ -528,14 +526,12 @@ def on_chat_model_start(
528526 self ._normalize_langchain_message (message )
529527 )
530528 normalized_messages = normalize_message_roles (normalized_messages )
531-
532- if normalized_messages is not None :
533- set_data_normalized (
534- span ,
535- SPANDATA .GEN_AI_REQUEST_MESSAGES ,
536- normalized_messages ,
537- unpack = False ,
538- )
529+ set_data_normalized (
530+ span ,
531+ SPANDATA .GEN_AI_REQUEST_MESSAGES ,
532+ normalized_messages ,
533+ unpack = False ,
534+ )
539535
540536 def on_chat_model_end (
541537 self : "SentryLangchainCallback" ,
@@ -1143,14 +1139,12 @@ def new_invoke(self: "Any", *args: "Any", **kwargs: "Any") -> "Any":
11431139 input = result .get ("input" )
11441140 if input is not None and record_inputs :
11451141 normalized_messages = normalize_message_roles ([input ])
1146-
1147- if normalized_messages is not None :
1148- set_data_normalized (
1149- span ,
1150- SPANDATA .GEN_AI_REQUEST_MESSAGES ,
1151- normalized_messages ,
1152- unpack = False ,
1153- )
1142+ set_data_normalized (
1143+ span ,
1144+ SPANDATA .GEN_AI_REQUEST_MESSAGES ,
1145+ normalized_messages ,
1146+ unpack = False ,
1147+ )
11541148
11551149 output = result .get ("output" )
11561150 if output is not None and record_outputs :
@@ -1199,14 +1193,12 @@ def new_stream(self: "Any", *args: "Any", **kwargs: "Any") -> "Any":
11991193 input = args [0 ].get ("input" ) if len (args ) >= 1 else None
12001194 if input is not None and record_inputs :
12011195 normalized_messages = normalize_message_roles ([input ])
1202-
1203- if normalized_messages is not None :
1204- set_data_normalized (
1205- span ,
1206- SPANDATA .GEN_AI_REQUEST_MESSAGES ,
1207- normalized_messages ,
1208- unpack = False ,
1209- )
1196+ set_data_normalized (
1197+ span ,
1198+ SPANDATA .GEN_AI_REQUEST_MESSAGES ,
1199+ normalized_messages ,
1200+ unpack = False ,
1201+ )
12101202
12111203 # Run the agent
12121204 result = f (self , * args , ** kwargs )
0 commit comments