Workspace sync: auto commit 2026-04-23 12:02:11

This commit is contained in:
2026-04-23 12:02:11 +08:00
parent 6a8362bb5a
commit c59cc07327
57 changed files with 3427 additions and 30 deletions

View File

@@ -0,0 +1,39 @@
---
title: "LangChain"
type: entity
tags: [llm, framework, python, rag, ai]
last_updated: 2025-01-16
---
## Definition
LangChain 是一个用于构建 LLM 应用的 Python/JavaScript 框架提供模块化组件抽象Document Loader、Text Splitter、Embedding、Vector Store、Retriever、Chain、PromptTemplate 等),大幅简化 RAG、Agent 等 LLM 应用的开发。
## Type
- **Category**: AI Framework / 开发框架
- **Website**: python.langchain.com
- **Language**: Python, JavaScript/TypeScript
## Core Components
1. **Document Loader**:从 160+ 不同来源(网页/PDF/Notion/Slack 等)加载文档
2. **Text Splitter**:将长文档切分为满足 Embedding Context Window 的小片段Split
3. **Embedding**:集成多种 Embedding ProviderBAAI/BGE、OpenAI、Cohere 等)
4. **Vector Store**集成多种向量数据库Qdrant、Pinecone、Chroma、FAISS 等)
5. **Retriever**:基于向量相似度的文档检索接口
6. **Chain**:将多个步骤串联执行的抽象,最关键的是 RAG ChainRetrievalQA Chain
7. **PromptTemplate**:将变量、上下文、用户问题组装为 LLM 输入 Prompt 的模板引擎
8. **Memory**:为 Agent 提供对话历史记忆能力
## Key Value
- **降低 RAG 开发门槛**:将 Indexing-Retrieval-Generation 三阶段封装为可复用的组件,开发者无需从零实现向量化和相似度检索
- **Chain 抽象**:通过 LCELLangChain Expression Language声明式组合各组件支持 RAG Chain、Conversation Chain 等开箱即用模式
- **工具生态**:与 LangSmith监控、LangServe部署构成完整应用生命周期支持
## In RAG Context
- [[rag从入门到精通系列1-基础rag]] 中作为核心工具链组件,负责 Indexing 阶段的文档加载/切分/向量化入库,以及 Retrieval + Generation 阶段的 Chain 编排
## Related Concepts
- [[RAG]] — LangChain 的核心应用场景
- [[Indexing]] — LangChain 封装的关键阶段
- [[Retrieval]] — LangChain 的 Retriever 组件
- [[Generation]] — LangChain 的 Chain + PromptTemplate 组件
- [[LlamaIndex]] — 同类竞品框架,各有侧重