Retrieval Augmented Generation

218 public types in this namespace, organized by kind.

Models & Types (171)

Type Summary
AgenticChunker Production-ready intelligent chunker that decides where to split text based on semantic boundaries.
AggregateStats Represents aggregated statistics across multiple evaluations.
AnnVectorIndex<T> A dependency-free approximate-nearest-neighbour index (Flat / IVF / PQ / IVFPQ) implemented on the AiDotNet Tensors stack via AnnIndex.
AnswerCorrectnessMetric<T> Evaluates the factual correctness of generated answers.
AnswerRelevanceMetric<T> Evaluates how relevant the generated answer is to the original query (RAGAS answer relevance).
AnswerSimilarityMetric<T> Evaluates the similarity between the generated answer and ground truth.
AutoCompressor<T> Auto-compressor using rule-based text compression for document content reduction.
AzureSearchDocumentStore<T> Azure AI Search document store backed by the real Azure AI Search REST API.
BM25Retriever<T> BM25 (Best Matching 25) retrieval algorithm for sparse keyword-based search.
BTreeIndex Simple file-based index for mapping string keys to file offsets.
BinaryQuantizer<T> Sign-based binary quantizer that packs each dimension into a single bit (1 if the component is non-negative, 0 otherwise).
CacheBackedEmbeddings<T> An IEmbeddingModel decorator that caches embeddings by content hash so that repeated texts are not re-embedded, mirroring LangChain’s CacheBackedEmbeddings and LlamaIndex’s ingestion cache.
ChainOfThoughtRetriever<T> Chain-of-Thought retriever that generates reasoning steps before retrieving documents.
ChatClientGenerator<T> A real external-LLM generator for RAG.
ChromaDBDocumentStore<T> ChromaDB-based document store designed for simplicity and developer experience.
CodeAwareTextSplitter Code-aware text splitter that respects code structure and syntax.
CohereEmbeddingModel<T> Cohere embedding model integration for high-performance embeddings.
CohereReranker<T> Reranks documents using Cohere’s specialized reranking API for state-of-the-art relevance scoring.
ColBERTRetriever<T> Retrieves documents using ColBERT’s token-level late interaction mechanism (Khattab & Zaharia 2020, “ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT”).
ColbertReranker<T> A ColBERT-style late-interaction reranker (Khattab & Zaharia 2020) that scores each (query, document) pair with the “MaxSim” rule and reorders candidates by descending score.
CommunityIndex<T> Index structure that maps hierarchy levels and community IDs to their summaries, enabling efficient community-based retrieval for GraphRAG.
CommunitySummarizer<T> Generates structured summaries for detected communities in a knowledge graph.
CommunitySummary Represents a summary of a detected community within a knowledge graph.
ComparisonFilter A leaf node comparing a single metadata field against a scalar value with one of the operators Eq, Ne, Gt, Gte, Lt or Lte.
ComplExEmbedding<T> ComplEx embedding model: uses complex-valued embeddings with Hermitian dot product scoring.
ContextCoverageMetric<T> Evaluates how well the retrieved documents cover the information needed to answer the query.
ContextPrecisionMetric<T> Evaluates context precision (RAGAS): whether the relevant retrieved contexts are ranked highly.
ContextRecallMetric<T> Evaluates context recall (RAGAS): what fraction of the ground-truth answer is supported by the retrieved contexts.
ContextRelevanceMetric<T> Evaluates the relevance of retrieved context to the query.
CosineSimilarityMetric<T> Cosine similarity metric for vector search.
CrossEncoderReranker<T> Reranks documents using a cross-encoder model that computes fine-grained relevance scores.
DenseRetriever<T> Dense retrieval using vector similarity search.
DistMultEmbedding<T> DistMult embedding model: bilinear diagonal scoring with Σ(h_k · r_k · t_k).
DiversityReranker<T> Reranks documents to maximize diversity while maintaining relevance.
DocumentSummarizer<T> Document summarizer for creating concise summaries of retrieved content.
Document<T> Represents a document with content, metadata, and optional relevance scoring.
DotProductMetric<T> Dot product metric for vector search.
EmbeddingModelQueryEmbedder<T> An IQueryEmbedder that embeds queries with an IEmbeddingModel, the same model that embedded the documents, so the query lands in the store’s embedding space.
EmbeddingModelTokenAdapter<T> Adapts any real single-vector IEmbeddingModel into a per-token ITokenEmbeddingModel by tokenizing the text and embedding each token through the underlying model.
EnhancedGraphRAG<T> Enhanced Graph-based RAG that integrates with KnowledgeGraph and supports Local, Global (Leiden community summaries), and DRIFT retrieval modes.
EnsembleRetriever<T> Fuses the results of any number of retrievers via Reciprocal Rank Fusion (RRF), with optional per-retriever weights.
EuclideanDistanceMetric<T> Euclidean distance metric for vector search.
EvaluationResult Represents the evaluation results for a single grounded answer.
ExistsFilter A leaf node matching when a metadata field is present.
ExtractedClaim Represents a claim (covariate) extracted from text about an entity, following the Microsoft GraphRAG claim-extraction model.
ExtractedEntity Represents an entity extracted from text during knowledge graph construction.
ExtractedEntity Represents an entity extracted from text.
ExtractedRelation Represents a relation extracted from text between two entities.
FAISSDocumentStore<T> In-memory, brute-force document store that mimics FAISS-style integer indexing.
FLARERetriever<T> FLARE (Forward-Looking Active REtrieval) pattern that actively decides when and what to retrieve during generation.
FaithfulnessMetric<T> Evaluates whether the generated answer is faithful to the source documents.
FileDocumentStore<T> A durable, file-based vector document store with HNSW indexing and write-ahead logging.
FileGraphStore<T> File-based implementation of IGraphStore with persistent storage on disk.
FixedSizeChunkingStrategy A simple fixed-size text chunking strategy that splits text at character boundaries.
FlatIndex<T> Flat index that performs exact brute-force similarity search.
GooglePalmEmbeddingModel<T> Google PaLM embedding model integration via Vertex AI.
GpuFlatIndex<T> Flat (brute-force) index that offloads the query-vs-all similarity computation to the GPU when a device is available, falling back to an exact CPU scan otherwise.
GraphEdge<T> Represents a directed edge (relationship) between two nodes in a knowledge graph.
GraphPath<T> Represents a path in the graph: source node -> edge -> target node.
GraphQueryMatcher<T> Simple pattern matching for graph queries (inspired by Cypher/SPARQL but simplified).
GraphRAG<T> Graph-based RAG (Retrieval Augmented Generation) that combines knowledge graph traversal with vector search for enhanced retrieval.
GraphRetriever<T> Retrieves documents by identifying entities and their relationships in knowledge graph structures.
GraphTransaction<T> Transaction coordinator for managing transactions on graph stores with best-effort rollback.
GroundedAnswer<T> Represents a generated answer with citations and source attribution for transparency and verification.
HNSWIndex<T> Hierarchical Navigable Small World (HNSW) graph-based index for approximate nearest neighbor search.
HeaderBasedTextSplitter Splits structured documents based on header tags (H1, H2, H3, etc.).
HuggingFaceEmbeddingModel<T> HuggingFace-based embedding model for generating embeddings via Inference API.
HyDEQueryExpansion Hypothetical Document Embeddings (HyDE) query expansion (Gao et al., 2022).
HybridDocumentStore<T> Hybrid document store combining vector and keyword search strategies.
HybridGraphRetriever<T> Hybrid retriever that combines vector similarity search with graph traversal for enhanced RAG.
HybridRetriever<T> Hybrid retriever combining dense and sparse retrieval via Reciprocal Rank Fusion (RRF).
IVFIndex<T> Inverted File (IVF) index that partitions the vector space for faster search.
IdentityQueryProcessor A pass-through query processor that returns the query unchanged.
IdentityReranker<T> A pass-through reranker that returns documents without modifying their order or scores.
InFilter A leaf node matching when a metadata field equals any value in a set (set membership).
InMemoryDocumentStore<T> High-performance in-memory vector document store optimized for rapid prototyping and small-to-medium datasets.
InMemoryEmbeddingCache<T> A thread-safe, in-memory IEmbeddingCache backed by a ConcurrentDictionary with optional maximum size and approximate least-recently-used (LRU) eviction.
JaccardSimilarityMetric<T> Jaccard similarity metric for vector search.
KGConstructor<T> Constructs a knowledge graph from unstructured text using heuristic entity and relation extraction.
KGEmbeddingTrainingResult Contains the results of training a knowledge graph embedding model.
KeywordExtractionQueryProcessor Extracts key terms and phrases from queries for focused retrieval.
KnowledgeGraph<T> Knowledge graph for storing and querying entity relationships using a pluggable storage backend.
LLMBasedReranker<T> LLM-based reranking using language model relevance assessment.
LLMContextCompressor<T> LLM-based context compression to reduce token usage while preserving key information.
LLMQueryExpansion LLM-based query expansion: rewrites a query into several alternative phrasings that capture the same information need.
LSHIndex<T> Locality-Sensitive Hashing (LSH) index for approximate nearest neighbor search.
LearnedSparseEncoderExpansion Expands queries using learned sparse representations (SPLADE-like) with term importance weighting for hybrid retrieval.
LeidenCommunityDetector<T> Implements the Leiden algorithm for community detection in knowledge graphs.
LeidenResult Contains the results of Leiden community detection, including hierarchical partitions.
LemmatizationQueryProcessor Reduces words to their base or dictionary form (lemma) for better matching.
LinkPredictionEvaluation Contains evaluation metrics for a link prediction model.
LinkPredictor<T> Link prediction engine that uses trained KG embeddings to predict missing triples and evaluate model quality.
LocalTransformerEmbedding<T> Local transformer embedding model for generating embeddings using ONNX Runtime without external API calls.
LogicalFilter A combinator node joining child filters with logical And or Or.
LostInTheMiddleReranker<T> Addresses the “lost in the middle” problem by strategically reordering documents.
ManhattanDistanceMetric<T> Manhattan distance metric for vector search.
MarkdownTextSplitter Markdown-aware text splitter that respects markdown structure.
MaximalMarginalRelevanceReranker<T> Implements Maximal Marginal Relevance (MMR) reranking to balance relevance and diversity.
MemoryGraphStore<T> In-memory implementation of IGraphStore using dictionaries for fast lookups.
MilvusDocumentStore<T> Milvus vector-database document store backed by the real Milvus v2 REST API (/v2/vectordb/*).
MultiHopRetriever<T> An agentic multi-hop retriever that wraps a base IRetriever and an IGenerator to answer questions requiring several rounds of evidence gathering.
MultiModalEmbeddingModel<T> Multi-modal embedding model that creates unified vector representations for both text and images in the same embedding space.
MultiModalTextSplitter Multi-modal splitter for documents containing both text and images.
MultiQueryExpansion Expands queries by generating multiple query variations from different perspectives using LLM-based reformulation.
MultiQueryRetriever<T> Multi-query retriever that generates multiple query variations and merges results.
MultiStepReasoningResult<T> Result of multi-step reasoning retrieval.
MultiStepReasoningResult<T> Result of multi-step reasoning retrieval.
MultiStepReasoningRetriever<T> Multi-step reasoning retriever that breaks down complex queries into sequential steps.
MultiVectorRetriever<T> Retrieves documents by matching against multiple vector representations per document for improved precision.
NamedEntityRecognizer Production-ready Named Entity Recognition model using pattern matching and heuristics.
NeuralGenerator<T> Neural network-based text generator for RAG systems using LSTM architecture.
NoiseRobustnessMetric<T> Evaluates how well a RAG system handles noisy or irrelevant documents in the retrieved context.
NotFilter A combinator node negating a single child filter.
ONNXSentenceTransformer<T> Production-ready sentence transformer for generating semantic embeddings using ONNX Runtime.
OnnxCrossEncoderReranker<T> A production-ready cross-encoder reranker that scores (query, document) pairs with a real transformer model loaded via ONNX Runtime (e.g.
OpenAIEmbeddingModel<T> OpenAI embedding model for generating embeddings via OpenAI API.
ParentDocumentRetriever<T> Retrieves precise small chunks for matching but returns complete parent documents for comprehensive context.
PineconeDocumentStore<T> Pinecone vector-database document store backed by the real Pinecone REST API.
PredictedTriple Represents a predicted (head, relation, tail) triple with its plausibility score.
ProductQuantizer<T> Product Quantizer (PQ) that splits each vector into M contiguous subspaces, learns a small k-means codebook (default 256 centroids) per subspace, and encodes a vector as one byte per subspace.
QdrantDocumentStore<T> Qdrant vector-database document store backed by the real Qdrant REST API.
QuantizedFlatIndex<T> A flat (brute-force) index that stores compressed quantized codes instead of full vectors, trading a small amount of accuracy for large memory savings and faster scanning.
QueryExpansionProcessor Expands queries with synonyms and related terms to improve retrieval recall.
QueryRewritingProcessor<T> Rewrites queries for clarity and completeness, especially in conversational contexts.
QueryRoutingRetriever<T> Routes each query to the single most appropriate underlying retriever (data source).
RAGEvaluator<T> Evaluates RAG system performance using multiple metrics.
RagPipeline<T> End-to-end RAG orchestrator that composes the individual components into the two operations an application actually performs: IngestAsync (chunk → embed → store) and QueryAsync (retrieve → rerank → compress → generate).
RagResult<T> The outcome of a QueryAsync call.
ReasoningStepResult<T> Represents a single reasoning step in the multi-step process.
ReasoningStepResult<T> Represents a single reasoning step in the multi-step process.
ReciprocalRankFusion<T> Reciprocal Rank Fusion for combining multiple ranking lists.
RecursiveCharacterChunkingStrategy Recursively splits text using a hierarchy of separators to preserve document structure.
RecursiveCharacterTextSplitter Recursive character-based text splitting that preserves semantic meaning.
RetrievalResult<T> Represents a retrieval result from the hybrid retriever.
RotatEEmbedding<T> RotatE embedding model: models relations as rotations in complex vector space.
Route<T> A named, described data source backed by a retriever.
ScalarQuantizer<T> Per-dimension scalar quantizer that maps each floating-point component to a single unsigned byte (uint8) using learned min/max ranges.
SelectiveContextCompressor<T> Selective context compressor that picks the most relevant sentences based on the query.
SelfCorrectingRetriever<T> Self-correcting retriever that iteratively refines answers through critique, error detection, and targeted re-retrieval.
SelfQueryRetriever<T> Self-querying retriever: uses a text generator to split a natural-language query into a semantic search string plus structured metadata filters over known fields, then delegates to a base retriever with those filters merged in.
SemanticChunkingStrategy Semantic text chunking.
SentenceChunkingStrategy Splits text into chunks based on sentence boundaries to preserve semantic coherence.
SentenceTransformersFineTuner<T> Fine-tuner for sentence transformer embedding models on domain-specific training data using triplet loss.
SlidingWindowChunkingStrategy Sliding window chunking strategy with configurable window size and stride.
SpellCheckQueryProcessor Processes queries by correcting common spelling errors using a dictionary-based approach.
StaticWordEmbeddingModel<T> Implements a static word embedding model (e.g., GloVe, Word2Vec, FastText).
StopWordRemovalQueryProcessor Removes common stop words from queries to improve retrieval precision.
StubEmbeddingModel<T> A deterministic stub embedding model for testing and development that uses hash-based vector generation.
StubGenerator<T> A simple stub generator for testing and development that creates template-based answers.
SubQueryExpansion Expands complex queries by decomposing them into simpler, focused sub-queries for parallel retrieval.
TFIDFRetriever<T> TF-IDF (Term Frequency-Inverse Document Frequency) retrieval strategy with cached statistics.
TableAwareTextSplitter Specialized splitter that correctly parses and chunks tabular data from documents.
TemporalTransEEmbedding<T> Temporal TransE embedding: extends TransE with time-aware scoring via discretized time bins.
TokenBasedChunkingStrategy Chunks text by TOKEN count rather than character count.
ToolAugmentedReasoningRetriever<T> Tool-augmented reasoning retriever that can use external tools during reasoning.
ToolAugmentedResult<T> Result of tool-augmented reasoning.
ToolAugmentedResult<T> Result of tool-augmented reasoning.
ToolInvocation<T> Represents a tool invocation during reasoning.
ToolInvocation Represents a tool invocation during reasoning.
TransEEmbedding<T> TransE embedding model: entities and relations are vectors in the same space, with the scoring function d(h, r, t) = ||h + r - t||.
TreeOfThoughtsRetriever<T> Tree-of-Thoughts retriever that explores multiple reasoning paths in a tree structure.
ValidationResult The result of a pipeline validation, containing any errors and warnings.
VectorDocument<T> Represents a document paired with its vector embedding for storage and retrieval.
VectorRetriever<T> A dense vector-based retriever that uses embedding similarity for document retrieval.
VerifiedReasoningResult<T> Result of verified reasoning retrieval.
VerifiedReasoningRetriever<T> Verified reasoning retriever that validates each reasoning step with critic models.
VerifiedReasoningStep<T> Represents a reasoning step with verification information.
VoyageAIEmbeddingModel<T> Voyage AI embedding model that calls the Voyage AI embeddings REST API.
WALEntry Represents a single entry in the Write-Ahead Log.
WeaviateDocumentStore<T> Weaviate vector-database document store backed by the real Weaviate REST/GraphQL API.
WriteAheadLog Write-Ahead Log (WAL) for ensuring ACID properties and crash recovery.

Base Classes (12)

Type Summary
ChunkingStrategyBase Provides a base implementation for text chunking strategies with common functionality.
ContextCompressorBase<T> Provides a base implementation for context compressors with common functionality.
DocumentStoreBase<T> Provides a base implementation for document stores with common functionality.
EmbeddingModelBase<T> Provides a base implementation for embedding models with common functionality.
GeneratorBase<T> Base class for generator implementations providing common functionality and validation.
KGEmbeddingBase<T> Abstract base class for knowledge graph embedding models providing shared training infrastructure.
MetadataFilter An immutable, provider-agnostic boolean metadata-filter expression tree.
QueryExpansionBase Base class for query expansion strategies.
QueryProcessorBase Base class for query processor implementations with common validation logic.
RAGMetricBase<T> Provides a base implementation for RAG evaluation metrics with common functionality.
RerankerBase<T> Provides a base implementation for document rerankers with common functionality.
RetrieverBase<T> Provides a base implementation for document retrievers with common functionality.

Interfaces (7)

Type Summary
IColBertEmbedder<T> Token-level embedder contract for ColBERT-style late interaction.
IEmbeddingCache<T> Defines a cache that stores previously computed embedding vectors keyed by a stable string key.
IKnowledgeGraphEmbedding<T> Defines the contract for knowledge graph embedding models that learn vector representations of entities and relations.
IQueryEmbedder<T> Single-vector query embedder contract for dense retrievers that need a per-query embedding (DPR-style, Karpukhin et al.
ISimilarityMetric<T> Interface for similarity/distance metrics used in vector search.
IVectorIndex<T> Interface for vector search indexes.
IVectorQuantizer<T> Common interface for vector quantizers used to compress dense embeddings for memory- and latency-efficient similarity search.

Enums (6)

Type Summary
AnnVectorIndexType The approximate-nearest-neighbour structure backing an AnnVectorIndex.
AnnVectorMetric The distance metric used by an AnnVectorIndex.
MetadataFilterOperator The kind of node in a MetadataFilter expression tree.
RetrievalSource Indicates how a result was retrieved.
TransactionState Represents the state of a transaction.
WALOperationType Types of operations that can be logged in the WAL.

Options & Configuration (14)

Type Summary
ChunkingConfig Configuration for chunking strategies.
ContextCompressionConfig Configuration for context compression strategies.
DocumentStoreConfig Configuration for document store components.
EmbeddingConfig Configuration for embedding models.
FileDocumentStoreOptions Configuration options for the file-based document store.
GraphRAGOptions Configuration options for the enhanced GraphRAG retrieval system.
KGConstructionOptions Configuration options for automated knowledge graph construction from text.
KGEmbeddingOptions Configuration options for training knowledge graph embedding models.
KnowledgeGraphOptions Configuration options for advanced knowledge graph capabilities including embeddings, community detection, link prediction, temporal queries, and KG construction.
LeidenOptions Configuration options for the Leiden community detection algorithm.
QueryExpansionConfig Configuration for query expansion strategies.
RAGConfiguration<T> Configuration for RAG pipeline components.
RerankingConfig Configuration for reranking strategies.
RetrievalConfig Configuration for retrieval strategies.

Helpers & Utilities (8)

Type Summary
ContentHash Provides stable, content-based hashing utilities used for caching and de-duplicating text.
GpuVectorScorer GPU-accelerated batched similarity scoring for vector search.
GraphAnalytics Provides graph analytics algorithms for analyzing knowledge graphs.
GraphNode<T> Represents a node in a knowledge graph, typically an entity extracted from text.
PipelineValidator Validates that a set of components forms a valid AI pipeline at runtime.
RAGConfigurationBuilder<T> Builder for constructing RAG configuration.
RetrievalMetrics Pure-math information-retrieval (IR) metrics over ranked retrieval results: nDCG@k, MRR, MAP, Hit-Rate@k, Precision@k and Recall@k.
ThoughtNode<T> Represents a node in the Tree-of-Thoughts reasoning tree.