A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 6, 19:15 UTC
[Frontend] Fix usage incorrectly returned with empty stream_options` (#36379)
Signed-off-by: Csrayz <33659823+Csrayz@users.noreply.github.com>
Csrayz committed
Mar 13, 2026 at 11:33 UTC
bc2c0c86efb28e77677a3cfb8687e976914a313a
2 files changed
+13
-1
tests/v1/entrypoints/openai/test_completion.py
+12
@@ -457,6 +457,18 @@ async def test_completion_stream_options(client: openai.AsyncOpenAI, model_name:
457
)
458
assert final_chunk.choices == []
459
460
+ # Test stream=True, stream_options={}
461
+ stream = await client.completions.create(
462
+ model=model_name,
463
+ prompt=prompt,
464
+ max_tokens=5,
465
+ temperature=0.0,
466
+ stream=True,
467
+ stream_options={},
468
+ )
469
+ async for chunk in stream:
470
+ assert chunk.usage is None
471
+
472
# Test stream=False, stream_options=
473
# {"include_usage": None}
474
with pytest.raises(BadRequestError):
vllm/entrypoints/openai/engine/protocol.py
+1
-1
@@ -159,7 +159,7 @@ AnyResponseFormat: TypeAlias = (
159
160
161
class StreamOptions(OpenAIBaseModel):
162
- include_usage: bool | None = True
162
+ include_usage: bool | None = False
163
continuous_usage_stats: bool | None = False
164
165