@@ -325,7 +325,6 @@ async def transcription_stream_generator(
325
325
created_time = int (time .time ())
326
326
model_name = request .model
327
327
chunk_object_type : Final = "transcription.chunk"
328
- first_iteration = True
329
328
330
329
completion_tokens = 0
331
330
num_prompt_tokens = 0
@@ -352,30 +351,9 @@ async def transcription_stream_generator(
352
351
# We need to do it here, because if there are exceptions in
353
352
# the result_generator, it needs to be sent as the FIRST
354
353
# response (by the try...catch).
355
- if first_iteration :
356
- # Fist delta message.
357
- choice_data = TranscriptionResponseStreamChoice (
358
- delta = DeltaMessage (content = "" , ), finish_reason = None )
359
- chunk = TranscriptionStreamResponse (
360
- id = request_id ,
361
- object = chunk_object_type ,
362
- created = created_time ,
363
- choices = [choice_data ],
364
- model = model_name )
365
-
366
- # if continuous usage stats are requested, add it
367
- if include_continuous_usage :
368
- chunk .usage = UsageInfo (
369
- prompt_tokens = num_prompt_tokens ,
370
- completion_tokens = 0 ,
371
- total_tokens = num_prompt_tokens )
372
-
373
- data = chunk .model_dump_json (exclude_unset = True )
374
- yield f"data: { data } \n \n "
375
-
376
- first_iteration = False
377
354
378
355
# Just one output (n=1) supported.
356
+ assert len (res .outputs ) == 1
379
357
output = res .outputs [0 ]
380
358
381
359
delta_message = DeltaMessage (content = output .text )
0 commit comments