@@ -731,7 +731,7 @@ def _run(
731731 self .write_to_storage ()
732732
733733 # 7. Parse team response model
734- if self .response_model is not None :
734+ if self .response_model is not None and not isinstance ( run_response . content , self . response_model ) :
735735 if isinstance (run_response .content , str ) and self .parse_response :
736736 try :
737737 parsed_response_content = parse_response_model_str (run_response .content , self .response_model )
@@ -745,8 +745,8 @@ def _run(
745745 except Exception as e :
746746 log_warning (f"Failed to convert response to output model: { e } " )
747747 else :
748- log_warning ("Something went wrong. Run response content is not a string" )
749- elif self ._member_response_model is not None :
748+ log_warning ("Something went wrong. Team run response content is not a string" )
749+ elif self ._member_response_model is not None and not isinstance ( run_response . content , self . _member_response_model ) :
750750 if isinstance (run_response .content , str ):
751751 try :
752752 parsed_response_content = parse_response_model_str (
@@ -761,7 +761,7 @@ def _run(
761761 except Exception as e :
762762 log_warning (f"Failed to convert response to output model: { e } " )
763763 else :
764- log_warning ("Something went wrong. Run response content is not a string" )
764+ log_warning ("Something went wrong. Member run response content is not a string" )
765765
766766 # 8. Log Team Run
767767 self ._log_team_run ()
@@ -1046,7 +1046,7 @@ async def arun(
10461046 if self .response_model is not None and self .parse_response :
10471047 # Disable stream if response_model is set
10481048 stream = False
1049- log_warning ("Disabling stream as response_model is set" )
1049+ log_debug ("Disabling stream as response_model is set" )
10501050
10511051 # Configure the model for runs
10521052 self ._configure_model (show_tool_calls = show_tool_calls )
@@ -1320,7 +1320,7 @@ async def _arun(
13201320 self .write_to_storage ()
13211321
13221322 # 7. Parse team response model
1323- if self .response_model is not None :
1323+ if self .response_model is not None and not isinstance ( run_response . content , self . response_model ) :
13241324 if isinstance (run_response .content , str ) and self .parse_response :
13251325 try :
13261326 parsed_response_content = parse_response_model_str (run_response .content , self .response_model )
@@ -1334,8 +1334,8 @@ async def _arun(
13341334 except Exception as e :
13351335 log_warning (f"Failed to convert response to output model: { e } " )
13361336 else :
1337- log_warning ("Something went wrong. Run response content is not a string" )
1338- elif self ._member_response_model is not None :
1337+ log_warning ("Something went wrong. Team run response content is not a string" )
1338+ elif self ._member_response_model is not None and not isinstance ( run_response . content , self . _member_response_model ) :
13391339 if isinstance (run_response .content , str ):
13401340 try :
13411341 parsed_response_content = parse_response_model_str (
@@ -1350,7 +1350,7 @@ async def _arun(
13501350 except Exception as e :
13511351 log_warning (f"Failed to convert response to output model: { e } " )
13521352 else :
1353- log_warning ("Something went wrong. Run response content is not a string" )
1353+ log_warning ("Something went wrong. Member run response content is not a string" )
13541354
13551355 # 8. Log Team Run
13561356 await self ._alog_team_run ()
0 commit comments