Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
Thanks for this. #45423 has the same one-line fix and is out of draft, so we're landing that one and will close this after |
4 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a developer receives an empty assistant turn when the backend streams refusal text
delta.refusalAfter: the same request preserves the refusal explanation
delta.refusalRelevant issues
Addresses #45235
Automated verification
uv run --no-sync python -m pytest tests/unit/litellm_core_utils/test_streaming_handler.py -q --tb=short --timeout=60 --disable-warnings: 173 passed, 30 warningsThe eight new cases cover
openaiandhosted_vllm, synchronous and asynchronous iteration, and refusal fragments arriving separately from or with the terminal event. They feed scripted SSE through the real parser and wrapper without patching LiteLLM's own methods. Before adding the refusal check, all eight failed because no refusal fragments reached the caller. After the change, all eight passedmake lint: passed, including Ruff, test-tree lint, strict-rule, type-discipline, test-quality and basedpyright gates, circular imports, import safety and MCP boundary checks. Type gates compare against existing repository diagnostics; this does not claim zero type errors across the repositoryScoped Ruff formatting and
git diff --check: passedPre-Submission checklist
Type
Bug Fix
Caveats
Medium
Low
Manual verification
Run the issue's refusal-producing request against the same real backend at the base and PR tip. Confirm the fixed SDK preserves every refusal fragment and finishes once. Capture sanitized stream output and commit hashes before requesting maintainer review. Scripted SSE tests above are automated regression evidence, not real-provider proof
Final Attestation