A vector database stores high-dimensional vector representations of text and searches them by semantic similarity. In retrieval-augmented generation (RAG), documents become embeddings, and a new query is converted into a vector so the system can retrieve related documents for a language model. section 8.13 section 10.20
A vector database supports grounded responses by:
- Finding semantically similar documents or past examples rather than relying only on static model training data. section 8.13 section 10.20
- Supplying retrieved text to the model context, which can improve factual accuracy and provide sources that users can inspect. section 8.13 section 10.20
- Working alongside web search, memory, and planning as part of a broader system for selecting relevant information. section 10.20
Travel-policy question
An employee asks whether a five-hour sales-trip flight qualifies for premium-economy reimbursement. The query becomes a vector, similar policy documents are retrieved, and the language model answers using the relevant policy text. section 8.13
Restaurant recommendation
A RAG-enabled system can combine a user's earlier rejection of a steakhouse with Yelp retrieval when answering a question about vegan restaurants in Copenhagen. section 10.20
Figure 8.9 The architecture of retrieval-augmented generation (RAG)
Trace how embedded documents move through retrieval and into a language model's context. section 8.13
Figure 10.4 A schematic diagram for an LLM accessing data stored in a vector database and retrieving search results from the web
Compare vector-database retrieval with web search and other context sources in a language-model architecture. section 10.20

























