Repository navigation
Conversation
Contributor
|
@lester076 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
lester076
force-pushed
the
fix/mock-chat-generator-stream-whitespace
branch
from
November 19, 2026 06:12
d7de66a to
582a47b
Compare
MockChatGenerator split the reply with re.findall(r'\S+\s*'), which drops leading whitespace and streams a whitespace-only reply as nothing at all — the streamed chunks no longer joined into the reply that run() returns, so tests asserting on streamed text saw different content than the reply (deepset-ai#13810). Real generators stream the text unchanged. Split with r'\s*\S+\s*|\s+': leading whitespace rides on the first chunk and whitespace-only text becomes a single chunk.
lester076
force-pushed
the
fix/mock-chat-generator-stream-whitespace
branch
from
November 19, 2026 06:34
582a47b to
f0b98d8
Compare
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.
Fixes #13810
Problem
MockChatGeneratorsplits the reply withre.findall(r"\S+\s*", reply.text), which drops leading whitespace and streams a whitespace-only reply as no text at all. The streamed chunks no longer join into the reply thatrun()returns, so tests using the mock to assert streaming behaviour see different text in the callback than in the reply — real generators stream the text unchanged.What changed
The split is now
r"\s*\S+\s*|\s+"(the fix suggested in the issue): leading whitespace rides on the first chunk, and whitespace-only text becomes a single chunk. Chunks still break between words, so per-chunk assertions keep working.Verification
New
test_streamed_chunks_join_back_into_the_replyparametrized over"\n\nhello there"," indented reply\n"and" ": the concatenated chunk contents equal the returned reply text (all three fail on main, pass here).test/components/generators/chat/test_mock.py: 36 passed.ruff check/ruff formatclean.