@@ -711,6 +711,7 @@ def new_invoke(self, *args, **kwargs):
711711 origin = LangchainIntegration .origin ,
712712 ) as span :
713713 span .set_data (SPANDATA .GEN_AI_OPERATION_NAME , "invoke_agent" )
714+
714715 if hasattr (self , "agent" ) and hasattr (self .agent , "llm" ):
715716 model_name = getattr (self .agent .llm , "model_name" , None ) or getattr (
716717 self .agent .llm , "model" , None
@@ -729,7 +730,6 @@ def _wrap_agent_executor_stream(f):
729730 @wraps (f )
730731 def new_stream (self , * args , ** kwargs ):
731732 # type: (Any, Any, Any) -> Any
732-
733733 integration = sentry_sdk .get_client ().get_integration (LangchainIntegration )
734734 if integration is None :
735735 return f (self , * args , ** kwargs )
@@ -741,6 +741,7 @@ def new_stream(self, *args, **kwargs):
741741 origin = LangchainIntegration .origin ,
742742 ) as span :
743743 span .set_data (SPANDATA .GEN_AI_OPERATION_NAME , "invoke_agent" )
744+
744745 if hasattr (self , "agent" ) and hasattr (self .agent , "llm" ):
745746 model_name = getattr (self .agent .llm , "model_name" , None ) or getattr (
746747 self .agent .llm , "model" , None
0 commit comments