A retriever finds information in an external knowledge source that is relevant to a user’s query. In retrieval-augmented generation (RAG), it supplies context to a generator instead of leaving the generator to rely only on what the language model learned during training. This matters when product details or policies change: a fluent answer can still be outdated or wrong. section 3.2.1 section 3.1
A typical query follows this path:
- The retriever searches an external knowledge base for relevant information. Sources may include documents, databases, web pages, or APIs; data is typically indexed beforehand for effective retrieval. section 3.2.1
- The generator receives both the original query and the retrieved information, then produces a response using that context. section 3.2.3
Answering a warranty question
A shopper asks about a lamp’s warranty. The retriever finds its terms in product documentation or a warranty database: a two-year limited warranty covers defects in materials or workmanship but excludes accidents, misuse, and normal wear. The generator can then answer with those specific terms rather than a generic warranty guess. section 3.2.4
retriever = product_db.as_retriever()
The one-line `product_db.as_retriever()` call shows how a product database is exposed as the component that fetches relevant information for a chatbot. It does not show how the database searches or ranks results. section 3.8.8
Retrieval can reduce unsupported answers, but adding a retriever does not guarantee correctness. Data quality and freshness, indexing, chunk size, and embedding choices affect what reaches the generator. Evaluate retrieval precision alongside answer relevance and factual accuracy, then refine the system as its data changes. section 3.1 section 3.9


