-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Modular RAG: Retrieval with Vector Stores #1604
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
Modular RAG: Retrieval with Vector Stores #1604
Conversation
* Establish new package for Modular RAG components. * Add new Query API, representing a query in the context of a RAG flow. * Define Retrieval package for the RAG building blocks handling the data retrieval operations. * Relocate DocumentRetriever to Retrieval package and implement VectorStoreDocumentRetriever. * Introduce RetrievalAugmentationAdvisor as the successor of QuestionAnswerAdvisor. It uses the Retrieval building blocks described in the previous point. * Make Advisor APIs null-safe and update tests accordingly. Relates to gh-spring-projects#1603 Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
f5a5f07
to
31c044a
Compare
public record AdvisedRequest( | ||
// @formatter:off | ||
ChatModel chatModel, | ||
String userText, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be an odd case, but maybe should allow userText to be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought a lot about a possible use case where I would want that and didn't really come up with anything. For example, OpenAI requires a message to be included in each request to a chat model. It fails if the user message is null. Before this change, we supported the user message to be null, and in that case set the "userText" to be an empty string as a workaround. That could be dangerous because as a developer I wouldn't catch scenarios where I'm not passing a user message by mistake, but the model would still be called and the outcome would be unpredictable.
// 4. Augment user prompt with the context data. | ||
UserMessage augmentedUserMessage = (UserMessage) this.promptTemplate.createMessage(promptParameters); | ||
|
||
return AdvisedRequest.from(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an issue, #1592 related to how we want to consistently implement builders. Does from
go in the 'product' class or in the 'builder' class?
merged in 5d8c032 |
Relates to gh-#1603
It might also address the requests from #1290