@@ -1359,34 +1359,34 @@ async def get_response_async(
13591359 # Capture tool calls from streaming chunks if provider supports it
13601360 if formatted_tools and self ._supports_streaming_tools ():
13611361 tool_calls = self ._process_tool_calls_from_stream (delta , tool_calls )
1362-
1363- response_text = response_text .strip ()
1364-
1365- # We already have tool_calls from streaming if supported
1366- # No need for a second API call!
1367- else :
1368- # Non-streaming approach (when tools require it or streaming is disabled)
1369- tool_response = await litellm .acompletion (
1370- ** self ._build_completion_params (
1371- messages = messages ,
1372- temperature = temperature ,
1373- stream = False ,
1374- tools = formatted_tools ,
1375- ** {k :v for k ,v in kwargs .items () if k != 'reasoning_steps' }
1376- )
1377- )
1378- response_text = tool_response .choices [0 ].message .get ("content" , "" )
1379- tool_calls = tool_response .choices [0 ].message .get ("tool_calls" , [])
1380-
1381- if verbose :
1382- # Display the complete response at once
1383- display_interaction (
1384- original_prompt ,
1385- response_text ,
1386- markdown = markdown ,
1387- generation_time = time .time () - start_time ,
1388- console = console
1362+
1363+ response_text = response_text .strip ()
1364+
1365+ # We already have tool_calls from streaming if supported
1366+ # No need for a second API call!
1367+ else :
1368+ # Non-streaming approach (when tools require it or streaming is disabled)
1369+ tool_response = await litellm .acompletion (
1370+ ** self ._build_completion_params (
1371+ messages = messages ,
1372+ temperature = temperature ,
1373+ stream = False ,
1374+ tools = formatted_tools ,
1375+ ** {k :v for k ,v in kwargs .items () if k != 'reasoning_steps' }
1376+ )
13891377 )
1378+ response_text = tool_response .choices [0 ].message .get ("content" , "" )
1379+ tool_calls = tool_response .choices [0 ].message .get ("tool_calls" , [])
1380+
1381+ if verbose :
1382+ # Display the complete response at once
1383+ display_interaction (
1384+ original_prompt ,
1385+ response_text ,
1386+ markdown = markdown ,
1387+ generation_time = time .time () - start_time ,
1388+ console = console
1389+ )
13901390
13911391 # Now handle tools if we have them (either from streaming or non-streaming)
13921392 if tools and execute_tool_fn and tool_calls :
0 commit comments