π Fully Offline | π’ Enterprise Ready | π§ Local AI | π Document Q&A
A secure, offline AI assistant that enables enterprises to query their internal documents using natural language. Built with clean architecture principles, RAG Box processes documents locally and provides intelligent answers without sending data to external services.
- π 100% Offline - No internet connection required after setup
- π Multi-format Support - PDF, DOCX, XLSX, CSV, TXT files
- π§ Local LLM Integration - Powered by Ollama for secure inference
- π Advanced RAG - Retrieval-Augmented Generation with vector search
- π― RAG Fusion - Multiple query variations for better accuracy
- π Auto-reindexing - File watcher detects changes automatically
- π¨ Multiple Interfaces - CLI, Streamlit UI, file watcher
- ποΈ Clean Architecture - Modular, testable, maintainable code
- Python 3.12+
- Poetry for dependency management
- Ollama for local LLM inference
- Pre-commit (optional, for development)
-
Clone the repository:
git clone https://github.com/galezra/ragbox.git cd ragbox
-
Install dependencies:
poetry install
-
Set up Ollama (if not already installed):
# Install Ollama (macOS/Linux) curl -fsSL https://ollama.ai/install.sh | sh # Pull a model (example: llama3) ollama pull llama3
-
Configure the system:
# Copy and edit configuration cp config/default.yaml config/local.yaml # Edit config/local.yaml with your preferred settings
Place your documents in the data/
directory:
mkdir -p data
cp /path/to/your/documents/* data/
# Start CLI chat
poetry run python -m src.interfaces.cli.run
# Or use the entry point
poetry run ragbox
# Launch Streamlit UI
poetry run python -m src.interfaces.streamlit_ui.run_streamlit
# Start file watcher in background
poetry run python -m src.interfaces.watcher.run_watcher start
RAG Box follows clean architecture principles with clear separation of concerns:
src/
βββ domain/ # Core business logic
βββ application/ # Use cases (ingest, answer, reindex)
βββ infrastructure/ # External systems (LLM, vector store, loaders)
βββ interfaces/ # Delivery mechanisms (CLI, UI, watcher)
- Document Processing - Multi-format loaders with metadata extraction
- Embedding System - Local sentence transformers for vector representations
- Vector Store - FAISS-based similarity search with persistence
- LLM Integration - Ollama client with streaming and error handling
- RAG Pipeline - Advanced retrieval with fusion and re-ranking
- Architecture Overview - Detailed system design
- Development Tasks - Implementation progress
- CLI Interface - Command line usage
- Streamlit UI - Web interface guide
- File Watcher - Auto-reindexing setup
The system uses YAML configuration files in the config/
directory:
# Example configuration
data_dir: "./data"
vector_store_dir: "./vector_store"
chunk_size: 1000
chunk_overlap: 200
# Embedding settings
embedding_model: "BAAI/bge-small-en-v1.5"
embedding_device: "cpu"
# LLM settings
llm_model: "llama3"
llm_temperature: 0.1
llm_max_tokens: 2048
# Install with dev dependencies
poetry install --with dev
# Install pre-commit hooks
pre-commit install
# Run tests
poetry run pytest
# Run linting
poetry run ruff check
poetry run mypy src/
This project uses:
- Ruff - Fast Python linter and formatter
- MyPy - Static type checking
- Pytest - Testing framework
- Pre-commit - Git hooks for quality checks
# Build image
docker build -t ragbox:latest .
# Run container
docker run -p 8501:8501 -v $(pwd)/data:/app/data ragbox:latest
- No External APIs - All processing happens locally
- No Data Leakage - Documents never leave your infrastructure
- Audit Trail - All interactions logged locally
- Configurable Logging - Control what gets logged
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Ollama for local LLM inference
- Powered by FAISS for vector search
- Uses Sentence Transformers for embeddings
- UI built with Streamlit
Made with β€οΈ for enterprises who value data privacy and security.