| .. | ||
| archives | ||
| diff_hku | ||
| 0001-quick-start.md | ||
| 0002-architecture-overview.md | ||
| 0003-api-reference.md | ||
| 0004-storage-backends.md | ||
| 0005-llm-integration.md | ||
| 0006-deployment-guide.md | ||
| 0007-configuration-reference.md | ||
| 0008-multi-tenancy.md | ||
| DockerDeployment.md | ||
| FrontendBuildGuide.md | ||
| OfflineDeployment.md | ||
| README.md | ||
| UV_LOCK_GUIDE.md | ||
LightRAG Enterprise Documentation
Version 2.0.0-enterprise | Graph-Enhanced Retrieval-Augmented Generation
╔═══════════════════════════════════════════════════════════════════════════╗
║ ║
║ ██╗ ██╗ ██████╗ ██╗ ██╗████████╗██████╗ █████╗ ██████╗ ║
║ ██║ ██║██╔════╝ ██║ ██║╚══██╔══╝██╔══██╗██╔══██╗██╔════╝ ║
║ ██║ ██║██║ ███╗███████║ ██║ ██████╔╝███████║██║ ███╗ ║
║ ██║ ██║██║ ██║██╔══██║ ██║ ██╔══██╗██╔══██║██║ ██║ ║
║ ███████╗██║╚██████╔╝██║ ██║ ██║ ██║ ██║██║ ██║╚██████╔╝ ║
║ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ║
║ ║
║ ENTERPRISE EDITION ║
║ Simple and Fast Graph-Enhanced RAG System ║
║ ║
╚═══════════════════════════════════════════════════════════════════════════╝
🔱 Fork Project | This is an enterprise-ready fork of LightRAG by Raphaël MANSUY.
Goal: Create an enterprise-ready version of LightRAG with production-grade features.
First Enterprise Feature: ✅ Multi-tenancy support with RBAC, tenant isolation, and knowledge base management.
Documentation Overview
| Document | Description |
|---|---|
| Quick Start | Get up and running in 5 minutes |
| Architecture Overview | System design, data flow, and core concepts |
| API Reference | Complete REST API documentation |
| Storage Backends | Configure KV, vector, and graph storage |
| LLM Integration | LLM providers and embedding models |
| Deployment Guide | Docker, Kubernetes, and production setup |
| Configuration Reference | All environment variables and options |
| Multi-Tenancy | Tenant isolation and RBAC |
Quick Links
Getting Started
# Install
pip install lightrag-hku
# Start server
export OPENAI_API_KEY=sk-xxx
python -m lightrag.api.lightrag_server
Python Usage
from lightrag import LightRAG, QueryParam
rag = LightRAG(working_dir="./rag_storage")
await rag.ainsert("Your document text...")
result = await rag.aquery("Your question?", param=QueryParam(mode="hybrid"))
REST API
# Insert document
curl -X POST http://localhost:9621/documents/text \
-H "Content-Type: application/json" \
-d '{"text": "Document content..."}'
# Query
curl -X POST http://localhost:9621/query \
-H "Content-Type: application/json" \
-d '{"query": "Your question?", "mode": "hybrid"}'
Docker
docker run -p 9621:9621 -e OPENAI_API_KEY=sk-xxx ghcr.io/hkuds/lightrag:latest
System Overview
┌─────────────────────────────────────────────────────────────────────────────┐
│ LightRAG │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Documents ──▶ Chunking ──▶ Entity Extraction ──▶ Knowledge Graph │
│ │ │ │
│ ▼ ▼ │
│ Embeddings ──────────────────────▶ Hybrid Retrieval │
│ │ │
│ ▼ │
│ Query ──▶ LLM Generation ──▶ Response │
│ │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Storage Backends: │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ KV Storage │ │ Vector Store │ │ Graph Store │ │
│ │ JSON/Redis/ │ │ NanoVectorDB │ │ NetworkX/ │ │
│ │ PostgreSQL/ │ │ pgvector/ │ │ Neo4j/AGE/ │ │
│ │ MongoDB │ │ Milvus/FAISS │ │ Memgraph │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ LLM Providers: │
│ OpenAI │ Anthropic │ Ollama │ Azure │ Bedrock │ HuggingFace │ ... │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Query Modes
| Mode | Description | Best For |
|---|---|---|
naive |
Basic vector similarity search | Simple lookups |
local |
Entity-focused retrieval | Specific facts |
global |
High-level community summaries | Broad questions |
hybrid |
Combined local + global | Balanced queries |
mix |
Full KG + vector integration | Complex reasoning |
Deployment Options
| Option | Use Case | Guide |
|---|---|---|
| Local | Development | pip install lightrag-hku |
| Docker | Staging/Production | Docker Guide |
| Kubernetes | Production/Scale | K8s Guide |
Storage Topology
| Environment | KV | Vector | Graph |
|---|---|---|---|
| Development | JSON | NanoVectorDB | NetworkX |
| Production | PostgreSQL | pgvector | Neo4j |
| High-Scale | Redis | Milvus | Neo4j |
Configuration Quick Reference
Essential Environment Variables
# LLM
LLM_BINDING=openai
LLM_MODEL=gpt-4o-mini
OPENAI_API_KEY=sk-xxx
# Embedding
EMBEDDING_BINDING=openai
EMBEDDING_MODEL=text-embedding-ada-002
EMBEDDING_DIM=1536
# Storage
LIGHTRAG_KV_STORAGE=JsonKVStorage
LIGHTRAG_VECTOR_STORAGE=NanoVectorDBStorage
LIGHTRAG_GRAPH_STORAGE=NetworkXStorage
# Server
PORT=9621
See Configuration Reference for all options.
Feature Highlights
Knowledge Graph Integration
┌────────────────────────────────────────────────────┐
│ KNOWLEDGE GRAPH │
│ │
│ [Person: Einstein] ─────developed──────▶ │
│ │ │ │
│ born_in [Theory: │
│ │ Relativity] │
│ ▼ │ │
│ [Location: Germany] describes_│ │
│ ▼ │
│ [Concept: │
│ Spacetime] │
└────────────────────────────────────────────────────┘
Multi-Tenant Isolation
Tenant A Tenant B Tenant C
│ │ │
▼ ▼ ▼
┌────────┐ ┌────────┐ ┌────────┐
│ KB-1 │ │ KB-1 │ │ KB-1 │
│ KB-2 │ │ KB-2 │ └────────┘
│ KB-3 │ └────────┘
└────────┘
Resources
Enterprise Fork
- GitHub (Enterprise): https://github.com/raphaelmansuy/LightRAG
- Author: Raphaël MANSUY - Elitizon
- Issues: https://github.com/raphaelmansuy/LightRAG/issues
Original Project
- GitHub (Original): https://github.com/HKUDS/LightRAG
- PyPI: https://pypi.org/project/lightrag-hku/
Document Index
-
- Installation options
- Python SDK basics
- REST API basics
- Common patterns
-
- System design diagrams
- Core concepts (entities, relations, chunks)
- Data flow pipeline
- Query execution flow
-
- Document endpoints
- Query endpoints
- Graph endpoints
- Admin endpoints
-
- KV storage options
- Vector storage options
- Graph storage options
- Configuration tables
-
- Provider configurations
- Embedding models
- Reranking options
- Custom implementations
-
- Local development
- Docker deployment
- Kubernetes/Helm
- Production best practices
-
- Environment variables
- CLI arguments
- QueryParam options
- Complete .env example
-
- Tenant isolation
- RBAC roles/permissions
- TenantRAGManager
- API endpoints
Original LightRAG built with ❤️ by HKUDS
Enterprise Edition maintained by Raphaël MANSUY @ Elitizon