{"id":24322,"date":"2025-02-06T10:17:25","date_gmt":"2025-02-06T02:17:25","guid":{"rendered":"https:\/\/aif.amtbbs.org\/?p=24322"},"modified":"2025-02-06T10:17:25","modified_gmt":"2025-02-06T02:17:25","slug":"%e5%9f%ba%e4%ba%8eag2chromadb%e5%bc%80%e5%8f%91%e5%a4%9a%e4%bb%a3%e7%90%86rag%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"https:\/\/aif.amtbbs.org\/index.php\/2025\/02\/06\/24322\/","title":{"rendered":"\u57fa\u4e8eAG2+ChromaDB\u5f00\u53d1\u591a\u4ee3\u7406RAG\u7cfb\u7edf"},"content":{"rendered":"<p style=\"font-weight: 400;\">\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u5f00\u6e90\u7684AI\u591a\u4ee3\u7406\u6846\u67b6AG2\u548c\u5f00\u6e90\u7684\u5411\u91cf\u6570\u636e\u5e93ChromaDB\u6784\u5efa\u4e00\u4e2a\u591a\u4ee3\u7406RAG\u7cfb\u7edf\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u5f15\u8a00<\/h2>\n<p>\u8fd1\u5e74\u6765\uff0c\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff08RAG\uff09\u7cfb\u7edf\u5f97\u5230\u4e86\u8fc5\u901f\u6539\u8fdb\u3002\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u6f14\u53d8\u5212\u5206\u4e3a\u4e09\u4e2a\u9636\u6bb5\u3002\u7b2c\u4e00\u9636\u6bb5\uff0c\u5373\u5728LLM\u51fa\u73b0\u4e4b\u524d\uff0c\u4fe1\u606f\u68c0\u7d22\u7cfb\u7edf\u4e3b\u8981\u4f9d\u8d56\u4e8e\u4f20\u7edf\u7684\u641c\u7d22\u7b97\u6cd5\u548c\u7d22\u5f15\u6280\u672f\u3002\u8fd9\u4e9b\u7cfb\u7edf\u5728\u7406\u89e3\u4e0a\u4e0b\u6587\u548c\u751f\u6210\u7c7b\u4f3c\u4eba\u7c7b\u7684\u54cd\u5e94\u65b9\u9762\u7684\u80fd\u529b\u662f\u975e\u5e38\u6709\u9650\u7684\u3002\u7b2c\u4e8c\u9636\u6bb5\uff0c\u51fa\u73b0\u4e86LLM\uff08\u5927\u578b\u8bed\u8a00\u6a21\u578b\uff09\u9636\u6bb5\uff0c\u5bfc\u81f4\u4e86\u5267\u70c8\u7684\u8303\u5f0f\u8f6c\u53d8\u3002\u73b0\u5728\uff0c\u5373\u7b2c\u4e09\u9636\u6bb5\uff0c\u51fa\u73b0\u4e86\u4ee3\u7406\uff0c\u53e6\u4e00\u79cd\u8303\u5f0f\u8f6c\u53d8\u6b63\u5728\u53d1\u751f\u3002<\/p>\n<p>\u9996\u5148\u8ba9\u6211\u4eec\u9000\u4e00\u6b65\u6765\u770b\u770b\u4ec0\u4e48\u662fRAG\uff1f<\/p>\n<h2>RAG\u7684\u5de5\u4f5c\u539f\u7406<\/h2>\n<p>\u8981\u4e86\u89e3RAG\u7cfb\u7edf\u7684\u5de5\u4f5c\u539f\u7406\uff0c\u5c06\u5176\u6d41\u7a0b\u4e0e\u56fe\u4e66\u9986\u7684\u6d41\u7a0b\u8fdb\u884c\u6bd4\u8f83\u4f1a\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<h3>RAG\u7684\u57fa\u672c\u7ec4\u4ef6<\/h3>\n<ul data-id=\"u738a58b-iYm5lKcd\">\n<li data-id=\"ld70c578-cjXP42ZS\"><strong>\u6444\u53d6<\/strong>\u3002\u6b64\u9636\u6bb5\u7c7b\u4f3c\u4e8e\u50a8\u5907\u56fe\u4e66\u9986\u3002\u5c31\u50cf\u56fe\u4e66\u7ba1\u7406\u5458\u7ec4\u7ec7\u4e66\u7c4d\u5e76\u521b\u5efa\u7d22\u5f15\u4e00\u6837\uff0cRAG\u7cfb\u7edf\u901a\u8fc7\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u79f0\u4e3a\u5d4c\u5165\u7684\u6570\u5b57\u8868\u793a\u6765\u51c6\u5907\u6570\u636e\u3002\u8fd9\u4e9b\u5d4c\u5165\u5b58\u50a8\u5728\u5411\u91cf\u6570\u636e\u5e93\u4e2d\uff0c\u4fbf\u4e8e\u4ee5\u540e\u67e5\u627e\u76f8\u5173\u4fe1\u606f\u3002<\/li>\n<li data-id=\"ld70c578-Oa7H4JIj\"><strong>\u00a0\u68c0\u7d22\u3002<\/strong>\u5f53\u7528\u6237\u63d0\u51fa\u95ee\u9898\u65f6\uff0c\u8fd9\u5c31\u50cf\u5411\u56fe\u4e66\u7ba1\u7406\u5458\u8be2\u95ee\u4fe1\u606f\u3002RAG\u7cfb\u7edf\u4f7f\u7528\u67e5\u8be2\u6765\u641c\u7d22\u7d22\u5f15\u6570\u636e\u5e76\u4ece\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u6700\u76f8\u5173\u7684\u6587\u6863\u6216\u4fe1\u606f\u3002\u6b64\u8fc7\u7a0b\u53ef\u786e\u4fdd\u7cfb\u7edf\u63d0\u53d6\u51c6\u786e\u4e14\u6700\u65b0\u7684\u5185\u5bb9\u3002<\/li>\n<li data-id=\"ld70c578-WK2Uf9d1\"><strong>\u751f\u6210\u3002<\/strong>\u5229\u7528\u68c0\u7d22\u5230\u7684\u4fe1\u606f\uff0c\u7cfb\u7edf\u5c06\u8fd9\u4e9b\u4fe1\u606f\u4e0e\u5176\u5185\u90e8\u77e5\u8bc6\u76f8\u7ed3\u5408\u6765\u751f\u6210\u54cd\u5e94\u3002\u8fd9\u7c7b\u4f3c\u4e8e\u56fe\u4e66\u7ba1\u7406\u5458\u7efc\u5408\u6765\u81ea\u591a\u4e2a\u6765\u6e90\u7684\u4fe1\u606f\u4ee5\u63d0\u4f9b\u95ee\u9898\u7684\u7b54\u6848\u4e00\u6837\u3002<\/li>\n<\/ul>\n<p>\u672c\u7167\u7247\u7531Radu Marcusu\u5728Unsplash\u4e0a\u62cd\u6444<\/p>\n<p>\u9700\u8981\u6f84\u6e05\u7684\u662f\uff0c\u867d\u7136\u6444\u53d6\u9636\u6bb5\u4e25\u683c\u6765\u8bf4\u4e0d\u662fRAG\uff08\u4ee3\u8868\u201c\u68c0\u7d22\u589e\u5f3a\u751f\u6210\u201d\uff09\u7684\u7ec4\u6210\u90e8\u5206\uff0c\u4f46\u6211\u603b\u662f\u66f4\u559c\u6b22\u5c06\u6444\u53d6\u4f5c\u4e3a\u8be5\u8fc7\u7a0b\u7684\u5173\u952e\u90e8\u5206\u3002\u663e\u7136\uff0c\u5982\u679c\u6ca1\u6709\u9002\u5f53\u7684\u77e5\u8bc6\u7ec4\u7ec7\uff0c\u540e\u7eed\u9636\u6bb5\u4e0d\u592a\u53ef\u80fd\u6709\u6548\u8fd0\u4f5c\u3002<\/p>\n<p>RAG\u7cfb\u7edf\u4f20\u7edf\u4e0a\u901a\u8fc7\u987a\u5e8f\u5de5\u4f5c\u6d41\u8fd0\u884c\uff0c\u5176\u4e2d\u4e0d\u540c\u7684\u7ba1\u9053\u5206\u522b\u7528\u6765\u5904\u7406\u6570\u636e\u7684\u63d0\u53d6\u3001\u57fa\u4e8e\u7528\u6237\u67e5\u8be2\u7684\u76f8\u5173\u4fe1\u606f\u68c0\u7d22\u4ee5\u53ca\u4f7f\u7528\u68c0\u7d22\u5230\u7684\u6570\u636e\u751f\u6210\u54cd\u5e94\u3002\u867d\u7136\u8fd9\u79cd\u67b6\u6784\u5bf9\u4e8e\u8bb8\u591a\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\u90fd\u662f\u7b80\u5355\u800c\u6709\u6548\u7684\uff0c\u4f46\u5b83\u5728\u9700\u8981\u590d\u6742\u548c\u975e\u7ebf\u6027\u4ea4\u4e92\u7684\u573a\u666f\u4e2d\u5b58\u5728\u5f88\u5927\u7684\u5c40\u9650\u6027\u3002<\/p>\n<h2>MAS=\uff1f<\/h2>\n<p>\u5728\u4eba\u5de5\u667a\u80fd\u7684\u80cc\u666f\u4e0b\uff0c\u4ee3\u7406\u88ab\u5b9a\u4e49\u4e3a\u611f\u77e5\u5176\u73af\u5883\u3001\u505a\u51fa\u51b3\u7b56\u5e76\u81ea\u4e3b\u91c7\u53d6\u884c\u52a8\u4ee5\u5b9e\u73b0\u7279\u5b9a\u76ee\u6807\u7684\u7cfb\u7edf\u6216\u7a0b\u5e8f\u3002\u4f8b\u5982\uff0c\u56fe\u4e66\u7ba1\u7406\u5458\u53ef\u4ee5\u88ab\u89c6\u4e3a\u4ee3\u7406\uff1b\u4ed6\u7ec4\u7ec7\u4e66\u7c4d\u3001\u7814\u7a76\u4fe1\u606f\u5e76\u5236\u5b9a\u5bf9\u67e5\u8be2\u7684\u56de\u590d\u3002\u4e0eAI\u4ee3\u7406\u975e\u5e38\u76f8\u4f3c\uff0c\u56fe\u4e66\u7ba1\u7406\u5458\u53ef\u4ee5\u6d4f\u89c8\u5927\u91cf\u4fe1\u606f\uff0c\u6574\u7406\u5e76\u63d0\u4f9b\u77e5\u8bc6\u8bbf\u95ee\u6e20\u9053\uff0c\u540c\u65f6\u9002\u5e94\u7528\u6237\u7684\u9700\u6c42\u3002\u6211\u4eec\u5c06\u5f00\u53d1\u7684\u4ee3\u7406\u4e3b\u8981\u5c06\u51b3\u7b56\u7ec4\u4ef6\u59d4\u6258\u7ed9\u5927\u578b\u8bed\u8a00\u6a21\u578b\uff08LLM\uff09\uff0c\u5229\u7528\u5176\u5148\u8fdb\u7684\u529f\u80fd\u6765\u5904\u7406\u548c\u751f\u6210\u7c7b\u4f3c\u4eba\u7c7b\u7684\u6587\u672c\u3002<\/p>\n<p>\u57fa\u4e8eLLM\u7684\u591a\u4ee3\u7406\u7cfb\u7edf\uff08MAS\uff09\u7531\u4e00\u7ec4\u6b64\u7c7b\u4ee3\u7406\u7ec4\u6210\uff0c\u5b83\u4eec\u534f\u4f5c\u5b9e\u73b0\u5171\u540c\u76ee\u6807\u6216\u89e3\u51b3\u590d\u6742\u95ee\u9898\u3002\u5728MAS\u4e2d\uff0c\u6bcf\u4e2a\u4ee3\u7406\u72ec\u7acb\u8fd0\u884c\uff0c\u4f46\u53ef\u4ee5\u4e0e\u5176\u4ed6\u4ee3\u7406\u8fdb\u884c\u901a\u4fe1\u3001\u8fa9\u8bba\u548c\u534f\u8c03\uff0c\u4ee5\u5171\u4eab\u4fe1\u606f\u3001\u59d4\u6d3e\u4efb\u52a1\u5e76\u63d0\u9ad8\u6574\u4f53\u7cfb\u7edf\u6027\u80fd\u3002<\/p>\n<p>\u522b\u62c5\u5fc3\uff0c\u6211\u4eec\u4e0d\u4f1a\u7528Python\u4ece\u5934\u5f00\u59cb\u7f16\u5199\u591a\u4ee3\u7406\u7cfb\u7edf\uff08MAS\uff09\u3002\u76ee\u524d\uff0c\u5df2\u7ecf\u5b58\u5728\u51e0\u79cd\u53ef\u7528\u7684\u6846\u67b6\u53ef\u4ee5\u7b80\u5316\u5f00\u53d1\u8fc7\u7a0b\u3002\u9700\u8981\u5f3a\u8c03\u7684\u662f\uff0c\u672c\u6587\u7684\u76ee\u6807\u4e0d\u662f\u6784\u5efa\u7ec8\u6781\u7684\u591a\u4ee3\u7406\u68c0\u7d22\u589e\u5f3a\u751f\u6210\u7cfb\u7edf\uff0c\u800c\u4ec5\u662f\u5c55\u793a\u5982\u4f55\u4f7f\u7528\u53ef\u7528\u7684\u5de5\u5177\u8f7b\u677e\u6784\u5efa\u76f8\u5bf9\u590d\u6742\u7684\u7cfb\u7edf\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u672c\u6587\u4e2d\u663e\u793a\u7684\u6bcf\u4e00\u6bb5\u4ee3\u7801\u4e5f\u90fd\u5c55\u793a\u5728\u672c\u6587\u7684GitHub\u5b58\u50a8\u5e93\u4e2d\u3002<\/p>\n<p>\u51c6\u5907\u597d\u4e86\u5417\uff1f\u6211\u4eec\u5f00\u59cb\u5427\uff01<\/p>\n<h2>\u73af\u5883\u8bbe\u7f6e<\/h2>\n<p>\u6211\u4eec\u5728\u672c\u6587\u4e2d\u5c06\u4f7f\u7528Anaconda\u8fdb\u884c\u5f00\u53d1\u3002\u5982\u679c\u4f60\u7684\u673a\u5668\u4e0a\u6ca1\u6709\u5b83\uff0c\u8bf7\u4ece\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u5b83\uff08\u53ea\u9700\u6309\u7167\u5b89\u88c5\u811a\u672c\u8bf4\u660e\u64cd\u4f5c\u5373\u53ef\uff09\u3002<\/p>\n<p>\u7136\u540e\uff0c\u6253\u5f00\u7ec8\u7aef\uff0c\u4f7f\u7528\u4e00\u4e9b\u6211\u4eec\u5728\u6b64\u8fc7\u7a0b\u4e2d\u4f7f\u7528\u7684\u5305\u6765\u521b\u5efa\u73af\u5883\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>conda create -n &#8220;mas&#8221; python=3.12.8 conda activate mas git clone https:\/\/github.com\/ngshya\/mas-is-all-you-need.git cd mas-is-all-you-need pip install -r requirements.txt<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<\/ul>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u5728\u9879\u76ee\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a.env\u6587\u4ef6\uff0c\u6211\u4eec\u5c06OpenAI API\u5bc6\u94a5\u548cChromaDB\u914d\u7f6e\u653e\u5728\u5176\u4e2d\u3002\u4f8b\u5982\uff0c\u6211\u7684\u8fd9\u4e9b\u6570\u636e\u770b\u8d77\u6765\u50cf\u4e0b\u9762\u7684\u6837\u5b50\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>OPENAI_API_KEY=&#8221;sk-proj-abcdefg&#8230;&#8221; CHROMA_DB_HOST=&#8221;localhost&#8221; CHROMA_DB_PORT=8001<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<\/ul>\n<h2>\u6570\u636e\u6444\u53d6<\/h2>\n<p>\u5728\u672c\u6587\u7684\u4ee3\u7801\u5b58\u50a8\u5e93\u4e2d\uff0c\u6211\u4eec\u5df2\u7ecf\u51c6\u5907\u4e86\u4e00\u4e9b\u4f4d\u4e8ekb\u6587\u4ef6\u5939\u4e2d\u7684\u793a\u4f8b\u6570\u636e\u3002\u8fd9\u4e9b\u6587\u672c\u6587\u4ef6\u7684\u5185\u5bb9\u6765\u81ea\u7ef4\u57fa\u767e\u79d1\u3002\u4e3a\u4e86\u4fbf\u4e8e\u63d0\u53d6\u6b64\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u672c\u6587\u4ef6\uff0c\u6211\u4eec\u5728tools_ingestion.py\u6587\u4ef6\u4e2d\u5b9e\u73b0\u4e86\u4e00\u4e9b\u51fd\u6570\uff1a<\/p>\n<ul data-id=\"u738a58b-2RAdkjMO\">\n<li data-id=\"ld70c578-2a0EX7aa\">get_txt_file_content()\uff1a\u8bfb\u53d6\u6587\u672c\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/li>\n<li data-id=\"ld70c578-S3gJRKGI\">process_text()\uff1a\u901a\u8fc7LLM\u8c03\u7528\u5c06\u957f\u6587\u672c\u8f6c\u6362\u4e3a\u5757\u3002<\/li>\n<li data-id=\"ld70c578-BnaIJKnk\">text_to_list()\uff1a\u5c06\u524d\u4e00\u4e2a\u51fd\u6570\u7684\u8f93\u51fa\u7b80\u5316\u4e3a\u6709\u6548\u7684Python\u5217\u8868\u3002<\/li>\n<li data-id=\"ld70c578-WmfRU0MR\">save_chunks_to_db()\uff1a\u5c06text_to_list()\u7684\u8f93\u51fa\u4fdd\u5b58\u5230\u6301\u4e45\u6570\u636e\u5e93\uff08\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\u662fChromaDB\uff09\u3002<\/li>\n<li data-id=\"ld70c578-cbGk8F1b\">path_to_db()\uff1a\u6309\u987a\u5e8f\u8c03\u7528get_txt_file_content()\u2192process_text()\u2192text_to_list()\u2192save_chunks_to_db()\u3002<\/li>\n<li data-id=\"ld70c578-kZQLtWl2\">text_to_db()\uff1a\u6309\u987a\u5e8f\u8c03\u7528process_text()\u2192text_to_list()\u2192save_chunks_to_db()\u3002<\/li>\n<\/ul>\n<p>\u5728\u6b64\uff0c\u6211\u4e0d\u4f1a\u5bf9\u8fd9\u4e9b\u51fd\u6570\u8fdb\u884c\u89e3\u91ca\uff0c\u56e0\u4e3a\u5b83\u4eec\u5df2\u7ecf\u5728\u811a\u672c\u4e2d\u8fdb\u884c\u4e86\u76f8\u5e94\u7684\u6ce8\u91ca\u3002\u73b0\u5728\uff0c\u6211\u4eec\u53ef\u4ee5\u542f\u52a8ChromaDB\u6570\u636e\u5e93\u4e86\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>chmod +x start_chroma .\/start_chroma<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<p>\u7136\u540e\uff0c\u5728\u540c\u4e00\u4e2a\u9879\u76ee\u6587\u4ef6\u5939\u4e2d\u7684\u5355\u72ec\u7ec8\u7aef\u4e2d\u8fd0\u884c\u6444\u53d6\u7ba1\u9053\uff08\u8bf7\u8bb0\u4f4f\u4f7f\u7528\u4f60\u4e4b\u524d\u521b\u5efa\u7684\u76f8\u540cPython\u73af\u5883\uff09\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>chmod +x ingest .\/ingest<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<p>\u5982\u679c\u6211\u4eec\u67e5\u770b\u4e00\u4e0b\u6587\u4ef6ingest\u7684\u5185\u5bb9\uff0c\u6211\u4eec\u4f1a\u6ce8\u610f\u5230\u5173\u4e8eTurin\u57ce\u5e02\u7684\u6700\u540e\u4e00\u884c\u88ab\u6ce8\u91ca\u4e86\u3002\u8fd9\u662f\u6709\u539f\u56e0\u7684\uff0c\u6211\u4eec\u5f88\u5feb\u5c31\u4f1a\u53d1\u73b0\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<h2>\u68c0\u7d22<\/h2>\n<p>\u5728\u5f00\u59cb\u6784\u5efa\u6211\u4eec\u7684MAS\u5e94\u7528\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b9a\u4e49\u4e00\u4e9b\u51fd\u6570\u6765\u4eceChromaDB\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u4fe1\u606f\u3002\u4f60\u53ef\u4ee5\u5728<u>tools_retrieve.py<\/u>\u6587\u4ef6\u4e2d\u627e\u5230\u8fd9\u4e9b\u51fd\u6570\u7684\u5b9e\u73b0\u3002\u57fa\u672c\u903b\u8f91\u662f\uff0c\u51fd\u6570tries()\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u8ba1\u7b97\u8f93\u5165\u67e5\u8be2\u7684\u5d4c\u5165\uff0c\u67e5\u770b\u7c7b\u4f3c\u7684\u5757\u5e76\u8fd4\u56de\u7ed3\u679c\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u641c\u7d22\u201cUniversities in Amsterdam\u201d\u6765\u6d4b\u8bd5\u6b64\u811a\u672c\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>python tools_retrieve.py &#8211;query &#8220;Universities in Amsterdam&#8221; &#8211;n_results 2<\/p>\n<ul>\n<li>1.<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u7ed3\u679c\u5e94\u8be5\u7c7b\u4f3c\u4e8e\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>[ { &#8220;uuid&#8221;: &#8220;9a921695-9310-53b4-9f52-c42d7c6432ef&#8221;, &#8220;distance&#8221;: 0.5576044321060181, &#8220;source&#8221;: &#8220;kb\/cities\/europe\/amsterdam.txt&#8221;, &#8220;last_update&#8221;: &#8220;12 January 2025 07:11:18 UTC +0000&#8221;, &#8220;chunk&#8221;: &#8220;\\n&lt;context&gt;Educational Institutions&lt;\/context&gt;\\n&lt;content&gt;The University of Amsterdam (abbreviated as UvA, Dutch: Universiteit van Amsterdam) is a public research university located in Amsterdam, Netherlands. Established in 1632 by municipal authorities, it is the fourth-oldest academic institution in the Netherlands still in operation. The UvA is one of two large, publicly funded research universities in the city, the other being the Vrije Universiteit Amsterdam (VU). It is also part of the largest research universities in Europe with 31,186 students, 4,794 staff, 1,340 PhD students and an annual budget of \\u20ac600 million. It is the largest university in the Netherlands by enrollment.&lt;\/content&gt;\\n&#8221; }, { &#8220;uuid&#8221;: &#8220;5ce692ab-b762-53f7-84bc-f95fc6585015&#8221;, &#8220;distance&#8221;: 0.561765730381012, &#8220;source&#8221;: &#8220;kb\/cities\/europe\/amsterdam.txt&#8221;, &#8220;last_update&#8221;: &#8220;12 January 2025 07:11:18 UTC +0000&#8221;, &#8220;chunk&#8221;: &#8220;\\n&lt;context&gt;University Structure and Achievements&lt;\/context&gt;\\n&lt;content&gt;The main campus is located in central Amsterdam, with a few faculties located in adjacent boroughs. The university is organised into seven faculties: Humanities, Social and Behavioural Sciences, Economics and Business, Science, Law, Medicine, Dentistry. Close ties are harbored with other institutions internationally through its membership in the League of European Research Universities (LERU), the Institutional Network of the Universities from the Capitals of Europe (UNICA), European University Association (EUA) and Universitas 21. The University of Amsterdam has produced six Nobel Laureates and five prime ministers of the Netherlands.&lt;\/content&gt;\\n&#8221; } ]<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<\/ul>\n<h2>\u4f7f\u7528AG2\u6846\u67b6\u6784\u5efaMAS\u7cfb\u7edf<\/h2>\n<p>AG2\uff08\u4ee5\u524d\u79f0\u4e3aAutoGen\uff09\u662f\u4e00\u4e2a\u521b\u65b0\u578b\u7684\u5f00\u6e90\u7f16\u7a0b\u6846\u67b6\uff0c\u65e8\u5728\u4fc3\u8fdbAI\u4ee3\u7406\u7684\u5f00\u53d1\u5e76\u589e\u5f3a\u591a\u4e2a\u4ee3\u7406\u4e4b\u95f4\u7684\u534f\u4f5c\u4ee5\u89e3\u51b3\u590d\u6742\u4efb\u52a1\uff1b\u5176\u4e3b\u8981\u76ee\u6807\u662f\u7b80\u5316\u4ee3\u7406AI\u7684\u521b\u5efa\u548c\u7814\u7a76\u3002\u867d\u7136AG2\u5b98\u65b9\u7f51\u7ad9\u58f0\u79f0\u8be5\u6846\u67b6\u5df2\u51c6\u5907\u597d\u201c\u5728\u51e0\u5206\u949f\u5185\u6784\u5efa\u53ef\u7528\u4e8e\u751f\u4ea7\u573a\u666f\u7684\u591a\u4ee3\u7406\u7cfb\u7edf\u201d\uff0c\u4f46\u6211\u4e2a\u4eba\u8ba4\u4e3a\u5728\u5b8c\u5168\u53ef\u7528\u4e8e\u751f\u4ea7\u573a\u666f\u4e4b\u524d\u4ecd\u9700\u8981\u505a\u4e00\u4e9b\u5de5\u4f5c\u3002\u4e0d\u53ef\u5426\u8ba4\u7684\u662f\uff0cAG2\u4e3a\u521b\u5efa\u65e8\u5728\u7814\u7a76\u7684\u5b9e\u9a8c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u975e\u5e38\u7528\u6237\u53cb\u597d\u7684\u73af\u5883\u3002\u9700\u8981\u5f3a\u8c03\u7684\u662f\uff0c\u8fd8\u6709\u8bb8\u591a\u5176\u4ed6\u6846\u67b6\u53ef\u7528\u4e8e\u521b\u5efa\u591a\u4ee3\u7406\u7cfb\u7edf\u3002\u4f8b\u5982\uff1aLetta\u3001LangGraph\u3001CrewA<u>I<\/u>\u7b49\u3002<\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5b9e\u73b0\u4e00\u4e2aMAS\uff0c\u5176\u4e2d\u5305\u542b\uff1a<\/p>\n<ul data-id=\"u738a58b-1Jj51coa\">\n<li data-id=\"ld70c578-62cssJCB\">\u4eba\u7c7b\u2192\u4eba\u7c7b\u8f93\u5165\u7684\u4ee3\u7406\u3002<\/li>\n<li data-id=\"ld70c578-NjH9bM9U\">\u4ee3\u7406\u6444\u53d6\u2192\u8d1f\u8d23\u4ece\u6587\u672c\u6587\u4ef6\u6216\u76f4\u63a5\u4ece\u6587\u672c\u8f93\u5165\u4e2d\u6444\u53d6\u4fe1\u606f\u3002<\/li>\n<li data-id=\"ld70c578-3qObm2iM\">\u4ee3\u7406\u68c0\u7d22\u2192\u8d1f\u8d23\u4ece\u5185\u90e8\u6570\u636e\u5e93\u4e2d\u63d0\u53d6\u76f8\u5173\u4fe1\u606f\uff0c\u4ee5\u534f\u52a9\u5176\u4ed6\u4ee3\u7406\u56de\u7b54\u7528\u6237\u95ee\u9898\u3002<\/li>\n<li data-id=\"ld70c578-kp038QQ8\">\u4ee3\u7406\u5e94\u7b54\u2192\u8d1f\u8d23\u4f7f\u7528\u4ee3\u7406\u6444\u53d6\u68c0\u7d22\u5230\u7684\u4fe1\u606f\u4e3a\u7528\u6237\u67e5\u8be2\u63d0\u4f9b\u7b54\u6848\u3002<\/li>\n<li data-id=\"ld70c578-5EOPZZtN\">\u4ee3\u7406\u8def\u7531\u5668\u2192\u8d1f\u8d23\u4fc3\u8fdb\u4eba\u7c7b\u7528\u6237\u4e0e\u5176\u4ed6\u4ee3\u7406\u4e4b\u95f4\u7684\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<p>\u4eba\u7c7b\u5c06\u53ea\u4e0e\u4ee3\u7406\u8def\u7531\u5668\u4ea4\u4e92\uff0c\u540e\u8005\u5c06\u8d1f\u8d23\u5185\u90e8\u804a\u5929\u7ec4\uff0c\u5305\u62ec\u4ee3\u7406\u68c0\u7d22\u3001\u4ee3\u7406\u5e94\u7b54\u548c\u4ee3\u7406\u6444\u53d6\u3002\u804a\u5929\u7ec4\u5185\u7684\u4ee3\u7406\u5229\u7528\u5b83\u4eec\u7684\u77e5\u8bc6\u548c\u5de5\u5177\u534f\u4f5c\uff0c\u63d0\u4f9b\u5c3d\u53ef\u80fd\u6700\u597d\u7684\u7b54\u6848\u3002<\/p>\n<p>\u590d\u5236<\/p>\n<p>#\u4ee3\u7406\u62d3\u6251\u7ed3\u6784 Human &lt;-&gt; Agent Router &lt;-&gt; [Agent Ingestion, Agent Retrieve, Agent Answer]<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<p>\u590d\u5236<\/p>\n<p>MA-RAG\uff08\u591a\u4ee3\u7406\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff09\u7cfb\u7edf\u7684\u5b8c\u6574\u4ee3\u7801\u53ef\u4ee5\u5728mas.py\u6587\u4ef6\u4e2d\u627e\u5230\u3002\u5728\u672c\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u4ee3\u7801\u4e2d\u4e00\u4e9b\u7279\u522b\u503c\u5f97\u6ce8\u610f\u7684\u5173\u952e\u7ec4\u4ef6\u548c\u529f\u80fd\u3002<\/p>\n<h3>\u4ee3\u7406\u5b9a\u4e49<\/h3>\n<p>\u8981\u5728AG2\u4e2d\u5b9a\u4e49\u4ee3\u7406\uff0c\u6211\u4eec\u4f7f\u7528ConversableAgent()\u7c7b\u3002\u4f8b\u5982\uff0c\u8981\u5b9a\u4e49\u4ee3\u7406\u6444\u53d6\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>agent_ingestion = ConversableAgent( name = &#8220;agent_ingestion&#8221;, system_message = SYSTEM_PROMPT_AGENT_INGESTION, description = DESCRIPTION_AGENT_INGESTION, llm_config = llm_config, human_input_mode = &#8220;NEVER&#8221;, silent=False )<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<\/ul>\n<p>\u4e0a\u9762\u5404\u4e2a\u53c2\u6570\u6307\u5b9a\u4e86\uff1a<\/p>\n<ul data-id=\"u738a58b-YeO2m1CF\">\n<li data-id=\"ld70c578-xIQm6T4b\">\u540d\u79f0\uff1aagent_ingestion\uff1b<\/li>\n<li data-id=\"ld70c578-0zKAuTe2\">\u5b9a\u4e49\u4ee3\u7406\u7684\u7cfb\u7edf\u63d0\u793a\uff1aSYSTEM_PROMPT_AGENT_INGESTION\u662fprompts.py\u4e2d\u5b9a\u4e49\u7684\u53d8\u91cf\u3002<\/li>\n<\/ul>\n<p>\u590d\u5236<\/p>\n<p>SYSTEM_PROMPT_AGENT_INGESTION = &#8221;&#8217; You are the **Ingestion Agent** tasked with acquiring new knowledge from various sources. Your primary responsibility is to ingest information from text files or directly from text inputs. ### Key Guidelines: &#8211; **No New Information**: You do not contribute new information to conversations; your role is strictly to ingest and store knowledge. &#8211; **Evaluation of Information**: Before ingesting any new knowledge, carefully assess whether the information provided is genuinely novel and relevant. &#8211; **Step-by-Step Approach**: Take a moment to reflect and approach each task methodically. Breathe deeply and focus on the process. ### Tools Available: 1. **`path_to_db()`**: Use this tool to ingest knowledge from a specified text file. 2. **`text_to_db()`**: Utilize this tool to ingest knowledge directly from provided text. Your mission is to enhance the database with accurate and relevant information while ensuring that you adhere to the guidelines above. &#8221;&#8217;<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<\/ul>\n<ul data-id=\"u738a58b-TmAN7Nae\">\n<li data-id=\"ld70c578-SiaAeMu5\">\u5728\u6d88\u606f\u8def\u7531\u8fc7\u7a0b\u4e2d\u6709\u5e2e\u52a9\u7684\u63cf\u8ff0\uff08DESCRIPTION_AGENT_INGESTION\u662f\u5728prompts.py\u4e2d\u5b9a\u4e49\u7684\u53d8\u91cf\uff09\uff1b<\/li>\n<\/ul>\n<p>\u590d\u5236<\/p>\n<p>DESCRIPTION_AGENT_INGESTION = &#8221;&#8217; I am the **Ingestion Agent** responsible for acquiring new knowledge from text files or directly from user-provided text. &#8221;&#8217;<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<\/ul>\n<ul data-id=\"u738a58b-AF6rDQba\">\n<li data-id=\"ld70c578-w0VMNPql\">LLM\u7684\u914d\u7f6e\uff1b<\/li>\n<\/ul>\n<p>\u590d\u5236<\/p>\n<p>llm_config = { &#8220;config_list&#8221;: [ { &#8220;model&#8221;: &#8220;gpt-4o-mini&#8221;, &#8220;api_key&#8221;: os.environ[&#8220;OPENAI_API_KEY&#8221;], &#8220;temperature&#8221;: 0.7, } ] }<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<\/ul>\n<ul data-id=\"u738a58b-m3k6662C\">\n<li data-id=\"ld70c578-bITv9S5d\">\u662f\u5426\u6bcf\u6b21\u6536\u5230\u6d88\u606f\u65f6\u90fd\u8981\u6c42\u4eba\u5de5\u8f93\u5165\uff08\u901a\u8fc7\u8bbe\u7f6ehuman_input_mode=\u201cNEVER\u201d\uff0c\u4ee3\u7406\u5c06\u6c38\u8fdc\u4e0d\u4f1a\u63d0\u793a\u4eba\u5de5\u8f93\u5165\uff09\u3002<\/li>\n<li data-id=\"ld70c578-QpCN7vov\">\u662f\u5426\u4e0d\u6253\u5370\u53d1\u9001\u7684\u6d88\u606f\u3002<\/li>\n<\/ul>\n<p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9a\u4e49\u6240\u6709\u5176\u4ed6\u7684\u4ee3\u7406\uff08human\u3001agent_retrieve\u3001agent_answer\u3001agent_router\uff09\u3002<\/p>\n<h3>\u6dfb\u52a0\u5de5\u5177<\/h3>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u6211\u4eec\u5df2\u7ecf\u5b9a\u4e49\u4e86\u5404\u79cd\u4ee3\u7406\uff1b\u4f46\u662f\uff0c\u6839\u636e\u76ee\u524d\u7684\u914d\u7f6e\uff0c\u8fd9\u4e9b\u4ee3\u7406\u53ea\u80fd\u63a5\u6536\u6587\u672c\u8f93\u5165\u5e76\u4ee5\u6587\u672c\u8f93\u51fa\u8fdb\u884c\u54cd\u5e94\uff0c\u800c\u65e0\u6cd5\u6267\u884c\u9700\u8981\u7279\u5b9a\u5de5\u5177\u7684\u66f4\u590d\u6742\u4efb\u52a1\u3002\u4f8b\u5982\uff0c\u5f53\u524d\u72b6\u6001\u4e0b\u7684\u4ee3\u7406\u65e0\u6cd5\u8bbf\u95ee\u6211\u4eec\u5728\u672c\u6587\u7b2c\u4e00\u90e8\u5206\u4e2d\u521b\u5efa\u7684\u6570\u636e\u5e93\u6765\u8fdb\u884c\u641c\u7d22\u3002<\/p>\n<p>\u4e3a\u4e86\u5b9e\u73b0\u6b64\u529f\u80fd\uff0c\u6211\u4eec\u9700\u8981\u201c\u544a\u8bc9\u201d\u4ee3\u7406\uff0c\u5b83\u53ef\u4ee5\u8bbf\u95ee\u80fd\u591f\u6267\u884c\u67d0\u4e9b\u4efb\u52a1\u7684\u5de5\u5177\u3002\u6211\u4eec\u9009\u62e9\u786e\u5b9a\u6027\u5730\u5b9e\u73b0\u4e00\u4e2a\u5de5\u5177\uff0c\u800c\u4e0d\u662f\u8ba9\u4ee3\u7406\u81ea\u5df1\u5f04\u6e05\u695a\uff0c\u8fd9\u662f\u57fa\u4e8e\u6548\u7387\u548c\u53ef\u9760\u6027\u800c\u8003\u8651\u7684\u3002\u8fd9\u79cd\u786e\u5b9a\u6027\u7684\u65b9\u6cd5\u53ef\u4ee5\u964d\u4f4e\u51fa\u9519\u7684\u53ef\u80fd\u6027\uff0c\u56e0\u4e3a\u53ef\u4ee5\u660e\u786e\u5b9a\u4e49\u548c\u7f16\u7801\u8be5\u8fc7\u7a0b\u3002\u5c3d\u7ba1\u5982\u6b64\uff0c\u6211\u4eec\u4ecd\u5c06\u8d4b\u4e88\u4ee3\u7406\u8d23\u4efb\u548c\u81ea\u4e3b\u6743\uff0c\u4ee5\u9009\u62e9\u4f7f\u7528\u54ea\u79cd\u5de5\u5177\uff0c\u786e\u5b9a\u5176\u4f7f\u7528\u53c2\u6570\uff0c\u5e76\u51b3\u5b9a\u5982\u4f55\u7ec4\u5408\u591a\u79cd\u5de5\u5177\u6765\u5904\u7406\u590d\u6742\u8bf7\u6c42\u3002\u6307\u5bfc\u548c\u81ea\u4e3b\u4e4b\u95f4\u7684\u8fd9\u79cd\u5e73\u8861\u5c06\u589e\u5f3a\u4ee3\u7406\u7684\u80fd\u529b\uff0c\u540c\u65f6\u4fdd\u6301\u7ed3\u6784\u5316\u65b9\u6cd5\u3002<\/p>\n<p>\u6211\u5e0c\u671b\u73b0\u5728\u4f60\u5df2\u7ecf\u5f88\u6e05\u695a\uff0c\u4e0e\u8bb8\u591a\u975e\u4e13\u5bb6\u58f0\u79f0\u4ee3\u7406\u201c\u975e\u5e38\u806a\u660e\u201d\u4ee5\u81f3\u4e8e\u53ef\u4ee5\u6beb\u4e0d\u8d39\u529b\u5730\u5904\u7406\u590d\u6742\u4efb\u52a1\u7684\u8bf4\u6cd5\u76f8\u53cd\uff0c\u5b9e\u9645\u4e0a\u5e55\u540e\u6709\u5927\u91cf\u5de5\u4f5c\u6b63\u5728\u7814\u53d1\u4e2d\u3002\u4ee3\u7406\u6240\u4f9d\u8d56\u7684\u57fa\u7840\u5de5\u5177\u9700\u8981\u4ed4\u7ec6\u7814\u7a76\u3001\u5b9e\u65bd\u548c\u6d4b\u8bd5\u3002\u5373\u4f7f\u5728\u751f\u6210\u5f0fAI\u9886\u57df\uff0c\u4e5f\u6ca1\u6709\u4efb\u4f55\u4e8b\u60c5\u662f\u201c\u81ea\u52a8\u53d1\u751f\u7684\u201d\u3002\u7406\u89e3\u8fd9\u4e00\u533a\u522b\u5bf9\u4e8e\u7406\u89e3\u5f00\u53d1\u6709\u6548AI\u7cfb\u7edf\u6240\u6d89\u53ca\u7684\u590d\u6742\u6027\u548c\u5de5\u4f5c\u91cf\u81f3\u5173\u91cd\u8981\u3002\u867d\u7136\u8fd9\u4e9b\u4ee3\u7406\u53ef\u4ee5\u6267\u884c\u4ee4\u4eba\u5370\u8c61\u6df1\u523b\u7684\u4efb\u52a1\uff0c\u4f46\u5b83\u4eec\u7684\u80fd\u529b\u662f\u7cbe\u5fc3\u8bbe\u8ba1\u548c\u6df1\u601d\u719f\u8651\u7684\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u5929\u751f\u7684\u667a\u6167\u3002<\/p>\n<p>\u8fd8\u8bb0\u5f97\u6211\u4eec\u4e4b\u524d\u4e3a\u6444\u53d6\u521b\u5efa\u7684\u51fd\u6570text_to_db()\u548cpath_to_db()\u5417\uff1f\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u5c06\u5b83\u4eec\u201c\u6ce8\u518c\u201d\u5230\u4ee3\u7406\u6444\u53d6\u4e2d\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>register_function( path_to_db, caller=agent_ingestion, executor=agent_ingestion, name=&#8221;path_to_db&#8221;, description=&#8221;Ingest new knowledge from a text file given its path.&#8221;, ) register_function( text_to_db, caller=agent_ingestion, executor=agent_ingestion, name=&#8221;text_to_db&#8221;, description=&#8221;Ingest new knowledge from a piece of conversation.&#8221;, )<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<\/ul>\n<p>\u7c7b\u4f3c\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u68c0\u7d22\u5de5\u5177\u6dfb\u52a0\u5230\u4ee3\u7406\u68c0\u7d22\u4e2d\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>register_function( retrieve_str, caller=agent_retrieve, executor=agent_retrieve, name=&#8221;retrieve_str&#8221;, description=&#8221;Retrieve useful information from internal DB.&#8221;, )<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<\/ul>\n<h3>MAS\u62d3\u6251\u7ed3\u6784<\/h3>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u6211\u4eec\u5df2\u7ecf\u5b9a\u4e49\u4e86\u6bcf\u4e2a\u4ee3\u7406\u3001\u5b83\u4eec\u7684\u89d2\u8272\u4ee5\u53ca\u5b83\u4eec\u53ef\u4ee5\u4f7f\u7528\u7684\u5de5\u5177\u3002\u5269\u4e0b\u7684\u5c31\u662f\u8fd9\u4e9b\u4ee3\u7406\u5982\u4f55\u7ec4\u7ec7\u4ee5\u53ca\u5b83\u4eec\u5982\u4f55\u76f8\u4e92\u901a\u4fe1\u3002\u6211\u4eec\u7684\u76ee\u6807\u662f\u521b\u5efa\u4e00\u4e2a\u62d3\u6251\u3002\u5728\u8fd9\u4e2a\u62d3\u6251\u4e2d\uff0c\u4eba\u7c7b\u4e0e\u4ee3\u7406\u8def\u7531\u5668\u4ea4\u4e92\uff0c\u7136\u540e\u4ee3\u7406\u8def\u7531\u5668\u4e0e\u5176\u4ed6\u4ee3\u7406\u4e00\u8d77\u53c2\u4e0e\u5d4c\u5957\u804a\u5929\u7ec4\u3002\u8be5\u7ec4\u534f\u4f5c\u89e3\u51b3\u4eba\u7c7b\u67e5\u8be2\uff0c\u81ea\u4e3b\u786e\u5b9a\u64cd\u4f5c\u987a\u5e8f\uff0c\u9009\u62e9\u9002\u5f53\u7684\u5de5\u5177\u5e76\u5236\u5b9a\u54cd\u5e94\u3002\u5728\u6b64\u8bbe\u7f6e\u4e2d\uff0c\u4ee3\u7406\u8def\u7531\u5668\u5145\u5f53\u4e2d\u592e\u534f\u8c03\u5668\uff0c\u6307\u5bfc\u4ee3\u7406\u4e4b\u95f4\u7684\u4fe1\u606f\u6d41\uff08\u4ee3\u7406\u6444\u53d6\u3001\u4ee3\u7406\u68c0\u7d22\u548c\u4ee3\u7406\u5e94\u7b54\uff09\u3002\u6bcf\u4e2a\u4ee3\u7406\u90fd\u6709\u4e00\u4e2a\u7279\u5b9a\u7684\u529f\u80fd\uff1a\u4ee3\u7406\u6444\u53d6\u5904\u7406\u4f20\u5165\u6570\u636e\uff0c\u4ee3\u7406\u68c0\u7d22\u4ece\u6570\u636e\u5e93\u8bbf\u95ee\u76f8\u5173\u4fe1\u606f\uff0c\u4ee3\u7406\u5e94\u7b54\u6839\u636e\u6536\u96c6\u5230\u7684\u89c1\u89e3\u63d0\u51fa\u6700\u7ec8\u54cd\u5e94\u3002<\/p>\n<p>\u8981\u521b\u5efa\u7fa4\u804a\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528GroupChat()\u7c7b\u3002<\/p>\n<p>\u590d\u5236<\/p>\n<p>group_chat = GroupChat( agents = [ agent_router, agent_ingestion, agent_retrieve, agent_answer ], messages=[], send_introductions=False, max_round=10, speaker_selection_method=&#8221;auto&#8221;, speaker_transitions_type=&#8221;allowed&#8221;, allowed_or_disallowed_speaker_transitions={ agent_router: [agent_ingestion, agent_retrieve, agent_answer], agent_ingestion: [agent_router], agent_retrieve: [agent_answer], agent_answer: [agent_router], }, )<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<li>17.<\/li>\n<li>18.<\/li>\n<li>19.<\/li>\n<\/ul>\n<p>\u5728\u4e0a\u9762\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u5217\u51fa\u4e86\u5c06\u6210\u4e3a\u7fa4\u7ec4\u4e00\u90e8\u5206\u7684\u4ee3\u7406\uff08agents\uff09\uff0c\u51b3\u5b9a\u5b83\u4eec\u4e0d\u9700\u8981\u5728\u804a\u5929\u5f00\u59cb\u65f6\u81ea\u6211\u4ecb\u7ecd\uff08send_introductions\uff09\uff0c\u5c06\u5bf9\u8bdd\u7684\u6700\u5927\u8f6e\u6b21\u8bbe\u7f6e\u4e3a10\uff08max_round\uff09\uff0c\u5c06\u6bcf\u8f6e\u7684\u53d1\u8a00\u4eba\u9009\u62e9\u59d4\u6258\u7ed9\u804a\u5929\u7ba1\u7406\u5668\uff08speaker_selection_method\uff09\uff0c\u5e76\u5c06\u5bf9\u8bdd\u8f6c\u6362\u9650\u5236\u4e3a\u7279\u5b9a\u65b9\u6848\uff08allowed_or_disallowed_speaker_transitions\uff09\u3002<\/p>\n<p>\u521b\u5efa\u7fa4\u7ec4\u540e\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u7fa4\u7ec4\u7ba1\u7406\u5668\u6765\u7ba1\u7406\u5bf9\u8bdd\u987a\u5e8f\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>group_chat_manager = GroupChatManager( groupchat=group_chat, llm_config=llm_config, silent=False, is_termination_msg=lambda msg: &#8220;(to human)&#8221; in msg[&#8220;content&#8221;].lower() )<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<\/ul>\n<p>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u662f\u7528\u4e8eis_termination_msg\u53c2\u6570\u7684lambda\u51fd\u6570\u3002\u6b64\u51fd\u6570\u901a\u8fc7\u68c0\u67e5\u6700\u540e\u4e00\u6761\u6d88\u606f\u662f\u5426\u5305\u542b\u5b50\u5b57\u7b26\u4e32\u201c(to human)\u201d\u6765\u786e\u5b9a\u804a\u5929\u4f55\u65f6\u5e94\u8be5\u7ec8\u6b62\u3002\u6b64\u673a\u5236\u81f3\u5173\u91cd\u8981\uff0c\u56e0\u4e3a\u5728\u4ee3\u7406\u8def\u7531\u5668\u7684\u7cfb\u7edf\u63d0\u793a\u4e2d\uff0c\u5b83\u6307\u5b9a\uff1a\u201c\u6e05\u695a\u5730\u8868\u660e\u4f60\u7684\u6d88\u606f\u7684\u9884\u671f\u6536\u4ef6\u4eba\u3002\u4f8b\u5982\uff0c\u5728\u5411\u7528\u6237\u81f4\u8f9e\u65f6\u4f7f\u7528\uff08to human\uff09\u3002\u201d\u8fd9\u79cd\u65b9\u6cd5\u4e3a\u4f55\u65f6\u9000\u51fa\u5d4c\u5957\u804a\u5929\u5e76\u5411\u4eba\u7c7b\u7528\u6237\u8fd4\u56de\u54cd\u5e94\u63d0\u4f9b\u4e86\u660e\u786e\u7684\u4fe1\u53f7\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u7fa4\u804a\uff0c\u6211\u4eec\u521a\u521a\u521b\u5efa\u4e86\u4e00\u4e2a\u4ece\u4ee3\u7406\u8def\u7531\u5668\u8fdb\u884c\u7edf\u8ba1\u7684\u5d4c\u5957\u804a\u5929\u3002<\/p>\n<p>\u590d\u5236<\/p>\n<p>nested_chats = [ { &#8220;recipient&#8221;: group_chat_manager, &#8220;summary_method&#8221;: &#8220;last_msg&#8221;, } ] agent_router.register_nested_chats( nested_chats, trigger=lambda sender: sender in [human], )<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u5229\u7528\u7ed3\u6784\u5316\u7684\u901a\u4fe1\u6846\u67b6\u548c\u4ee3\u7406\u4e4b\u95f4\u7684\u9884\u5b9a\u4e49\u8f6c\u6362\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u4fdd\u4ee3\u7406\u4e4b\u95f4\u7684\u9ad8\u6548\u534f\u4f5c\uff0c\u540c\u65f6\u5141\u8bb8\u51b3\u7b56\u7684\u7075\u6d3b\u6027\u3002<\/p>\n<h3>\u5f00\u59cb\u804a\u5929<\/h3>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u51c6\u5907\u597d\u4e86\uff0c\u8981\u5f00\u59cb\u4e0e\u4ee3\u7406\u8def\u7531\u5668\u8fdb\u884c\u804a\u5929\u4e86\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>chat_results = human.initiate_chat( agent_router, message=input(&#8220;Ciao! How can I assist you today? \ufffd\ufffd : &#8220;), max_turns = 100 )<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<\/ul>\n<p>\u6216\u8005\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884cPython\u811a\u672c\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>python mas.py<\/p>\n<ul>\n<li>1.<\/li>\n<\/ul>\n<p>\u4f60\u5e94\u8be5\u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u64cd\u4f5c\u4e0e\u8f93\u51fa\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>$ python mas.py [conda:mas] Ciao! How can I assist you today? \ufffd\ufffd :<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<p>\u53ea\u9700\u8f93\u5165\u4f60\u7684\u6d88\u606f\uff0c\u4f60\u5c31\u4f1a\u6536\u5230\u4ee3\u7406\u8def\u7531\u5668\u7684\u7b54\u590d\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u5728<a href=\"https:\/\/github.com\/ngshya\/mas-is-all-you-need\/blob\/main\/chat_logs\/12_January_2025_07_14_27_UTC_%2B0000.json\" target=\"_blank\" rel=\"noopener\">\u6b64\u5904<\/a>\u627e\u5230\u8fd9\u4e2a\u5bf9\u8bdd\u7684\u5b8c\u6574\u793a\u4f8b\u3002\u9996\u5148\uff0c\u804a\u5929\u4ee5\u95ee\u9898\u5f00\u59cb\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>[Human] Is there a university in Philadelphia, and was it established before the University of California, Berkeley?<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<p>\u4e2d\u6587\u542b\u4e49vk\u5982\u4e0b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>\u8d39\u57ce\u6709\u5927\u5b66\u5417\uff1f\u5b83\u662f\u5728\u52a0\u5dde\u5927\u5b66\u4f2f\u514b\u5229\u5206\u6821\u4e4b\u524d\u5efa\u7acb\u7684\u5417\uff1f<\/p>\n<ul>\n<li>1.<\/li>\n<\/ul>\n<p>\u800c\u4ee3\u7406\u8def\u7531\u5668\u7ed9\u51fa\u7684\u7b54\u6848\u662f\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>[Agent Router] Yes, there is a university in Philadelphia known as the **University of Pennsylvania** (commonly referred to as Penn or UPenn). It is a private Ivy League research university and was chartered prior to the U.S. Declaration of Independence, making it one of the oldest institutions of higher education in the United States. The university first convened its board of trustees in 1749, which positions it as the fourth-oldest institution, though some argue it may be the fifth-oldest due to the establishment dates of other institutions. \ufffd\ufffd On the other hand, the **University of California, Berkeley** was founded in **1868**. Given these dates, the University of Pennsylvania was established significantly earlier than the University of California, Berkeley. \ufffd\ufffd **Sources**: 1. University of Pennsylvania Overview (last updated: 12 January 2025) 2. University of California, Berkeley Overview (last updated: 12 January 2025)<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<\/ul>\n<p>\u4e2d\u6587\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>\u662f\u7684\uff0c\u8d39\u57ce\u6709\u4e00\u6240\u5927\u5b66\uff0c\u540d\u4e3a**\u5bbe\u5915\u6cd5\u5c3c\u4e9a\u5927\u5b66**\uff08\u901a\u5e38\u79f0\u4e3aPenn\u6216UPenn\uff09\u3002\u5b83\u662f\u4e00\u6240\u79c1\u7acb\u5e38\u6625\u85e4\u76df\u6821\u7814\u7a76\u578b\u5927\u5b66\uff0c\u5728\u7f8e\u56fd\u300a\u72ec\u7acb\u5ba3\u8a00\u300b\u4e4b\u524d\u5c31\u5df2\u6210\u7acb\uff0c\u662f\u7f8e\u56fd\u6700\u53e4\u8001\u7684\u9ad8\u7b49\u6559\u80b2\u673a\u6784\u4e4b\u4e00\u3002\u8be5\u5927\u5b66\u4e8e1749\u5e74\u9996\u6b21\u53ec\u96c6\u8463\u4e8b\u4f1a\uff0c\u8fd9\u4f7f\u5b83\u6210\u4e3a\u7b2c\u56db\u53e4\u8001\u7684\u673a\u6784\uff0c\u5c3d\u7ba1\u6709\u4e9b\u4eba\u8ba4\u4e3a\uff0c\u7531\u4e8e\u5176\u4ed6\u673a\u6784\u7684\u6210\u7acb\u65e5\u671f\uff0c\u5b83\u53ef\u80fd\u662f\u7b2c\u4e94\u53e4\u8001\u7684\u673a\u6784\u3002 \u53e6\u4e00\u65b9\u9762\uff0c**\u52a0\u5dde\u5927\u5b66\u4f2f\u514b\u5229\u5206\u6821**\u6210\u7acb\u4e8e**1868\u5e74**\u3002 \u9274\u4e8e\u8fd9\u4e9b\u65e5\u671f\uff0c\u5bbe\u5915\u6cd5\u5c3c\u4e9a\u5927\u5b66\u7684\u6210\u7acb\u65f6\u95f4\u660e\u663e\u65e9\u4e8e\u52a0\u5dde\u5927\u5b66\u4f2f\u514b\u5229\u5206\u6821\u3002 **\u6765\u6e90**\uff1a 1. \u5bbe\u5915\u6cd5\u5c3c\u4e9a\u5927\u5b66\u6982\u51b5\uff08\u6700\u540e\u66f4\u65b0\u65f6\u95f4\uff1a2025\u5e741\u670812\u65e5\uff09 2. \u52a0\u5dde\u5927\u5b66\u4f2f\u514b\u5229\u5206\u6821\u6982\u51b5\uff08\u6700\u540e\u66f4\u65b0\u65f6\u95f4\uff1a2025\u5e741\u670812\u65e5\uff09<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<\/ul>\n<p>\u8bf7\u6ce8\u610f\uff0c\u6211\u4eec\u4e00\u5f00\u59cb\u63d0\u53d6\u7684\u6587\u672c\u6587\u4ef6\u4e2d\u5e76\u6ca1\u6709\u63d0\u4f9b\u5bf9\u521d\u59cb\u95ee\u9898\u7684\u76f4\u63a5\u56de\u7b54\u3002\u4e8b\u5b9e\u4e0a\uff0c\u5982\u679c\u6211\u4eec\u67e5\u770b\u7b2c74\u884c\u7684\u5d4c\u5957\u804a\u5929\u65e5\u5fd7\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u5728\u5d4c\u5957\u804a\u5929\u4e2d\uff0c\u4ee3\u7406\u68c0\u7d22\u5668\u4f1a\u4f7f\u7528\u68c0\u7d22\u5de5\u5177\u81ea\u52a8\u8fdb\u884c\u4e24\u6b21\u4e0d\u540c\u7684\u67e5\u8be2\uff0c\u67e5\u8be2\u6709\u5173\u8d39\u57ce\u5927\u5b66\u548c\u52a0\u5dde\u5927\u5b66\u4f2f\u514b\u5229\u5206\u6821\u7684\u4fe1\u606f\uff0c\u7136\u540e\u4ee3\u7406\u5e94\u7b54\u4f1a\u4f7f\u7528\u68c0\u7d22\u5230\u7684\u5757\u63d0\u51fa\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u5f53\u6211\u4eec\u6dfb\u52a0\u65b0\u6570\u636e\u6e90\u65f6\u4e5f\u4f1a\u6d89\u53ca\u7c7b\u4f3c\u7684\u673a\u5236\uff08\u8fd8\u8bb0\u5f97\u6211\u4eec\u4e4b\u524d\u9057\u6f0f\u7684\u5173\u4e8e\u90fd\u7075\u57ce\u5e02\u7684\u6587\u4ef6\u5417\uff1f\uff09\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>[Human] What do you know about the University of Turin?<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<p>\u4e2d\u6587\u542b\u4e49\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>\u4f60\u5bf9\u90fd\u7075\u5927\u5b66\u4e86\u89e3\u591a\u5c11\uff1f [Agent Router] \ufffd\ufffd It seems I couldn\u2019t find specific information about the University of Turin. The details I retrieved were mainly about other universities like the University of Barcelona and UC Berkeley. If there\u2019s a particular aspect of the University of Turin you\u2019re curious about, or if you\u2019d like information on something else, just let me know! \ufffd\ufffd<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<\/ul>\n<p>\u4e2d\u6587\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>\u4f3c\u4e4e\u6211\u627e\u4e0d\u5230\u5173\u4e8e\u90fd\u7075\u5927\u5b66\u7684\u5177\u4f53\u4fe1\u606f\u3002\u6211\u68c0\u7d22\u5230\u7684\u8be6\u7ec6\u4fe1\u606f\u4e3b\u8981\u662f\u5173\u4e8e\u5176\u4ed6\u5927\u5b66\uff0c\u5982\u5df4\u585e\u7f57\u90a3\u5927\u5b66\u548c\u52a0\u5dde\u5927\u5b66\u4f2f\u514b\u5229\u5206\u6821\u3002\u5982\u679c\u4f60\u5bf9\u90fd\u7075\u5927\u5b66\u7684\u67d0\u4e2a\u65b9\u9762\u611f\u5174\u8da3\uff0c\u6216\u8005\u4f60\u60f3\u4e86\u89e3\u5176\u4ed6\u4fe1\u606f\uff0c\u8bf7\u544a\u8bc9\u6211\uff01 [Human] Information about Turin can be found in kb\/cities\/europe\/turin.txt<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<\/ul>\n<p>\u4e2d\u6587\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>\u6709\u5173\u90fd\u7075\u7684\u4fe1\u606f\u53ef\u4ee5\u5728kb\/cities\/europe\/turin.txt\u4e2d\u627e\u5230\u3002 [Agent Router] Here is some information about Turin: ### Overview **Location**: Turin (Italian: Torino) is a city in Northern Italy, \u2026 [\u2026]<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<\/ul>\n<p>\u4e2d\u6587\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n<p>\u590d\u5236<\/p>\n<p>\u4ee5\u4e0b\u662f\u5173\u4e8e\u90fd\u7075\u7684\u4e00\u4e9b\u4fe1\u606f\uff1a ###\u6982\u8ff0 **\u4f4d\u7f6e**\uff1a\u90fd\u7075\uff08\u610f\u5927\u5229\u8bed\uff1aTorino\uff09\u662f\u610f\u5927\u5229\u5317\u90e8\u7684\u4e00\u4e2a\u57ce\u5e02\uff0c\u2026\u2026<\/p>\n<ul>\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<\/ul>\n<p>\u5728\u540e\u53f0\u53d1\u751f\u7684\u4e8b\u60c5\u662f\uff0c\u5728\u5d4c\u5957\u804a\u5929\u4e2d\u7684\u7b2c\u4e00\u6b21\u4ea4\u4e92\u4e2d\uff0c\u4ee3\u7406\u5e94\u7b54\u610f\u8bc6\u5230\u68c0\u7d22\u5230\u7684\u4fe1\u606f\u90fd\u4e0e\u90fd\u7075\u65e0\u5173\uff08\u7b2c163<a href=\"https:\/\/github.com\/ngshya\/mas-is-all-you-need\/blob\/main\/chat_logs\/12_January_2025_07_14_27_UTC_%2B0000.json\" target=\"_blank\" rel=\"noopener\">\u884c<\/a>\uff09\u3002\u7136\u800c\uff0c\u7b2c\u4e8c\u6b21\uff0c\u5f53\u4ee3\u7406\u68c0\u6d4b\u5230\u65b0\u7684\u4fe1\u606f\u6e90\u65f6\uff0c\u4ee3\u7406\u6444\u53d6\u88ab\u8c03\u7528\uff08\u7b2c179\u884c\uff09\u6765\u5904\u7406\u65b0\u6570\u636e\u5e76\u5c06\u5176\u4fdd\u5b58\u5728\u6570\u636e\u5e93\u4e2d\u3002\u8fd9\u79cd\u52a8\u6001\u8bf4\u660e\u4e86\u7cfb\u7edf\u5185\u4ee3\u7406\u7684\u534f\u4f5c\u6027\u8d28\u3002\u6700\u521d\uff0c\u4ee3\u7406\u5e94\u7b54\u65e0\u6cd5\u627e\u5230\u76f8\u5173\u4fe1\u606f\uff0c\u8fd9\u51f8\u663e\u4e86\u5f7b\u5e95\u7684\u6570\u636e\u68c0\u7d22\u8fc7\u7a0b\u7684\u91cd\u8981\u6027\u3002\u4e00\u65e6\u786e\u5b9a\u4e86\u65b0\u7684\u6765\u6e90\uff0c\u4ee3\u7406\u6444\u53d6\u5c31\u4f1a\u8fc5\u901f\u4ecb\u5165\uff0c\u4ee5\u786e\u4fdd\u5c06\u6709\u4ef7\u503c\u7684\u4fe1\u606f\u7eb3\u5165\u6570\u636e\u5e93\uff0c\u4ece\u800c\u589e\u5f3a\u4ee3\u7406\u5728\u672a\u6765\u4ea4\u4e92\u4e2d\u6709\u6548\u54cd\u5e94\u7684\u80fd\u529b\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u5728\u65e5\u5fd7\u6587\u4ef6\u4e2d\u83b7\u5f97\u66f4\u591a\u793a\u4f8b\uff0c\u6211\u4eec\u5728\u5176\u4e2d\u6d4b\u8bd5\u4e86\u7cfb\u7edf\u5982\u4f55\u9002\u5e94\u5916\u90e8\u77db\u76fe\u9648\u8ff0\uff08\u7b2c34\u884c\uff09\u4ee5\u53ca\u4ee3\u7406\u6444\u53d6\u5982\u4f55\u4fdd\u5b58\u76f4\u63a5\u6765\u81ea\u5bf9\u8bdd\u7684\u65b0\u4fe1\u606f\uff08\u7b2c54\u3001352\u884c\uff09\u3002<\/p>\n<h2>\u8d85\u8d8a\u73a9\u5177\u7ea7\u7684MA-RAG<\/h2>\n<p>\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5df2\u7ecf\u63a2\u7d22\u4e86\u5982\u4f55\u57fa\u4e8e\u591a\u4ee3\u7406\u8303\u5f0f\u6765\u6784\u5efaRAG\u7cfb\u7edf\u3002\u6211\u4eec\u63d0\u51fa\u7684\u5f53\u7136\u662f\u8fd9\u79cd\u7cfb\u7edf\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5982\u4f55\u8fd0\u884c\u7684\u7b80\u5316\u5f62\u5f0f\u3002\u5176\u4e2d\uff0c\u6211\u4eec\u6709\u610f\u5ffd\u7565\u4e86\u8bb8\u591a\u91cd\u8981\u65b9\u9762\uff08\u4f8b\u5982\u62a4\u680f\u3001\u4ee4\u724c\u4f7f\u7528\u3001\u804a\u5929\u754c\u9762\u8bbe\u8ba1\u3001\u8eab\u4efd\u9a8c\u8bc1\u7b49\uff09\uff0c\u5e76\u4e14\u6709\u8bb8\u591a\u9886\u57df\u9700\u8981\u8fdb\u884c\u91cd\u5927\u6539\u8fdb\u3002\u4f8b\u5982\uff0c\u5b8c\u6574\u7684\u6570\u636e\u63d0\u53d6\u548c\u77e5\u8bc6\u5e93\u66f4\u65b0\u7ba1\u9053\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u540c\u65f6\u589e\u5f3a\u4fe1\u606f\u68c0\u7d22\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5229\u7528\u57fa\u4e8e\u56fe\u5f62\u7684\u65b9\u6cd5\uff0c\u800c\u4e0d\u662f\u4ec5\u4ec5\u4f9d\u8d56\u4e8e\u5d4c\u5165\u76f8\u4f3c\u6027\u3002\u6b64\u5916\uff0c\u4ee3\u7406\u7684\u62d3\u6251\u7ed3\u6784\u53ef\u4ee5\u6839\u636e\u9700\u8981\u53d8\u5f97\u5c3d\u53ef\u80fd\u590d\u6742\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u521b\u5efa\u591a\u4e2a\u804a\u5929\u7ec4\uff0c\u6bcf\u4e2a\u804a\u5929\u7ec4\u90fd\u4e13\u6ce8\u4e8e\u6574\u4e2a\u7ba1\u9053\u7684\u7279\u5b9a\u65b9\u9762\u3002\u6b64\u5916\uff0c\u6211\u4eec\u53ef\u4ee5\u5f15\u5165\u76d1\u7763\/\u5224\u65ad\u89d2\u8272\u6765\u6279\u5224\u6027\u5730\u8bc4\u4f30\u63d0\u8bae\u7684\u8ba1\u5212\u548c\u89e3\u51b3\u65b9\u6848\u3002\u53ef\u80fd\u6027\u51e0\u4e4e\u662f\u65e0\u9650\u7684\uff0c\u4e3a\u7279\u5b9a\u5e94\u7528\u573a\u666f\u627e\u5230\u6b63\u786e\u7684\u89e3\u51b3\u65b9\u6848\u901a\u5e38\u672c\u8eab\u5c31\u662f\u4e00\u79cd\u827a\u672f\u5f62\u5f0f\u3002<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>MAS\u7684\u8fc5\u901f\u666e\u53ca\u5f53\u7136\u5b58\u5728\u6ce1\u6cab\u7684\u56e0\u7d20\uff0c\u4f46\u5b83\u4e5f\u53d7\u5230\u6b64\u7c7b\u7cfb\u7edf\u89e3\u51b3\u4ee5\u524d\u65e0\u6cd5\u60f3\u8c61\u7684\u590d\u6742\u4efb\u52a1\u7684\u6f5c\u529b\u7684\u63a8\u52a8\u3002\u76ee\u524d\uff0c\u6211\u4eec\u4ecd\u5904\u4e8e\u8fd9\u9879\u6280\u672f\u7684\u521d\u6b65\u9636\u6bb5\uff0c\u5c3d\u7ba1\u4f17\u591a\u7684\u5e73\u53f0\u6b63\u5728\u4e89\u76f8\u6d8c\u73b0\u4ee5\u4fc3\u8fdbMAS\u7684\u521b\u5efa\u3002\u56de\u987e\u4e00\u4e0b\u672c\u6587\u5185\u5bb9\uff0c\u5f88\u660e\u663e\uff0c\u9664\u4e86LLM\u7684\u529f\u80fd\u5916\uff0c\u77e5\u8bc6\u5e93\u7684\u7ba1\u7406\u5bf9\u4e8eRAG\u7cfb\u7edf\u6765\u8bf4\u4e5f\u662f\u81f3\u5173\u91cd\u8981\u7684\uff0c\u5373\u4f7f\u901a\u8fc7MAS\u8fdb\u884c\u4e86\u589e\u5f3a\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u867d\u7136MAS\u5e26\u6765\u4e86\u65b0\u529f\u80fd\uff0c\u4f46\u5b83\u4e5f\u4e3a\u6b64\u7c7b\u7cfb\u7edf\u7684\u7f16\u7a0b\u5e26\u6765\u4e86\u590d\u6742\u6027\u3002\u968f\u7740\u6211\u4eec\u7ebf\u6027\u589e\u52a0\u4ee3\u7406\u6570\u91cf\uff0c\u5b83\u4eec\u4e4b\u95f4\u7684\u4ea4\u4e92\u6b21\u6570\u53ef\u80fd\u4f1a\u6210\u500d\u589e\u957f\u3002\u6bcf\u6b21\u4ea4\u4e92\u90fd\u4f1a\u5e26\u6765\u6b67\u4e49\u548c\u4f4e\u6548\u7387\u7684\u98ce\u9669\uff0c\u8fd9\u4e9b\u98ce\u9669\u53ef\u80fd\u4f1a\u4f20\u64ad\u5230\u540e\u7eed\u4ea4\u4e92\u4e2d\u3002\u603b\u4e4b\uff0c\u6709\u5f88\u591a\u673a\u4f1a\uff0c\u4f46\u4e5f\u5b58\u5728\u91cd\u5927\u7684\u65b0\u98ce\u9669\u3002\u6211\u4eec\u80fd\u505a\u7684\u5c31\u662f\u52aa\u529b\u6df1\u5165\u4e86\u89e3\u8fd9\u4e9b\u7cfb\u7edf\uff0c\u4e3a\u5b83\u4eec\u7684\u6311\u6218\u548c\u53ef\u80fd\u6027\u505a\u597d\u51c6\u5907\u3002<\/p>\n<h2>\u53c2\u8003\u8d44\u6599<\/h2>\n<ul data-id=\"u738a58b-ZS9lUC73\">\n<li data-id=\"ld70c578-8T1M2yyD\">https:\/\/github.com\/ngshya\/mas-is-all-you-need\/tree\/main<\/li>\n<li data-id=\"ld70c578-U6wMf5Og\">https:\/\/ag2.ai\/<\/li>\n<li data-id=\"ld70c578-kxZreJDj\">https:\/\/www.trychroma.com\/<\/li>\n<\/ul>\n<p>\u6587\u7ae0\u6765\u81ea:51CTO<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_24322\" class=\"pvc_stats total_only  \" data-element-id=\"24322\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u5f00\u6e90\u7684AI\u591a\u4ee3\u7406\u6846\u67b6AG2\u548c\u5f00\u6e90\u7684\u5411\u91cf\u6570\u636e\u5e93ChromaDB\u6784\u5efa\u4e00\u4e2a\u591a\u4ee3\u7406RAG\u7cfb\u7edf [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_24322\" class=\"pvc_stats total_only  \" data-element-id=\"24322\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":56,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,20,80],"tags":[1563,1564],"class_list":["post-24322","post","type-post","status-publish","format-standard","hentry","category-23","category-20","category-80","tag-ag2","tag-chromadb"],"_links":{"self":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/comments?post=24322"}],"version-history":[{"count":1,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24322\/revisions"}],"predecessor-version":[{"id":24323,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24322\/revisions\/24323"}],"wp:attachment":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media?parent=24322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/categories?post=24322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/tags?post=24322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}