Skip to main content

Prerequisites

Before installing Mini RAG, ensure you have:

Python >= 3.11

Mini RAG requires Python 3.11 or higher

OpenAI API Key

For embeddings and LLM generation (or compatible API)

Milvus Instance

Local or cloud instance for vector storage

Package Manager

uv (recommended), pip, or poetry

Install Mini RAG

uv is a fast Python package installer and resolver:
uv add mini-rag

Using pip

pip install mini-rag

Using poetry

poetry add mini-rag

Install from Source

For development or to use the latest features:
# Clone the repository
git clone https://github.com/vivek12345/mini-rag.git
cd mini-rag

# Install dependencies
uv sync

Dependencies

Mini RAG automatically installs the following dependencies:
PackageVersionPurpose
chonkie>=1.4.1Smart text chunking with multiple strategies
cohere>=5.0.0Cohere API for advanced re-ranking
markitdown>=0.1.3Multi-format document loading (PDF, DOCX, images)
pydantic>=2.12.4Data validation and settings management
pymilvus>=2.5.0Vector database client for similarity search
python-dotenv>=1.2.1Environment variable management
sentence-transformers>=2.2.0Local cross-encoder models for re-ranking
langfuse>=2.0.0Observability and tracing
openai>=1.0.0OpenAI API client for embeddings and LLMs

Set Up Milvus

Mini RAG uses Milvus as its vector database. Choose one of these options: The easiest way to get started with Milvus:
1

Sign Up

Create a free account at cloud.zilliz.com
2

Create Cluster

Create a new cluster (free tier available)
3

Get Credentials

Copy your cluster URI and API token
4

Add to .env

Add credentials to your .env file

Option 2: Local Milvus with Docker

Run Milvus locally using Docker:
# Download docker-compose configuration
wget https://github.com/milvus-io/milvus/releases/download/v2.3.0/milvus-standalone-docker-compose.yml -O docker-compose.yml

# Start Milvus
docker-compose up -d

# Your Milvus instance will be available at:
# URI: http://localhost:19530
For local Milvus, you don’t need a token. Just set MILVUS_URI=http://localhost:19530

Option 3: Milvus on Kubernetes

For production deployments, see the Milvus Kubernetes documentation.

Configure Environment Variables

Create a .env file in your project root:
.env
# ============================================
# OpenAI Configuration (Required)
# ============================================
OPENAI_API_KEY=sk-your-api-key-here
OPENAI_BASE_URL=https://api.openai.com/v1  # Optional
EMBEDDING_MODEL=text-embedding-3-small

# ============================================
# Milvus Configuration (Required)
# ============================================
MILVUS_URI=https://your-milvus-instance.com
MILVUS_TOKEN=your-milvus-token

# ============================================
# Optional: Cohere (for Cohere re-ranking)
# ============================================
COHERE_API_KEY=your-cohere-api-key

# ============================================
# Optional: Langfuse (for observability)
# ============================================
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_HOST=https://cloud.langfuse.com
If you’re using Azure OpenAI, configure your environment like this:
OPENAI_API_KEY=your-azure-api-key
OPENAI_BASE_URL=https://your-resource.openai.azure.com/openai/deployments/your-deployment
EMBEDDING_MODEL=text-embedding-ada-002
Mini RAG works with any OpenAI-compatible API (e.g., llama.cpp, Ollama):
OPENAI_API_KEY=not-needed
OPENAI_BASE_URL=http://localhost:8080/v1
EMBEDDING_MODEL=your-model-name

Verify Installation

Test that Mini RAG is installed correctly:
test_installation.py
from mini import AgenticRAG, EmbeddingModel, VectorStore

print("✅ Mini RAG imported successfully!")
print(f"📦 Version: {AgenticRAG.__module__}")
Run the test:
python test_installation.py

Troubleshooting

Solution: Ensure Mini RAG is installed in your current Python environment:
pip list | grep mini-rag
If not listed, reinstall:
pip install mini-rag
Solution: Check your Milvus configuration:
  1. Verify MILVUS_URI is correct
  2. Ensure Milvus is running (if using Docker: docker ps)
  3. Check network connectivity
  4. Verify token/credentials are correct
Solution: Verify your API key:
  1. Check OPENAI_API_KEY is set correctly
  2. Ensure key has not expired
  3. Verify key has required permissions
  4. Test key with a simple OpenAI API call
Solution: Mini RAG requires Python 3.11+:
python --version
If you need to upgrade, use pyenv or download from python.org.
Solution: Create a fresh virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install mini-rag

Optional: Install Development Tools

If you’re planning to contribute or develop with Mini RAG:
# Clone repository
git clone https://github.com/vivek12345/mini-rag.git
cd mini-rag

# Install with development dependencies
uv sync --all-extras

# Install pre-commit hooks (optional)
pre-commit install

Next Steps

Getting Help