DNFileRAG.Infrastructure 1.0.0

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

DNFileRAG

A .NET 9-powered, real-time file-driven RAG (Retrieval-Augmented Generation) engine that auto-ingests documents and serves fast, contextual query responses via API.

License: MIT .NET CI NuGet

Installation

NuGet Package

dotnet add package DNFileRAG.Infrastructure

From Source

git clone https://github.com/MLidstrom/DNFileRAG.git
cd DNFileRAG
dotnet build

Features

  • Real-time Document Ingestion - Automatically watches directories and indexes new/modified documents
  • Multiple Document Formats - Supports PDF, DOCX, TXT, MD, and HTML files
  • Flexible Embedding Providers - OpenAI, Azure OpenAI, or Ollama (local)
  • Multiple LLM Providers - OpenAI, Azure OpenAI, Anthropic, or Ollama (local)
  • Vector Search - Powered by Qdrant for fast semantic search
  • REST API - Simple API for queries and document management
  • Clean Architecture - Modular, testable, and extensible design

Quick Start

Prerequisites

  • .NET 9 SDK
  • Qdrant vector database (Docker recommended)
  • One of: OpenAI API key, Azure OpenAI, or Ollama for local inference

1. Start Qdrant

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

2. Clone and Build

git clone https://github.com/MLidstrom/DNFileRAG.git
cd DNFileRAG
dotnet build

3. Configure

Edit src/DNFileRAG/appsettings.json:

{
  "Qdrant": {
    "Host": "localhost",
    "Port": 6333,
    "CollectionName": "DNFileRAG",
    "VectorSize": 1536
  },
  "Embedding": {
    "Provider": "Ollama",
    "Ollama": {
      "BaseUrl": "http://localhost:11434",
      "Model": "nomic-embed-text"
    }
  },
  "Llm": {
    "Provider": "Ollama",
    "Ollama": {
      "BaseUrl": "http://localhost:11434",
      "Model": "llama3.2"
    }
  }
}

4. Run

cd src/DNFileRAG
dotnet run

The API will be available at http://localhost:8181

API Endpoints

Method Endpoint Description
GET /api/documents List all indexed documents
POST /api/documents/upload Upload a document for indexing
DELETE /api/documents/{fileId} Remove a document from the index
POST /api/query Query the RAG engine
POST /api/reindex Trigger full reindex
GET /health Health check

Query Example

curl -X POST http://localhost:8181/api/query \
  -H "Content-Type: application/json" \
  -d '{"query": "What is the main topic of the documents?"}'

Project Structure

DNFileRAG/
├── src/
│   ├── DNFileRAG/                 # Web API host
│   ├── DNFileRAG.Core/            # Domain models & interfaces
│   └── DNFileRAG.Infrastructure/  # External service implementations
│       ├── Embeddings/            # Embedding providers
│       ├── Llm/                   # LLM providers
│       ├── Parsers/               # Document parsers
│       ├── Services/              # Core services
│       └── VectorStore/           # Qdrant integration
└── tests/
    └── DNFileRAG.Tests/           # Unit tests

Configuration

Embedding Providers

Provider Config Key Requirements
OpenAI OpenAI API Key
Azure OpenAI AzureOpenAI Endpoint, API Key, Deployment
Ollama Ollama Local Ollama instance

LLM Providers

Provider Config Key Requirements
OpenAI OpenAI API Key
Azure OpenAI AzureOpenAI Endpoint, API Key, Deployment
Anthropic Anthropic API Key
Ollama Ollama Local Ollama instance

Local Development with Ollama

For fully local development without API keys:

  1. Install Ollama
  2. Pull required models:
    ollama pull mxbai-embed-large  # Recommended: 1024 dims, stable
    ollama pull llama3.2
    
  3. Set providers to Ollama in configuration
  4. Configure vector size to match embedding model:
Embedding Model Vector Size Notes
mxbai-embed-large 1024 Recommended for stability
nomic-embed-text 768 May crash on some PDFs (Ollama Windows bug)
all-minilm 384 Smaller, faster

Query Guardrails

DNFileRAG includes relevance score filtering to prevent off-topic queries:

{
  "Rag": {
    "MinRelevanceScore": 0.6
  }
}

Queries with no documents above the threshold return a "no relevant information" response without calling the LLM, saving cost and preventing hallucination

Docker

docker-compose up -d

Contributing

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

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