[Bugfix][Frontend] Avoid generation for empty streaming input (#59015)

Signed-off-by: Benedikt Falk <bfalk@nvidia.com>
This commit is contained in:
Benedikt Falk
2026-10-02 18:48:43 +00:00
committed by GitHub
parent 10f6ab01a9
commit c4973d94fe
3 changed files with 41 additions and 8 deletions
+2 -4
View File
@@ -491,7 +491,7 @@ async def test_streaming_input_per_chunk_sampling_params(engine: AsyncLLM):
async def test_streaming_input_empty_generator(engine: AsyncLLM):
"""Test behavior when the input generator yields nothing.
An empty generator should still produce a finished output.
An empty generator should finish without producing output.
"""
request_id = "test_empty_generator"
sampling_params = get_sampling_params(max_tokens=10)
@@ -505,9 +505,7 @@ async def test_streaming_input_empty_generator(engine: AsyncLLM):
async for output in engine.generate(empty_generator(), sampling_params, request_id):
outputs.append(output)
# Should still get a finished marker
assert len(outputs) >= 1, "Should receive at least one output"
assert outputs[-1].finished, "Should have a finished output"
assert outputs == []
@pytest.mark.asyncio(loop_scope="module")