@@ -198,6 +198,7 @@ async def handle_stream(
198
198
is not None , # fixed 0 -> 0 or 1
199
199
type = "response.output_text.delta" ,
200
200
sequence_number = sequence_number .get_and_increment (),
201
+ logprobs = [],
201
202
)
202
203
# Accumulate the text into the response part
203
204
state .text_content_index_and_output [1 ].text += delta .content
@@ -288,10 +289,11 @@ async def handle_stream(
288
289
function_call = state .function_calls [tc_delta .index ]
289
290
290
291
# 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
+ ):
295
297
# Calculate the output index for this function call
296
298
function_call_starting_index = 0
297
299
if state .reasoning_content_index_and_output :
@@ -308,9 +310,9 @@ async def handle_stream(
308
310
309
311
# Mark this function call as streaming and store its output index
310
312
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
+ )
314
316
315
317
# Send initial function call added event
316
318
yield ResponseOutputItemAddedEvent (
@@ -327,10 +329,11 @@ async def handle_stream(
327
329
)
328
330
329
331
# 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
+ ):
334
337
output_index = state .function_call_output_idx [tc_delta .index ]
335
338
yield ResponseFunctionCallArgumentsDeltaEvent (
336
339
delta = tc_function .arguments ,
0 commit comments