[fix][lmi] fix issue where streaming response that finishes with empt… #2726
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There was a bug in the RollingBatch.java implementation that was recently triggered by one of the integration tests. The issue was regarding how we decide to send a new chunk of data back to the client. For non-streaming cases, the engine will report back with empty tokens until the request is finished. It also reports the HTTP code on this final chunk, which allows us to provide the correct UX to end-users.
But with streaming, it's possible that the final token provided by the engine is actually empty/null. If that's the case, then the request hangs within the model server until it times out.
This PR updates the logic for determining when to send a new chunk of information back to the client.
I ran the failing test tests.py::TestVllm1::test_llama3_1_8b_instruct_tool locally and this fixes the issue. I also validated a couple of other test cases locally to ensure no regression.
Type of change
Please delete options that are not relevant.
Checklist:
pytest tests.py -k "TestCorrectnessLmiDist" -m "lmi_dist"
Feature/Issue validation/testing
Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.
Test A
Logs for Test A
Test B
Logs for Test B