LightRAG AI技能包 是 AI Skill Hub 本期精选AI工具之一。在 GitHub 上收获超过 35.2k 颗 Star,综合评分 8.2 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
EMNLP2025论文开源实现,提供简洁高效的检索增强生成系统。相比GraphRAG更轻量,支持知识图谱集成,适合开发者快速构建AI问答和内容生成应用,降低企业知识库的AI化成本。
LightRAG AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG系统、知识图谱、检索增强生成 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
EMNLP2025论文开源实现,提供简洁高效的检索增强生成系统。相比GraphRAG更轻量,支持知识图谱集成,适合开发者快速构建AI问答和内容生成应用,降低企业知识库的AI化成本。
LightRAG AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG系统、知识图谱、检索增强生成 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install lightrag
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install lightrag
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/HKUDS/LightRAG
cd LightRAG
pip install -e .
# 验证安装
python -c "import lightrag; print('安装成功')"
# 命令行使用
lightrag --help
# 基本用法
lightrag input_file -o output_file
# Python 代码中调用
import lightrag
# 示例
result = lightrag.process("input")
print(result)
# lightrag 配置文件示例(config.yml) app: name: "lightrag" debug: false log_level: "INFO" # 运行时指定配置文件 lightrag --config config.yml # 或通过环境变量配置 export LIGHTRAG_API_KEY="your-key" export LIGHTRAG_OUTPUT_DIR="./output"
lightrag-server
* Installation from Source
bash git clone https://github.com/HKUDS/LightRAG.git cd LightRAG
💡 Using uv for Package Management: This project uses uv for fast and reliable Python package management. Install uv first: curl -LsSf https://astral.sh/uv/install.sh | sh (Unix/macOS) or powershell -c "irm https://astral.sh/uv/install.ps1 | iex" (Windows)
Note: You can also use pip if you prefer, but uv is recommended for better performance and more reliable dependency management. 📦 Offline Deployment: For offline or air-gapped environments, see the Offline Deployment Guide for instructions on pre-installing all dependencies and cache files.
```bash
uv tool install "lightrag-hku[api]"
cd lightrag_webui bun install --frozen-lockfile bun run build cd ..
cd lightrag_webui bun install --frozen-lockfile bun run build cd ..
make env-base # Or: cp env.example .env and update it manually
Instead of editing env.example by hand, use the interactive setup wizard to generate a configured .env and, when needed, docker-compose.final.yml:
make env-base # Required first step: LLM, embedding, reranker
make env-storage # Optional: storage backends and database services
make env-server # Optional: server port, auth, and SSL
make env-base-rewrite # Optional: force-regenerate wizard-managed compose services
make env-storage-rewrite # Optional: force-regenerate wizard-managed compose services
make env-security-check # Optional: audit the current .env for security risks
For full description of every target see docs/InteractiveSetup.md.
```bash cd LightRAG
* Install from PyPI
bash uv pip install lightrag-hku
```
For detailed instructions on using the SDK, please refer to docs/ProgramingWithCore.md. Some LightRAG features are not exposed via the REST API and are accessible only through the SDK. These features are typically experimental and may not be compatible with future versions.
cd LightRAG
curl https://raw.githubusercontent.com/gusye1234/nano-graphrag/main/tests/mock_data.txt > ./book.txt
python examples/lightrag_openai_demo.py ```
For a streaming response implementation example, please see examples/lightrag_openai_compatible_demo.py. Prior to execution, ensure you modify the sample code's LLM and embedding configurations accordingly.
Note 1: When running the demo program, please be aware that different test scripts may use different embedding models. If you switch to a different embedding model, you must clear the data directory (./dickens); otherwise, the program may encounter errors. If you wish to retain the LLM cache, you can preserve the kv_store_llm_response_cache.json file while clearing the data directory.
Note 2: Only lightrag_openai_demo.py and lightrag_openai_compatible_demo.py are officially supported sample codes. Other sample files are community contributions that haven't undergone full testing and optimization.
make dev source .venv/bin/activate # Activate the virtual environment (Linux/macOS)
uv sync --extra test --extra offline source .venv/bin/activate # Activate the virtual environment (Linux/macOS)
docker compose up ```
Historical versions of LightRAG docker images can be found here: [LightRAG Docker Images]( https://github.com/HKUDS/LightRAG/pkgs/container/lightrag) Official GHCR images published by GitHub Actions are signed with Sigstore Cosign using GitHub OIDC. See docs/DockerDeployment.md for verification commands.
The default pipeline configuration in LightRAG does not allow the system to perform at its best. The quality of document parsing greatly impacts document indexing and querying. Therefore, we recommend configuring the pipeline to enable the MinerU parsing engine and activating the pipeline's image analysis features. Suggested configuration:
LIGHTRAG_PARSER=*:native-iteP,*:mineru-iteP,*:legacy-R
VLM_PROCESS_ENABLE=true
VLM_LLM_MODEL=<your_vlm_model_name>
Since the cloud-based MinerU service has limitations on usage, file size, and page count, it is recommended to use a locally deployed MinerU. For details on configuring the file processing pipeline, please refer to FileProcessingPipeline.md
MAX_ASYNC_LLM=8 MAX_PARALLEL_INSERT=3 EMBEDDING_FUNC_MAX_ASYNC=16 EMBEDDING_BATCH_NUM=32 ```
During the document insertion stage, you may also want to adjust the following environment variables based on your needs:
Chinese, English.entity/relation can be associated with.entity/relation exceeds its associated text chunk limit (by default it stops updating, because at that point the entity-relation description is already rich enough and further updates add little value; skipping updates can greatly speed up knowledge base construction).entity/relation can be associated with; once this limit is exceeded, new file names are no longer written to the vector storage.env.example.During the document query stage, you may also want to adjust the following environment variables based on your needs: - MAX_ENTITY_TOKENS / MAX_RELATION_TOKENS / MAX_TOTAL_TOKENS: Controls the token length of the retrieved content sent to the LLM context. The retrieved content consists of three parts: entities, relations, and text chunks. The lengths of entities and relations can be controlled independently, while the text chunk length is determined by subtracting the entity and relation lengths from the total length. - ENABLE_CONTENT_HEADINGS: Controls whether the section heading where a text chunk resides is sent to the LLM; enabled by default, providing richer context for the LLM and improving answer quality. - ENABLE_LLM_CACHE: Whether to cache query results. Enabled by default; identical query questions, query modes, and LLM model parameters will return the same result.
uv sync source .venv/bin/activate # 激活虚拟环境 (Linux/macOS)
lightrag-server
* Launching the LightRAG Server with Docker Compose
bash git clone https://github.com/HKUDS/LightRAG.git cd LightRAG cp env.example .env # Update the .env with your LLM and embedding configurations
The LightRAG server offers not only a web-based UI for exploring LightRAG functionalities but also a comprehensive REST API. For more information about the LightRAG server, please refer to LightRAG Server.

⚠️ For integration into your project, we strongly recommend using the REST API provided by the LightRAG Server. The LightRAG SDK is primarily intended for embedded applications or academic research and evaluation purposes.
To get started with LightRAG core, refer to the sample codes available in the examples folder. Additionally, a video demo demonstration is provided to guide you through the local setup process. If you already possess an OpenAI API key, you can run the demo right away:
```bash
export OPENAI_API_KEY="sk-...your_opeai_key..."
LightRAG 是一个先进的检索增强生成(RAG)框架,旨在通过结合知识图谱技术提升问答质量。本项目不仅支持高效的文档索引,还提供了直观的 Web UI 用于知识图谱的探索与交互,是构建智能化知识库系统的理想选择。
LightRAG 提供了丰富的进阶功能,包括 Token 使用量追踪、知识图谱数据导出以及 LLM 缓存管理。此外,它还集成了 Langfuse 用于可观测性分析,并支持基于 RAGAS 的评估框架,帮助开发者全面监控和优化 RAG 系统的性能。
由于 LightRAG 需要 LLM 执行复杂的实体关系提取任务,其对大语言模型(LLM)的能力要求显著高于传统 RAG 系统。开发者需确保配置了具备强大推理能力的 LLM 以及高性能的 Embedding 模型,以保证知识图谱构建的准确性。
推荐使用 uv 进行快速、可靠的包管理。你可以通过 `uv tool install "lightrag-hku[api]"` 安装 LightRAG Server。此外,项目也支持通过 PyPI 安装,或者使用 Docker Compose 进行容器化部署,以实现更便捷的环境隔离与运行。
在使用前,请先从 GitHub 下载 `env.example` 文件并将其重命名为 `.env`。在启动服务前,务必根据你的 LLM 和 Embedding 配置更新 `.env` 文件中的相关参数,确保环境配置正确。
项目通过 `.env` 文件进行环境配置。在启动开发环境前,建议使用 `make dev` 进行初始化。若需使用 OpenAI 服务,请确保在环境变量中正确设置 `OPENAI_API_KEY`。对于 Docker 用户,请在克隆仓库后通过 `cp env.example .env` 完成配置。
LightRAG Server 提供 Web UI 界面用于文档索引和知识图谱探索,并提供标准的 API 支持。特别地,它提供了兼容 Ollama 的接口,能够模拟为 Ollama chat 模型,从而让 Open WebUI 等 AI 聊天机器人能够无缝接入 LightRAG 能力。
EMNLP顶会论文实现,简洁优雅的RAG架构设计。相比复杂系统更易部署,兼顾性能与实用性,适合中小团队快速迭代。活跃维护,工程质量可靠。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,LightRAG AI技能包 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | LightRAG |
| 原始描述 | 开源AI工具:EMNLP2025 "LightRAG: Simple and Fast Retrieval-Augmented Generation"。⭐35.2k · Python |
| Topics | RAG系统知识图谱检索增强生成LLM应用开源框架 |
| GitHub | https://github.com/HKUDS/LightRAG |
| License | MIT |
| 语言 | Python |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。