Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: self-correcting loop for RAG #6420

Merged
merged 25 commits into from
Dec 20, 2023
Merged

example: self-correcting loop for RAG #6420

merged 25 commits into from
Dec 20, 2023

Conversation

ZanSara
Copy link
Contributor

@ZanSara ZanSara commented Nov 27, 2023

Related Issues

Proposed Changes:

Adds an example script with the following Pipeline:

test_bm25_rag_pipeline

The example has 3 custom component:

  • a "switch" component to manage the query over the loops
  • a pagination wrapper for a Retriever
  • a component that checks for a missing answer

How did you test it?

Notes for the reviewer

Checklist

@ZanSara ZanSara marked this pull request as ready for review November 27, 2023 13:42
@ZanSara ZanSara requested review from a team as code owners November 27, 2023 13:42
@ZanSara ZanSara requested review from dfokina, anakin87 and bilgeyucel and removed request for a team November 27, 2023 13:42
Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

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

In general, it looks good...

However, IDK if introducing a custom switch component is appropriate from the user's perspective...
It is a new concept that makes the example a bit harder to understand and replicate. WDYT?

@anakin87
Copy link
Member

@masci can you take a look at this PR?

We need another opinion on the Switch component...

@masci
Copy link
Member

masci commented Dec 13, 2023

@anakin87 the one in this PR is a bit different use case, but I was thinking that having a similar component in front of a pipeline is the way to go to simplify the run invocation, so overall I support this design. I wouldn't call it Switch tho, maybe something like Multiplexer would convey the concept that the component receives one or more inputs and sends them out into a single output of the same type.

@ZanSara ZanSara mentioned this pull request Dec 19, 2023
@github-actions github-actions bot added the 2.x Related to Haystack v2.0 label Dec 20, 2023
@ZanSara
Copy link
Contributor Author

ZanSara commented Dec 20, 2023

For completeness, here is the updated pipeline graph:

self_correcting_pipeline

Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

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

Very nice!

(just one final comment, but it's good to go)

@ZanSara ZanSara merged commit ae5297b into main Dec 20, 2023
9 checks passed
@ZanSara ZanSara deleted the self-correcting-rag branch December 20, 2023 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Self correction loop for RAG when "answer is not possible given context"
3 participants