LlamaIndex
定义
LlamaIndex focuses on connecting LLMs to your data: ingestion, indexing, and querying. It provides flexible RAG pipelines, multiple index types, and evaluation tools.
It complements LangChain: LlamaIndex emphasizes the data layer (documents, embeddings, vector stores, indexing strategies). 当…时使用 your priority is robust RAG over your own docs, APIs, or databases, with control over chunking, 检索, and synthesis. Also supports agents and query engines.
工作原理
从文档、API 或数据库加载数据到统一的文档格式。构建索引:向量索引(embeddings + vector store), keyword index, or hybrid; you choose node parsers (chunking), embedding model, and index type. Query engines run 检索 (optionally with reranking) and then synthesis (the LLM answers from retrieved nodes). You can customize retrievers, node parsers, and response synthesis (例如 tree summarization, simple concatenation). Evaluation tools (例如 faithfulness, relevance) help tune chunking and 检索 for production RAG. Agents can use LlamaIndex query engines as tools inside LangChain or native agent loops.
应用场景
LlamaIndex fits when you need flexible RAG indexing, query engines, and evaluation over your own data and APIs.
- RAG and document Q&A with flexible indexing and query engines
- Connecting LLMs to internal data (docs, APIs, databases)
- Evaluating and tuning 检索 and synthesis for production RAG