From 4f9ce35afe45a3222cbcb80dad39c6d9c3a61c6d Mon Sep 17 00:00:00 2001 From: Andreas Karatzas Date: Sat, 3 Jan 2026 00:28:49 -0600 Subject: [PATCH] [CI][Bugfix] Fix token counting in chunked prefill compl test (#31630) Signed-off-by: Andreas Karatzas --- tests/entrypoints/openai/test_chunked_prompt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/entrypoints/openai/test_chunked_prompt.py b/tests/entrypoints/openai/test_chunked_prompt.py index cbd351beb4..f9037ac3f8 100644 --- a/tests/entrypoints/openai/test_chunked_prompt.py +++ b/tests/entrypoints/openai/test_chunked_prompt.py @@ -66,8 +66,11 @@ async def test_completion_stream_options_and_logprobs_with_long_prompts( chunk.usage.prompt_tokens + chunk.usage.completion_tokens ) if not finished: - tokens_received += 1 assert chunk.choices[0].text + # Count actual tokens from logprobs since multiple tokens + # can be batched into a single chunk + assert chunk.choices[0].logprobs and chunk.choices[0].logprobs.tokens + tokens_received += len(chunk.choices[0].logprobs.tokens) if chunk.choices[0].finish_reason is not None: finished = True