fix(rag): keep sources when the LLM omits the citation tag - #847
fix(rag): keep sources when the LLM omits the citation tag#847Ahmath-Gadji wants to merge 3 commits into
Conversation
No [Sources: ...] tag means the model didn't report which sources it used, not that it used none. filter_sources_by_citations now keeps all retrieved sources in that case instead of hiding them, since answers were frequently coming back with no cited sources at all.
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthrough
ChangesCitation source handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds extra.retrieved_sources, carrying every source retrieval produced regardless of citation filtering, so clients can see what was searched even when extra.sources ends up narrower than the full retrieval set.
Clearer than retrieved_sources for a field meant for debugging and RAG evaluation.
Why
Sources are not cited in a lot of messages: PR #807 changed the fallback so a missing
[Sources: ...]tag hides all sources instead of keeping them. In practice the model often skips the tag on answers that are genuinely grounded in retrieved documents, so those sources were being dropped from the response.Fix
filter_sources_by_citationsnow keeps all retrieved sources when no tag is found, instead of returning none.extra.retrieved_sources: always the full, unfiltered retrieval set, alongside the (possibly citation-filtered)extra.sources.Summary by CodeRabbit