File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -477,3 +477,22 @@ def make_cmpl_request():
477477 assert last_progress ["total" ] > 0
478478 assert last_progress ["processed" ] == last_progress ["total" ]
479479 assert total_batch_count == batch_count
480+
481+
482+ def test_chat_completions_multiple_choices ():
483+ global server
484+ server .start ()
485+ res = server .make_request ("POST" , "/chat/completions" , data = {
486+ "max_tokens" : 8 ,
487+ "n" : 2 ,
488+ "messages" : [
489+ {"role" : "system" , "content" : "Book" },
490+ {"role" : "user" , "content" : "What is the best book" },
491+ ],
492+ })
493+ assert res .status_code == 200
494+ assert len (res .body ["choices" ]) == 2
495+ for choice in res .body ["choices" ]:
496+ assert "assistant" == choice ["message" ]["role" ]
497+ assert match_regex ("Suddenly" , choice ["message" ]["content" ])
498+ assert choice ["finish_reason" ] == "length"
You can’t perform that action at this time.
0 commit comments