TFIDFRetriever<T>
Models & Types ยท AiDotNet.RetrievalAugmentedGeneration.Retrievers
TF-IDF (Term Frequency-Inverse Document Frequency) retrieval strategy with cached statistics.
Inheritance: RetrieverBase<T> โ TFIDFRetriever<T>
For Beginners
TF-IDF ranks documents by how unique and frequent terms are.
This implementation uses a cache to avoid recalculating term statistics on every search, dramatically improving performance for repeated queries. The cache is automatically refreshed when documents are added, removed or changed.
How It Works
Implements production-ready TF-IDF retrieval with intelligent caching to avoid recomputing statistics on every query. The cache is automatically invalidated when the corpus changes (a document added, removed or replaced, even when the document count stays the same), ensuring accuracy while maximizing performance.
Constructors
| Constructor | Summary |
|---|---|
TFIDFRetriever(IDocumentStore<T> documentStore, int defaultTopK) |