RAG framework for fast, simple retrieval-augmented generation
Top 2.4% on sourcepulse
LightRAG is a Python library designed for efficient and straightforward Retrieval-Augmented Generation (RAG). It aims to simplify the RAG pipeline for developers and researchers by offering flexible storage options, multiple retrieval modes, and easy integration with various LLM and embedding models. The library supports advanced features like knowledge graph integration, custom prompt engineering, and conversation history, enabling more sophisticated and context-aware AI applications.
How It Works
LightRAG employs a modular architecture that separates data indexing, retrieval, and generation. It supports hybrid search strategies combining vector similarity with knowledge graph traversal for richer context. The system allows users to inject custom LLM and embedding functions, offering compatibility with OpenAI-like APIs, Hugging Face models, and Ollama. Data can be stored in various backends, including simple JSON key-value stores, PostgreSQL (with pgvector and AGE), Neo4j, and Faiss, providing flexibility for different deployment needs.
Quick Start & Requirements
pip install "lightrag-hku[api]"
or pip install -e .
from source.OPENAI_API_KEY
environment variable. The demo downloads a document and runs a query. See examples/lightrag_openai_demo.py
.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
15 hours ago
1 day