jonathanfavorite/RAGamuffin

A lightweight, cross-platform .NET library for building RAG (Retrieval-Augmented Generation) pipelines with local embedding models and SQLite vector storage. Perfect for developers who need privacy-focused, offline-capable document search and AI-powered question answering without external API dependencies.

C#

3

30 commits

updated Jul 8, 2025

See the code

README

RAGamuffin Banner

NuGet Version Build Status MIT License

A lightweight, cross-platform .NET library for building RAG (Retrieval-Augmented Generation) pipelines with local embedding models and SQLite vector storage.

πŸš€ Features

  • Local Embedding Models: Use ONNX models for offline, privacy-focused embeddings
  • SQLite Vector Storage: Lightweight, file-based vector database with no external dependencies
  • Multi-Format Support: Process PDFs and text files with intelligent chunking
  • Flexible Training Strategies: Retrain from scratch, incremental updates, or add-only modes
  • Real-time Ingestion: Stream text content directly into your vector store
  • Metadata Preservation: Maintain document context and metadata throughout the pipeline
  • Cross-Platform: Works on Windows, macOS, and Linux with .NET 8.0+

🎯 Quick Start

Installation

dotnet add package RAGamuffin

Basic Usage

using RAGamuffin.Builders;
using RAGamuffin.Core;
using RAGamuffin.Embedding;
using RAGamuffin.Enums;

// 1. Set up your embedding model (download from HuggingFace)
var embedder = new OnnxEmbedder("path/to/model.onnx", "path/to/tokenizer.json");

// 2. Configure your vector database
var vectorDb = new SqliteDatabaseModel("documents.db", "my_collection");

// 3. Build and train your pipeline
var pipeline = new IngestionTrainingBuilder()
    .WithEmbeddingModel(embedder)
    .WithVectorDatabase(vectorDb)
    .WithTrainingStrategy(TrainingStrategy.RetrainFromScratch)
    .WithTrainingFiles(new[] { "document.pdf" })
    .Build();

var ingestedItems = await pipeline.Train();

// 4. Search your documents
string[] results = await pipeline.SearchAndReturnTexts("What is the company policy?", 5);

Real-time Text Ingestion

// Stream text content directly into your vector store
var textItems = new[]
{
    new TextItem("Meeting notes from Q1", "Q1 was successful with 15% growth..."),
    new TextItem("Product roadmap", "Next quarter we'll launch feature X...")
};

var (ingestedItems, model) = await pipeline.TrainWithText(textItems);

Search Existing Vector Store

// Search without retraining
var vectorStore = new SqliteVectorStoreProvider("documents.db", "my_collection");
var searchResults = await vectorStore.SearchAsync("your query", embedder, 5);

// Get metadata
var metadata = await vectorStore.GetAllDocumentsMetadataAsync();

πŸ“š Examples

Check out the comprehensive examples in the Examples/ directory:

πŸ”§ Configuration

Embedding Models

RAGamuffin supports ONNX models for cross-platform compatibility. Recommended starter model:

  • Model: all-mpnet-base-v2 from HuggingFace
  • Download: Model | Tokenizer

Training Strategies

  • RetrainFromScratch: Drop all existing data and retrain
  • IncrementalAdd: Add new documents (skip if exists)
  • IncrementalUpdate: Add new documents and update existing ones
  • ProcessOnly: Only process documents, no vector operations

Chunking Options

// PDF processing options
.WithPdfOptions(new PdfHybridParagraphIngestionOptions
{
    MinSize = 0,        // Minimum chunk size
    MaxSize = 800,      // Maximum chunk size
    Overlap = 400,      // Overlap between chunks
    UseMetadata = true  // Include document metadata
})

// Text processing options
.WithTextOptions(new TextHybridParagraphIngestionOptions
{
    MinSize = 500,      // Minimum chunk size
    MaxSize = 800,      // Maximum chunk size
    Overlap = 400,      // Overlap between chunks
    UseMetadata = true  // Include document metadata
})

πŸ—οΈ Architecture

RAGamuffin is built with a modular architecture:

  • Abstractions: Clean interfaces for embedding, ingestion, and vector storage
  • Core: Main pipeline logic and data models
  • Embedding: ONNX-based embedding providers
  • Ingestion: PDF and text processing engines
  • VectorStores: SQLite vector database implementation
  • Builders: Fluent API for pipeline configuration

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

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


RAGamuffin - Making RAG pipelines simple and accessible for .NET developers.

ai
chunking
document-processing
dotnet
embedding-models
fluent-api
local-ai
metadata
ml
nlp
offline-ai
onnx
pdf-processing
privacy-focused
rag
retrieval-augmented-generation
semantic-search
sqlite
vector-database
vector-search

jonathanfavorite/RAGamuffin

A lightweight, cross-platform .NET library for building RAG (Retrieval-Augmented Generation) pipelines with local embedding models and SQLite vector storage. Perfect for developers who need privacy-focused, offline-capable document search and AI-powered question answering without external API dependencies.

C#

3

30 commits

updated Jul 8, 2025

See the code

README

RAGamuffin Banner

NuGet Version Build Status MIT License

A lightweight, cross-platform .NET library for building RAG (Retrieval-Augmented Generation) pipelines with local embedding models and SQLite vector storage.

πŸš€ Features

  • Local Embedding Models: Use ONNX models for offline, privacy-focused embeddings
  • SQLite Vector Storage: Lightweight, file-based vector database with no external dependencies
  • Multi-Format Support: Process PDFs and text files with intelligent chunking
  • Flexible Training Strategies: Retrain from scratch, incremental updates, or add-only modes
  • Real-time Ingestion: Stream text content directly into your vector store
  • Metadata Preservation: Maintain document context and metadata throughout the pipeline
  • Cross-Platform: Works on Windows, macOS, and Linux with .NET 8.0+

🎯 Quick Start

Installation

dotnet add package RAGamuffin

Basic Usage

using RAGamuffin.Builders;
using RAGamuffin.Core;
using RAGamuffin.Embedding;
using RAGamuffin.Enums;

// 1. Set up your embedding model (download from HuggingFace)
var embedder = new OnnxEmbedder("path/to/model.onnx", "path/to/tokenizer.json");

// 2. Configure your vector database
var vectorDb = new SqliteDatabaseModel("documents.db", "my_collection");

// 3. Build and train your pipeline
var pipeline = new IngestionTrainingBuilder()
    .WithEmbeddingModel(embedder)
    .WithVectorDatabase(vectorDb)
    .WithTrainingStrategy(TrainingStrategy.RetrainFromScratch)
    .WithTrainingFiles(new[] { "document.pdf" })
    .Build();

var ingestedItems = await pipeline.Train();

// 4. Search your documents
string[] results = await pipeline.SearchAndReturnTexts("What is the company policy?", 5);

Real-time Text Ingestion

// Stream text content directly into your vector store
var textItems = new[]
{
    new TextItem("Meeting notes from Q1", "Q1 was successful with 15% growth..."),
    new TextItem("Product roadmap", "Next quarter we'll launch feature X...")
};

var (ingestedItems, model) = await pipeline.TrainWithText(textItems);

Search Existing Vector Store

// Search without retraining
var vectorStore = new SqliteVectorStoreProvider("documents.db", "my_collection");
var searchResults = await vectorStore.SearchAsync("your query", embedder, 5);

// Get metadata
var metadata = await vectorStore.GetAllDocumentsMetadataAsync();

πŸ“š Examples

Check out the comprehensive examples in the Examples/ directory:

πŸ”§ Configuration

Embedding Models

RAGamuffin supports ONNX models for cross-platform compatibility. Recommended starter model:

  • Model: all-mpnet-base-v2 from HuggingFace
  • Download: Model | Tokenizer

Training Strategies

  • RetrainFromScratch: Drop all existing data and retrain
  • IncrementalAdd: Add new documents (skip if exists)
  • IncrementalUpdate: Add new documents and update existing ones
  • ProcessOnly: Only process documents, no vector operations

Chunking Options

// PDF processing options
.WithPdfOptions(new PdfHybridParagraphIngestionOptions
{
    MinSize = 0,        // Minimum chunk size
    MaxSize = 800,      // Maximum chunk size
    Overlap = 400,      // Overlap between chunks
    UseMetadata = true  // Include document metadata
})

// Text processing options
.WithTextOptions(new TextHybridParagraphIngestionOptions
{
    MinSize = 500,      // Minimum chunk size
    MaxSize = 800,      // Maximum chunk size
    Overlap = 400,      // Overlap between chunks
    UseMetadata = true  // Include document metadata
})

πŸ—οΈ Architecture

RAGamuffin is built with a modular architecture:

  • Abstractions: Clean interfaces for embedding, ingestion, and vector storage
  • Core: Main pipeline logic and data models
  • Embedding: ONNX-based embedding providers
  • Ingestion: PDF and text processing engines
  • VectorStores: SQLite vector database implementation
  • Builders: Fluent API for pipeline configuration

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

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


RAGamuffin - Making RAG pipelines simple and accessible for .NET developers.

ai
chunking
document-processing
dotnet
embedding-models
fluent-api
local-ai
metadata
ml
nlp
offline-ai
onnx
pdf-processing
privacy-focused
rag
retrieval-augmented-generation
semantic-search
sqlite
vector-database
vector-search

Languages

C#

100.0%