Skip to content

feat: support reference ranges in AnswerBuilder (e.g. [1-3])#11214

Open
GauravPatil2515 wants to merge 1 commit intodeepset-ai:mainfrom
GauravPatil2515:feat/answer-builder-reference-ranges
Open

feat: support reference ranges in AnswerBuilder (e.g. [1-3])#11214
GauravPatil2515 wants to merge 1 commit intodeepset-ai:mainfrom
GauravPatil2515:feat/answer-builder-reference-ranges

Conversation

@GauravPatil2515
Copy link
Copy Markdown

Closes #11002

AnswerBuilder now expands range references like [1-3] into individual document references [1], [2], [3] when extracting referenced documents. Invalid ranges like [3-1] are ignored.

Related Issues

  • fixes #issue-number

Proposed Changes:

How did you test it?

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

Closes deepset-ai#11002

AnswerBuilder now expands range references like [1-3] into individual
document references [1], [2], [3] when extracting referenced documents.
Invalid ranges like [3-1] are ignored.
@GauravPatil2515 GauravPatil2515 requested a review from a team as a code owner April 28, 2026 17:26
@GauravPatil2515 GauravPatil2515 requested review from sjrl and removed request for a team April 28, 2026 17:26
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

@GauravPatil2515 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 28, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Apr 28, 2026
@sjrl
Copy link
Copy Markdown
Contributor

sjrl commented Apr 29, 2026

@GauravPatil2515 thanks for the contribution! Could we make this opt in behavior? So add a init param that toggles whether this used or not and turn it off by default so we keep the expected default behavior.


def test_run_with_range_reference_pattern(self):
builder = AnswerBuilder(reference_pattern=r"\[(\d+)\]")
replies = ["Paris [1-2] and Rome [3]."]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add a test with a more complicated reference like [2-5, 7, 10, 14-16] to see if it works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support reference ranges in AnswerBuilder (e.g. [6-10])

3 participants