LangChain(一)——LangChain简介
一、LangChain简介
1.1 什么是LangChain
LangChain 是用于构建大模型应用程序的开源框架,它由模块化的组件构成,可单独使用也可链式组合实现端到端应用。
LangChain核心组件
- Model I/O 封装
- Models:大语言模型封装,包含LLMs和Chat Models(一般基于 LLMs,但按对话结构重新封装)
- PromptTemple:提示词模板
- OutputParser:输出格式化
- 数据连接封装(Retrieval)
- Document Loaders:各种格式文件的加载器
- Document Transformers:对文档的常用操作,如:split, filter, translate, extract metadata, etc
- Text Embedding Models:用于将文本进行向量化
- Verctor Stores: 存储文本向量,可用于检索
- Retrievers: 向量数据的检索
- Indexing: 将来自任何来源的文档加载并保持与向量存储的同步
- 记忆封装
- Memory:可以理解为“上文”、“历史记录”或者说“记忆力”的管理
- 架构封装
- Callbacks
- 回调系统,可以连接到LLM应用程序的各个阶段,便于进行日志记录、追踪等数据导流
LangChain模块架构图 [1]

LangChain文档(Python)
- 功能模块:https://python.langchain.com/docs/get_started/introduction
- API 文档:https://api.python.langchain.com/en/latest/langchain_api_reference.html
- 三方组件集成:https://python.langchain.com/docs/integrations/platforms/
- 官方应用案例:https://python.langchain.com/docs/use_cases
- 调试部署等指导:https://python.langchain.com/docs/guides/debugging
- LangSmith: https://docs.smith.langchain.com/cookbook
LangChain(一)——LangChain简介
https://mztchaoqun.com.cn/posts/D25_LangChain/