DNFileRAG.Infrastructure 1.2.0

dotnet add package DNFileRAG.Infrastructure --version 1.2.0
                    
NuGet\Install-Package DNFileRAG.Infrastructure -Version 1.2.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="DNFileRAG.Infrastructure" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DNFileRAG.Infrastructure" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="DNFileRAG.Infrastructure" />
                    
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 DNFileRAG.Infrastructure --version 1.2.0
                    
#r "nuget: DNFileRAG.Infrastructure, 1.2.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 DNFileRAG.Infrastructure@1.2.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=DNFileRAG.Infrastructure&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=DNFileRAG.Infrastructure&version=1.2.0
                    
Install as a Cake Tool

DNFileRAG

A .NET 9 real-time, file-driven RAG (Retrieval-Augmented Generation) engine that watches a folder, ingests documents, and serves fast answers over an HTTP API (with Qdrant vector search).

License: MIT .NET CI NuGet

<a href="https://youtu.be/6O5fafYHkAc"> <img src="https://img.youtube.com/vi/6O5fafYHkAc/maxresdefault.jpg" alt="Watch the demo" width="600"> </a>

Click to watch the demo video

What you get

  • Real-time ingestion: watches a folder and keeps your index up to date
  • Formats: .pdf, .docx, .txt, .md, .html, .png, .jpg, .jpeg, .webp
  • Providers: OpenAI / Azure OpenAI / Anthropic / Ollama (local)
  • Vector store: Qdrant
  • API: /api/query, /api/documents, /api/health
  • Example UI: mock company landing page + popup help chat (examples/HelpChat)

Choose your path

  • Tutorial 1: Local dev (recommended): Ollama + Qdrant + dotnet run (fastest to try)
  • Tutorial 2: HelpChat demo UI: run a static page that calls your local API
  • Tutorial 3: Docker deploy: docker-compose up -d (self-contained stack)
  • Tutorial 4: Testing: fast vs integration tests
  • Tutorial 5: Production tips: hardening checklist

Tutorial 1 — Local dev (Ollama + Qdrant)

This uses the defaults in src/DNFileRAG/appsettings.Development.json:

  • API on http://localhost:8181
  • ApiSecurity:RequireApiKey = false (no key needed)
  • Embeddings + LLM via Ollama
  • Qdrant vector size 1024 (matches mxbai-embed-large)

Step 1) Start Qdrant

docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant

Step 2) Install Ollama + pull models

ollama pull mxbai-embed-large
ollama pull llama3.2:3b
ollama pull llava

Images: Vision extraction is enabled by default in Development via Vision:Enabled=true and uses the Ollama model llava (configurable).

Step 3) Run DNFileRAG

dotnet run --project ./src/DNFileRAG

Step 4) Add documents

Put files into:

  • src/DNFileRAG/data/documents/

If you want to watch a different folder, change FileWatcher:WatchPath in:

  • src/DNFileRAG/appsettings.Development.json

Step 5) Verify indexing

curl http://localhost:8181/api/documents

Step 6) Query

  • cURL
curl -X POST http://localhost:8181/api/query \
  -H "Content-Type: application/json" \
  -d "{\"query\":\"What are our support hours?\"}"
  • PowerShell
Invoke-RestMethod http://localhost:8181/api/query -Method Post -ContentType "application/json" -Body (@{ query = "What are our support hours?" } | ConvertTo-Json)

Tutorial 2 — HelpChat demo UI (landing page + popup chat)

HelpChat is a static mock company page under examples/HelpChat/ that opens a popup chat and calls your local DNFileRAG API.

Step 1) Start DNFileRAG

Follow Tutorial 1 so the API is running at http://localhost:8181.

Step 2) Serve the static files

cd examples/HelpChat
python -m http.server 3000

Step 3) Open it

Open http://localhost:3000 and click Help.

You can open examples/HelpChat/index.html directly, but some browsers restrict file:// pages from calling http://localhost.


Tutorial 3 — Docker deploy (self-contained stack)

This uses docker-compose.yml to run:

  • Qdrant
  • Ollama
  • DNFileRAG API on http://localhost:8080

Step 1) Start the stack

docker-compose up -d

Step 2) Add documents

Files in ./documents are mounted into the container at /app/data/documents:

mkdir -p documents
cp /path/to/your/files/* documents/

Step 3) Query

curl -X POST http://localhost:8080/api/query \
  -H "Content-Type: application/json" \
  -d '{"query":"What are our support hours?"}'

Stop / reset

docker-compose down
docker-compose down -v   # also removes Qdrant + Ollama volumes

Tutorial 4 — Testing

Fast tests (unit tests + fast checks)

  • Windows (PowerShell)
dotnet test .\DNFileRAG.sln -c Release --filter "Category!=Integration"
  • macOS/Linux (bash/zsh)
dotnet test ./DNFileRAG.sln -c Release --filter "Category!=Integration"

Full suite (includes integration tests)

Integration tests may start Docker containers (Testcontainers) and will run slower.

  • Windows (PowerShell)
dotnet test .\DNFileRAG.sln -c Release
  • macOS/Linux (bash/zsh)
dotnet test ./DNFileRAG.sln -c Release

Note on FluentAssertions licensing

Tests use FluentAssertions. If you plan commercial use, you may need a commercial license (see the warning emitted during test runs).


Tutorial 5 — Production tips (checklist)

Security

  • Enable API keys: set ApiSecurity:RequireApiKey = true and configure ApiSecurity:ApiKeys.
  • Run behind HTTPS: terminate TLS at a reverse proxy (or configure Kestrel HTTPS). Ensure forwarded headers are configured if applicable.
  • CORS: lock down origins (avoid AllowAnyOrigin() for production).

Reliability

  • Persist Qdrant: store Qdrant data on durable storage (volumes/backups).
  • Health checks: use /api/health and /api/health/detailed for monitoring.
  • Resource sizing: embeddings + parsing can be CPU/RAM heavy; size accordingly.

Performance & quality

  • Vector size must match your embedding model (e.g., mxbai-embed-large → 1024).
  • Tune chunking: Chunking:ChunkSize and Chunking:ChunkOverlap.
  • Tune retrieval: Rag:DefaultTopK and Rag:MinRelevanceScore.

Ops

  • Logging: keep Production log levels at Info/Warn (Debug is noisy).
  • Documents path: ensure your FileWatcher:WatchPath points to the mounted directory in your environment.

API reference

Method Endpoint Description
POST /api/query Query the RAG engine
GET /api/documents List indexed documents
POST /api/documents/reindex Trigger full reindex
DELETE /api/documents?filePath=... Remove a document from the index
GET /api/health Basic health check
GET /api/health/detailed Detailed component health status

Using as a NuGet package

dotnet add package DNFileRAG.Infrastructure

Then register services:

using DNFileRAG;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDNFileRAGServices(builder.Configuration);

Project structure

DNFileRAG/
├── src/
│   ├── DNFileRAG/                 # Web API host
│   ├── DNFileRAG.Core/            # Domain models & interfaces
│   └── DNFileRAG.Infrastructure/  # External service implementations
├── tests/
│   └── DNFileRAG.Tests/           # Test suite
└── examples/
    └── HelpChat/                  # Mock landing page + popup support chat

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License — see LICENSE.

Acknowledgments

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 146 12/14/2025
1.1.0 119 12/12/2025
1.0.0 409 12/11/2025