Cisharpai.Rag 0.4.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Cisharpai.Rag --version 0.4.0
                    
NuGet\Install-Package Cisharpai.Rag -Version 0.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cisharpai.Rag" Version="0.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cisharpai.Rag" Version="0.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Cisharpai.Rag" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cisharpai.Rag --version 0.4.0
                    
#r "nuget: Cisharpai.Rag, 0.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cisharpai.Rag@0.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cisharpai.Rag&version=0.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Cisharpai.Rag&version=0.4.0
                    
Install as a Cake Tool

Cisharpai.Rag

Provider-independent RAG ingestion foundations for .NET 8 and .NET 10: fixed-size text chunking, bulk float embeddings with token-aware batching, bounded concurrency and retry, and a composable document pipeline using IEmbeddingClient.

using Cisharpai.Rag;
using Cisharpai.Rag.Chunking;
using Cisharpai.Rag.Embeddings;
using Cisharpai.Rag.Models;

// embeddingClient is an existing configured Cisharpai IEmbeddingClient.
var pipeline = new RagIngestionPipeline(
    new FixedSizeChunker(new FixedSizeChunkerOptions
    {
        ChunkSize = 1024,
        Overlap = 128
    }),
    new BulkEmbeddingProcessor(embeddingClient, new BulkEmbeddingOptions
    {
        // Provider presets set MaxBatchItems/MaxBatchTokens; apply before your own overrides.
        Model = "text-embedding-3-small",
        MaxConcurrency = 3
    }.ApplyProfile(EmbeddingProviderProfile.OpenAi)));

await foreach (var batch in pipeline.IngestAsync(new[]
{
    new RagDocument("guide", "Your document text")
}))
{
    if (!batch.IsSuccess)
    {
        Console.Error.WriteLine($"Batch {batch.BatchIndex} failed: {batch.ErrorMessage}");
        continue; // a failed batch does not stop the run
    }
    foreach (var item in batch.Items)
        Console.WriteLine($"{item.Chunk.DocumentId}:{item.Chunk.Index}: {item.Vector.Length}");
}

Register a provider separately, then use services.AddCisharpaiRag(options => ...) for DI. A factory overload selects keyed embedding clients. The same pipeline accepts IAsyncEnumerable<RagDocument> and cancellation; BulkEmbeddingProcessor also accepts existing chunk streams.

Defaults: chunk size 1024 Unicode scalar values, overlap 128, 32 items per batch with no token budget, sequential requests (MaxConcurrency = 1), 3 retries on transient failures, document input type, float vectors. BulkEmbeddingOptions.ForProvider/ApplyProfile set per-provider batch ceilings (OpenAi, AzureOpenAi, AzureAiInference, Cohere, Conservative). Chunk positions use UTF-16 offsets. Options are validated and snapshotted at construction/resolution. A failed batch is reported through EmbeddingBatchResult and the run continues; IProgress<BulkEmbeddingProgress> reports how far along ingestion is. Read-ahead is bounded by MaxPendingBatches, so memory does not grow with corpus size. Parsing, vector storage, retrieval, and generation are outside this package. For real token counting (replacing the default s.Length / 4 heuristic), install Cisharpai.Rag.Tokenizers and wire in TiktokenCounter.ToTokenEstimator().

See the RAG usage guide for host configuration, keyed providers, option tables, streaming, and failure handling.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Cisharpai.Rag:

Package Downloads
Cisharpai.Testing

Unified .NET client library for chat completions and embeddings across multiple LLM providers.

Cisharpai.Rag.OpenAi

Bridge package connecting Cisharpai.OpenAi hosted retrieval (file_search) with Cisharpai.Rag's IRetriever contract.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0-alpha.16.404 60 9/27/2026
0.5.0-alpha.12.396 58 9/22/2026
0.5.0-alpha.8.391 61 9/21/2026
0.5.0-alpha.4.386 59 9/21/2026
0.4.0 120 9/20/2026
0.4.0-PullRequest81.41.376 70 9/16/2026
0.4.0-PullRequest81.36.378 55 9/16/2026
0.4.0-PullRequest81.36.377 66 9/16/2026
0.4.0-alpha.35.380 66 9/16/2026
0.4.0-alpha.34.368 60 9/15/2026
0.4.0-alpha.33.358 55 9/15/2026
0.4.0-alpha.32.353 56 9/15/2026
0.4.0-alpha.31.346 65 9/14/2026
0.4.0-alpha.30.340 59 9/14/2026
0.4.0-alpha.29.336 56 9/13/2026
0.4.0-alpha.28.330 56 9/13/2026
0.4.0-alpha.27.324 67 9/13/2026
0.4.0-alpha.26.319 53 9/13/2026
0.4.0-alpha.25.309 54 9/13/2026
0.4.0-alpha.24.306 56 9/13/2026
Loading failed