Retrieval logic finds the few most relevant knowledge chunks in a vector database when a user asks a question, giving an LLM extra context for its answer. section 4.1
Treat retrieval as the runtime phase of a three-step RAG flow:
- Ingest documents into a knowledge database during setup, repeating the process when the document base changes. section 4.1
- Search the vector database for the few best chunks relevant to the user’s question. section 4.1
- Pass the retrieved knowledge to answer generation, which runs alongside retrieval whenever a user asks a question. section 4.1
A question-driven search
A user asks about information contained in an uploaded document. Retrieval searches the vector database, selects the closest matching chunks, and supplies them as context for the generated response. section 4.1
Figure 4.1 A RAG-based flow includes three essential steps: document ingestion, document retrieval, and answer generation.
Trace retrieval as the middle stage connecting document ingestion with answer generation. section 4.1










