Rag.NET
1.8.2
See the version list below for details.
dotnet add package Rag.NET --version 1.8.2
NuGet\Install-Package Rag.NET -Version 1.8.2
<PackageReference Include="Rag.NET" Version="1.8.2" />
<PackageVersion Include="Rag.NET" Version="1.8.2" />
<PackageReference Include="Rag.NET" />
paket add Rag.NET --version 1.8.2
#r "nuget: Rag.NET, 1.8.2"
#:package Rag.NET@1.8.2
#addin nuget:?package=Rag.NET&version=1.8.2
#tool nuget:?package=Rag.NET&version=1.8.2
Rag.NET
A modular RAG pipeline for .NET, built on Microsoft.Extensions.AI. Ships as 74 packages so a pipeline downloads only what it calls. Documentation · Repository
The core Retrieval-Augmented Generation pipeline for .NET: AddRagNet() wires ingestion
(parse → chunk → embed → store) and retrieval (query → search → rerank → answer) into any
IServiceCollection, exposed to your code as one IRagPipeline.
Install
dotnet add package Rag.NET
Setup
Rag.NET builds on Microsoft.Extensions.AI: register any IChatClient and
IEmbeddingGenerator<string, Embedding<float>> (OpenAI, Azure OpenAI, Ollama, …) before
calling AddRagNet(). Out of the box this package parses text and Markdown, chunks
recursively, and can run entirely in memory — perfect for a first spike before you attach a
real vector store package such as Rag.NET.VectorStores.PgVector.
using Microsoft.Extensions.DependencyInjection;
using Rag.NET.Abstractions;
using Rag.NET.DependencyInjection;
using Rag.NET.Storage;
// chatClient / embeddingGenerator: your Microsoft.Extensions.AI implementations.
services.AddSingleton(chatClient);
services.AddSingleton(embeddingGenerator);
services.AddSingleton<IVectorStore>(new InMemoryVectorStore()); // nothing persisted
services.AddRagNet();
Example
using Microsoft.Extensions.DependencyInjection;
using Rag.NET.Abstractions;
using Rag.NET.Models;
var pipeline = provider.GetRequiredService<IRagPipeline>();
using var stream = File.OpenRead("notes.md");
var ingested = await pipeline.IngestAsync(stream, new DocumentMetadata
{
DocumentId = new DocumentId("notes"),
FileName = "notes.md",
ContentType = "text/markdown",
});
var response = await pipeline.AskAsync("What do the notes say about pricing?");
Console.WriteLine(response.Answer);
foreach (var source in response.Sources)
Console.WriteLine($"[{source.Score:F2}] {source.Chunk.Text}");
RetrieveAsync returns raw ranked chunks, AskStreamingAsync streams the answer
token-by-token, and the RagBuilder passed to AddRagNet(rag => …) activates self-query,
parent-document retrieval, MMR, corrective RAG, conversation memory and more.
Full guide
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net11.0 is compatible. |
-
net10.0
- Microsoft.Extensions.AI.Abstractions (>= 10.11.0)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.15)
- Microsoft.Extensions.DependencyInjection (>= 10.0.15)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.15)
- Microsoft.ML.Tokenizers (>= 3.0.0)
- Microsoft.ML.Tokenizers.Data.Cl100kBase (>= 3.0.0)
- Rag.NET.Abstractions (>= 1.8.2)
- Rag.NET.QueryTechniques (>= 1.8.2)
- ZeroAlloc.Inject (>= 1.12.0)
- ZeroAlloc.Pipeline (>= 1.5.0)
- ZeroAlloc.Results (>= 1.5.0)
- ZeroAlloc.Specification (>= 1.3.3)
- ZeroAlloc.Validation (>= 1.7.8)
-
net11.0
- Microsoft.Extensions.AI.Abstractions (>= 10.11.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.15)
- Microsoft.ML.Tokenizers (>= 3.0.0)
- Microsoft.ML.Tokenizers.Data.Cl100kBase (>= 3.0.0)
- Rag.NET.Abstractions (>= 1.8.2)
- Rag.NET.QueryTechniques (>= 1.8.2)
- ZeroAlloc.Inject (>= 1.12.0)
- ZeroAlloc.Pipeline (>= 1.5.0)
- ZeroAlloc.Results (>= 1.5.0)
- ZeroAlloc.Specification (>= 1.3.3)
- ZeroAlloc.Validation (>= 1.7.8)
NuGet packages (19)
Showing the top 5 NuGet packages that depend on Rag.NET:
| Package | Downloads |
|---|---|
|
Rag.NET.DataProviders
Shared OAuth and base class infrastructure for Rag.NET data provider connectors |
|
|
Rag.NET.Mediator
ZeroAlloc.Mediator integration for Rag.NET |
|
|
Rag.NET.Security
Prompt injection defence-in-depth for Rag.NET: chunk sanitisation, query sanitisation, retrieval guards, and prompt hardening. |
|
|
Rag.NET.Api
ASP.NET Core REST API for Rag.NET pipelines |
|
|
Rag.NET.Api.Grpc
gRPC service for Rag.NET pipelines |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.8.4 | 0 | 11/15/2026 |
| 1.8.3 | 0 | 11/15/2026 |
| 1.8.2 | 86 | 11/14/2026 |
| 1.8.1 | 85 | 11/14/2026 |
| 1.8.0 | 88 | 11/14/2026 |
| 1.6.0 | 568 | 11/10/2026 |
| 1.5.0 | 388 | 11/9/2026 |
| 1.4.1 | 430 | 11/9/2026 |
| 1.4.0 | 444 | 11/8/2026 |
| 1.3.10 | 473 | 11/8/2026 |
| 1.3.9 | 492 | 11/7/2026 |
| 1.3.8 | 565 | 11/6/2026 |
| 1.3.7 | 545 | 11/2/2026 |
| 1.3.6 | 490 | 11/2/2026 |
| 1.3.5 | 458 | 11/1/2026 |
| 1.3.4 | 457 | 10/30/2026 |
| 1.3.2 | 467 | 10/26/2026 |
| 1.3.1 | 453 | 10/25/2026 |
| 1.3.0 | 478 | 10/22/2026 |
| 1.2.0 | 440 | 10/22/2026 |