Rag.NET 1.6.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rag.NET --version 1.6.0
                    
NuGet\Install-Package Rag.NET -Version 1.6.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="Rag.NET" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rag.NET" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Rag.NET" />
                    
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 Rag.NET --version 1.6.0
                    
#r "nuget: Rag.NET, 1.6.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 Rag.NET@1.6.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=Rag.NET&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Rag.NET&version=1.6.0
                    
Install as a Cake Tool

Rag.NET

NuGet Downloads Docs .NET License GitHub Sponsors

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.Diagnostics

Disposable in-memory pipeline traces for Rag.NET: the last N query executions, with chunk scores, stage latencies and guard actions

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
Loading failed