Skip to content

Commit 21de6d4

Browse files
[CI][Bugfix] Fix token counting in chunked prefill streaming test (vllm-project#31565)
Signed-off-by: Andreas Karatzas <[email protected]>
1 parent 6c2cfb6 commit 21de6d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/entrypoints/openai/test_chunked_prompt.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ async def test_chat_completion_stream_options_and_logprobs_with_long_prompts(
116116
assert chunk.choices[0].logprobs is None
117117
empty_chunks_received += 1
118118
else:
119-
tokens_received += 1
119+
# Count actual tokens from logprobs since multiple tokens
120+
# can be batched into a single chunk
121+
assert chunk.choices[0].logprobs and chunk.choices[0].logprobs.content
122+
tokens_received += len(chunk.choices[0].logprobs.content)
120123

121124
if chunk.choices[0].finish_reason is not None:
122125
finished = True

0 commit comments

Comments
 (0)