Skip to main content

Welcome to Mini RAG ๐Ÿš€

Mini RAG is a lightweight, modular, and production-ready Retrieval-Augmented Generation (RAG) library built with Python. Install with uv add mini-rag and start building intelligent document search and question-answering systems in minutes.

Key Features

๐Ÿค– Agentic RAG

Intelligent query processing with automatic query rewriting and result re-ranking

๐Ÿ“„ Multi-format Support

Load documents from PDF, DOCX, images, and more using MarkItDown

โœ‚๏ธ Smart Chunking

Advanced text chunking with Chonkie for optimal context preservation

๐Ÿ”ฎ Flexible Embeddings

Support for OpenAI, Azure OpenAI, and any OpenAI-compatible API

๐Ÿ’พ Vector Storage

Powered by Milvus for high-performance similarity search

๐ŸŽฏ Query Optimization

Automatic query rewriting for better retrieval results

๐Ÿ” Hybrid Search

Combine semantic (vector) and keyword (BM25) search

๐Ÿ“Š Multiple Re-ranking

Choose from Cohere API, local cross-encoders, or LLM-based re-ranking

๐Ÿ“ˆ Observability

Built-in Langfuse integration for tracing and monitoring

๐Ÿ”ง Modular Design

Use individual components or the complete RAG pipeline

Quick Start

Get started with Mini RAG in just 5 lines of code:
import os
from mini import AgenticRAG, EmbeddingModel, VectorStore

# Initialize
embedding_model = EmbeddingModel()
vector_store = VectorStore(
    uri=os.getenv("MILVUS_URI"),
    token=os.getenv("MILVUS_TOKEN"),
    collection_name="my_docs",
    dimension=1536
)
rag = AgenticRAG(vector_store=vector_store, embedding_model=embedding_model)

# Index a document
rag.index_document("path/to/document.pdf")

# Ask a question
response = rag.query("What is this document about?")
print(response.answer)

Why Mini RAG?

Mini RAG provides a clean, intuitive API that follows Python best practices. Get started with just a few lines of code.
Built with production use cases in mind, featuring error handling, retry logic, observability, and comprehensive configuration options.
Use individual components (loader, chunker, embeddings, vector store) or the complete RAG pipeline. Mix and match as needed.
Query rewriting, hybrid search, multiple re-ranking strategies, and observability built-inโ€”features that typically require custom implementation.
Support for multiple embedding providers, vector stores, and re-ranking methods. Easy to extend with custom implementations.

Architecture

Mini RAG follows a modular architecture that makes it easy to understand and customize:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      AgenticRAG System                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚                     โ”‚                     โ”‚
        โ–ผ                     โ–ผ                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ DocumentLoaderโ”‚    โ”‚   Chunker    โ”‚    โ”‚EmbeddingModelโ”‚
โ”‚  (MarkItDown) โ”‚โ”€โ”€โ”€โ–ถโ”‚  (Chonkie)   โ”‚โ”€โ”€โ”€โ–ถโ”‚   (OpenAI)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                 โ”‚
                                                 โ–ผ
                                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                        โ”‚ VectorStore  โ”‚
                                        โ”‚   (Milvus)   โ”‚
                                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Community & Support

Next Steps

1

Install Mini RAG

Follow the installation guide to set up Mini RAG
2

Complete Quick Start

Build your first RAG application with our quick start guide
3

Explore Features

Learn about advanced features like hybrid search and re-ranking
4

Check Examples

Browse practical examples for your use case