LightRAG/docs
2025-12-04 19:09:08 +08:00
..
archives docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
diff_hku Add logs for recent actions and decisions regarding upstream changes 2025-12-04 18:28:44 +08:00
0001-quick-start.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
0002-architecture-overview.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
0003-api-reference.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
0004-storage-backends.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
0005-llm-integration.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
0006-deployment-guide.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
0007-configuration-reference.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
0008-multi-tenancy.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
DockerDeployment.md Improve Docker build workflow with automated multi-arch script and docs 2025-12-04 19:09:08 +08:00
OfflineDeployment.md Change default docker image to offline version 2025-12-04 19:08:59 +08:00
README.md docs: Enterprise Edition & Multi-tenancy attribution (#5) 2025-12-04 18:09:15 +08:00
UV_LOCK_GUIDE.md Migrate Dockerfile from pip to uv package manager for faster builds 2025-12-04 19:08:59 +08:00

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

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

Original Project


Document Index

  1. Quick Start Guide

    • Installation options
    • Python SDK basics
    • REST API basics
    • Common patterns
  2. Architecture Overview

    • System design diagrams
    • Core concepts (entities, relations, chunks)
    • Data flow pipeline
    • Query execution flow
  3. API Reference

    • Document endpoints
    • Query endpoints
    • Graph endpoints
    • Admin endpoints
  4. Storage Backends

    • KV storage options
    • Vector storage options
    • Graph storage options
    • Configuration tables
  5. LLM Integration

    • Provider configurations
    • Embedding models
    • Reranking options
    • Custom implementations
  6. Deployment Guide

    • Local development
    • Docker deployment
    • Kubernetes/Helm
    • Production best practices
  7. Configuration Reference

    • Environment variables
    • CLI arguments
    • QueryParam options
    • Complete .env example
  8. Multi-Tenancy Guide

    • Tenant isolation
    • RBAC roles/permissions
    • TenantRAGManager
    • API endpoints

Original LightRAG built with ❤️ by HKUDS

Enterprise Edition maintained by Raphaël MANSUY @ Elitizon