Closed
Description
This issue will track the first part of the adoption of the Modular RAG architecture in Spring AI.
Context
The work can be split into two categories.
- The design and implementation of the building blocks for RAG modules that will be done in the
org.springframework.ai.rag
package. Each component is well encapsulated and can be used by itself to compose any kind of RAG flow. For example, you can use such components to build your own RAG flows using Spring State Machine, Spring Cloud Function or Spring Cloud Data Flow. - Using the Advisor API, a
RetrievalAugmentationAdvisor
will be implemented to provide some out-of-the-box RAG flows using the building blocks defined in the previous category.
For background information, please refer to the following sources:
- Modular RAG: Transforming RAG Systems into LEGO-like Reconfigurable Frameworks
- Retrieval-Augmented Generation for Large Language Models: A Survey
- LangChain Retrieval Conceptual Guide
- LlamaIndex Advanced Retrieval Strategies
Design
Modules
In this first part, the focus will be on establishing the following modules and submodules:
- Pre-Retrieval
- Query Transformation Modular RAG - Query Analysis #1703
- Query Expansion Modular RAG - Query Analysis #1703
- Retrieval
- Document Search Modular RAG: Retrieval with Vector Stores #1604
- Document Join Modular RAG: Orchestration and Post-Retrieval #1767
- Post-Retrieval (only interfaces)
- Document Ranking Modular RAG: Orchestration and Post-Retrieval #1767 (a)
- Document Selection Modular RAG: Orchestration and Post-Retrieval #1767 (a)
- Document Compression Modular RAG: Orchestration and Post-Retrieval #1767 (a)
- Augmentation
- Orchestration (experimental)
- Query Routing Modular RAG: Orchestration and Post-Retrieval #1767
This issue will be updated as we progress with the design and implementation work.
Advisor
In this first part, the focus will be on:
- Establishing a
RetrievalAugmentationAdvisor
. - Adopting the available sub-modules to support Naive and Advanced RAG flows.
- Experimental branching and conditional components.