RetrievalAugmentationAdvisor is a modular Spring AI RAG advisor that retrieves document context and assembles it into a language-model interaction. Unlike a vector-store-specific advisor, it accepts a configurable DocumentRetriever, allowing retrieval from a vector store or another knowledge-base service. section 4.6
Configure the advisor by composing retrieval and query-processing components:
- Add the Spring AI RAG dependency, then create the advisor with its builder. section 4.6
- Provide a DocumentRetriever; VectorStoreDocumentRetriever supplies the vector-store implementation. section 4.6
- Attach query transformers such as TranslationQueryTransformer and RewriteQueryTransformer to translate and focus searches. section 4.6.2
- Attach MultiQueryExpander to generate alternative searches, controlling query count and whether the original query remains. section 4.6.3
- Register the advisor as a ChatClient default advisor or apply it while building an individual prompt. section 4.6
Multilingual, expanded retrieval
A vector store containing English board-game rules can receive an English translation of a German question, followed by a focused rewrite. MultiQueryExpander can additionally produce differently worded searches so similarity retrieval may find documents missed by the original wording. section 4.6.2 section 4.6.3
