Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@greptile review this PR |
[Medium impact] The PR appears safe to merge, with the previously reported low-impact quote-loss issue still outstanding. Findings
Fix with agent prompt### Issue 1
nemoguardrails/streaming.py:420-424
Streaming removes a final curly quote even when the reply opened with a straight quote. If the provider ends with ` "She said “hello”` before closing the outer quote, `_strip_current_suffix` removes the inner `”`. Non-streaming `strip_quotes` preserves it, so callers receive different text.
Choose the closing quote from the matched opening quote rather than stripping either alternative.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR adds curly-quote support and fixes how buffered replies reach streaming callers.
|
| suffixes = (self.suffix,) if isinstance(self.suffix, str) else self.suffix | ||
| for candidate in (self.current_chunk, self.current_chunk.rstrip()): | ||
| for suffix in suffixes: | ||
| if suffix and candidate.endswith(suffix): | ||
| self.current_chunk = candidate[: -len(suffix)] |
There was a problem hiding this comment.
Streaming removes a final curly quote even when the reply opened with a straight quote. If the provider ends with "She said “hello” before closing the outer quote, _strip_current_suffix removes the inner ”. Non-streaming strip_quotes preserves it, so callers receive different text.
Choose the closing quote from the matched opening quote rather than stripping either alternative.
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemoguardrails/streaming.py
Line: 420-424
Comment:
**Final inner quote disappears**
Streaming removes a final curly quote even when the reply opened with a straight quote. If the provider ends with ` "She said “hello”` before closing the outer quote, `_strip_current_suffix` removes the inner `”`. Non-streaming `strip_quotes` preserves it, so callers receive different text.
Choose the closing quote from the matched opening quote rather than stripping either alternative.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.…lies Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
f5b9d62 to
4145638
Compare
Deferred to a future release under NGR-1070; resolves NGR-1047 as part of the later reasoning-model migration. PR #2550 supplies the independent v0.25.0 fix for NGR-1045. Retained as a draft, with #2516 stacked on this branch.
Description
Handle matching curly quote delimiters in generated bot messages, strip closing delimiters before trailing whitespace, and flush buffered replies at end-of-stream. Preserve straight-quoted multiline replies containing inner curly quotes.
Smaller replacement for #2515; no quote-depth tracking or new dialogue-boundary inference. Arbitrary nested curly quotations and extra-dialogue recovery remain outside scope.
Related Issue(s)
Resolves NGR-1047. Supersedes #2515.
Verification
366 related tests passed, including streaming, generation, and IORails coverage. Pre-commit passed. Full suite and live-provider tests not run.
AI Assistance
Codex assisted with implementation, tests, and review.
Checklist
Summary by CodeRabbit