In RAG, the documents that best match the user's query are searched for in the vector store using a Retriever. Those documents and the original query are then sent to the LLM to generate an answer.
python
# Create a retriever from the vector store
retriever = vectorstore.as_retriever()
# Create a chain that combines the retrieved documents and the question
# and sends it to the LLM.
# (This requires a more complex chain setup)
response = qa_chain.invoke({"query": "What is the main topic of the document?"})You should see
(The LLM will return an answer based on the information in the document you provided)