经 AI Skill Hub 精选评估,LEANN AI技能包 获评「强烈推荐」。在 GitHub 上收获超过 11.0k 颗 Star,这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.2 分,适合有一定技术背景的用户使用。
LEANN AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG、检索增强、向量数据库 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
LEANN AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG、检索增强、向量数据库 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install leann
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install leann
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/yichuan-w/LEANN
cd LEANN
pip install -e .
# 验证安装
python -c "import leann; print('安装成功')"
# 命令行使用
leann --help
# 基本用法
leann input_file -o output_file
# Python 代码中调用
import leann
# 示例
result = leann.process("input")
print(result)
# leann 配置文件示例(config.yml) app: name: "leann" debug: false log_level: "INFO" # 运行时指定配置文件 leann --config config.yml # 或通过环境变量配置 export LEANN_API_KEY="your-key" export LEANN_OUTPUT_DIR="./output"
<p align="center"> <img src="assets/logo-text.png" alt="LEANN Logo" width="400"> </p>
<p align="center"> <a href="https://trendshift.io/repositories/15049" target="_blank"> <img src="https://trendshift.io/api/badge/repositories/15049" alt="yichuan-w/LEANN | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/> </a> </p>
<p align="center"> <img src="https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue.svg" alt="Python Versions"> <img src="https://github.com/yichuan-w/LEANN/actions/workflows/build-and-publish.yml/badge.svg" alt="CI Status"> <img src="https://img.shields.io/badge/Platform-Ubuntu%20%26%20Arch%20%26%20WSL%20%7C%20macOS%20(ARM64%2FIntel)%20%7C%20Windows-lightgrey" alt="Platform"> <img src="https://img.shields.io/badge/License-MIT-green.svg" alt="MIT License"> <img src="https://img.shields.io/badge/MCP-Native%20Integration-blue" alt="MCP Integration"> <a href="https://join.slack.com/t/leann-e2u9779/shared_invite/zt-3ol2ww9ic-Eg_kB8omwe6xmYVd0epr4Q"> <img src="https://img.shields.io/badge/Slack-Join-4A154B?logo=slack&logoColor=white" alt="Join Slack"> </a>
</p>
We track zero telemetry. This survey is the ONLY way to tell us if you want
GPU Acceleration or More Integrations next.
👉 Click here to cast your vote (2 mins)
We'd love for you to be part of the LEANN community!
👉 Join LEANN Slack
If the invite link has expired or you have trouble joining, please open an issue and we'll help you get in!
LEANN is an innovative vector database that democratizes personal AI. Transform your laptop into a powerful RAG system that can index and search through millions of documents while using 97% less storage than traditional solutions without accuracy loss.
LEANN achieves this through graph-based selective recomputation with high-degree preserving pruning, computing embeddings on-demand instead of storing them all. Illustration Fig → | Paper →
Ready to RAG Everything? Transform your laptop into a personal AI assistant that can semantic search your file system, emails, browser history, chat history (WeChat, iMessage), agent memory (ChatGPT, Claude), live data (Slack, Twitter), codebase\* , or external knowledge bases (i.e., 60M documents) - all on your laptop, with zero cloud costs and complete privacy.
\* Claude Code only supports basic grep-style keyword search. LEANN is a drop-in semantic search MCP service fully compatible with Claude Code, unlocking intelligent retrieval without changing your workflow. 🔥 Check out the easy setup →
Install uv first if you don't have it. Typically, you can install it with:
curl -LsSf https://astral.sh/uv/install.sh | sh
vcpkg install zeromq:x64-windows openblas:x64-windows lapack:x64-windows ` boost-program-options:x64-windows protobuf:x64-windows
uv pip install colpali_engine pdf2image pillow matplotlib qwen_vl_utils einops seaborn brew install poppler # macOS only, for PDF processing
#### Build Indexbash python -m apps.colqwen_rag build \ --pdfs ./pdf_directory/ \ --index my_index \ --model colqwen2 # or colpali
#### Searchbash python -m apps.colqwen_rag search my_index "your question here" --top-k 5 ```
#### Models - ColQwen2 (colqwen2): Latest vision-language model with improved performance - ColPali (colpali): Proven multimodal retriever
For detailed usage, see the ColQwen Guide.
</details>
python -m apps.imessage_rag
Clone the repository to access all examples and try amazing applications,
git clone https://github.com/yichuan-w/LEANN.git leann
cd leann
and install LEANN from PyPI to run them immediately:
```bash uv venv source .venv/bin/activate uv pip install leann
choco install cmake swig pkgconfiglite nuget.commandline -y
builder = LeannBuilder(backend_name="hnsw") builder.add_text("LEANN saves 97% storage compared to traditional vector databases.") builder.add_text("Tung Tung Tung Sahur called—they need their banana‑crocodile hybrid back") builder.build_index(INDEX_PATH)
LEANN supports many LLM providers for text generation (HuggingFace, Ollama, Anthropic, and Any OpenAI compatible API).
<details> <summary><strong>🔑 OpenAI API Setup (Default)</strong></summary>
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY="your-api-key-here"
Make sure to use --llm openai flag when using the CLI. You can also specify the model name with --llm-model <model-name> flag.
</details>
<details> <summary><strong>🛠️ Supported LLM & Embedding Providers (via OpenAI Compatibility)</strong></summary>
Thanks to the widespread adoption of the OpenAI API format, LEANN is compatible out-of-the-box with a vast array of LLM and embedding providers. Simply set the OPENAI_BASE_URL and OPENAI_API_KEY environment variables to connect to your preferred service.
export OPENAI_API_KEY="xxx"
export OPENAI_BASE_URL="http://localhost:1234/v1" # base url of the provider
To use OpenAI compatible endpoint with the CLI interface:
If you are using it for text generation, make sure to use --llm openai flag and specify the model name with --llm-model <model-name> flag.
If you are using it for embedding, set the --embedding-mode openai flag and specify the model name with --embedding-model <MODEL>.
-----
Below is a list of base URLs for common providers to get you started.
curl -fsSL https://ollama.ai/install.sh | sh
--backend-name NAME # Backend to use: hnsw or diskann (default: hnsw) --graph-degree N # Graph degree for index construction (default: 32) --build-complexity N # Build complexity for index construction (default: 64) --compact / --no-compact # Use compact storage (default: true). Must be no-compact for no-recompute build. --recompute / --no-recompute # Enable/disable embedding recomputation (default: enabled). Should not do a no-recompute search in a recompute build. ```
</details>
python -m apps.colqwen_rag build --pdfs ./my_papers/ --index research_papers
uv tool install leann-core --with leann claude mcp add --scope user leann-server -- leann_mcp
``` Try our fully agentic pipeline with auto query rewriting, semantic search planning, and more:

🔥 Ready to supercharge your coding? Complete Setup Guide →
If you followed the Quick Start, leann is already installed in your virtual environment:
source .venv/bin/activate
leann --help
To make it globally available: ```bash
uv tool install leann-core --with leann
leann build my-docs --docs ./your_documents
leann watch my-docs
Our declarative API makes RAG as easy as writing a config file.
Check out demo.ipynb or
```python from leann import LeannBuilder, LeannSearcher, LeannChat from pathlib import Path INDEX_PATH = str(Path("./").resolve() / "demo.leann")
--index-dir DIR # Directory to store the index (default: current directory) --query "YOUR QUESTION" # Single query mode. Omit for interactive chat (type 'quit' to exit), and now you can play with your index interactively --max-items N # Limit data preprocessing (default: -1, process all data) --force-rebuild # Force rebuild index even if it exists
python -m apps.chatgpt_rag --export-path conversations.html
python -m apps.claude_rag --export-path my_claude_conversations.json
```bash
$env:CMAKE_PREFIX_PATH = "$env:VCPKG_ROOT\installed\x64-windows" $env:PKG_CONFIG_PATH = "$env:VCPKG_ROOT\installed\x64-windows\lib\pkgconfig" $env:PKG_CONFIG_EXECUTABLE = "C:\ProgramData\chocolatey\bin\pkg-config.exe" $env:OPENBLAS_LIB = "$env:VCPKG_ROOT\installed\x64-windows\lib\openblas.lib" $env:PATH += ";$env:VCPKG_ROOT\installed\x64-windows\bin" $env:PATH += ";$env:VCPKG_ROOT\installed\x64-windows\tools\protobuf"
uv sync --extra diskann ```
</details>
LEANN provides flexible parameters for embedding models, search strategies, and data processing to fit your specific needs.
📚 Need configuration best practices? Check our Configuration Guide for detailed optimization tips, model selection advice, and solutions to common issues like slow embeddings or poor search quality.
<details> <summary><strong>📋 Click to expand: Common Parameters (Available in All Examples)</strong></summary>
All RAG examples share these common parameters. Interactive mode is available in all examples - simply run without --query to start a continuous Q&A session where you can ask multiple questions. Type 'quit' to exit.
```bash
LEANN_EMBEDDING_DEVICE # GPU for embedding model (e.g., cuda:0, cuda:1, cpu) LEANN_LLM_DEVICE # GPU for HFChat LLM (e.g., cuda:1, or "cuda" for multi-GPU auto)
leann --help ```
Note: Global installation is required for Claude Code integration. Theleann_mcpserver depends on the globally availableleanncommand.
LEANN includes a powerful CLI for document processing and search. Perfect for quick document indexing and interactive chat.
```
</details>
Connect to live data sources through the Model Context Protocol (MCP). LEANN now supports real-time RAG on platforms like Slack, Twitter, and more through standardized MCP servers.
Key Benefits: - Live Data Access: Fetch real-time data without manual exports - Standardized Protocol: Use any MCP-compatible server - Easy Extension: Add new platforms with minimal code - Secure Access: MCP servers handle authentication
Transform your Slack workspace into a searchable knowledge base! Find discussions, decisions, and shared knowledge across all your channels.
```bash
<details> <summary><strong>AST‑Aware Code Chunking</strong></summary>
LEANN features intelligent code chunking that preserves semantic boundaries (functions, classes, methods) for Python, Java, C#, and TypeScript, improving code understanding compared to text-based chunking.
📖 Read the AST Chunking Guide →
</details>
The future of code assistance is here. Transform your development workflow with LEANN's native MCP integration for Claude Code. Index your entire codebase and get intelligent code assistance directly in your IDE.
Key features: - 🔍 Semantic code search across your entire project, fully local index and lightweight - 🧠 AST-aware chunking preserves code structure (functions, classes) - 📚 Context-aware assistance for debugging and development - 🚀 Zero-config setup with automatic language detection
```bash
| System | DPR (2.1M) | Wiki (60M) | Chat (400K) | Email (780K) | Browser (38K) |
|---|---|---|---|---|---|
| Traditional vector database (e.g., FAISS) | 3.8 GB | 201 GB | 1.8 GB | 2.4 GB | 130 MB |
| LEANN | 324 MB | 6 GB | 64 MB | 79 MB | 6.4 MB |
| Savings | 91% | 97% | 97% | 97% | 95% |
python -m apps.colqwen_rag ask research_papers --interactive
<details>
<summary><strong>📋 Click to expand: ColQwen Setup & Usage</strong></summary>
#### Prerequisitesbash
leann ask my-docs "Where are prompts configured?"
LEANN 是一个基于 AI 的文本处理框架,提供了高级文本分析和生成能力。它支持多种语言模型和搜索策略,能够处理大规模文本数据。
LEANN 提供了多种高级功能,包括详细的特性列表、文本分析和生成能力、支持多种语言模型和搜索策略等。
LEANN 需要安装 uv、C++ 依赖项(通过 vcpkg 安装)和其他依赖项(通过 pip 安装)。
LEANN 可以通过多种方式安装,包括从源码克隆、通过 pip 安装、通过 Docker 安装等。
LEANN 的使用教程包括如何使用 CLI、如何配置环境变量、如何使用 API 等。
LEANN 提供了多种配置选项,包括环境变量、MCP 集成、关键参数等。用户可以根据自己的需求进行配置。
LEANN 的 API 提供了多种功能,包括文本分析和生成能力、搜索策略等。用户可以通过 API 来调用这些功能。
LEANN 的工作流包括多种模块,包括文本分析和生成能力、搜索策略等。用户可以根据自己的需求来选择和配置这些模块。
LEANN 的 FAQ 提供了常见问题和答案,帮助用户解决问题。
LEANN在RAG领域创新显著,存储优化技术突出,11k星标认可度高。架构完整,易用性强,是现阶段值得关注的开源RAG框架。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:LEANN AI技能包 的核心功能完整,质量优秀。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | LEANN |
| 原始描述 | 开源AI工具:MLsys2026: RAG on Everything with LEANN. Enjoy 97% storage savings while running。⭐11.0k · Python |
| Topics | RAG检索增强向量数据库存储优化LangChain |
| GitHub | https://github.com/yichuan-w/LEANN |
| License | MIT |
| 语言 | Python |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。