lightrag-hku
LightRAG: Simple and Fast Retrieval-Augmented Generation
What it is and what it does
LightRAG is a Python framework for building retrieval-augmented generation (RAG) systems that combine knowledge graph extraction with semantic search. It ingests documents, extracts entities and relationships into a graph structure, and answers queries by retrieving relevant context from that graph and passing it to an LLM for synthesis. The package supports multiple storage backends (PostgreSQL, Neo4j, MongoDB, OpenSearch, nano-vectordb), multiple LLM providers (Google GenAI, OpenAI-compatible APIs), and multimodal document parsing (text, images, tables, PDFs).
The framework is designed for developers building question-answering systems, document analysis pipelines, or knowledge management applications. It handles chunking strategy selection, role-specific LLM configuration (separate models for extraction, querying, keyword generation, and vision tasks), reranking, and citation tracking. Installation is straightforward via pip, and a web UI and Docker Compose deployment option are available for rapid prototyping.
Use it for:
- Build a Q&A system over internal documentation or knowledge bases by ingesting PDFs and Office documents, then querying them with natural language.
- Extract structured knowledge graphs from unstructured text to support downstream analytics, recommendation, or compliance workflows.
- Deploy a multimodal RAG service that processes mixed document types (text, images, tables) and returns cited answers with source traceability.
- Evaluate RAG quality using integrated RAGAS evaluation and trace query execution with Langfuse for debugging and optimization.
- Run a local RAG server with Docker Compose using open-source LLMs (Qwen, Ollama) and PostgreSQL for air-gapped or privacy-sensitive environments.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
LightRAG is a retrieval-augmented generation framework that builds knowledge graphs from documents and answers queries by combining graph-based retrieval with LLM reasoning, supporting multiple storage backends and embedding providers.
Yes. LightRAG is actively maintained, has no known vulnerabilities, installs with low friction, and offers a mature feature set (knowledge graphs, multimodal parsing, multiple backends, evaluation integration). The MIT license is permissive. Install it if you need a production-ready RAG framework with flexibility in storage and LLM choice; skip it only if you need a simpler, lighter-weight alternative or have strict offline requirements without pre-configured backends.
Install
lightrag-hku on PyPI
pip
pip install lightrag-hkuuv
uv add lightrag-hkupoetry
poetry add lightrag-hkuInstalling lightrag-hku
Before you install
Low install friction with a wheel distribution. Active maintenance with a recent release (8 days old) and strong repository signals (38864 stars, last commit 2026-08-13). Requires Python >=3.10 and pulls in 19 runtime dependencies including aiohttp, pydantic, and google-genai, but all are standard packages.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects, with minimal restrictions beyond attribution.
Quickstart
pip install 'lightrag-hku[api]'
from lightrag import LightRAG
rag = LightRAG(working_dir="./rag_storage")
rag.insert("Your document text here")
result = rag.query("Your question here")
Requires Python >=3.10. LLM and embedding provider credentials (e.g., Google GenAI API key) must be configured via .env file before queries will work.
Verify before relying
- Whether the package works offline or requires live API calls to external LLM/embedding providers by default.
- Performance characteristics (latency, throughput) for typical document sizes and query patterns.
- Storage backend requirements and whether nano-vectordb is sufficient for production use or if PostgreSQL/Neo4j/MongoDB are recommended.
- Whether multimodal support (images, tables, equations) requires additional system dependencies beyond Python packages.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 19 — aiohttp, configparser, google-api-core, google-genai, json_repair, nano-vectordb, networkx, numpy, packaging, pandas, pipmaster, pydantic, pypinyin, PyYAML, python-dotenv, setuptools, tenacity, tiktoken, xlsxwriter |
| Maintenance | actively maintained — 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 277,360/month — #8,147 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lightrag_hku-1.5.6-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
graphragGraphRAG extracts structured knowledge graphs…
permissive · top 15,000 on PyPI
FlagEmbeddingFlagEmbedding provides embedding and reranking…
unclear · top 15,000 on PyPI
neo4j-graphragBuilds graph retrieval-augmented generation…
permissive · top 15,000 on PyPI
voyageaiProvides Python access to Voyage AI's embedding…
permissive · top 5,000 on PyPI
langchain-graph-retrieverRetrieves documents from a graph structure…
permissive · top 15,000 on PyPI
llama-index-coreLlamaIndex Core provides foundational…
permissive · top 5,000 on PyPI
langchain-chromaConnects LangChain applications to Chroma, a…
permissive · top 5,000 on PyPI
graph-retrieverCombines vector similarity search with graph…
permissive · top 15,000 on PyPI
llama-index-vector-stores-qdrantIntegrates Qdrant vector database with…
permissive · top 15,000 on PyPI
needle-pythonPython client library for the Needle API,…
permissive · top 15,000 on PyPI