Auto-sync: update nexus workspace

This commit is contained in:
2026-04-28 07:26:52 +08:00
parent b83b4e3105
commit 3224ec4787
436 changed files with 17107 additions and 15920 deletions

View File

@@ -1,39 +1,48 @@
---
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]] — 同类竞品框架,各有侧重
---
title: "LangChain"
type: entity
tags: [LLM应用, RAG框架, Python]
sources: [rag从入门到精通系列1-基础rag]
last_updated: 2025-01-16
---
## Definition
LangChain 是一个用于构建 LLM 应用的 Python/JavaScript 开源框架提供文档加载、向量存储集成、Chain 组合、Agent 开发等能力。
## Key Capabilities
- **Document Loaders**160+ 文档加载器,支持网页/ PDF / Markdown / 数据库等多种来源
- **Vector Stores**:与 Qdrant、Chroma、Milvus、Pinecone 等向量数据库的原生集成
- **Chains**:将多个步骤(检索→组装→生成)串联为统一管道
- **Agents**:构建可自主调用工具的 LLM Agent
- **Memory**:跨对话的上下文记忆管理
- **Prompt Templates**:结构化 Prompt 管理
## Usage in RAG
本文档使用 LangChain 演示基础 RAG 管道:
1. 通过 `WebBaseLoader` 加载外部博客文档
2. 通过 `RecursiveCharacterTextSplitter` 切分文档
3. 通过 `Qdrant` 向量存储集成建立索引
4. 通过 `RetrievalQA Chain` 串联检索和生成
## LangSmith
LangSmith 是 LangChain 官方提供的 LLM 应用监控和调试平台,支持:
- 追踪 LLM 应用执行链路
- 查看每个步骤的输入输出
- 评估应用效果和 Token 消耗
## Connections
- [[LangChain]] ← used_in ← [[RAG]]
- [[LangChain]] ← integrates_with ← [[Vector-Store]]
- [[LangChain]] ← integrates_with ← [[Embedding]]
- [[LangChain]] ← provides ← [[Generation]]
- [[LangChain]] ← monitors_with ← [[LangSmith]]
## Aliases
- LangChain Python
- LangChain JS