File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
examples/server/tests/unit Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,11 @@ def test_chat_completion_with_timings_per_token():
242242 "stream" : True ,
243243 "timings_per_token" : True ,
244244 })
245- for data in res :
245+
246+ for i , data in enumerate (res ):
247+ if i == 0 :
248+ assert "timings" not in data , f'First event should not have timings: { data } '
249+ continue
246250 assert "prompt_per_second" in data ["timings" ]
247251 assert "predicted_per_second" in data ["timings" ]
248252 assert "predicted_n" in data ["timings" ]
@@ -294,8 +298,15 @@ def test_logprobs_stream():
294298 )
295299 output_text = ''
296300 aggregated_text = ''
297- for data in res :
301+
302+ for i , data in enumerate (res ):
303+ assert len (data .choices ) == 1
298304 choice = data .choices [0 ]
305+
306+ if i == 0 :
307+ assert choice .delta .content is None
308+ continue
309+
299310 if choice .finish_reason is None :
300311 if choice .delta .content :
301312 output_text += choice .delta .content
You can’t perform that action at this time.
0 commit comments