用途:LlamaIndex 是构建 RAG(检索增强生成)与 LLM 应用的数据框架,覆盖数据接入、索引和检索,主要用 Python 编写。
主要能力:支持 RAG;提供 300+ 数据连接器;多种索引类型;查询与聊天引擎;多种向量存储集成;智能体框架。数据加载可用 SimpleDirectoryReader 按目录或文件读取,也支持自定义连接器返回 Document 列表。可配置全局 Settings(LLM、嵌入模型、chunk_size、chunk_overlap)。检索侧支持元数据过滤、重排序、混合检索与查询融合。
安装:pip install llama-index;可选 pip install llama-index-llms-openai、pip install llama-index-embeddings-openai、pip install llama-index-core、pip install llama-index-vector-stores-chroma、pip install llama-index-vector-stores-pinecone、pip install llama-index-vector-stores-qdrant。当前稳定版为 v0.14.x,导入路径统一在 llama_index.core 下。
用法要点:典型流程为加载文档、建立 VectorStoreIndex、调用 as_query_engine 查询;可结合 StorageContext 持久化。分块建议 chunk_size 512-1024、重叠约 5-10%,并注意文档结构与元数据(source、page、section 等)。检索质量差时可提高 similarity_top_k 再加 reranker,并确保索引与查询使用同一嵌入模型、维度一致。常见问题包括块过小或过大、缺少重排序、内存不足(建议分批 insert_nodes)与嵌入维度不匹配。
适用场景:构建基于自有文档的问答、检索与聊天应用。
限制:上述资料未提供具体定价、效果承诺、支持平台清单或其他未提及的细节;文档还提及 references/retrieval.md、references/agents-workflows.md、references/evaluation-observability.md 等进阶主题按需加载。