当前位置: 首页>后端>正文

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

GitHub - langchain-ai/langchain: 馃馃敆 Build context-aware reasoning applicationsLangChain寮€婧愬湴鍧€

1 LangChain鏄粈涔?/h2>

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.
【可能是全网最丝滑的LangChain教程】一、LangChain介绍,第1张
9c18b5f0a88747b69f2fe441df858d7b.png

1.2 涓汉鐞嗚В

LangChain Libraries鏄竴涓暣鍚堜簡鍚勭Prompt鐨勫伐鍏峰寘銆備娇鐢ㄨ繖涓伐鍏峰寘锛屽紑鍙戣€呰兘鏇翠笓娉ㄤ簬涓氬姟閫昏緫鍜屼笟鍔″疄鐜般€?br>

【可能是全网最丝滑的LangChain教程】一、LangChain介绍,第2张
langchain涓嶭LM.png

闄ゆ涔嬪锛?strong>LangChain Templates銆丩angServer銆丩angSmith銆丩angGraph绠楁槸LangChain閿︿笂娣昏姳涔嬩綔锛屾湁鏇夸唬鏂规锛屼篃涓嶆槸杩欎釜绯诲垪鏂囩珷鐨勯噸鐐癸紝鎵€浠ュ悗缁笉浼氬仛鍒嗘瀽涓庢紨绀恒€?/p>

2 鎴戜滑鍙互鐢↙angChain鏋勫缓浠€涔堬紵

2.1 Q&A with RAG

RAG锛屽叏绉颁负Retrieval-Augmented Generation锛屼腑鏂囩炕璇戜负妫€绱㈠寮虹敓鎴愩€傚畠鏄竴绉嶄负澶фā鍨嬫彁渚涘閮ㄧ煡璇嗘簮鐨勭瓥鐣ワ紝浣垮緱澶фā鍨嬪湪鍥炵瓟闂涔嬪墠锛屽彲浠ュ厛鍒╃敤涓€涓煡璇嗗簱鏉ヨ幏鍙栧€欓€夌殑鐭ヨ瘑锛屽啀鐢卞ぇ妯″瀷鏉ョ敓鎴愮瓟妗堛€傝繖绉嶆柟寮忓彲浠ユ湁鏁堝湴鍑忓皯妯″瀷骞昏闂锛屽嵆澶фā鍨嬭儭璇村叓閬撶殑鎯呭喌锛屽悓鏃朵篃鑳介伩鍏嶇敱浜庢暟鎹笉鍙婃椂鎴栨湭鏇存柊鑰屽鑷寸殑绛旀涓嶅噯纭殑闂銆俁AG鎶€鏈湪浼佷笟涓嶅悓鐨勯鍩熶腑鏈夐潪甯稿骞跨殑搴旂敤棰嗗煙锛屽彲浠ヨВ鍐崇敱浜庢暟鎹笉鍙婃椂鎴栨湭鏇存柊鑰屽鑷寸殑绛旀涓嶅噯纭殑闂銆?/p>

浣跨敤LangChain鍙互璁╁ぇ妯″瀷鍩轰簬鏈湴鐭ヨ瘑搴撹繘琛岄棶绛旓紝閫傜敤鍦烘櫙锛氭櫤鑳藉鏈?/p>

2.2 Analyzing structured data

鍒嗘瀽缁撴瀯鍖栨暟鎹紙杩欎簡鍚勪綅鍚屽搴旇鍏堜簡瑙d粈涔堟槸缁撴瀯鍖栨暟鎹紒锛侊紒锛夐€傜敤鍦烘櫙锛氭暟鎹垎鏋愩€佹暟鎹礊瀵熺瓑绛?/p>

2.3 Chatbots

鑱婂ぉ鏈哄櫒浜虹殑鐗圭偣鏄畠浠彲浠ラ暱鏃堕棿杩愯锛屾湁鐘舵€佸璇濓紝骞跺彲浠ヤ娇鐢ㄧ浉鍏充俊鎭洖绛旂敤鎴烽棶棰樸€?/p>

2.4 鏇村鐨勪娇鐢ㄥ満鏅?/h3>

浠庡閮ㄦ暟鎹腑缁撴瀯鍖栨彁鍙栦俊鎭€佸鏂囨。鍋氭€荤粨銆佷唬鐮佺悊瑙c€佸伐鍏蜂娇鐢ㄣ€佽鍙栫綉椤典俊鎭€佽闂甋QL鏁版嵁搴撶瓑绛?/p>

瀹樻柟绀轰緥


https://www.xamrdz.com/backend/3ja1923391.html

相关文章: