File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
vllm/entrypoints/anthropic Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,13 @@ async def message_stream_converter(
295
295
296
296
# last chunk including usage info
297
297
if len (origin_chunk .choices ) == 0 :
298
+ if content_block_started :
299
+ stop_chunk = AnthropicStreamEvent (
300
+ index = content_block_index ,
301
+ type = "content_block_stop" ,
302
+ )
303
+ data = stop_chunk .model_dump_json (exclude_unset = True )
304
+ yield f"data: { data } \n \n "
298
305
chunk = AnthropicStreamEvent (
299
306
type = "message_delta" ,
300
307
delta = AnthropicDelta (
@@ -381,15 +388,6 @@ async def message_stream_converter(
381
388
382
389
if origin_chunk .choices [0 ].finish_reason is not None :
383
390
finish_reason = origin_chunk .choices [0 ].finish_reason
384
-
385
- if content_block_started :
386
- stop_chunk = AnthropicStreamEvent (
387
- index = content_block_index ,
388
- type = "content_block_stop" ,
389
- )
390
- data = stop_chunk .model_dump_json (exclude_unset = True )
391
- yield f"data: { data } \n \n "
392
- content_block_started = False
393
391
continue
394
392
395
393
else :
You can’t perform that action at this time.
0 commit comments