A chatbot may recognize that a question concerns side effects yet miss what the person actually needs to know. Adding another fixed answer for every unusual variation is difficult to maintain. Information retrieval offers another route: find relevant passages in a document repository when a predefined intent is not enough. section 6.1 section 6.0
In retrieval-augmented generation (RAG), retrieval is the first phase. It searches for snippets relevant to the user’s question; generation then uses the retrieved material to produce an answer. Traditional search can use the same basic finding step but presents links or passages for the user to read instead. section 6.3 section 6.1 section 6.4
A question that needs more than a side-effects answer
Suppose someone asks whether they can take ibuprofen with blood-pressure medication because their arms are sore after vaccination. A fixed side-effects response may be too generic. Search can surface passages about the vaccine, pain, ibuprofen, and blood pressure, but a list of snippets still leaves the person to combine the information. RAG uses relevant passages to form a more targeted response. section 6.1.1 section 6.1
Retrieval depends on both the question and the information made searchable:
- Prepare documents by converting content such as PDFs into processable text, adding useful metadata where appropriate, and dividing text into coherent chunks. Chunk boundaries affect the results. section 6.3.2
- An embedding model can turn chunks into numerical representations stored in a vector database. Similarity search then helps find relevant passages by meaning rather than relying only on matching keywords. section 6.3.2 section 6.1.3
- In a chatbot that also uses intents, a confident intent match can receive its prepared answer; otherwise, the question can go to search. section 6.1.2
Figure 6.9 RAG uses a vector database during build time and run time.
The build-time and run-time view helps distinguish preparing a searchable vector database from using it to retrieve information for a question. section 6.3.2
Choose the result format with the user’s effort in mind. Links and snippets let users inspect sources, but reading several results can interrupt a chat, especially in a voice interface. A generated answer is more convenient, yet it still needs safeguards: assess retrieval separately from indexing and generation, and provide a fallback or human handover when needed. section 6.1.3 section 6.6










