{"id":1817,"date":"2024-04-17T00:43:28","date_gmt":"2024-04-16T16:43:28","guid":{"rendered":"https:\/\/www.tchepai.com\/?p=1817"},"modified":"2024-04-17T00:43:28","modified_gmt":"2024-04-16T16:43:28","slug":"llmagent","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/en\/llmagent\/","title":{"rendered":"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003"},"content":{"rendered":"<p>ChatGPT\u548cKimi\u7b49\u95ee\u7b54\u4ea7\u54c1\u90fd\u5728\u7528Agent\u5bf9\u8bdd\uff08\u80fd\u8c03\u7528\u4e0d\u540c\u5de5\u5177\u4e0e\u7528\u6237\u8fdb\u884c\u4ea4\u4e92\uff09\uff0c\u6bd4\u5982Kimi\u7684\u5de5\u5177\u5c31\u6709LLM\u5bf9\u8bdd\u3001\u94fe\u63a5\u5bf9\u8bdd\u3001\u6587\u4ef6\u5bf9\u8bdd\u3001\u8054\u7f51\u5bf9\u8bdd\u3002\u6bd4\u5982ChatGPT\u3001\u6587\u5fc3\u4e00\u8a00\u548c\u8baf\u98de\u661f\u706b\u7b49\uff0c\u8fd8\u6269\u5c55\u6709\u6587\u751f\u56fe\u3001\u4ee3\u7801\u7f16\u5199\u3001\u6570\u5b66\u8ba1\u7b97\u5668\u7b49\u5de5\u5177\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3117\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/a04c9d6d77e4e1f.png\" width=\"936\" height=\"289\" alt=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-1\" title=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-1\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/a04c9d6d77e4e1f.png 936w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/a04c9d6d77e4e1f-300x93.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/a04c9d6d77e4e1f-768x237.png 768w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/p>\n<p>&nbsp;<\/p>\n<div style=\"width: 954px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3119\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e0d073324cd6278.png\" width=\"944\" height=\"712\" alt=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-2\" title=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-2\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e0d073324cd6278.png 944w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e0d073324cd6278-300x226.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e0d073324cd6278-768x579.png 768w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><p class=\"wp-caption-text\">ChatGPT4\u7684Agent\u5bf9\u8bdd<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u73b0\u5728\u5b9e\u73b0Agent\u5bf9\u8bdd\u80fd\u529b\u7684\u4e3b\u6d41\u6846\u67b6\u662fReAct\uff082022\u5e74\u7531\u666e\u6797\u65af\u987f\u5927\u5b66\u548cGoogle\u63d0\u51fa\uff09\uff0cReAct[1]\u5c31\u662f\u4e00\u79cd\u63d0\u793a\u8bcd\u65b9\u6cd5\uff0c\u878d\u5408\u4e86\u601d\u8003\u548c\u884c\u52a8\u3002\u5b83\u7684\u5386\u53f2\u6f14\u53d8\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3118\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/8fa07969e9424b6.png\" width=\"1080\" height=\"291\" alt=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-3\" title=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-3\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/8fa07969e9424b6.png 1080w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/8fa07969e9424b6-300x81.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/8fa07969e9424b6-1024x276.png 1024w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/8fa07969e9424b6-768x207.png 768w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0a\u56fe\u4e2d3\u79cd\u65b9\u6cd5\u5206\u522b\u4e3a\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Reason Only\uff1a<\/strong>\u4f7f\u7528Chain-of-thought\u8fdb\u884c\u591a\u6b65\u601d\u8003\uff0c\u5728Prompt\u524d\u52a0\u5165\u95ee\u9898\u8f93\u5165\u524d\u52a0\u5165\u201cLet\u2019s think step by step\u201d\u7684\u63d0\u793a\u8bcd\uff0c\u5f15\u5bfc\u591a\u6b65\u601d\u8003\uff0c\u522b\u76f4\u63a5\u7ed9\u7b54\u6848\uff0c\u4f46\u7f3a\u70b9\u5f88\u660e\u663e\uff1aReason Only\u95ed\u95e8\u5149\u60f3\u4e0d\u505a\uff0c\u4e0d\u4f1a\u51fa\u53bb\u770b\u770b\u4e86\u89e3\u5916\u9762\u7684\u4e16\u754c\u518d\u601d\u8003\uff0c\u56e0\u6b64\u4f1a\u4ea7\u751f\u5e7b\u89c9\uff0c\u671d\u4ee3\u66f4\u8fed\u4e86\u90fd\u4e0d\u77e5\u9053\uff1b<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Act-Only\uff1a<\/strong>\u901a\u8fc7\u5355\u6b65\u884c\u52a8Action\u83b7\u53d6\u89c2\u5bdf\u7ed3\u679cObservation\uff0c\u7f3a\u70b9\uff1a\u6ca1\u60f3\u597d\u5c31\u7acb\u9a6c\u505a\uff0c\u6700\u540e\u5f97\u5230\u7684\u7b54\u6848\u53ef\u80fd\u8ddf\u6211\u60f3\u8981\u7684\u4e0d\u4e00\u5b9a\u80fd\u4fdd\u8bc1\u4e00\u81f4\uff1b<\/p>\n<p>&nbsp;<\/p>\n<p><strong>ReAct\uff1a<\/strong>\u878d\u5408\u4e86\u601d\u8003\u548c\u884c\u52a8\uff0c\u5373\u5148\u601d\u8003\u518d\u884c\u52a8\uff0c\u628a\u884c\u52a8\u540e\u7684\u7ed3\u679c\u8fd4\u56de\u540e\u518d\u601d\u8003\u4e0b\u4e00\u6b65\u8be5\u505a\u4ec0\u4e48\uff0c\u518d\u884c\u52a8\uff0c\u4e0d\u65ad\u91cd\u590d\u8be5\u8fc7\u7a0b\uff0c\u77e5\u9053\u4ea7\u751f\u6700\u7ec8\u7b54\u6848\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6269\u5c55\uff1a2023\u5e74\u8fd8\u51fa\u4e86\u4e00\u4e2a\u81ea\u6211\u53cd\u601d\uff08<strong>Reflexion<\/strong>\uff09\u7684\u6846\u67b6\uff0c\u52a0\u5165\u4e86\u53cd\u601d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8fd9\u91cc\u4e0d\u505a\u6df1\u5165\u3002\u53e6\u5916\u6709\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u770b\u4e0b\u5927\u6dd8\u5b9d\u6280\u672f\u516c\u4f17\u53f7\u7684\u300aAgent\u8c03\u7814&#8211;19\u7c7bAgent\u6846\u67b6\u5bf9\u6bd4\u300b\uff0c\u8fd9\u5757\u4e3a\u4e86\u53d1\u8bba\u6587\u771f\u7684\u662f\u8d8a\u73a9\u8d8a\u82b1\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2958\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/bde522de56bf99e.png\" width=\"939\" height=\"673\" alt=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-4\" title=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-4\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/bde522de56bf99e.png 939w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/bde522de56bf99e-300x215.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/bde522de56bf99e-768x550.png 768w\" sizes=\"auto, (max-width: 939px) 100vw, 939px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u5c55\u793aReAct\u8bba\u6587\u63d0\u5230\u7684\u4f8b\u5b50\uff0c\u80fd\u66f4\u597d\u8bf4\u660e\u4ee5\u4e0a\u903b\u8f91\u548c\u4f18\u7f3a\u70b9\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2962\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/61a3c009eb0fda3.png\" width=\"1080\" height=\"471\" alt=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-5\" title=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-5\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/61a3c009eb0fda3.png 1080w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/61a3c009eb0fda3-300x131.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/61a3c009eb0fda3-1024x447.png 1024w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/61a3c009eb0fda3-768x335.png 768w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>ReAct\u7684Prompt\u662f\uff1a<\/p>\n<blockquote><p>&#8220;&#8221;&#8221;<br \/>\nAgent Prompt\u7684\u8f93\u5165\u53d8\u91cf\u89e3\u91ca\uff1a<br \/>\n&#8211; tools: \u5de5\u5177\u96c6\u8bf4\u660e\uff0c\u683c\u5f0f\u4e3a&#8221;{tool.name}: {tool.description}&#8221;<br \/>\n&#8211; toool_names\uff1a\u5de5\u5177\u540d\u79f0\u5217\u8868<br \/>\n&#8211; history: \u7528\u6237\u548cAgent\u7684\u5bf9\u8bdd\u5386\u53f2\uff08\u6ce8\u610fagent chat\u4e2d\u95f4\u591a\u8f6eReAct\u8fc7\u7a0b\u4e0d\u8ba1\u5165\u5bf9\u8bdd\u5386\u53f2\uff09<br \/>\n&#8211; input: \u7528\u6237\u63d0\u95ee<br \/>\n&#8211; agent_scratchpad: \u4e2d\u95f4action\u548cobservation\u7684\u8fc7\u7a0b\uff0c<br \/>\n\u4f1a\u88ab\u683c\u5f0f\u6210&#8221;\\nObservation: {observation}\\nThought:{action} &#8220;\uff0c<br \/>\n\u7136\u540e\u4f20\u5165agent_scratchpad\uff08Agent\u7684\u601d\u7ef4\u8bb0\u5f55\uff09<br \/>\n&#8220;&#8221;&#8221;<br \/>\nagent_prompt = &#8220;&#8221;&#8221;<br \/>\nAnswer the following questions as best you can. If it is in order, you can use some tools appropriately. You have access to the following tools:<\/p>\n<p>{tools}<\/p>\n<p>Use the following format:<br \/>\nQuestion: the input question you must answer1<br \/>\nThought: you should always think about what to do and what tools to use.<br \/>\nAction: the action to take, should be one of {toool_names}<br \/>\nAction Input: the input to the action<br \/>\nObservation: the result of the action<br \/>\n&#8230; (this Thought\/Action\/Action Input\/Observation can be repeated zero or more times)<br \/>\nThought: I now know the final answer<br \/>\nFinal Answer: the final answer to the original input question<br \/>\nBegin!<\/p>\n<p>history: {history}<\/p>\n<p>Question: {input}<\/p>\n<p>Thought: {agent_scratchpad}&#8221;&#8221;&#8221;<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>ReAct\u5e94\u7528\u6d41\u7a0b\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2960\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e8b5325b8956cf0.png\" width=\"1076\" height=\"455\" alt=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-6\" title=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-6\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e8b5325b8956cf0.png 1076w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e8b5325b8956cf0-300x127.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e8b5325b8956cf0-1024x433.png 1024w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/e8b5325b8956cf0-768x325.png 768w\" sizes=\"auto, (max-width: 1076px) 100vw, 1076px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u7f51\u4e0a\u6709\u4e2a\u4f8b\u5b50\u633a\u597d\u7684\uff0c\u8fd9\u91cc\u53c2\u8003\u6765\u505a\u4e3e\u4f8b\u9610\u91ca[2]\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7528\u6237\u63d0\u95ee\uff08Question\uff09<\/strong>\uff1a\u201d\u76ee\u524d\u5e02\u573a\u4e0a\u73ab\u7470\u82b1\u7684\u5e73\u5747\u4ef7\u683c\u662f\u591a\u5c11\uff1f\u5982\u679c\u6211\u5728\u6b64\u57fa\u7840\u4e0a\u52a0\u4ef715%\u5356\u51fa\uff0c\u5e94\u8be5\u5982\u4f55\u5b9a\u4ef7\uff1f\u201d<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u5de5\u5177\u5e93\uff08Tools\uff09<\/strong>\uff1a{\u2019bing web search\u2019: \u7528\u5fc5\u5e94Search\u641c\u7d22\u7f51\u7edc\u5f00\u6e90\u4fe1\u606f\u7684\u5de5\u5177\uff1b\u2018llm-math\u2019: \u7528\u5927\u6a21\u578b\u548cPython\u505a\u6570\u5b66\u8fd0\u7b97\u7684\u5de5\u5177}<\/p>\n<p>&nbsp;<\/p>\n<p>\u90a3\u4e48\u7b2c\u4e00\u8f6e\u5bf9\u8bdd\u7684\u8f93\u5165\u4e3a\uff1a<\/p>\n<blockquote><p>Answer the following questions as best you can. If it is in order, you can use some tools appropriately. You have access to the following tools:<br \/>\nbing-web-search: \u7528\u5fc5\u5e94Search\u641c\u7d22\u7f51\u7edc\u5f00\u6e90\u4fe1\u606f\u7684\u5de5\u5177<br \/>\nllm-math: \u7528\u5927\u6a21\u578b\u548cPython\u505a\u6570\u5b66\u8fd0\u7b97\u7684\u5de5\u5177<br \/>\nUse the following format:<br \/>\nQuestion: the input question you must answer1<br \/>\nThought: you should always think about what to do and what tools to use.<br \/>\nAction: the action to take, should be one of [bing-web-search, llm-math]<br \/>\nAction Input: the input to the action<br \/>\nObservation: the result of the action<br \/>\n&#8230; (this Thought\/Action\/Action Input\/Observation can be repeated zero or more times)<br \/>\nThought: I now know the final answer<br \/>\nFinal Answer: the final answer to the original input question<br \/>\nBegin!<br \/>\nhistory:<br \/>\nQuestion: \u76ee\u524d\u5e02\u573a\u4e0a\u73ab\u7470\u82b1\u7684\u5e73\u5747\u4ef7\u683c\u662f\u591a\u5c11\uff1f\u5982\u679c\u6211\u5728\u6b64\u57fa\u7840\u4e0a\u52a0\u4ef715%\u5356\u51fa\uff0c\u5e94\u8be5\u5982\u4f55\u5b9a\u4ef7\uff1f<br \/>\nThought:<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u5f97\u5230\u8f93\u51fa\u540e\u89e3\u6790\uff0c\u83b7\u53d6Thought\u3001Action\u548cAction Input\uff1a<\/p>\n<blockquote><p>Thought: \u6211\u5e94\u8be5\u4f7f\u7528\u641c\u7d22\u5de5\u5177\u6765\u67e5\u627e\u7b54\u6848\uff0c\u8fd9\u6837\u6211\u53ef\u4ee5\u5feb\u901f\u5730\u627e\u5230\u6240\u9700\u7684\u4fe1\u606f\u3002<br \/>\nAction: bing-web-search<br \/>\nAction Input: \u73ab\u7470\u82b1\u5e73\u5747\u4ef7\u683c<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u8c03\u7528bing-web-search\u5de5\u5177\uff0c\u8f93\u5165&#8221;\u73ab\u7470\u82b1\u5e73\u5747\u4ef7\u683c&#8221;\uff0c\u83b7\u53d6\u8fd4\u56de\u5185\u5bb9Observation\uff1a\u201d\u6839\u636e\u7f51\u7edc\u8d44\u6599\u663e\u793a\uff0c\u7f8e\u56fd\u6bcf\u675f\u73ab\u7470\u82b1\u572880.16\u7f8e\u5143\u3002\u201d\u3002\u4e4b\u540e\u5c06\u4ee5\u4e0a\u5185\u5bb9\uff0c\u6574\u7406\u518d\u653e\u5165ReAct\u7684\u63d0\u793a\u8bcd\u6a21\u677f\u4e2d\uff0c\u5f00\u542f\u7b2c\u4e8c\u8f6e\u5bf9\u8bdd\u7684\u8f93\u5165\uff1a<\/p>\n<blockquote><p>Answer the following questions as best you can. If it is in order, you can use some tools appropriately. You have access to the following tools:<br \/>\nbing-web-search: \u7528\u5fc5\u5e94Search\u641c\u7d22\u7f51\u7edc\u5f00\u6e90\u4fe1\u606f\u7684\u5de5\u5177<br \/>\nllm-math: \u7528\u5927\u6a21\u578b\u548cPython\u505a\u6570\u5b66\u8fd0\u7b97\u7684\u5de5\u5177<br \/>\nUse the following format:<br \/>\nQuestion: the input question you must answer1<br \/>\nThought: you should always think about what to do and what tools to use.<br \/>\nAction: the action to take, should be one of [bing-web-search, llm-math]<br \/>\nAction Input: the input to the action<br \/>\nObservation: the result of the action<br \/>\n&#8230; (this Thought\/Action\/Action Input\/Observation can be repeated zero or more times)<br \/>\nThought: I now know the final answer<br \/>\nFinal Answer: the final answer to the original input question<br \/>\nBegin!<br \/>\nhistory:<br \/>\nQuestion: \u76ee\u524d\u5e02\u573a\u4e0a\u73ab\u7470\u82b1\u7684\u5e73\u5747\u4ef7\u683c\u662f\u591a\u5c11\uff1f\u5982\u679c\u6211\u5728\u6b64\u57fa\u7840\u4e0a\u52a0\u4ef715%\u5356\u51fa\uff0c\u5e94\u8be5\u5982\u4f55\u5b9a\u4ef7\uff1f<br \/>\nThought: \u6211\u5e94\u8be5\u4f7f\u7528\u641c\u7d22\u5de5\u5177\u6765\u67e5\u627e\u7b54\u6848\uff0c\u8fd9\u6837\u6211\u53ef\u4ee5\u5feb\u901f\u5730\u627e\u5230\u6240\u9700\u7684\u4fe1\u606f\u3002<br \/>\nAction: bing-web-search<br \/>\nAction Input: \u73ab\u7470\u82b1\u5e73\u5747\u4ef7\u683c<br \/>\nObservation: \u6839\u636e\u7f51\u7edc\u8d44\u6599\u663e\u793a\uff0c\u7f8e\u56fd\u6bcf\u675f\u73ab\u7470\u82b1\u572880.16\u7f8e\u5143\u3002<br \/>\nThought:<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u5f97\u5230\u8f93\u51fa\u540e\u89e3\u6790\uff0c\u83b7\u53d6Thought\u3001Action\u548cAction Input\uff1a<\/p>\n<blockquote><p>Thought: \u6211\u9700\u8981\u6570\u5b66\u8ba1\u7b97\u5728\u6b64\u57fa\u7840\u4e0a\u52a0\u4ef715%\u7684\u4ef7\u683c\u662f\u591a\u5c11\u3002<br \/>\nAction: llm-math<br \/>\nAction Input: 80.16*1.15<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u8c03\u7528llm-math\u5de5\u5177\uff0c\u8f93\u5165&#8221;80.16*1.15&#8243;\uff0c\u83b7\u53d6\u8fd4\u56de\u5185\u5bb9Observation\uff1a\u201d92.184\u201d\u3002\u4e4b\u540e\u5c06\u4ee5\u4e0a\u5185\u5bb9\uff0c\u6574\u7406\u518d\u653e\u5165ReAct\u7684\u63d0\u793a\u8bcd\u6a21\u677f\u4e2d\uff0c\u5f00\u542f\u7b2c\u4e09\u8f6e\u5bf9\u8bdd\u7684\u8f93\u5165\uff1a<\/p>\n<blockquote><p>Answer the following questions as best you can. If it is in order, you can use some tools appropriately. You have access to the following tools:<br \/>\nbing-web-search: \u7528\u5fc5\u5e94Search\u641c\u7d22\u7f51\u7edc\u5f00\u6e90\u4fe1\u606f\u7684\u5de5\u5177<br \/>\nllm-math: \u7528\u5927\u6a21\u578b\u548cPython\u505a\u6570\u5b66\u8fd0\u7b97\u7684\u5de5\u5177<br \/>\nUse the following format:<br \/>\nQuestion: the input question you must answer1<br \/>\nThought: you should always think about what to do and what tools to use.<br \/>\nAction: the action to take, should be one of [bing-web-search, llm-math]<br \/>\nAction Input: the input to the action<br \/>\nObservation: the result of the action<br \/>\n&#8230; (this Thought\/Action\/Action Input\/Observation can be repeated zero or more times)<br \/>\nThought: I now know the final answer<br \/>\nFinal Answer: the final answer to the original input question<br \/>\nBegin!<br \/>\nhistory:<br \/>\nQuestion: \u76ee\u524d\u5e02\u573a\u4e0a\u73ab\u7470\u82b1\u7684\u5e73\u5747\u4ef7\u683c\u662f\u591a\u5c11\uff1f\u5982\u679c\u6211\u5728\u6b64\u57fa\u7840\u4e0a\u52a0\u4ef715%\u5356\u51fa\uff0c\u5e94\u8be5\u5982\u4f55\u5b9a\u4ef7\uff1f<br \/>\nThought: \u6211\u5e94\u8be5\u4f7f\u7528\u641c\u7d22\u5de5\u5177\u6765\u67e5\u627e\u7b54\u6848\uff0c\u8fd9\u6837\u6211\u53ef\u4ee5\u5feb\u901f\u5730\u627e\u5230\u6240\u9700\u7684\u4fe1\u606f\u3002<br \/>\nAction: bing-web-search<br \/>\nAction Input: \u73ab\u7470\u82b1\u5e73\u5747\u4ef7\u683c<br \/>\nObservation: \u6839\u636e\u7f51\u7edc\u8d44\u6599\u663e\u793a\uff0c\u7f8e\u56fd\u6bcf\u675f\u73ab\u7470\u82b1\u572880.16\u7f8e\u5143\u3002<br \/>\nThought: \u6211\u9700\u8981\u6570\u636e\u8ba1\u7b97\u5728\u6b64\u57fa\u7840\u4e0a\u52a0\u4ef715\u7684\u4ef7\u683c\u662f\u591a\u5c11\u3002<br \/>\nAction: llm-math<br \/>\nAction Input: 80.16*1.15<br \/>\nObservation: 92.184<br \/>\nThought:<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u5f97\u5230\u8f93\u51fa\u540e\u89e3\u6790\uff0c\u83b7\u53d6Thought\u3001Action\u548cAction Input\uff1a<\/p>\n<blockquote><p>Thought: \u6211\u77e5\u9053\u6700\u7ec8\u7b54\u6848\u4e86\u3002<br \/>\nFinal Answer: \u5982\u679c\u8981\u52a0\u4ef715%\u5356\uff0c\u5e94\u8be5\u5b9a\u4ef7\u4e3a92.184\u7f8e\u5143\u3002<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>Langchain\u5df2\u5b9e\u73b0\u4e86ReAct\u7684\u8c03\u7528[3]\uff0c\u5177\u4f53\u7684\u9700\u8981\u4f60\u53bb\u521b\u5efaReAct Agent\u3001AgentExecutor\u548ctools\u3002\u901a\u8fc7ReAct Agent\uff0c\u6211\u4eec\u4fbf\u80fd\u5b9e\u73b0\u524d\u9762\u63d0\u5230\u7684\uff0c\u8fde\u63a5\u4e0d\u540c\u5de5\u5177\uff0c\u6839\u636e\u7528\u6237\u9700\u6c42\u548cLLM\u7684\u601d\u8003\u53bb\u8c03\u7528\u4e0d\u540c\u5de5\u5177\u63d0\u9ad8\u95ee\u7b54\u8868\u73b0\u3002\u5982\u679c\u81ea\u5df1\u91cd\u5199ReAct-based\u7684Agent Chat\uff0c\u7279\u522b\u9700\u8981\u6ce8\u610f\u4e00\u4e9b\u8fb9\u754c\u6761\u4ef6\uff0c\u6bd4\u5982\u9009\u62e9\u5de5\u5177\u4e0d\u5b58\u5728\u3001\u5de5\u5177\u8c03\u7528\u5931\u8d25\uff0c\u5de5\u5177\u8c03\u7528\u9677\u5165\u6b7b\u5faa\u73af\u7b49\u60c5\u51b5\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u4f1a\u6700\u7ec8\u5f71\u54cd\u4ea4\u4e92\u7684\u6548\u679c\u3002\u4e2a\u4eba\u5728\u5b9e\u8df5ReAct Agent Chat\u6548\u679c\u65f6\uff0c\u6709\u51e0\u4e0b\u5fc3\u5f97\uff1a<\/p>\n<ul>\n<li>\u9009\u62e9\u505a\u8fc7Agent\u5bf9\u8bdd\u80fd\u529b\u5bf9\u9f50\u7684LLM\uff0c\u6700\u597dReAct Prompt\u80fd\u9002\u914dLLM\uff1b<\/li>\n<li>\u6e05\u6670\u63cf\u8ff0\u597d\u5de5\u5177\u4ecb\u7ecd\uff0c\u51cf\u5c11\u5de5\u5177\u4e4b\u95f4\u7684\u63cf\u8ff0\u6a21\u7cca\uff0c\u907f\u514d\u7528\u9519\u5de5\u5177\uff1b<\/li>\n<li>\u5c0f\u5fc3\u591a\u8f6e\u601d\u8003-\u884c\u52a8-\u89c2\u5bdf\u540e\uff0c\u5bfc\u81f4\u8f93\u5165\u4e0a\u4e0b\u6587\u8fc7\u591a\uff0c\u800c\u5f88\u591aLLM\u5bf9\u957f\u4e0a\u4e0b\u6587\u8f93\u5165\u7406\u89e3\u80fd\u529b\u4f1a\u53d8\u5dee\u3002<\/li>\n<li>\u5982\u679c\u53ea\u6709\u5355\u8f6e\u601d\u8003-\u884c\u52a8-\u89c2\u5bdf\uff0c\u90a3\u4e48\u4e00\u5957\u6d41\u7a0b\u4e0b\u6765\uff0c\u9700\u8981\u7ecf\u8fc72\u6b21LLM\u548c1\u6b21tool\u8c03\u7528\uff0c\u4f1a\u5f71\u54cd\u56de\u590d\u65f6\u95f4\uff0c\u5982\u679c\u60f3\u7b80\u5316\u8be5ReAct\u7684\u6d41\u7a0b\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u610f\u56fe\u8bc6\u522b+\u5de5\u5177\u8c03\u7528\u7684\u65b9\u5f0f\uff0c\u7531\u5de5\u5177\u76f4\u63a5\u8f93\u51fa\u6700\u7ec8\u7ed3\u679c\uff0c\u4e0d\u7528\u53cd\u9988\u81f3LLM\u505a\u603b\u7ed3\u56de\u7b54\uff0c\u7f3a\u70b9\u5c31\u662f\u6ca1\u90a3\u4e48\u5b8c\u7f8e\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>LangChain\u63d0\u4f9b\u4e00\u4e9b\u5165\u95e8\u5de5\u5177\u5305\uff0c\u53ef\u4ee5\u53c2\u8003[4]\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u901a\u8fc7\u524d\u9762\uff0c\u6211\u4eec\u80fd\u53d1\u73b0Action\u548cAction Input\u662f\u8c03\u7528\u7684\u5de5\u5177\u540d\u79f0\u548c\u8be5\u5de5\u5177\u7684\u8f93\u5165\uff0c\u5982\u679c\u6211\u4eec\u60f3\u5bf9\u4e34\u65f6\u6027\u4e0a\u4f20\u6587\u4ef6\u8fdb\u884c\u5bf9\u8bdd\uff0c\u4e5f\u76f4\u63a5\u52a0\u5165tools\u5c31\u884c\u4e86\uff1f\u5b9e\u9645\u4e0a\uff0c\u6ca1\u90a3\u4e48\u597d\u64cd\u4f5c\uff0c\u56e0\u4e3aAction Input\u662fLLM\u57fa\u4e8equery\u89e3\u6790\u5f97\u5230\u7684\u5de5\u5177\u8f93\u5165\uff0c\u800c\u201c\u5bf9\u4e34\u65f6\u6027\u4e0a\u4f20\u6587\u4ef6\u8fdb\u884c\u5bf9\u8bdd\u201d\u529f\u80fd\u9700\u8981\u6587\u4ef6\u4f4d\u7f6e\u6216\u6587\u4ef6\u5185\u5bb9\uff0c\u4e3a\u6b64\uff0c\u5176\u5b9e\u53ef\u4ee5\u6309\u6211\u4e0b\u56fe\u7ed8\u5236\u7684\uff0c\u5355\u72ec\u628a \u201c\u5bf9\u4e34\u65f6\u6027\u4e0a\u4f20\u6587\u4ef6\u8fdb\u884c\u5bf9\u8bdd\u201d\u529f\u80fd\u62bd\u79bb\u51fa\u6765\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2959\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/ecd82ca3285c982.png\" width=\"697\" height=\"767\" alt=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-7\" title=\"LLM\u5e94\u7528\uff1aAgent\u5bf9\u8bdd(\u9644\u5de5\u5177\u8c03\u7528)\u7684\u601d\u8003-7\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/ecd82ca3285c982.png 697w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/04\/ecd82ca3285c982-273x300.png 273w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u5177\u4f53\u524d\u540e\u7aef\u914d\u5408\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n<p>1\u3001\u7528\u6237\u4e0a\u4f20\u6587\u4ef6\u540e\uff0c\u524d\u7aef\u5148\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u77e5\u8bc6\u5e93\uff0c\u7136\u540e\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230\u8be5\u77e5\u8bc6\u5e93\uff0c\u540c\u65f6\u521d\u59cb\u5316\u6587\u4ef6\u5bf9\u8bdd\u8f6e\u6570\u4e3a0\uff0c\u5e76\u8bb0\u5f55\u8be5\u4e34\u65f6\u77e5\u8bc6\u5e93\u7684\u53d8\u91cf\u540d\u79f0\uff1b<\/p>\n<p>2\u3001\u540e\u7eed\u6bcf\u8f6e\u5bf9\u8bdd\uff0c\u90fd\u628a\u77e5\u8bc6\u5e93\u540d\u79f0\u4f20\u5165Agent Chat\u4e2d\uff0c\u6309\u4e0a\u56fe\u6d41\u7a0b\u8d70\uff0c\u6bcf\u8f6e\u5bf9\u8bdd\u540e\uff0c\u90fd\u66f4\u65b0\u4e0b\u6587\u4ef6\u5bf9\u8bdd\u8f6e\u6570\uff1b<\/p>\n<p>3\u3001\u5f53\u6587\u4ef6\u5bf9\u8bdd\u8f6e\u6570 &gt; \u6587\u4ef6\u4fdd\u7559\u8f6e\u6570 \u6216 \u7528\u6237\u624b\u52a8\u6e05\u7a7a\u4e0a\u4e0b\u6587\uff0c\u5219\u524d\u7aef\u5220\u9664\u8be5\u4e34\u65f6\u77e5\u8bc6\u5e93\uff0c\u5e76\u6e05\u7a7a\u8be5\u4e34\u65f6\u77e5\u8bc6\u5e93\u7684\u53d8\u91cf\u540d\u79f0\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u53c2\u8003\u8d44\u6599<\/strong><\/p>\n<p>[1] <a href=\"https:\/\/www.kdjingpai.com\/en\/react\/\">ReAct<\/a>: Synergizing Reasoning and Acting in Language Models\uff0c\u5b98\u65b9\u4ecb\u7ecd\uff1ahttps:\/\/react-lm.github.io\/<\/p>\n<p>[2] LangChain\u5e72\u8d27\uff081\uff09\uff1aAgentExecutor\u7a76\u7adf\u662f\u600e\u6837\u9a71\u52a8\u6a21\u578b\u548c\u5de5\u5177\u5b8c\u6210\u4efb\u52a1\u7684\uff1f- \u9ec4\u4f73\u7684\u6587\u7ae0 &#8211; \u77e5\u4e4ehttps:\/\/zhuanlan.zhihu.com\/p\/661244337<\/p>\n<p>[3] ReAct\uff0cLangchain\u6587\u6863\uff1ahttps:\/\/python.langchain.com\/docs\/modules\/agents\/agent_types\/react\/<\/p>\n<p>[4] Agent \u5de5\u5177\u7bb1\uff0cLangchain\u6587\u6863\uff1ahttps:\/\/python.langchain.com\/docs\/integrations\/toolkits\/<\/p>\n<p>[5]\u300aLLM+\u641c\u7d22\u6539\u5199\u300b10\u7bc7\u8bba\u6587\u4e00\u89c8 &#8211; \u60c5\u8ff7\u641c\u5e7f\u63a8\u7684\u6587\u7ae0 &#8211; \u77e5\u4e4e\uff1ahttps:\/\/zhuanlan.zhihu.com\/p\/672357196<\/p>\n<p>[6] MultiQueryRetriever\uff0cLangchain\u6587\u6863\uff1ahttps:\/\/python.langchain.com\/docs\/modules\/data_connection\/retrievers\/MultiQueryRetriever\/<\/p>\n<p>[7] HypotheticalDocumentEmbedder\uff0cLangchain\u6587\u6863\uff1ahttps:\/\/github.com\/langchain-ai\/langchain\/blob\/master\/cookbook\/hypothetical_document_embeddings.ipynb<\/p>\n<p>[8] \u5927\u6a21\u578b\u5e94\u7528\u5f00\u53d1\uff0c\u5fc5\u770b\u7684RAG\u9ad8\u9636\u6280\u5de7 &#8211; \u96e8\u98de\u7684\u6587\u7ae0 &#8211; \u77e5\u4e4e\uff1ahttps:\/\/zhuanlan.zhihu.com\/p\/680232507<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ChatGPT\u548cKimi\u7b49\u95ee\u7b54\u4ea7\u54c1\u90fd\u5728\u7528Agent\u5bf9\u8bdd\uff08\u80fd\u8c03\u7528\u4e0d\u540c\u5de5\u5177\u4e0e\u7528\u6237\u8fdb\u884c\u4ea4\u4e92\uff09\uff0c\u6bd4\u5982Kimi\u7684\u5de5\u5177\u5c31\u6709LLM\u5bf9\u8bdd\u3001\u94fe\u63a5\u5bf9\u8bdd\u3001\u6587\u4ef6\u5bf9\u8bdd\u3001\u8054\u7f51\u5bf9\u8bdd\u3002\u6bd4\u5982ChatGPT\u3001\u6587\u5fc3\u4e00\u8a00\u548c\u8baf\u98de\u661f\u706b\u7b49\uff0c\u8fd8\u6269\u5c55\u6709\u6587\u751f\u56fe\u3001\u4ee3\u7801\u7f16\u5199\u3001\u6570\u5b66\u8ba1\u7b97\u5668\u7b49\u5de5\u5177\u3002 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182],"tags":[],"class_list":["post-1817","post","type-post","status-publish","format-standard","hentry","category-shicao"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts\/1817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/comments?post=1817"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts\/1817\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/media?parent=1817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/categories?post=1817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/tags?post=1817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}