How can I retrieve the context documents from RetrievalAugmentationAdvisor in a RAG pipeline? #4297
Replies: 1 comment
-
done: return chatClient.prompt()
.advisors(retrievalAugmentationAdvisor)
.user(question)
.stream()
.chatResponse()
.flatMap { chatResponse ->
...
val sources = chatResponse.metadata.get<List<Document>>("rag_document_context")
...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Spring AI with Qdrant to implement a RAG (Retrieval-Augmented Generation) pipeline, and I've integrated
RetrievalAugmentationAdvisor
(orQuestionAnswerAdvisor
) to automate the retrieval and generation flow.While the advisor successfully generates accurate answers, I need to return the retrieved context documents (e.g., code snippets, text chunks) alongside the answer to show evidence or source references in the UI.
However, it appears that
RetrievalAugmentationAdvisor
only returns the final answer string and does not expose the list of retrievedDocument
objects used in the context.My Questions:
RetrievalAugmentationAdvisor
after retrieval?VectorStore.similaritySearch
) + generation (ChatClient
) for more control?Environment:
1.0.1
QdrantVectorStore
)Any guidance or examples (e.g., custom advisor, decorated vector store, etc.) would be greatly appreciated!
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions