@@ -35,7 +35,7 @@ async def main():
3535
3636 result = Runner .run_streamed (
3737 agent ,
38- input = "Create a Python web project called 'my-app' with FastAPI. Version 1.0.0, dependencies: fastapi, uvicorn"
38+ input = "Create a Python web project called 'my-app' with FastAPI. Version 1.0.0, dependencies: fastapi, uvicorn" ,
3939 )
4040
4141 # Track function calls for detailed output
@@ -50,23 +50,20 @@ async def main():
5050 function_name = getattr (event .data .item , "name" , "unknown" )
5151 call_id = getattr (event .data .item , "call_id" , "unknown" )
5252
53- function_calls [call_id ] = {
54- 'name' : function_name ,
55- 'arguments' : ""
56- }
53+ function_calls [call_id ] = {"name" : function_name , "arguments" : "" }
5754 current_active_call_id = call_id
5855 print (f"\n 📞 Function call streaming started: { function_name } ()" )
5956 print ("📝 Arguments building..." )
6057
6158 # Real-time argument streaming
6259 elif isinstance (event .data , ResponseFunctionCallArgumentsDeltaEvent ):
6360 if current_active_call_id and current_active_call_id in function_calls :
64- function_calls [current_active_call_id ][' arguments' ] += event .data .delta
61+ function_calls [current_active_call_id ][" arguments" ] += event .data .delta
6562 print (event .data .delta , end = "" , flush = True )
6663
6764 # Function call completed
6865 elif event .data .type == "response.output_item.done" :
69- if hasattr (event .data .item , ' call_id' ):
66+ if hasattr (event .data .item , " call_id" ):
7067 call_id = getattr (event .data .item , "call_id" , "unknown" )
7168 if call_id in function_calls :
7269 function_info = function_calls [call_id ]
0 commit comments