Skip to content

Commit 4f9ce35

Browse files
[CI][Bugfix] Fix token counting in chunked prefill compl test (vllm-project#31630)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
1 parent 97a0130 commit 4f9ce35

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
@@ -66,8 +66,11 @@ async def test_completion_stream_options_and_logprobs_with_long_prompts(
6666
chunk.usage.prompt_tokens + chunk.usage.completion_tokens
6767
)
6868
if not finished:
69-
tokens_received += 1
7069
assert chunk.choices[0].text
70+
# Count actual tokens from logprobs since multiple tokens
71+
# can be batched into a single chunk
72+
assert chunk.choices[0].logprobs and chunk.choices[0].logprobs.tokens
73+
tokens_received += len(chunk.choices[0].logprobs.tokens)
7174

7275
if chunk.choices[0].finish_reason is not None:
7376
finished = True

0 commit comments

Comments
 (0)