能力标签
LightRAG AI技能包
🛠
AI工具

LightRAG AI技能包

基于 Python · 开源免费,本地部署,数据完全自主可控
英文名:LightRAG
⭐ 35.2k Stars 🍴 5.0k Forks 💻 Python 📄 MIT 🏷 AI 8.2分
8.2AI 综合评分
RAG系统知识图谱检索增强生成LLM应用开源框架
✦ AI Skill Hub 推荐

LightRAG AI技能包 是 AI Skill Hub 本期精选AI工具之一。在 GitHub 上收获超过 35.2k 颗 Star,综合评分 8.2 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。

📚 深度解析

LightRAG AI技能包 是一款基于 Python 的开源工具,在 GitHub 上收获 35k+ Star,是RAG系统、知识图谱、检索增强生成、LLM应用领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
LightRAG AI技能包 依赖 Python 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 Python 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 LightRAG AI技能包 的版本更新,及时通知重要功能变化。

📋 工具概览

EMNLP2025论文开源实现,提供简洁高效的检索增强生成系统。相比GraphRAG更轻量,支持知识图谱集成,适合开发者快速构建AI问答和内容生成应用,降低企业知识库的AI化成本。

LightRAG AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG系统、知识图谱、检索增强生成 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 35.2k
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
活跃维护,更新频繁
开源协议
MIT
AI 综合评分
8.2 分
工具类型
AI工具
Forks
5.0k

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

EMNLP2025论文开源实现,提供简洁高效的检索增强生成系统。相比GraphRAG更轻量,支持知识图谱集成,适合开发者快速构建AI问答和内容生成应用,降低企业知识库的AI化成本。

LightRAG AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG系统、知识图谱、检索增强生成 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一: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('安装成功')"
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 命令行使用
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"
📑 README 深度解析 真实文档 完整度 79/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

LightRAG Logo

About LightRAG

Features & Advantages

  • Deep Contextual Understanding: Through graph-structured indexing, LightRAG captures complex semantic dependencies between entities, overcoming the fragmented context limitations typical of traditional chunk-based retrieval methods. Its generation quality and context awareness are particularly outstanding in vertical domains (e.g., legal, financial) that require global comprehension or logical reasoning.
  • Exceptional Comprehensiveness & Diversity: LightRAG’s dual-level retrieval mechanism allows it to integrate detailed facts and abstract concepts concurrently. This enables the system to achieve remarkable performance in query result comprehensiveness and diversity, making it highly effective at handling complex, cross-document queries.
  • Extreme Retrieval Efficiency & Low Cost: LightRAG does not rely on inefficient community reports or multi-hop reasoning for complex queries. This drastically reduces the number of LLM calls required during both the indexing and querying phases, significantly lowering response latency and LLM computational costs.
  • Rapid Adaptation to Dynamic Data: LightRAG supports seamless, incremental knowledge base updates. New data only needs to go through a standard graph indexing pipeline to generate a local graph, which is then directly integrated into the existing graph via set merging. This process eliminates the need to disrupt the original structure or rebuild the global index, ensuring real-time relevance in dynamic data environments. When deleting documents, the system leverages LLM caching from the construction phase to rapidly rebuild affected entity relationships, vastly improving knowledge base update efficiency.

compatibility; set WHITELIST_PATHS=/health to require auth on them too.

lightrag-server


* Installation from Source
bash git clone https://github.com/HKUDS/LightRAG.git cd LightRAG

Installation

💡 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.

Install LightRAG Server

  • Install from PyPI

```bash

pip install "lightrag-hku[api]"

Build front-end artifacts

cd lightrag_webui bun install --frozen-lockfile bun run build cd ..

Setup env file

make dev installs the test toolchain plus the full offline stack

(API, storage backends, and provider integrations), then builds the frontend.

Or using pip with virtual environment

pip install -e ".[test,offline]"

Build front-end artifacts

cd lightrag_webui bun install --frozen-lockfile bun run build cd ..

setup env file

make env-base # Or: cp env.example .env and update it manually

Create .env File With Setup Tool

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.

Install LightRAG SDK

  • Install from source code

```bash cd LightRAG

或: pip install -e .


* Install from PyPI
bash uv pip install lightrag-hku

或: pip install lightrag-hku

```

Obtain the env.example file by downloading it from the GitHub repository root

Run make env-base or copy env.example to .env before starting the server.

Key Configuration Guide

**Notes on SDK Usage**

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.

you should run the demo code with project folder

cd LightRAG

download the demo document of "A Christmas Carol" by Charles Dickens

curl https://raw.githubusercontent.com/gusye1234/nano-graphrag/main/tests/mock_data.txt > ./book.txt

run the demo code

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.

python -m venv .venv

source .venv/bin/activate # Windows: .venv\Scripts\activate

SECURITY: before exposing it on a network, configure authentication in .env

Or on Windows: .venv\Scripts\activate

Note: uv sync automatically creates a virtual environment in .venv/

uv sync --extra test --extra offline source .venv/bin/activate # Activate the virtual environment (Linux/macOS)

Or on Windows: .venv\Scripts\activate

python -m venv .venv

source .venv/bin/activate # Windows: .venv\Scripts\activate

modify LLM and Embedding settings in .env

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.

Document Processing Pipeline Configuration

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

Sample Configuration

MAX_ASYNC_LLM=8 MAX_PARALLEL_INSERT=3 EMBEDDING_FUNC_MAX_ASYNC=16 EMBEDDING_BATCH_NUM=32 ```

Other Important Configurations for Document Processing

During the document insertion stage, you may also want to adjust the following environment variables based on your needs:

  • SUMMARY_LANGUAGE: Controls the language used by the LLM when outputting entity-relation names and summaries, e.g., Chinese, English.
  • ENTITY_EXTRACTION_USE_JSON: Controls whether the LLM outputs entity-relation extractions in JSON format. Using JSON format typically yields more stable results, but it consumes more tokens and can be slightly slower.
  • ENABLE_CONTENT_HEADINGS: Controls whether the section heading information of a text chunk is sent to the LLM during the query stage (enabled by default, providing more context for the LLM).
  • FORCE_LLM_SUMMARY_ON_MERGE / MAX_SOURCE_IDS_PER_RELATION: Controls the maximum number of text chunks an entity/relation can be associated with.
  • SOURCE_IDS_LIMIT_METHOD: Controls whether to keep updating the entity/relation description once an 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).
  • DEFAULT_MAX_FILE_PATHS: Controls the maximum number of source files an entity/relation can be associated with; once this limit is exceeded, new file names are no longer written to the vector storage.
  • OPENAI_LLM_MAX_TOKENS / OPENAI_LLM_MAX_COMPLETION_TOKENS: Set a max output token limit to prevent endless output from certain LLMs, which may trigger timeout errors during entity and relation extraction. Different LLM providers require distinct parameter configurations, as detailed in the env.example.

Other Important Configurations for Document Querying

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 会自动在 .venv/ 目录创建虚拟环境

uv sync source .venv/bin/activate # 激活虚拟环境 (Linux/macOS)

Windows 系统: .venv\Scripts\activate

Launch the server. It binds to all interfaces (0.0.0.0) by default.

(LIGHTRAG_API_KEY, or AUTH_ACCOUNTS together with TOKEN_SECRET), or bind to

127.0.0.1 for local-only access; without auth every endpoint is public.

Note: the Ollama-compatible /api/* routes stay open by default for client

Launch API-WebUI server

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

LightRAG API Server

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.

iShot_2025-03-23_12.40.08

Using LightRAG As SDK

⚠️ 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.

LightRAG SDK Sample Code

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

provide your API-KEY for OpenAI

export OPENAI_API_KEY="sk-...your_opeai_key..."

🇨🇳 中文文档镜像 AI 翻译 2026-06-01
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

LightRAG 是一个先进的检索增强生成(RAG)框架,旨在通过结合知识图谱技术提升问答质量。本项目不仅支持高效的文档索引,还提供了直观的 Web UI 用于知识图谱的探索与交互,是构建智能化知识库系统的理想选择。

⚡ 功能介绍

LightRAG 提供了丰富的进阶功能,包括 Token 使用量追踪、知识图谱数据导出以及 LLM 缓存管理。此外,它还集成了 Langfuse 用于可观测性分析,并支持基于 RAGAS 的评估框架,帮助开发者全面监控和优化 RAG 系统的性能。

📋 环境依赖

由于 LightRAG 需要 LLM 执行复杂的实体关系提取任务,其对大语言模型(LLM)的能力要求显著高于传统 RAG 系统。开发者需确保配置了具备强大推理能力的 LLM 以及高性能的 Embedding 模型,以保证知识图谱构建的准确性。

🛠 安装步骤(Docker/pip/源码)

推荐使用 uv 进行快速、可靠的包管理。你可以通过 `uv tool install "lightrag-hku[api]"` 安装 LightRAG Server。此外,项目也支持通过 PyPI 安装,或者使用 Docker Compose 进行容器化部署,以实现更便捷的环境隔离与运行。

🚀 使用教程

在使用前,请先从 GitHub 下载 `env.example` 文件并将其重命名为 `.env`。在启动服务前,务必根据你的 LLM 和 Embedding 配置更新 `.env` 文件中的相关参数,确保环境配置正确。

⚙️ 配置说明(含 MCP / env)

项目通过 `.env` 文件进行环境配置。在启动开发环境前,建议使用 `make dev` 进行初始化。若需使用 OpenAI 服务,请确保在环境变量中正确设置 `OPENAI_API_KEY`。对于 Docker 用户,请在克隆仓库后通过 `cp env.example .env` 完成配置。

🔌 API 说明

LightRAG Server 提供 Web UI 界面用于文档索引和知识图谱探索,并提供标准的 API 支持。特别地,它提供了兼容 Ollama 的接口,能够模拟为 Ollama chat 模型,从而让 Open WebUI 等 AI 聊天机器人能够无缝接入 LightRAG 能力。

🎯 aiskill88 AI 点评 A 级 2026-05-22

EMNLP顶会论文实现,简洁优雅的RAG架构设计。相比复杂系统更易部署,兼顾性能与实用性,适合中小团队快速迭代。活跃维护,工程质量可靠。

📚 实用指南(长尾问题)
适合谁
  • 构建企业知识库 / RAG 检索应用的团队
最佳实践
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • 分块大小建议 256-512 tokens,向量库优选 pgvector 或 Qdrant
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • embedding 模型与查询模型不一致导致检索失效
  • 显存不足直接 OOM — 优先降低 context 或换更小的量化模型
  • Python 依赖冲突:建议用 venv / uv 隔离环境
部署方案
  • Docker:LightRAG 提供官方镜像,docker compose up 一键启动
  • 本地部署:CPU 8GB 起,GPU 推荐 16GB+ 显存
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
LightRAG 中文教程LightRAG 安装报错怎么办LightRAG Docker 部署LightRAG 与同类工具对比LightRAG 最佳实践LightRAG 适合谁用

⚡ 核心功能

👥 适合谁
  • 构建企业知识库 / RAG 检索应用的团队
⭐ 最佳实践
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • 分块大小建议 256-512 tokens,向量库优选 pgvector 或 Qdrant
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • embedding 模型与查询模型不一致导致检索失效
  • 显存不足直接 OOM — 优先降低 context 或换更小的量化模型

👥 适合人群

AI 技术爱好者研究人员和学生开发者和工程师技术创业者

🎯 使用场景

  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发

⚖️ 优点与不足

✅ 优点
  • +GitHub 35.2k Star,社区高度认可
  • +MIT 协议,可免费商用
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐

📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

轻量级设计,部署和运维成本更低,速度更快,同时保持竞争力的效果。
💡 AI Skill Hub 点评

经综合评估,LightRAG AI技能包 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。

📚 深入学习 LightRAG 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
🔗 原始来源
🐙 GitHub 仓库  https://github.com/HKUDS/LightRAG 🌐 官方网站  https://arxiv.org/abs/2410.05779

收录时间:2026-05-14 · 更新时间:2026-05-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。

📺 订阅 AI Skill Hub Daily Telegram 频道
每天 8 条精选 AI Skill、MCP、Agent 与自动化工具推送
加入频道 →