{"id":19897,"date":"2025-12-16T10:34:21","date_gmt":"2025-12-16T02:34:21","guid":{"rendered":"https:\/\/92it.top\/?p=19897"},"modified":"2026-02-09T09:07:16","modified_gmt":"2026-02-09T01:07:16","slug":"langchain%e9%80%9a%e4%bf%97%e7%9a%84%e8%ae%b2%e8%a7%a3%e6%8e%a8%e8%8d%90","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=19897","title":{"rendered":"LangChain\u5165\u95e8\u8bb2\u89e3_\u7cfb\u52171"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\u5c0f\u7ea2\u4e66\uff1aAI\u4ea7\u54c1\u8d75\u54e5<\/p>\n\n\n\n<p><strong>\u524d\u8a00<\/strong>\u00a0<strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4f5c\u4e3a\u4e00\u4e2a AI \u4ea7\u54c1\u7ecf\u7406\u8fc7\u6765\u4eba\uff0c\u6211\u5f88\u80fd\u7406\u89e3\u5927\u5bb6\u9762\u5bf9 LangChain \u8fd9\u4e2a\u5bb6\u4f19\u65f6\uff0c\u61f5\u4e86\u4e2a\u5708\u7684\u72b6\u6001\u3002<\/p>\n\n\n\n<p>\u542c\u8bf4\u8fd9\u4e1c\u897f\u5f88\u706b\uff1f\u542c\u8bf4\u5b83\u662f\u5f00\u53d1 AI \u5e94\u7528\u7684\u5fc5\u4fee\u8bfe\uff1f\u4f46\u53bb Github \u4e00\u770b\uff0c\u5168\u662f\u4ee3\u7801\uff1b\u53bb\u8bfb\u5b98\u65b9\u6587\u6863\uff0c\u53c8\u662f\u5404\u79cd\u62bd\u8c61\u6982\u5ff5\u3002<\/p>\n\n\n\n<p>\u4f5c\u4e3a\u4ea7\u54c1\u7ecf\u7406\uff0c\u5230\u5e95\u8981\u4e0d\u8981\u5b66\uff1f\u5b66\u5230\u4ec0\u4e48\u7a0b\u5ea6\uff1f\u4ee5\u540e\u80fd\u7528\u5f97\u4e0a\u5417\uff1f<\/p>\n\n\n\n<p>\u522b\u614c\uff0c\u4eca\u5929\u54b1\u4eec\u5c31\u628a\u8fd9\u4e2a\u5bb6\u4f19\u62c6\u5f00\u3001\u63c9\u788e\u3001\u7096\u70c2\u3001\u716e\u719f\uff0c\u8ba9\u4f60\u5403\u5f97\u4e0b\u53bb\uff0c\u6d88\u5316\u8fdb\u53bb\u3002<\/p>\n\n\n\n<p>\u4e3a\u4e86\u65b9\u4fbf\u5927\u5bb6\u9605\u8bfb\uff0c\u6211\u628a\u8fd9\u4e2a\u7cfb\u5217\u5206\u6210\u4e86\u51e0\u4e2a\u5927\u6a21\u5757\uff0c\u4f60\u53ef\u4ee5\u628a\u5b83\u5f53\u6210\u4e00\u672c\u8ff7\u4f60\u7684 \u201cLangChain \u5b9e\u6218\u624b\u518c\u201d\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e00\u3001\u5148\u641e\u6e05\u695a\uff1aLangChain \u5230\u5e95\u662f\u4e2a\u5565\uff1f\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u54b1\u4eec\u5148\u522b\u6025\u7740\u770b\u4ee3\u7801\uff0c\u5148\u641e\u6e05\u695a\u5b9a\u4f4d\u3002\u4f60\u80af\u5b9a\u7528\u8fc7 ChatGPT\uff0c\u5bf9\u5427\uff1f\u5b83\u5f88\u5f3a\uff0c\u4e0a\u77e5\u5929\u6587\u4e0b\u77e5\u5730\u7406\u3002\u4f46\u662f\uff0c\u4f60\u6709\u6ca1\u6709\u53d1\u73b0\u5b83\u5728\u534f\u52a9\u6211\u4eec\u5b8c\u6210\u4efb\u52a1\u7684\u65f6\u5019\uff0c\u6709\u4e09\u4e2a\u5de8\u5927\u7684\u8f6f\u808b\uff1a<\/p>\n\n\n\n<ul>\n<li>\u5b83\u662f\u4e2a \u201c\u8111\u5b50\u201d\uff0c\u4f46\u6ca1\u6709 \u201c\u624b\u811a\u201d\uff1a\u5b83\u6ca1\u6cd5\u76f4\u63a5\u5e2e\u4f60\u53bb Google \u641c\u6700\u65b0\u7684\u65b0\u95fb\uff0c\u4e5f\u6ca1\u6cd5\u76f4\u63a5\u6253\u5f00\u4f60\u7684 Excel \u8868\u4fee\u6539\u6570\u636e\uff08\u9664\u975e\u7528\u7279\u5b9a\u63d2\u4ef6\uff0c\u4f46\u90a3\u4e0d\u662f\u4f60\u81ea\u5df1\u5f00\u53d1\u7684\uff09\u3002<\/li>\n\n\n\n<li>\u5b83\u662f\u4e2a \u201c\u91d1\u9c7c\u8bb0\u5fc6\u201d\uff1a\u4f60\u8981\u662f\u8ddf\u5b83\u804a\u5f97\u592a\u4e45\uff0c\u6216\u8005\u6362\u4e2a\u5bf9\u8bdd\u6846\uff0c\u5b83\u5c31\u628a\u4f60\u4e4b\u524d\u8bf4\u5565\u7ed9\u5fd8\u4e86\u3002<\/li>\n\n\n\n<li>\u5b83\u4e0d\u61c2\u4f60\u7684 \u201c\u5bb6\u52a1\u4e8b\u201d\uff1a\u4f60\u95ee\u5b83 \u201c\u6211\u516c\u53f8\u4e0a\u4e2a\u6708\u7684\u9500\u552e\u989d\u662f\u591a\u5c11\u201d\uff0c\u5b83\u80af\u5b9a\u4e0d\u77e5\u9053\uff0c\u56e0\u4e3a\u5b83\u6ca1\u770b\u8fc7\u4f60\u7684\u79c1\u6709\u6570\u636e\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u65f6\u5019\uff0cLangChain \u5c31\u95ea\u4eae\u767b\u573a\u4e86\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u8bf4 LLM\uff08\u5927\u8bed\u8a00\u6a21\u578b\uff0c\u6bd4\u5982 GPT-4\u3001\u6587\u5fc3\u4e00\u8a00\uff09\u662f\u90a3\u4e2a\u667a\u5546\u7206\u8868\u7684\u5927\u8111\uff0c\u90a3\u4e48 LangChain \u5c31\u662f\u94fe\u63a5\u8fd9\u4e2a\u5927\u8111\u548c\u5916\u90e8\u4e16\u754c\u7684 \u201c\u795e\u7ecf\u7cfb\u7edf\u201d\u3002\u5b83\u8d1f\u8d23\u5e2e\u5927\u6a21\u578b\uff1a<\/p>\n\n\n\n<ul>\n<li>\u8fde\u4e0a\u7f51\uff08\u641c\u7d22\u5de5\u5177\uff09\uff1b<\/li>\n\n\n\n<li>\u8bfb\u6587\u4ef6\uff08\u52a0\u8f7d PDF\u3001Excel\uff09\uff1b<\/li>\n\n\n\n<li>\u8bb0\u4e8b\u60c5\uff08\u957f\u77ed\u671f\u8bb0\u5fc6\uff09\uff1b<\/li>\n\n\n\n<li>\u505a\u51b3\u7b56\uff08\u8be5\u5148\u5e72\u561b\u540e\u5e72\u561b\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u7528\u4e2a\u6700\u4fd7\u7684\u6bd4\u55bb\uff1a\u5927\u6a21\u578b\u662f\u4e94\u661f\u7ea7\u5927\u53a8\uff08\u8111\u5b50\u597d\uff0c\u4f1a\u505a\u83dc\uff09\u3002<\/p>\n\n\n\n<p>\u4f46\u662f\u5927\u53a8\u4e0d\u80fd\u5149\u7740\u8eab\u5b50\u505a\u83dc\u5427\uff1f\u4ed6\u9700\u8981\u53a8\u623f\uff08\u73af\u5883\uff09\uff0c\u9700\u8981\u5e2e\u53a8\uff08\u5de5\u5177\uff09\u53bb\u4e70\u83dc\u3001\u6d17\u83dc\uff0c\u9700\u8981\u83dc\u8c31\uff08Prompt\uff09\uff0c\u8fd8\u9700\u8981\u8bb0\u6027\uff08Memory\uff09\u8bb0\u4f4f\u5ba2\u4eba\u7684\u5fcc\u53e3\u3002<\/p>\n\n\n\n<p>LangChain \u5c31\u662f\u90a3\u4e2a\u5e2e\u4f60\u628a\u53a8\u623f\u5efa\u597d\u3001\u628a\u5e2e\u53a8\u62db\u597d\u3001\u628a\u83dc\u8c31\u5199\u597d\uff0c\u6700\u540e\u628a\u5927\u53a8\u8bf7\u8fdb\u6765\u5e72\u6d3b\u7684\u9910\u5385\u7ecf\u7406\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e8c\u3001\u6784\u6210\uff1aLangChain \u7684\u516d\u5927\u6a21\u5757\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>LangChain \u4e4b\u6240\u4ee5\u5f3a\u5927\uff0c\u662f\u56e0\u4e3a\u5b83\u628a\u5f00\u53d1 AI \u5e94\u7528\u7684\u8fc7\u7a0b\u62c6\u6210\u4e86\u51e0\u4e2a\u6807\u51c6\u5316\u7684\u6a21\u5757\u3002\u54ea\u6015\u4f60\u4ee3\u7801\u57fa\u7840\u4e00\u822c\uff0c\u50cf\u642d\u79ef\u6728\u4e00\u6837\u62fc\u62fc\u51d1\u51d1\uff0c\u4e5f\u80fd\u5f04\u51fa\u4e2a\u50cf\u6a21\u50cf\u6837\u7684\u4e1c\u897f\u6765\u3002<\/p>\n\n\n\n<p>\u8fd9\u516d\u5927\u91d1\u521a\u5206\u522b\u662f\uff1aModels\uff08\u6a21\u578b\uff09\u3001Memory\uff08\u8bb0\u5fc6\uff09\u3001Retrieval\uff08\u7d22\u5f15 \/ \u6570\u636e\u68c0\u7d22\uff09\u3001Chains\uff08\u94fe\uff09\u3001Agents\uff08\u4ee3\u7406\uff09\u3001Callback\uff08\u56de\u8c03\uff09\u3002<\/p>\n\n\n\n<p>\u54b1\u4eec\u4e00\u4e2a\u4e2a\u628a\u5b83\u4eec \u201c\u6252\u5149\u201d \u4e86\u770b\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"661\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-1024x661.png\" alt=\"\" class=\"wp-image-19900\" style=\"width:546px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-1024x661.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-300x194.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-768x496.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-830x536.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-230x148.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-350x226.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85-480x310.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-85.png 1187w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p>\ud83d\udd39<strong>2.1.Models\uff08\u6a21\u578b\uff09\uff1a\u6362\u4e2a \u201c\u8111\u5b50\u201d \u5c31\u50cf\u6362\u706f\u6ce1<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"359\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-1024x359.png\" alt=\"\" class=\"wp-image-19901\" style=\"width:586px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-1024x359.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-300x105.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-768x269.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-830x291.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-230x81.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-350x123.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86-480x168.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-86.png 1197w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u4ee5\u524d\u6211\u4eec\u8981\u6362\u4e2a\u6a21\u578b\uff0c\u6bd4\u5982\u4ece GPT-3.5 \u6362\u5230 Claude\uff0c\u90a3\u4ee3\u7801\u5f97\u6539\u4e00\u5806\uff0c\u63a5\u53e3\u90fd\u4e0d\u4e00\u6837\u3002<\/p>\n\n\n\n<p>LangChain \u505a\u4e86\u4e00\u4ef6\u5927\u597d\u4e8b\uff0c\u5b83\u628a\u5e02\u9762\u4e0a\u4e3b\u6d41\u7684\u6a21\u578b\u90fd\u5c01\u88c5\u6210\u4e86\u7edf\u4e00\u7684\u63a5\u53e3\u3002<\/p>\n\n\n\n<p>\u4e0d\u7ba1\u4f60\u662f\u7528 OpenAI\uff0c\u8fd8\u662f\u7528 HuggingFace \u4e0a\u7684\u5f00\u6e90\u6a21\u578b\uff0c\u5728 LangChain \u91cc\uff0c\u4e5f\u5c31\u662f\u6539\u4e00\u884c\u53c2\u6570\u7684\u4e8b\u513f\u3002\u8fd9\u53eb\u6807\u51c6\u5316\u3002<\/p>\n\n\n\n<ul>\n<li>LLMs\uff08\u5927\u8bed\u8a00\u6a21\u578b\uff09\uff1a\u8fd9\u79cd\u4e3b\u8981\u5c31\u662f\u4e3a\u4e86 \u201c\u8865\u5168\u201d\uff0c\u4f60\u7ed9\u5b83\u534a\u53e5\u8bdd\uff0c\u5b83\u7ed9\u4f60\u8865\u5168\u5269\u4e0b\u7684\u3002<\/li>\n\n\n\n<li>Chat Models\uff08\u804a\u5929\u6a21\u578b\uff09\uff1a\u8fd9\u79cd\u66f4\u50cf\u6211\u4eec\u73b0\u5728\u7684 ChatGPT\uff0c\u6709\u660e\u786e\u7684 \u201c\u7cfb\u7edf\u89d2\u8272\u201d\u3001\u201c\u7528\u6237\u89d2\u8272\u201d\u3001\u201cAI \u89d2\u8272\u201d\uff0c\u5b83\u662f\u4e3a\u4e86\u5bf9\u8bdd\u8bbe\u8ba1\u7684\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5e72\u8d27\u7ec6\u8282\uff1a\u8fd9\u91cc\u6709\u4e2a\u5c0f\u5751\u3002\u5f88\u591a\u65b0\u624b\u5728\u7528\u7684\u65f6\u5019\uff0c\u5206\u4e0d\u6e05 text-davinci-003\uff08\u8001 LLM\uff09\u548c gpt-3.5-turbo\uff08Chat Model\uff09\u7684\u533a\u522b\u3002\u867d\u7136 LangChain \u80fd\u5e2e\u4f60\u5c4f\u853d\u4e00\u90e8\u5206\u5dee\u5f02\uff0c\u4f46\u8f93\u5165\u683c\u5f0f\u662f\u4e0d\u4e00\u6837\u7684\u3002LLM \u5403\u7684\u662f\u4e00\u4e32\u5b57\u7b26\u4e32\uff0cChat Model \u5403\u7684\u662f\u4e00\u4e2a\u5217\u8868\uff08List of Messages\uff09\u3002\u8fd9\u4e00\u70b9\u8981\u662f\u641e\u6df7\u4e86\uff0c\u62a5\u9519\u80fd\u62a5\u5230\u4f60\u6000\u7591\u4eba\u751f\u3002<\/p>\n\n\n\n<p><strong>Prompts\uff08\u63d0\u793a\u8bcd\uff09\uff1a\u628a \u201c\u8bf4\u8bdd\u201d \u53d8\u6210 \u201c\u586b\u7a7a\u9898\u201d<\/strong><\/p>\n\n\n\n<p>\u4f60\u80af\u5b9a\u542c\u8bf4\u8fc7\uff0c\u63d0\u793a\u8bcd\u5de5\u7a0b\u5f88\u91cd\u8981\u3002\u4f46\u5982\u679c\u4f60\u6bcf\u6b21\u5199\u7a0b\u5e8f\u90fd\u8981\u624b\u6572\u4e00\u6bb5\uff1a&#8221;\u4f60\u662f\u4e00\u4e2a\u6709\u7528\u7684\u52a9\u624b\uff0c\u8bf7\u56de\u7b54\u2026\u2026&#8221; \u90a3\u592a\u7d2f\u4e86\u3002<\/p>\n\n\n\n<p>LangChain \u5f15\u5165\u4e86 Prompt Template\uff08\u63d0\u793a\u8bcd\u6a21\u677f\uff09\u3002<\/p>\n\n\n\n<p>\u60f3\u8c61\u4e00\u4e0b\u4f60\u8981\u505a\u4e00\u4e2a \u201c\u7ffb\u8bd1\u673a\u5668\u4eba\u201d\u3002\u4f60\u4e0d\u7528\u6bcf\u6b21\u90fd\u5199\uff1a\u201c\u8bf7\u628a\u8fd9\u53e5\u8bdd\u7ffb\u8bd1\u6210\u82f1\u8bed\uff1a\u4f60\u597d\u201d\u3002\u4f60\u53ef\u4ee5\u505a\u4e00\u4e2a\u6a21\u677f\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u201c\u8bf7\u628a\u8fd9\u53e5\u8bdd\u7ffb\u8bd1\u6210 {target_language}\uff1a{text}\u201d<\/pre>\n\n\n\n<p>\u8fd9\u5c31\u662f\u4e2a\u586b\u7a7a\u9898\u3002\u5f53\u4f60\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u53ea\u9700\u8981\u628a\u53d8\u91cf\u586b\u8fdb\u53bb\uff0cLangChain \u81ea\u52a8\u5e2e\u4f60\u751f\u6210\u5b8c\u6574\u7684\u63d0\u793a\u8bcd\u53d1\u7ed9\u6a21\u578b\u3002\u8fd9\u6709\u70b9\u7c7b\u4f3c\u4e8e\u6211\u4eec\u9ad8\u8003\u7684\u65f6\u5019\uff0c\u80cc\u7684\u90a3\u4e9b\u4f5c\u6587\u6a21\u677f\uff0c\u5230\u8003\u573a\u4e0a\u53bb\u6309\u7167\u4f5c\u6587\u7684\u8981\u6c42\u5957\u6a21\u677f\u7684\u8fc7\u7a0b\u3002<\/p>\n\n\n\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u5f88\u91cd\u8981\uff1f\u56e0\u4e3a\u5b83\u8ba9\u4f60\u7684\u7a0b\u5e8f\u53d8 \u201c\u6d3b\u201d \u4e86\u3002\u4f60\u53ef\u4ee5\u968f\u65f6\u52a8\u6001\u5730\u6539\u53d8\u7ffb\u8bd1\u7684\u76ee\u6807\u8bed\u8a00\uff0c\u6216\u8005\u7ffb\u8bd1\u7684\u5185\u5bb9\uff0c\u800c\u4e0d\u9700\u8981\u53bb\u6539\u5e95\u5c42\u7684\u903b\u8f91\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p>\ud83d\udd39<strong>2.2.Memory\uff08\u8bb0\u5fc6\uff09\uff1a\u6cbb\u597d AI \u7684 \u201c\u5065\u5fd8\u75c7\u201d<\/strong><\/p>\n\n\n\n<p>\u8fd9\u662f\u6211\u89c9\u5f97 LangChain \u6700\u6027\u611f\u7684\u529f\u80fd\u4e4b\u4e00\u3002<\/p>\n\n\n\n<p>\u539f\u751f\u7684 API \u63a5\u53e3\u662f\u65e0\u72b6\u6001\u7684\u3002\u5565\u53eb\u65e0\u72b6\u6001\uff1f\u5c31\u662f\u4f60\u95ee\u5b8c\u7b2c\u4e00\u53e5\uff0c\u518d\u95ee\u7b2c\u4e8c\u53e5\uff0c\u6a21\u578b\u538b\u6839\u4e0d\u77e5\u9053\u7b2c\u4e00\u53e5\u662f\u5565\u3002\u4e3a\u4e86\u8ba9\u5bf9\u8bdd\u80fd\u7ee7\u7eed\uff0c\u4f60\u9700\u8981\u628a\u4e4b\u524d\u7684\u5bf9\u8bdd\u8bb0\u5f55\u6253\u5305\uff0c\u6bcf\u6b21\u90fd\u4e00\u80a1\u8111\u5730\u53d1\u7ed9\u6a21\u578b\u3002<\/p>\n\n\n\n<p>LangChain \u5e2e\u4f60\u81ea\u52a8\u5316\u4e86\u8fd9\u4e2a\u8fc7\u7a0b\u3002\u5b83\u63d0\u4f9b\u4e86\u597d\u51e0\u79cd\u8bb0\u5fc6\u6a21\u5f0f\uff1a<\/p>\n\n\n\n<ul>\n<li>ConversationBufferMemory\uff1a\u6700\u7b80\u5355\u7c97\u66b4\uff0c\u628a\u4e4b\u524d\u8bf4\u8fc7\u7684\u8bdd\u5168\u8bb0\u4e0b\u6765\uff0c\u6bcf\u6b21\u5168\u6254\u7ed9 AI\u3002\u7f3a\u70b9\u662f\u8d35\uff0cToken \u6d88\u8017\u5de8\u5927\u3002<\/li>\n\n\n\n<li>ConversationBufferWindowMemory\uff1a\u53ea\u8bb0\u6700\u8fd1\u7684 K \u8f6e\u5bf9\u8bdd\uff08\u6bd4\u5982\u6700\u8fd1 3 \u53e5\uff09\u3002\u4e4b\u524d\u7684\u5c31\u5fd8\u4e86\u3002\u8fd9\u5c31\u50cf\u9c7c\u7684\u8bb0\u5fc6\uff0c\u4f46\u7701\u94b1\u3002<\/li>\n\n\n\n<li>ConversationSummaryMemory\uff1a\u8fd9\u4e2a\u5389\u5bb3\u4e86\u3002\u5b83\u4f1a\u7528\u53e6\u4e00\u4e2a LLM\uff0c\u5e2e\u54b1\u628a\u4e4b\u524d\u7684\u5bf9\u8bdd\u505a\u4e00\u4e2a\u603b\u7ed3\uff0c\u7136\u540e\u53ea\u4fdd\u7559\u603b\u7ed3\u3002\u8fd9\u5c31\u50cf\u6211\u4eec\u5f00\u4f1a\uff0c\u4e0d\u8bb0\u6d41\u6c34\u8d26\uff0c\u53ea\u8bb0\u4f1a\u8bae\u7eaa\u8981\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8bf4\u5b9e\u8bdd\uff0c\u73b0\u5728\u7684 Memory \u6a21\u5757\u867d\u7136\u597d\u7528\uff0c\u4f46\u6709\u65f6\u5019\u4e5f\u633a\u667a\u969c\u7684\u3002\u7279\u522b\u662f\u90a3\u4e2a \u201c\u603b\u7ed3\u8bb0\u5fc6\u201d\uff0c\u6709\u65f6\u5019\u603b\u7ed3\u5f97\u9a74\u5507\u4e0d\u5bf9\u9a6c\u5634\uff0c\u628a\u5173\u952e\u7ec6\u8282\u7ed9\u4e22\u4e86\u3002\u6240\u4ee5\u5728\u5b9e\u9645\u505a\u9879\u76ee\u65f6\uff0c\u6211\u4eec\u7ecf\u5e38\u5f97\u628a\u597d\u51e0\u79cd\u8bb0\u5fc6\u65b9\u5f0f\u6df7\u5408\u8d77\u6765\u7528\uff0c\u6216\u8005\u81ea\u5df1\u5199\u70b9\u903b\u8f91\u53bb\u4fee\u8865\u3002<\/p>\n\n\n\n<p>\u3000\u3000<br><strong>\ud83d\udd392.3.Retrieval\uff08\u68c0\u7d22\uff09\u4e0e RAG\uff1a\u7ed9 AI \u5f00\u5c0f\u7076<\/strong><\/p>\n\n\n\n<p>\u8fd9\u90e8\u5206\u662f\u73b0\u5728\u6700\u706b\u7684\uff0c\u4e5f\u5c31\u662f\u5927\u5bb6\u5e38\u8bf4\u7684 RAG\uff08\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff09\u3002\u7b80\u5355\u8bf4\uff0c\u5c31\u662f\u600e\u4e48\u628a\u4f60\u7684 PDF\u3001Word\u3001\u516c\u53f8\u6587\u6863\u5582\u7ed9 AI\u3002<br>LangChain \u628a\u8fd9\u4e2a\u8fc7\u7a0b\u53d8\u6210\u4e86\u6d41\u6c34\u7ebf\uff1a<\/p>\n\n\n\n<ul>\n<li>Document Loaders\uff08\u6587\u6863\u52a0\u8f7d\u5668\uff09\uff1a\u4e0d\u7ba1\u4f60\u662f PDF\u3001TXT\u3001Json \u8fd8\u662f\u7f51\u9875\uff0cLangChain \u90fd\u6709\u5bf9\u5e94\u7684\u5de5\u5177\u628a\u5b83\u8bfb\u8fdb\u6765\u3002<\/li>\n\n\n\n<li>Text Splitters\uff08\u6587\u672c\u5206\u5272\u5668\uff09\uff1a\u5927\u6a21\u578b\u4e00\u6b21\u5403\u4e0d\u4e0b\u4e00\u6574\u672c\u4e66\u3002\u4f60\u9700\u8981\u628a\u4e66\u5207\u6210\u4e00\u5757\u4e00\u5757\u7684\uff08Chunk\uff09\u3002\u8fd9\u4e00\u6b65\u975e\u5e38\u6709\u8bb2\u7a76\uff01\u5207\u592a\u5927\u4e86\uff0cToken \u4e0d\u591f\uff1b\u5207\u592a\u5c0f\u4e86\uff0c\u4e0a\u4e0b\u6587\u610f\u601d\u65ad\u4e86\u3002<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>Vector Stores\uff08\u5411\u91cf\u6570\u636e\u5e93\uff09\uff1a\u8fd9\u662f\u6838\u5fc3\u3002\u6211\u4eec\u8981\u628a\u5207\u597d\u7684\u6587\u5b57\uff0c\u8f6c\u5316\u6210\u5411\u91cf\uff08\u4e00\u4e32\u6570\u5b57\uff09\u5b58\u8d77\u6765\u3002\u5c31\u50cf\u53bb\u56fe\u4e66\u9986\u627e\u4e66\u3002\u4ee5\u524d\u662f\u6309\u4e66\u540d\u627e\uff0c\u73b0\u5728\u662f\u6309 \u201c\u610f\u601d\u201d \u627e\u3002\u4f60\u95ee \u201c\u600e\u4e48\u505a\u7ea2\u70e7\u8089\u201d\uff0c\u7cfb\u7edf\u4f1a\u628a\u6240\u6709\u8ddf \u201c\u732a\u8089\u201d\u3001\u201c\u9171\u6cb9\u201d\u3001\u201c\u7096\u201d \u76f8\u5173\u7684\u7247\u6bb5\u627e\u51fa\u6765\u3002<\/li>\n\n\n\n<li>Retrievers\uff08\u68c0\u7d22\u5668\uff09\uff1a\u5f53\u4f60\u63d0\u95ee\u65f6\uff0c\u5148\u53bb\u6570\u636e\u5e93\u91cc\u628a\u76f8\u5173\u7684\u7247\u6bb5\u635e\u51fa\u6765\uff0c\u62fc\u5728 Prompt \u91cc\uff0c\u518d\u6254\u7ed9 LLM\u3002<\/li>\n<\/ul>\n\n\n\n<p>RAG \u662f\u76ee\u524d\u4f01\u4e1a\u843d\u5730 AI \u5e94\u7528\u7684\u6700\u4e3b\u6d41\u65b9\u5f0f\uff0c\u6ca1\u6709\u4e4b\u4e00\u3002<\/p>\n\n\n\n<p>LangChain \u5728\u8fd9\u91cc\u7684\u751f\u6001\u662f\u6700\u5b8c\u5584\u7684\u3002\u4f60\u5982\u679c\u60f3\u505a\u4e2a \u201c\u6cd5\u5f8b\u987e\u95ee AI\u201d \u6216\u8005 \u201c\u5ba2\u670d\u673a\u5668\u4eba\u201d\uff0c\u8fd9\u4e00\u5757\u5fc5\u987b\u5403\u900f\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"671\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-1024x671.png\" alt=\"\" class=\"wp-image-19905\" style=\"width:552px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-1024x671.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-300x197.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-768x504.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-830x544.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-230x151.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-350x230.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88-480x315.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-88.png 1220w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000\u3000<br><\/p>\n\n\n\n<p><strong>\ud83d\udd392.4.Chains\uff08\u94fe\uff09\uff1a\u628a\u52a8\u4f5c\u4e32\u8d77\u6765<\/strong><\/p>\n\n\n\n<p>\u8fd9\u5c31\u662f LangChain \u540d\u5b57\u7684\u7531\u6765\uff08LangChain = Language Chain\uff09\u3002\u4e00\u4e2a\u590d\u6742\u7684\u4efb\u52a1\uff0c\u5f80\u5f80\u4e0d\u662f\u4e00\u6b65\u5c31\u80fd\u641e\u5b9a\u7684\u3002\u6bd4\u5982\u6211\u8981\u5199\u4e00\u7bc7\u80a1\u8bc4\uff1a<\/p>\n\n\n\n<ul>\n<li>\u7b2c\u4e00\u6b65\uff1a\u53bb\u641c\u96c6\u4eca\u5929\u7684\u80a1\u5e02\u6570\u636e\u3002<\/li>\n\n\n\n<li>\u7b2c\u4e8c\u6b65\uff1a\u8ba9 AI \u5206\u6790\u6570\u636e\u3002<\/li>\n\n\n\n<li>\u7b2c\u4e09\u6b65\uff1a\u8ba9 AI \u6839\u636e\u5206\u6790\u5199\u6210\u6587\u7ae0\u3002<\/li>\n\n\n\n<li>\u7b2c\u56db\u6b65\uff1a\u628a\u6587\u7ae0\u7ffb\u8bd1\u6210\u82f1\u6587\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u56db\u4e2a\u6b65\u9aa4\uff0c\u5c31\u662f\u56db\u73af\u94fe\u6761\u3002LangChain \u63d0\u4f9b\u4e86 SequentialChain\uff08\u987a\u5e8f\u94fe\uff09\uff0c\u80fd\u628a\u8fd9\u4e9b\u6b65\u9aa4\u50cf\u4e32\u7cd6\u846b\u82a6\u4e00\u6837\u4e32\u8d77\u6765\u3002\u524d\u4e00\u4e2a\u6b65\u9aa4\u7684\u8f93\u51fa\uff0c\u81ea\u52a8\u53d8\u6210\u4e0b\u4e00\u4e2a\u6b65\u9aa4\u7684\u8f93\u5165\u3002<br>\u8fd9\u5c31\u6709\u70b9\u50cf\u5de5\u4e1a\u6d41\u6c34\u7ebf\u4e86\u3002\u6ca1\u6709 LangChain \u4e4b\u524d\uff0c\u4f60\u5f97\u81ea\u5df1\u5199\u4e00\u5927\u5806 if-else \u548c\u80f6\u6c34\u4ee3\u7801\u6765\u4f20\u9012\u6570\u636e\uff0c\u73b0\u5728\u53ea\u9700\u8981\u5b9a\u4e49\u597d\u94fe\u6761\u7ed3\u6784\u5c31\u884c\u3002<\/p>\n\n\n\n<p>\u3000\u3000<br><br><strong>\ud83d\udd392.5.Agents\uff08\u667a\u80fd\u4f53 \/ \u4ee3\u7406\uff09\uff1aAI \u6709\u4e86 \u201c\u81ea\u4e3b\u610f\u8bc6\u201d<\/strong><\/p>\n\n\n\n<p>\u8fd9\u662f LangChain \u51fa\u73b0\u540e\uff0c\u6700\u8ba9\u4eba\u5174\u594b\u7684\u70b9\uff0c\u4f46\u4e5f\u6700\u5bb9\u6613\u7ffb\u8f66\u7684\u90e8\u5206\u3002\u5982\u679c\u8bf4 Chains \u662f\u6309\u90e8\u5c31\u73ed\u7684\u6d41\u6c34\u7ebf\uff0c\u90a3 Agents \u5c31\u662f\u62e5\u6709\u81ea\u4e3b\u51b3\u7b56\u6743\u7684\u5458\u5de5\u3002<\/p>\n\n\n\n<p>\u4f60\u7ed9 Agent \u4e00\u4e2a\u76ee\u6807\uff1a&#8221;\u5e2e\u6211\u7b56\u5212\u4e00\u6b21\u53bb\u65e5\u672c\u7684\u65c5\u884c\uff0c\u5e76\u9884\u5b9a\u673a\u7968\u3002&#8221;Agent \u4f1a\u81ea\u5df1\u601d\u8003\uff1a<\/p>\n\n\n\n<ul>\n<li>&#8220;\u6211\u5f97\u5148\u53bb\u641c\u641c\u65e5\u672c\u54ea\u91cc\u597d\u73a9\u3002&#8221;\u2192 \u8c03\u7528\u641c\u7d22\u5de5\u5177\u3002<\/li>\n\n\n\n<li>&#8220;\u6211\u60f3\u53bb\u4eac\u90fd\uff0c\u6211\u5f97\u67e5\u67e5\u53bb\u4eac\u90fd\u7684\u673a\u7968\u3002&#8221;\u2192 \u8c03\u7528\u673a\u7968\u67e5\u8be2\u5de5\u5177\u3002<\/li>\n\n\n\n<li>&#8220;\u8fd9\u4e2a\u822a\u73ed\u592a\u8d35\u4e86\uff0c\u6211\u518d\u67e5\u67e5\u522b\u7684\u3002&#8221;\u2192 \u518d\u6b21\u8c03\u7528\u5de5\u5177\u3002<\/li>\n\n\n\n<li>\u201c\u5b9a\u597d\u4e86\u3002\u201d\u2192 \u8fd4\u56de\u7ed3\u679c\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5728 Agent \u6a21\u5f0f\u4e0b\uff0cLLM \u53d8\u6210\u4e86\u5927\u8111\uff0c\u5b83\u6839\u636e\u5f53\u4e0b\u7684\u60c5\u51b5\uff0c\u81ea\u5df1\u51b3\u5b9a\u8be5\u7528\u4ec0\u4e48\u5de5\u5177\uff08Tool\uff09\uff0c\u8be5\u5e72\u4ec0\u4e48\u4e8b\u3002\u8fd9\u5c31\u662f\u901a\u5f80 AGI\uff08\u901a\u7528\u4eba\u5de5\u667a\u80fd\uff09\u7684\u96cf\u5f62\u554a\uff01<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u4e00\u4e2a\u6570\u5b66\u516c\u5f0f\u6765\u8868\u793a\uff1aAgent = LLM + Memory + Tools + Planning + Action<\/pre>\n\n\n\n<p>\u771f\u5fc3\u8bdd\uff1a\u867d\u7136 Agents \u542c\u8d77\u6765\u5f88\u5c4c\uff0c\u4f46\u5728\u5b9e\u9645\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u5b83\u975e\u5e38\u4e0d\u53ef\u63a7\u3002\u6709\u65f6\u5019\u5b83\u4f1a\u9677\u5165\u6b7b\u5faa\u73af\uff08\u4e00\u76f4\u5728\u601d\u8003\uff0c\u4e0d\u5e72\u6d3b\uff09\uff0c\u6709\u65f6\u5019\u4f1a\u4e71\u8c03\u7528\u5de5\u5177\u3002\u76ee\u524d\u6211\u4eec\u5728\u505a\u4e25\u8083\u7684\u5546\u4e1a\u9879\u76ee\u65f6\uff0c\u5bf9 Agent \u7684\u4f7f\u7528\u8fd8\u662f\u6bd4\u8f83\u8c28\u614e\u7684\uff0c\u66f4\u591a\u65f6\u5019\u8fd8\u662f\u503e\u5411\u4e8e\u7528\u786e\u5b9a\u7684 Chains\u3002<br><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"590\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-1024x590.png\" alt=\"\" class=\"wp-image-19907\" style=\"width:628px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-1024x590.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-300x173.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-768x442.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-830x478.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-230x132.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-350x202.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90-480x276.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-90.png 1219w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd392.6.Callbacks\uff08\u56de\u8c03\uff09\u2014\u2014 \u6218\u7532\u7684 \u201c\u65e5\u5fd7\u4e0e\u76d1\u63a7\u7cfb\u7edf\u201d<\/strong><\/p>\n\n\n\n<p>\u8fd9\u662f\u4e00\u4e2a\u9762\u5411\u5f00\u53d1\u8005\u7684 \u201c\u8c03\u8bd5\u201d \u548c \u201c\u76d1\u63a7\u201d \u7cfb\u7edf\u3002<\/p>\n\n\n\n<ul>\n<li>\u529f\u80fd\uff1a\u5141\u8bb8\u4f60\u5728 LangChain \u8fd0\u884c\u7684\u4efb\u4f55\u4e00\u4e2a\u73af\u8282\uff08\u6bd4\u5982 LLM \u8c03\u7528\u524d\u3001\u5de5\u5177\u4f7f\u7528\u540e\uff09\uff0c\u201c\u6302\u8f7d\u201d \u4e00\u4e9b\u81ea\u5b9a\u4e49\u7684\u51fd\u6570\uff0c\u7528\u4e8e\u65e5\u5fd7\u8bb0\u5f55\u3001\u6027\u80fd\u76d1\u63a7\u3001\u6210\u672c\u8ba1\u7b97\u7b49\u3002<\/li>\n\n\n\n<li>\u6218\u7532\u6bd4\u55bb\uff1a\u8fd9\u662f\u94a2\u94c1\u4fa0\u6218\u7532\u7684 **\u201c\u7cfb\u7edf\u65e5\u5fd7\u548c\u8bca\u65ad\u9762\u677f\u201d**\u3002\u6258\u5c3c\u30fb\u65af\u5854\u514b\u53ef\u4ee5\u5b9e\u65f6\u770b\u5230\u6218\u7532\u6bcf\u4e2a\u90e8\u4ef6\u7684\u80fd\u8017\u3001\u6e29\u5ea6\u3001API \u8c03\u7528\u6b21\u6570\u3001\u82b1\u8d39\u4e86\u591a\u5c11\u94b1\u7b49\uff0c\u65b9\u4fbf\u4ed6\u8fdb\u884c\u4f18\u5316\u548c\u6545\u969c\u6392\u67e5\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e09\u3001\u5177\u4f53\u5b9e\u64cd\uff1a\u624b\u628a\u624b\u5e26\u4f60\u641e\u5b9a\u4e00\u4e2a\u77e5\u8bc6\u5e93\u52a9\u624b\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5149\u8bf4\u4e0d\u7ec3\u5047\u628a\u5f0f\u3002\u54b1\u4eec\u73b0\u5728\u8111\u8865\u4e00\u4e0b\uff0c\u600e\u4e48\u7528 LangChain \u505a\u4e00\u4e2a \u201c\u4e2a\u4eba\u77e5\u8bc6\u5e93\u52a9\u624b\u201d\u3002<\/p>\n\n\n\n<p>\u5047\u8bbe\u4f60\u7535\u8111\u91cc\u6709\u4e00\u5806 PDF \u683c\u5f0f\u7684\u884c\u4e1a\u62a5\u544a\uff0c\u4f60\u60f3\u95ee AI \u5173\u4e8e\u8fd9\u4e9b\u62a5\u544a\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u7b2c\u4e00\u9636\u6bb5\uff1a\u5907\u83dc\uff08\u6570\u636e\u5904\u7406\uff09<\/strong><\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u7528\u5230 LangChain \u7684 PyPDFLoader\u3002\u8fd9\u73a9\u610f\u513f\u5c31\u50cf\u4e2a\u626b\u63cf\u4eea\uff0c\u628a\u4f60\u6587\u4ef6\u5939\u91cc\u7684 PDF \u5168\u90e8\u8bfb\u6210\u6587\u672c\u3002<\/p>\n\n\n\n<p>\u7136\u540e\uff0c\u7528\u5230 RecursiveCharacterTextSplitter\u3002\u540d\u5b57\u5f88\u957f\uff0c\u522b\u6015\u3002\u5b83\u7684\u4f5c\u7528\u5c31\u662f\u62ff\u628a\u526a\u5200\uff0c\u628a\u957f\u7bc7\u5927\u8bba\u526a\u6210\u4e00\u6bb5\u4e00\u6bb5\u7684\uff0c\u6bd4\u5982\u6bcf\u6bb5 500 \u4e2a\u5b57\uff0c\u800c\u4e14\u4e3a\u4e86\u9632\u6b62\u526a\u65ad\u4e86\u53e5\u5b50\u7684\u610f\u601d\uff0c\u6bb5\u4e0e\u6bb5\u4e4b\u95f4\u8fd8\u4f1a\u7559\u4e00\u70b9\u91cd\u53e0<span style=\"font-family: Inter, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; white-space-collapse: collapse; color: initial;\">\u4e2a\u5b57\uff0c\u800c\u4e14\u4e3a\u4e86\u9632\u6b62\u526a\u65ad\u4e86\u53e5\u5b50\u7684\u610f\u601d\uff0c\u6bb5\u4e0e\u6bb5\u4e4b\u95f4\u8fd8\u4f1a\u7559\u4e00\u70b9\u91cd\u53e0\uff08Overlap\uff09\u3002<\/span><\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u7b2c\u4e8c\u9636\u6bb5\uff1a\u814c\u5236\uff08\u5411\u91cf\u5316\uff09<\/strong><\/p>\n\n\n\n<p>\u5207\u597d\u7684\u8089\uff08\u6587\u672c\u5757\uff09\u662f\u751f\u7684\uff0c\u6a21\u578b\u5403\u4e0d\u4e0b\u3002\u6211\u4eec\u9700\u8981\u8c03\u7528 OpenAI \u7684 Embeddings \u63a5\u53e3\uff0c\u628a\u8fd9\u4e9b\u6587\u5b57\u53d8\u6210\u5411\u91cf\u3002<br>\u8fd9\u65f6\u5019\uff0c\u4f60\u9700\u8981\u4e00\u4e2a\u5bb9\u5668\u6765\u88c5\u8fd9\u4e9b\u5411\u91cf\u3002\u5bf9\u4e8e\u65b0\u624b\uff0c\u63a8\u8350\u7528 FAISS \u6216\u8005 Chroma\u3002\u5b83\u4fe9\u5c31\u50cf\u4e2a\u8f7b\u91cf\u7ea7\u7684\u672c\u5730\u6570\u636e\u5e93\uff0c\u4e0d\u9700\u8981\u4f60\u88c5\u590d\u6742\u7684\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u76f4\u63a5\u5728\u4f60\u7684 Python \u73af\u5883\u91cc\u5c31\u80fd\u8dd1\u3002<\/p>\n\n\n\n<p>\u3000\u3000<br><strong>\ud83d\udd39\u7b2c\u4e09\u9636\u6bb5\uff1a\u5f00\u706b\uff08\u6784\u5efa\u68c0\u7d22\u94fe\uff09<\/strong><\/p>\n\n\n\n<p>\u73b0\u5728\uff0c\u4f60\u6709\u4e86\u6570\u636e\u5e93\uff0c\u6709\u4e86 API Key\u3002\u6211\u4eec\u8981\u6784\u5efa\u4e00\u4e2a RetrievalQA \u94fe\u3002\u8fd9\u4e2a\u94fe\u6761\u7684\u5de5\u4f5c\u539f\u7406\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<ul>\n<li>1\uff0e\u7528\u6237\u63d0\u95ee\uff1a&#8221;\u62a5\u544a\u91cc\u5173\u4e8e\u65b0\u80fd\u6e90\u6c7d\u8f66\u7684\u9884\u6d4b\u662f\u5565\uff1f&#8221;<\/li>\n\n\n\n<li>2\uff0e\u68c0\u7d22\uff1aLangChain \u628a\u4f60\u7684\u95ee\u9898\u4e5f\u53d8\u6210\u5411\u91cf\uff0c\u53bb\u6570\u636e\u5e93\u91cc &#8220;\u641c&#8221; \u6700\u76f8\u4f3c\u7684\u51e0\u6bb5\u539f\u6587\u3002<\/li>\n\n\n\n<li>3\uff0e\u7ec4\u88c5\uff1aLangChain \u6084\u6084\u5730\u628a\u641c\u5230\u7684\u539f\u6587\u548c\u4f60\u7684\u95ee\u9898\u62fc\u5728\u4e00\u8d77\uff0c\u53d8\u6210\u4e00\u4e2a\u65b0\u7684 Prompt\uff1a&#8221;\u8bf7\u6839\u636e\u4ee5\u4e0b\u53c2\u8003\u8d44\u6599\u56de\u7b54\u95ee\u9898\uff1a[\u8d44\u6599\u7247\u6bb5\u2026] \u95ee\u9898\u662f\uff1a\u65b0\u80fd\u6e90\u6c7d\u8f66\u7684\u9884\u6d4b\u662f\u5565\uff1f&#8221;<\/li>\n\n\n\n<li>4\uff0e\u751f\u6210\uff1a\u5927\u6a21\u578b\u770b\u5b8c\u8d44\u6599\uff0c\u5047\u88c5\u81ea\u5df1\u5168\u90fd\u77e5\u9053\uff0c\u7ed9\u4f60\u5410\u51fa\u4e86\u7b54\u6848\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u770b\u61c2\u4e86\u5417\uff1f\u5176\u5b9e AI \u6839\u672c\u6ca1\u8bb0\u4f4f\u4f60\u7684\u6587\u4ef6\uff0c\u5b83\u53ea\u662f\u5728\u4f60\u63d0\u95ee\u7684\u90a3\u4e00\u77ac\u95f4\uff0c\u4e34\u65f6\u62b1\u4f5b\u811a\u770b\u4e86\u5c0f\u6284\uff0c\u7136\u540e\u56de\u7b54\u4e86\u4f60\u3002\u8fd9\u5c31\u662f LangChain \u5e72\u7684\u6700\u6838\u5fc3\u7684\u4e8b\u513f\uff01<\/p>\n\n\n\n<p>\u3000\u3000<br><strong>\u56db\u3001\u4e0d\u7981\u53cd\u95ee\uff1aLangChain \u662f\u5b8c\u7f8e\u7684\u5417\uff1f\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u53cd\u8f6c\u6765\u4e86\uff0c\u6211\u8981\u7ed9\u4f60\u6cfc\u70b9\u51b7\u6c34\u3002<br>\u867d\u7136 LangChain \u73b0\u5728\u662f\u4e1a\u754c\u7684\u625b\u628a\u5b50\uff0c\u4f46\u5b83\u7684\u7cdf\u5fc3\u4e8b\u4e5f\u771f\u7684\u4e0d\u5c11\u3002<\/p>\n\n\n\n<ul>\n<li>\u6587\u6863\u5199\u5f97\u4e71\uff1a\u8fd9\u662f\u516c\u8ba4\u7684\u3002LangChain \u66f4\u65b0\u592a\u5feb\u4e86\uff0c\u5927\u6982\u4e24\u4e09\u5929\u5c31\u662f\u4e00\u4e2a\u65b0\u7248\u672c\u3002\u5b98\u65b9\u6587\u6863\u7ecf\u5e38\u8ddf\u4e0d\u4e0a\u4ee3\u7801\u7684\u66f4\u65b0\u901f\u5ea6\uff0c\u4f60\u5728\u6587\u6863\u91cc\u770b\u5230\u7684\u65b9\u6cd5\uff0c\u53ef\u80fd\u5728\u6700\u65b0\u7248\u4ee3\u7801\u91cc\u5df2\u7ecf\u88ab\u6539\u540d\u6216\u8005\u5220\u9664\u4e86\u3002\u8fd9\u5bf9\u65b0\u624b\u6781\u5176\u4e0d\u53cb\u597d\u3002<\/li>\n\n\n\n<li>\u62bd\u8c61\u8fc7\u5ea6\uff1a\u4e3a\u4e86\u517c\u5bb9\u6240\u6709\u7684\u6a21\u578b\u548c\u6570\u636e\u5e93\uff0cLangChain \u5c01\u88c5\u4e86\u4e00\u5c42\u53c8\u4e00\u5c42\u3002\u6709\u65f6\u5019\u4f60\u53ea\u60f3\u505a\u4e00\u4e2a\u7b80\u5355\u7684\u529f\u80fd\uff0c\u7ed3\u679c\u53d1\u73b0\u8981\u8c03\u7528\u7684\u7c7b\u85cf\u5728\u5f88\u6df1\u7684\u5730\u65b9\u3002\u8fd9\u4e5f\u5bfc\u81f4\u4e86\u6240\u8c13\u7684 \u201cLangChain \u5f88\u6162\u201d \u7684\u8bf4\u6cd5 \u2014\u2014 \u4e0d\u662f\u8fd0\u884c\u6162\uff0c\u662f\u8c03\u8bd5\u4ee3\u7801\u7684\u65f6\u5019\u8111\u5b50\u8f6c\u5f97\u6162\uff0c\u56e0\u4e3a\u8c03\u7528\u6808\u592a\u6df1\u4e86\u3002<\/li>\n\n\n\n<li>\u7248\u672c\u4e0d\u517c\u5bb9\uff1a\u4f60\u4eca\u5929\u5199\u7684\u4ee3\u7801\uff0c\u4e0b\u4e2a\u6708\u5347\u7ea7\u4e86 LangChain \u53ef\u80fd\u5c31\u8dd1\u4e0d\u901a\u4e86\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u90a3\u4e3a\u4ec0\u4e48\u8fd8\u8981\u5b66\u5b83\uff1f\u56e0\u4e3a\u5b83\u751f\u6001\u592a\u5f3a\u4e86\u3002<\/p>\n\n\n\n<ul>\n<li>\u4f60\u60f3\u7528\u7684\u4efb\u4f55\u5de5\u5177\uff08Google Search, Wikipedia, Notion, Gmail\u2026\uff09\uff0cLangChain \u91cc\u90fd\u6709\u73b0\u6210\u7684\u7ec4\u4ef6\u3002<\/li>\n\n\n\n<li>\u4f60\u60f3\u7528\u7684\u4efb\u4f55\u6280\u672f\uff08RAG, ReAct, MapReduce\u2026\uff09\uff0cLangChain \u91cc\u90fd\u6709\u73b0\u6210\u7684\u6a21\u677f\u3002<\/li>\n\n\n\n<li>\u5b83\u5c31\u50cf AI \u5c4a\u7684 Spring \u6846\u67b6\u6216\u8005 React \u6846\u67b6\uff0c\u867d\u7136\u81c3\u80bf\uff0c\u867d\u7136\u6709\u5751\uff0c\u4f46\u5b83\u662f\u76ee\u524d\u6700\u5feb\u4e0a\u624b\u3001\u8d44\u6e90\u6700\u591a\u7684\u9009\u62e9\u3002<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u521d\u5b66\u8005\uff0c\u6211\u7684\u5efa\u8bae\u662f\uff1a\u4e0d\u8981\u8bd5\u56fe\u53bb\u5b66\u5b8c LangChain \u7684\u6240\u6709 API\uff0c\u90a3\u662f\u4e0d\u53ef\u80fd\u7684\u3002\u4f60\u53ea\u9700\u8981\u641e\u61c2\u5b83\u7684\u6838\u5fc3\u903b\u8f91\uff08\u5c31\u662f\u4e0a\u9762\u8bf4\u7684\u516d\u5927\u6838\u5fc3\u6a21\u5757\uff09\uff0c\u7136\u540e\u7528\u5230\u4ec0\u4e48\u518d\u53bb\u67e5\u4ec0\u4e48\u3002\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u5de5\u5177\u7bb1\uff0c\u800c\u4e0d\u662f\u4e00\u672c\u6559\u79d1\u4e66\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<br><\/p>\n\n\n\n<p><strong>\u4e94\u3001\u672a\u6765\u4ec0\u4e48\u6837\uff1aLangChain 1.0 \u4e0e AI \u539f\u751f\u7684\u672a\u6765\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u73b0\u5728\u8fd8\u6709\u4e00\u4e2a\u8d8b\u52bf\uff0c\u53eb LangSmith \u548c LangServe\u3002<\/p>\n\n\n\n<ul>\n<li>LangSmith \u662f\u5e2e\u4f60\u770b\u6e05\u8fd9\u4e00\u5806\u4e71\u4e03\u516b\u7cdf\u7684\u94fe\u6761\u91cc\u5230\u5e95\u53d1\u751f\u4e86\u5565\u7684\u5e73\u53f0\uff08\u76d1\u63a7\u4e0e\u8c03\u8bd5\uff09\u3002<\/li>\n\n\n\n<li>LangServe \u662f\u5e2e\u4f60\u4e00\u952e\u628a\u5199\u597d\u7684\u94fe\u6761\u53d8\u6210 API \u63a5\u53e3\uff0c\u76f4\u63a5\u80fd\u7ed9\u524d\u7aef\u8c03\u7528\u7684\u795e\u5668\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u8bf4\u660e\u5565\uff1f\u8bf4\u660e LangChain \u6b63\u5728\u4ece\u4e00\u4e2a \u201c\u4ee3\u7801\u5e93\u201d \u8fdb\u5316\u6210\u4e00\u5957\u5b8c\u6574\u7684 \u201cAI \u5f00\u53d1\u64cd\u4f5c\u7cfb\u7edf\u201d\u3002\u800c\u4e14\uff0c\u968f\u7740\u5927\u6a21\u578b\u672c\u8eab\u7684\u80fd\u529b\u8d8a\u6765\u8d8a\u5f3a\uff08\u6bd4\u5982 GPT-4 \u7684 Context \u7a97\u53e3\u8d8a\u6765\u8d8a\u5927\uff0c\u80fd\u4e00\u6b21\u6027\u8bfb\u5b8c\u4e00\u672c\u4e66\uff09\uff0c\u4e5f\u8bb8\u672a\u6765\u7b80\u5355\u7684 RAG \u4e0d\u9700\u8981\u90a3\u4e48\u590d\u6742\u7684\u5207\u7247\u903b\u8f91\u4e86\u3002\u4f46 Agent\uff08\u667a\u80fd\u4f53\uff09\u7684\u903b\u8f91\u4f1a\u8d8a\u6765\u8d8a\u91cd\u8981\u3002<\/p>\n\n\n\n<p>\u672a\u6765\u7684 AI \u5e94\u7528\uff0c\u4e00\u5b9a\u4e0d\u662f\u7b80\u5355\u7684 \u201c\u4e00\u95ee\u4e00\u7b54\u201d\uff0c\u800c\u662f \u201c\u4e00\u53e5\u8bdd\u89e3\u51b3\u590d\u6742\u4efb\u52a1\u201d\u3002\u6bd4\u5982\uff1a\u201c\u5e2e\u6211\u5199\u4e2a\u6e38\u620f\uff0c\u7136\u540e\u53d1\u5e03\u5230 App Store\u201d\u3002\u8fd9\u4e2d\u95f4\u6d89\u53ca\u5230\u5199\u4ee3\u7801\u3001\u753b\u56fe\u3001\u6d4b\u8bd5\u3001\u586b\u8868\u5355\u3001\u4e0a\u4f20\u7b49\u51e0\u5341\u4e2a\u6b65\u9aa4\u3002LangChain \u5c31\u662f\u5728\u4e3a\u8fd9\u79cd\u672a\u6765\u6253\u5730\u57fa\u3002<\/p>\n\n\n\n<p>\u3000\u3000<br><strong>\u516d\u3001\u603b\u7ed3\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u672c\u6765\u5199\u4e86\u4e00\u4e9b\u603b\u7ed3\uff0c\u4f46\u662f\u611f\u89c9\u90fd\u4e0d\u591f\u5b8c\u7f8e\uff0c\u5c31\u653e\u4e0b\u9762\u8fd9\u5f20\u56fe\u5427\uff1a<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"827\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-1024x827.png\" alt=\"\" class=\"wp-image-19913\" style=\"width:572px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-1024x827.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-300x242.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-768x620.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-830x670.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-230x186.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-350x283.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93-480x388.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-93.png 1313w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u5c0f\u7ea2\u4e66\uff1aAI\u4ea7\u54c1\u8d75\u54e5 \u524d\u8a00\u00a0\ud83d\udd16 \u4f5c\u4e3a\u4e00\u4e2a AI \u4ea7\u54c1\u7ecf\u7406\u8fc7\u6765\u4eba\uff0c\u6211\u5f88\u80fd\u7406\u89e3\u5927\u5bb6\u9762\u5bf9 LangChain \u8fd9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/19897"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19897"}],"version-history":[{"count":11,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/19897\/revisions"}],"predecessor-version":[{"id":20320,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/19897\/revisions\/20320"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}