Secure by default
API-key auth, rate limiting, a CORS allow-list, upload size and type checks, and zero secrets in source control.
A secure Retrieval-Augmented Generation service that connects unstructured company documents to LLMs, with tenant isolation, swappable providers and answers that cite their sources.
Two companies upload their own documents and ask the same question. Only the company that owns the answer gets it. Recorded against the engine running locally on Llama 3.2 via Ollama.
Most RAG tutorials wire an LLM straight to a vector store, with no auth, no tenant boundaries and API keys in the script. This is a small, honest reference implementation of the production version.
API-key auth, rate limiting, a CORS allow-list, upload size and type checks, and zero secrets in source control.
Every chunk carries a tenant_id, and retrieval is filtered by it, so one customer's documents never reach another's answers. API keys can be bound to the tenants they may use.
Swap OpenAI for Llama-3 (Groq or Together) or a free local model via Ollama, and Chroma for Pinecone, with one environment variable.
The model answers only from retrieved context and returns the source snippets, so claims can be checked.
A pytest suite covers auth enforcement and chunking, with CI and secret scanning on every push.
Docker and docker-compose included; local embeddings (MiniLM) mean no paid API is needed to start.
Ingestion and querying both pass through auth and rate limiting first.
Full request and response schemas, generated from the code on every deploy, are in the interactive API reference.
| Endpoint | What it does |
|---|---|
GET /health | Liveness check |
POST /ingest | Upload documents for a tenant; they are chunked, embedded and stored |
POST /query | Ask a question for a tenant; returns the answer and the source snippets it used |
This page and the API reference are static. To call the API, run the service locally:
git clone https://github.com/CyberAli-eng/enterprise-rag-engine.git cd enterprise-rag-engine cp .env.example .env # add your keys, or set LLM_PROVIDER=ollama docker compose up --build # API on http://localhost:8000, docs at /docs # free & local, no API key: Ollama + Llama 3.2 docker compose --profile local up --build
Built by Ali Khusroo Bin Sabir · MIT licensed