Files
nexus/wiki/entities/LangChain.md

49 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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