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.
1.2 涓汉鐞嗚В
LangChain Libraries鏄竴涓暣鍚堜簡鍚勭Prompt鐨勫伐鍏峰寘銆備娇鐢ㄨ繖涓伐鍏峰寘锛屽紑鍙戣€呰兘鏇翠笓娉ㄤ簬涓氬姟閫昏緫鍜屼笟鍔″疄鐜般€?br>
闄ゆ涔嬪锛?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>
瀹樻柟绀轰緥