RagPipeline<T>

Models & Types · AiDotNet.RetrievalAugmentedGeneration

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). Previously callers had to wire these stages by hand; this is the single entry point that ties them together, fully async and cancellation-aware, with optional tenant/namespace isolation.

Constructors

Constructor Summary
RagPipeline(IEmbeddingModel<T> embedding, IDocumentStore<T> store, IRetriever<T> retriever, IChunkingStrategy chunking, IReranker<T> reranker, IContextCompressor<T> compressor, IGenerator<T> generator, string tenant)

Methods

Method Summary
Task<RagResult<T>> QueryAsync(string question, int topK, CancellationToken cancellationToken) Answers a question: retrieve → (rerank) → (compress) → (generate).
Task<int> IngestAsync(string id, string content, IReadOnlyDictionary<string, object> metadata, CancellationToken cancellationToken) Ingests a document: optionally chunks it, embeds each chunk, and upserts it into the store.

Fields

Field Summary
string OriginalDocumentIdMetadataKey Metadata key used internally to preserve the caller-visible chunk id when tenant isolation namespaces the physical document id in a shared store.
string TenantMetadataKey Metadata key under which the tenant/namespace is stored on ingested documents.