跳转到内容

LlamaIndex 项目介绍

LlamaIndex 🦙 项目介绍

项目定位

LlamaIndex 是一个开源数据框架,用于将私有数据与 LLM 连接起来,构建 RAG(检索增强生成)和 Agent 应用。核心版本 v0.14.22(commit f027669)。

核心能力

  • 数据连接与摄入:支持 PDF、文档、SQL、API 等 300+ 数据源,通过 IngestionPipeline 实现加载 → 分块 → 嵌入 → 向量存储的自动化流水线
  • 多种索引类型:VectorStoreIndex(向量索引)、TreeIndex(树形索引)、KnowledgeGraph(知识图谱)、PropertyGraph(属性图)等
  • 高级检索系统:向量检索、融合检索、路由检索、自动合并检索、递归检索等多种策略,配合 LLM Rerank、Cross-Encoder Rerank 等后处理器
  • 事件驱动 Agent:基于 Workflow 引擎的 ReActAgent、FunctionAgent、CodeActAgent,支持多 Agent 编排与 handoff
  • 插件式架构:核心 + 集成包分离设计,300+ 集成包覆盖 LLM、向量存储、嵌入模型等
  • 可观测性:CallbackManager + Instrumentation 双层追踪系统,支持调试、日志与 OpenTelemetry

技术栈

维度选择
语言Python 3.10+
数据验证Pydantic v2
异步asyncio 原生,httpx + aiohttp
构建Hatchling
包管理uv
LLM 抽象统一 BaseLLM 接口 + 插件注册
工作流引擎llama-index-workflows(独立 PyPI 包,事件驱动状态机)

架构概览

快速体验

Terminal window
# 安装核心 + 所需集成
pip install llama-index-core
pip install llama-index-llms-openai
pip install llama-index-embeddings-huggingface
# 5 行代码构建 RAG
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader("your_data/").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("你的问题")

教程导读

本教程分为 AI 应用编程核心 两部分:

AI 应用教程(ai/

章节主题引用的 Common 教程
01RAG 核心链路:从数据到答案RAG 全链路管线
02高级检索器组合RAG 管线Chunking 策略
03事件驱动 Agent 循环事件驱动运行时工具调用协议
04多 Agent 编排与 Handoff多 Agent 路由
05工具调用与 Function Calling工具调用协议
06LLM 多模型适配多模型架构
07Agent 记忆与长期知识记忆系统长期记忆

编程核心教程(dev/

章节主题
01插件式架构:核心 + 集成包设计
02事件驱动工作流引擎架构
03TransformComponent 数据流水线模式
04存储抽象层:StorageContext 与多后端
05可观测性系统:Callback + Instrumentation
06Settings 单例与惰性加载模式
07构建与分发:Hatchling + uv + 300+ 包管理

14 篇技术章节(7 篇 AI + 7 篇 Dev),基于 v0.14.22 (commit f027669) 分析。