VectorRetriever<T>
Models & Types · AiDotNet.RetrievalAugmentedGeneration.Retrievers
A dense vector-based retriever that uses embedding similarity for document retrieval.
Inheritance: RetrieverBase<T> → VectorRetriever<T>
For Beginners
This retriever finds documents by meaning, not just keywords.
Think of it like a smart librarian who understands what you’re asking:
- You ask: “How do cars work?”
- Keyword search finds: Documents with exact words “cars” and “work”
- Vector search finds: Documents about automobiles, engines, mechanics (similar meaning)
How it works:
- Convert your question to a vector (list of numbers representing meaning)
- Compare to vectors of all documents in the store
- Find documents with closest vectors (most similar meaning)
- Return the top matches
For example:
- Query: “renewable energy”
- Finds: Documents about solar, wind, hydroelectric (even if they don’t say “renewable”)
- Misses: Documents about fossil fuels (different meaning)
How It Works
This retriever uses vector embeddings to find semantically similar documents. It embeds the query using an embedding model, then searches the document store for the most similar document vectors. This approach captures semantic meaning rather than just keyword matching.
Constructors
| Constructor | Summary |
|---|---|
VectorRetriever(IDocumentStore<T> documentStore, IEmbeddingModel<T> embeddingModel, int defaultTopK) |
Initializes a new instance of the VectorRetriever class. |