@@ -198,6 +198,7 @@ async def handle_stream(
198198 is not None , # fixed 0 -> 0 or 1
199199 type = "response.output_text.delta" ,
200200 sequence_number = sequence_number .get_and_increment (),
201+ logprobs = [],
201202 )
202203 # Accumulate the text into the response part
203204 state .text_content_index_and_output [1 ].text += delta .content
@@ -288,10 +289,11 @@ async def handle_stream(
288289 function_call = state .function_calls [tc_delta .index ]
289290
290291 # Start streaming as soon as we have function name and call_id
291- if (not state .function_call_streaming [tc_delta .index ] and
292- function_call .name and
293- function_call .call_id ):
294-
292+ if (
293+ not state .function_call_streaming [tc_delta .index ]
294+ and function_call .name
295+ and function_call .call_id
296+ ):
295297 # Calculate the output index for this function call
296298 function_call_starting_index = 0
297299 if state .reasoning_content_index_and_output :
@@ -308,9 +310,9 @@ async def handle_stream(
308310
309311 # Mark this function call as streaming and store its output index
310312 state .function_call_streaming [tc_delta .index ] = True
311- state .function_call_output_idx [
312- tc_delta . index
313- ] = function_call_starting_index
313+ state .function_call_output_idx [tc_delta . index ] = (
314+ function_call_starting_index
315+ )
314316
315317 # Send initial function call added event
316318 yield ResponseOutputItemAddedEvent (
@@ -327,10 +329,11 @@ async def handle_stream(
327329 )
328330
329331 # Stream arguments if we've started streaming this function call
330- if (state .function_call_streaming .get (tc_delta .index , False ) and
331- tc_function and
332- tc_function .arguments ):
333-
332+ if (
333+ state .function_call_streaming .get (tc_delta .index , False )
334+ and tc_function
335+ and tc_function .arguments
336+ ):
334337 output_index = state .function_call_output_idx [tc_delta .index ]
335338 yield ResponseFunctionCallArgumentsDeltaEvent (
336339 delta = tc_function .arguments ,
0 commit comments