【可能是全网最丝滑的LangChain教程】一、LangChain介绍

GitHub - langchain-ai/langchain: 🦜🔗 Build context-aware reasoning applicationsLangChain开源地址

1 LangChain是什么

1.1 官方介绍

LangChain is a framework for developing applications powered by language models. It enables applications that:

  • Are context-aware: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.)
  • Reason: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc.)

This framework consists of several parts.

  • LangChain Libraries: The Python and JavaScript libraries. Contains interfaces and integrations for a myriad of components, a basic run time for combining these components into chains and agents, and off-the-shelf implementations of chains and agents.
  • LangChain Templates: A collection of easily deployable reference architectures for a wide variety of tasks.
  • LangServe: A library for deploying LangChain chains as a REST API.
  • LangSmith: A developer platform that lets you debug, test, evaluate, and monitor chains built on any LLM framework and seamlessly integrates with LangChain.
  • LangGraph: LangGraph is a library for building stateful, multi-actor applications with LLMs, built on top of (and intended to be used with) LangChain. It extends the LangChain Expression Language with the ability to coordinate multiple chains (or actors) across multiple steps of computation in a cyclic manner.

The LangChain libraries themselves are made up of several different packages.

  • langchain-core: Base abstractions and LangChain Expression Language.
  • langchain-community: Third party integrations.
  • langchain: Chains, agents, and retrieval strategies that make up an application's cognitive architecture.

1.2 个人理解

LangChain Libraries是一个整合了各种Prompt的工具包。使用这个工具包,开发者能更专注于业务逻辑和业务实现。

除此之外,LangChain Templates、LangServer、LangSmith、LangGraph算是LangChain锦上添花之作,有替代方案,也不是这个系列文章的重点,所以后续不会做分析与演示。

2 我们可以用LangChain构建什么?

2.1 Q&A with RAG

RAG,全称为Retrieval-Augmented Generation,中文翻译为检索增强生成。它是一种为大模型提供外部知识源的策略,使得大模型在回答问题之前,可以先利用一个知识库来获取候选的知识,再由大模型来生成答案。这种方式可以有效地减少模型幻觉问题,即大模型胡说八道的情况,同时也能避免由于数据不及时或未更新而导致的答案不准确的问题。RAG技术在企业不同的领域中有非常宽广的应用领域,可以解决由于数据不及时或未更新而导致的答案不准确的问题。

使用LangChain可以让大模型基于本地知识库进行问答,适用场景:智能客服

2.2 Analyzing structured data

分析结构化数据(这了各位同学应该先了解什么是结构化数据!!!)适用场景:数据分析、数据洞察等等

2.3 Chatbots

聊天机器人的特点是它们可以长时间运行,有状态对话,并可以使用相关信息回答用户问题。

2.4 更多的使用场景

从外部数据中结构化提取信息、对文档做总结、代码理解、工具使用、读取网页信息、访问SQL数据库等等

官方示例

  • 17
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值