{"id":26358,"date":"2025-02-22T10:16:29","date_gmt":"2025-02-22T02:16:29","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=26358"},"modified":"2025-02-22T10:23:28","modified_gmt":"2025-02-22T02:23:28","slug":"rags-wendangfenkuaice","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/ja\/rags-wendangfenkuaice\/","title":{"rendered":"\u7cbe\u901a RAG \u6587\u6863\u5206\u5757\u7b56\u7565\uff1a\u6784\u5efa\u9ad8\u6548\u68c0\u7d22\u7cfb\u7edf\u7684\u5206\u5757\u7b56\u7565\u6307\u5357"},"content":{"rendered":"<p>\u5982\u679c\u4f60\u7684 <a href=\"https:\/\/www.kdjingpai.com\/rag\/\">RAG<\/a> \u5e94\u7528\u672a\u80fd\u8fbe\u5230\u9884\u671f\u6548\u679c\uff0c\u6216\u8bb8\u662f\u65f6\u5019\u91cd\u65b0\u5ba1\u89c6\u4f60\u7684\u5206\u5757\u7b56\u7565\u4e86\u3002<strong>\u66f4\u597d\u7684\u5206\u5757\u610f\u5473\u7740\u66f4\u7cbe\u51c6\u7684\u68c0\u7d22\uff0c\u6700\u7ec8\u5e26\u6765\u66f4\u9ad8\u8d28\u91cf\u7684\u56de\u590d\u3002<\/strong><\/p>\n<p>\u7136\u800c\uff0c\u5206\u5757\u6280\u672f\u5e76\u975e\u201c\u4e00\u62db\u9c9c\u5403\u904d\u5929\u201d\uff0c\u6ca1\u6709\u54ea\u4e00\u79cd\u65b9\u6cd5\u662f\u7edd\u5bf9\u6700\u4f18\u7684\u3002\u4f60\u9700\u8981\u6839\u636e\u9879\u76ee\u7684\u5177\u4f53\u9700\u6c42\u3001\u6587\u6863\u7279\u6027\u4ee5\u53ca\u9884\u7b97\u7b49\u56e0\u7d20\uff0c\u7efc\u5408\u8003\u91cf\u5e76\u9009\u62e9\u6700\u9002\u5408\u7684\u7b56\u7565\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u4e3a\u4ec0\u4e48\u5206\u5757\u8d28\u91cf\u76f4\u63a5\u5f71\u54cd RAG \u56de\u590d\u8d28\u91cf\uff1f<\/h2>\n<p>\u6211\u76f8\u4fe1\uff0c\u9605\u8bfb\u672c\u6587\u7684\u4f60\u5bf9\u5206\u5757\u548c RAG \u7684\u57fa\u672c\u6982\u5ff5\u5df2\u7ecf\u6709\u6240\u4e86\u89e3\u3002\u7b80\u5355\u56de\u987e\u4e00\u4e0b\uff0cRAG \u7684\u6838\u5fc3\u601d\u60f3\u662f\u8ba9 LLM\u00a0<strong>\u57fa\u4e8e\u7ed9\u5b9a\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u56de\u7b54\u95ee\u9898<\/strong>\u3002\u8fd9\u662f\u56e0\u4e3a\uff0cLLM \u867d\u7136\u77e5\u8bc6\u50a8\u5907\u4e30\u5bcc\uff0c\u4f46\u5176\u77e5\u8bc6\u66f4\u65b0\u5b58\u5728\u6ede\u540e\u6027\uff0c\u4e14\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u79c1\u6709\u6570\u636e\u3002<\/p>\n<p>RAG \u901a\u8fc7\u5728\u63d0\u793a\u8bcd\u4e2d\u6ce8\u5165\u76f8\u5173\u6587\u6863\u7247\u6bb5\uff08\u5373\u4e0a\u4e0b\u6587\uff09\uff0c\u5f15\u5bfc LLM \u5728\u8fd9\u4e9b\u7247\u6bb5\u7684\u57fa\u7840\u4e0a\u751f\u6210\u7b54\u6848\uff0c\u5f25\u8865\u4e86 LLM \u81ea\u8eab\u7684\u4e0d\u8db3\u3002\u4e0a\u4e0b\u6587\u7684\u83b7\u53d6\u65b9\u5f0f\u591a\u79cd\u591a\u6837\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u67e5\u8be2\u3001\u4e92\u8054\u7f51\u641c\u7d22\u3001\u6216\u4ece PDF \u6587\u6863\u4e2d\u63d0\u53d6\u7b49\u3002<\/p>\n<p>\u6784\u5efa\u9ad8\u6548 RAG \u5e94\u7528\uff0c\u4f1a\u9047\u5230\u4e24\u4e2a\u5173\u952e\u6311\u6218\uff1a<\/p>\n<ol>\n<li><strong>LLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u9650\u5236<\/strong>\uff1a\u65e9\u671f\u7684 LLM\uff0c\u5982 GPT-2 \u548c GPT-3\uff0c\u4e0a\u4e0b\u6587\u7a97\u53e3\u8f83\u5c0f\uff0c\u9650\u5236\u4e86\u5355\u6b21\u53ef\u5904\u7406\u7684\u6587\u672c\u91cf\u3002\u867d\u7136\u73b0\u5728\u51fa\u73b0\u4e86\u652f\u6301\u66f4\u5927\u4e0a\u4e0b\u6587\u7a97\u53e3\u7684\u6a21\u578b\uff0c\u4f46\u8fd9\u5e76\u4e0d\u610f\u5473\u7740\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u5c06\u6574\u4e2a\u6587\u6863\u585e\u5165 LLM\u3002<\/li>\n<li><strong>\u4e0a\u4e0b\u6587\u566a\u58f0\u95ee\u9898<\/strong>\uff1a\u5373\u4f7f LLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u8db3\u591f\u5927\uff0c\u5982\u679c\u63d0\u4f9b\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u4e2d\u5305\u542b\u5927\u91cf\u4e0e\u95ee\u9898\u65e0\u5173\u7684\u5185\u5bb9\uff08\u566a\u58f0\uff09\uff0c\u4e5f\u4f1a\u5f71\u54cd LLM \u7684\u7406\u89e3\u548c\u5224\u65ad\uff0c\u5bfc\u81f4\u56de\u590d\u8d28\u91cf\u4e0b\u964d\u751a\u81f3\u4ea7\u751f\u5e7b\u89c9\u3002<\/li>\n<\/ol>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\uff0c<strong>\u6587\u6863\u5206\u5757<\/strong>\u6280\u672f\u5e94\u8fd0\u800c\u751f\u3002\u5176\u6838\u5fc3\u601d\u60f3\u662f\u5c06\u5927\u578b\u6587\u6863\u62c6\u5206\u6210\u66f4\u5c0f\u7684\u3001\u8bed\u4e49\u8fde\u8d2f\u7684\u7247\u6bb5\uff08\u5757\uff09\uff0c\u7136\u540e\u5728\u68c0\u7d22\u9636\u6bb5\uff0c\u53ea\u9009\u53d6\u6700\u76f8\u5173\u7684\u5757\u4f5c\u4e3a\u4e0a\u4e0b\u6587\u63d0\u4f9b\u7ed9 LLM\u3002<\/p>\n<p>\u6587\u6863\u5206\u5757\u7684\u65b9\u6cd5\u591a\u79cd\u591a\u6837\uff0c\u7b80\u5355\u7684\u5982\u6309\u53e5\u5b50\u3001\u6bb5\u843d\u5206\u5272\uff0c\u590d\u6742\u7684\u5219\u6709\u8bed\u4e49\u5206\u5757\u3001Agentic \u5206\u5757\u7b49\u3002\u9009\u62e9\u5408\u9002\u7684\u5206\u5757\u7b56\u7565\u81f3\u5173\u91cd\u8981\uff0c\u5b83\u76f4\u63a5\u5f71\u54cd RAG \u7cfb\u7edf\u7684\u68c0\u7d22\u6548\u7387\u548c\u6700\u7ec8\u7684\u56de\u590d\u8d28\u91cf\u3002<\/p>\n<p>\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8\u51e0\u79cd\u66f4\u9ad8\u7ea7\u4e14\u5b9e\u7528\u7684\u6587\u6863\u5206\u5757\u7b56\u7565\uff0c\u5e2e\u52a9\u4f60\u6784\u5efa\u66f4\u5f3a\u5927\u7684 RAG \u5e94\u7528\u3002\u6211\u4eec\u5c06\u8df3\u8fc7\u7b80\u5355\u7684\u53e5\u5b50\u548c\u6bb5\u843d\u5206\u5272\uff0c\u91cd\u70b9\u4ecb\u7ecd\u5728\u5b9e\u9645 RAG \u5e94\u7528\u4e2d\u66f4\u6709\u4ef7\u503c\u7684\u6280\u672f\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u51e0\u79cd\u6211\u5b66\u4e60\u548c\u5b9e\u8df5\u8fc7\u7684\u5206\u5757\u7b56\u7565\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u9012\u5f52\u5b57\u7b26\u5206\u5272\uff1a\u5feb\u901f\u4e14\u7ecf\u6d4e\u7684\u57fa\u7840\u65b9\u6cd5<\/h2>\n<p>\u9012\u5f52\u5b57\u7b26\u5206\u5272\uff0c\u4f60\u6216\u8bb8\u4f1a\u89c9\u5f97\u8fd9\u662f\u6700\u57fa\u7840\u7684\u65b9\u6cd5\u3002\u7684\u786e\uff0c\u5b83\u5f88\u57fa\u7840\uff0c\u4f46\u5b83\u4f9d\u7136\u662f\u6211\u8ba4\u4e3a\u6700\u5e38\u7528\u3001\u6027\u4ef7\u6bd4\u6700\u9ad8\u7684\u5206\u5757\u6280\u672f\u4e4b\u4e00\u3002\u5b83\u6613\u4e8e\u7406\u89e3\u3001\u5b9e\u73b0\u7b80\u5355\u3001\u901f\u5ea6\u5feb\u4e14\u6210\u672c\u4f4e\u5ec9\uff0c\u5c24\u5176\u9002\u5408\u5feb\u901f\u539f\u578b\u9a8c\u8bc1\u548c\u5bf9\u6210\u672c\u654f\u611f\u7684\u9879\u76ee\u3002<\/p>\n<p>\u9012\u5f52\u5b57\u7b26\u5206\u5272\u7684\u6838\u5fc3\u601d\u60f3\u662f<strong>\u4f7f\u7528\u56fa\u5b9a\u5927\u5c0f\u7684\u6ed1\u52a8\u7a97\u53e3<\/strong>\uff0c\u5e76\u5141\u8bb8\u7a97\u53e3\u4e4b\u95f4\u5b58\u5728\u91cd\u53e0\u3002\u5b83\u4ece\u6587\u6863\u7684\u8d77\u59cb\u4f4d\u7f6e\u5f00\u59cb\uff0c\u4ee5\u9884\u8bbe\u7684\u5757\u5927\u5c0f\u548c\u91cd\u53e0\u5b57\u7b26\u6570\uff0c\u4e0d\u65ad\u6ed1\u52a8\u7a97\u53e3\uff0c\u751f\u6210\u6587\u672c\u5757\u3002<\/p>\n<p>\u4e0b\u56fe\u5c55\u793a\u4e86\u9012\u5f52\u5b57\u7b26\u5206\u5272\u7684\u5de5\u4f5c\u539f\u7406\uff1a<\/p>\n<p><center><img decoding=\"async\" title=\"RAGs \u6587\u6863\u5206\u5757\u7b56\u7565\uff1a\u63d0\u5347\u68c0\u7d22\u8d28\u91cf\u7684\u5b9e\u6218\u6307\u5357-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/23a9344298206fe.png\" alt=\"RAGs \u6587\u6863\u5206\u5757\u7b56\u7565\uff1a\u63d0\u5347\u68c0\u7d22\u8d28\u91cf\u7684\u5b9e\u6218\u6307\u5357-1\" \/>\u9012\u5f52\u5b57\u7b26\u5206\u5272\u7684\u5de5\u4f5c\u539f\u7406 \u2014 \u4f5c\u8005 Thuwarakesh \u7ed8\u5236<\/center>\u56fe\u4e2d\u793a\u4f8b\uff0c\u5757\u5927\u5c0f\u8bbe\u7f6e\u4e3a 20 \u4e2a\u5b57\u7b26\uff0c\u91cd\u53e0\u5b57\u7b26\u6570\u4e3a 2\u3002\u5c55\u793a\u4e86\u5982\u4f55\u901a\u8fc7\u6ed1\u52a8\u7a97\u53e3\u65b9\u5f0f\u751f\u6210\u6587\u672c\u5757\u3002<\/p>\n<p>\u9012\u5f52\u5b57\u7b26\u5206\u5272\u7684\u4f18\u52bf\u5728\u4e8e\u5176\u7b80\u5355\u6027\u548c\u9ad8\u6548\u6027\u3002\u5b83\u53ef\u4ee5\u5feb\u901f\u5904\u7406\u5927\u578b\u6587\u6863\uff0c\u5728\u5206\u949f\u7ea7\u522b\u5185\u5b8c\u6210\u5e74\u5ea6\u62a5\u544a\u7684\u5206\u5757\u3002\u5728 Langchain \u4e2d\uff0c\u5b9e\u73b0\u9012\u5f52\u5b57\u7b26\u5206\u5272\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<pre><code>from langchain.text_splitter import RecursiveCharacterTextSplitter\r\ntext = \"\"\"\r\nHydroponics is an intelligent way to grow veggies indoors or in small spaces. In hydroponics, plants are grown without soil, using only a substrate and nutrient solution. The global population is rising fast, and there needs to be more space to produce food for everyone. Besides, transporting food for long distances involves lots of issues. You can grow leafy greens, herbs, tomatoes, and cucumbers with hydroponics.\r\n\"\"\"\r\nrc_splits = RecursiveCharacterTextSplitter.from_tiktoken_encoder(\r\nchunk_size=20, chunk_overlap=2\r\n).split_text(text)\r\n<\/code><\/pre>\n<p><strong>\u6ed1\u52a8\u7a97\u53e3\u7684\u53d8\u4f53<\/strong><\/p>\n<p><strong>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6ed1\u52a8\u7a97\u53e3\u7684\u5927\u5c0f\u548c\u6ed1\u52a8\u6b65\u957f\u53ef\u4ee5\u6709\u591a\u79cd\u53d8\u5316\uff0c\u4ee5\u9002\u5e94\u4e0d\u540c\u7684\u9700\u6c42\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u57fa\u4e8e\u5b57\u7b26 vs. \u57fa\u4e8e Token \u7684\u6ed1\u52a8\u7a97\u53e3<\/strong>: \u4e0a\u8ff0\u793a\u4f8b\u662f\u57fa\u4e8e\u5b57\u7b26\u7684\u6ed1\u52a8\u7a97\u53e3\u3002\u4e5f\u53ef\u4ee5\u4f7f\u7528\u57fa\u4e8e <a href=\"https:\/\/www.kdjingpai.com\/tokenization\/\">Token<\/a> \u7684\u6ed1\u52a8\u7a97\u53e3\uff0c\u786e\u4fdd\u5757\u5927\u5c0f\u66f4\u7b26\u5408 LLM \u7684\u5904\u7406\u65b9\u5f0f\u3002Langchain \u7684\u00a0<strong>RecursiveCharacterTextSplitter<\/strong>\u00a0\u540c\u65f6\u652f\u6301\u5b57\u7b26\u548c Token \u4e24\u79cd\u6a21\u5f0f\u3002<\/li>\n<li><strong>\u52a8\u6001\u7a97\u53e3\u5927\u5c0f<\/strong>: \u867d\u7136\u56fa\u5b9a\u7a97\u53e3\u5927\u5c0f\u662f\u9012\u5f52\u5b57\u7b26\u5206\u5272\u7684\u7279\u70b9\uff0c\u4f46\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u4e5f\u53ef\u4ee5\u8003\u8651\u52a8\u6001\u8c03\u6574\u7a97\u53e3\u5927\u5c0f\u3002\u4f8b\u5982\uff0c\u6839\u636e\u53e5\u5b50\u7684\u957f\u5ea6\u6216\u6bb5\u843d\u7684\u7ed3\u6784\uff0c\u81ea\u9002\u5e94\u5730\u8c03\u6574\u7a97\u53e3\u5927\u5c0f\uff0c\u4ee5\u4fdd\u8bc1\u5757\u7684\u8bed\u4e49\u5b8c\u6574\u6027\u3002<\/li>\n<\/ul>\n<p><strong>\u5c40\u9650\u6027<\/strong><\/p>\n<p><strong>\u9012\u5f52\u5b57\u7b26\u5206\u5272\u662f\u4e00\u79cd<\/strong>\u57fa\u4e8e\u4f4d\u7f6e\u7684\u5206\u5757\u65b9\u6cd5\u3002\u5b83\u7b80\u5355\u5730\u5047\u8bbe\u6587\u6863\u4e2d\u4f4d\u7f6e\u76f8\u90bb\u7684\u6587\u672c\u5728\u8bed\u4e49\u4e0a\u4e5f\u662f\u76f8\u5173\u7684\u3002\u7136\u800c\uff0c\u8fd9\u79cd\u5047\u8bbe\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\u5e76\u4e0d\u6210\u7acb\u3002<\/p>\n<p>\u601d\u8003\uff1a\u4e3a\u4ec0\u4e48\u57fa\u4e8e\u4f4d\u7f6e\u7684\u5206\u5757\u4f1a\u5bfc\u81f4 RAGs \u6027\u80fd\u4e0d\u4f73\uff1f\u5982\u4f55\u5b9e\u73b0\u8bed\u4e49\u5206\u5757\u5e76\u83b7\u5f97\u66f4\u597d\u7684\u7ed3\u679c\uff1f<\/p>\n<p>\u4f8b\u5982\uff0c\u540c\u4e00\u7ae0\u8282\u4e2d\uff0c\u4f5c\u8005\u53ef\u80fd\u5148\u8ba8\u8bba\u591a\u4e2a\u4e0d\u540c\u7684\u6982\u5ff5\uff0c\u6700\u540e\u624d\u5c06\u5b83\u4eec\u5173\u8054\u8d77\u6765\u3002\u5982\u679c\u4ec5\u4f7f\u7528\u9012\u5f52\u5b57\u7b26\u5206\u5272\uff0c\u53ef\u80fd\u4f1a\u5c06\u672c\u5e94\u5c5e\u4e8e\u540c\u4e00\u8bed\u4e49\u5355\u5143\u7684\u5185\u5bb9\u5206\u5272\u5f00\uff0c\u6216\u8005\u5c06\u8bed\u4e49\u65e0\u5173\u7684\u5185\u5bb9\u7ec4\u5408\u5728\u4e00\u8d77\uff0c\u5f71\u54cd\u68c0\u7d22\u6548\u679c\u3002<\/p>\n<p>\u5c3d\u7ba1\u5b58\u5728\u5c40\u9650\u6027\uff0c\u4f46\u9012\u5f52\u5b57\u7b26\u5206\u5272\u4f9d\u7136\u662f RAG \u5165\u95e8\u7684\u7406\u60f3\u9009\u62e9\u3002\u5728\u539f\u578b\u5f00\u53d1\u9636\u6bb5\uff0c\u6216\u8005\u5bf9\u4e8e\u7ed3\u6784\u7b80\u5355\u7684\u6587\u6863\uff0c\u5b83\u901a\u5e38\u80fd\u63d0\u4f9b\u4ee4\u4eba\u6ee1\u610f\u7684\u7ed3\u679c\u3002\u5982\u679c\u4f60\u7684\u9879\u76ee\u5bf9\u6210\u672c\u548c\u901f\u5ea6\u6709\u8f83\u9ad8\u8981\u6c42\uff0c\u9012\u5f52\u5b57\u7b26\u5206\u5272\u4e5f\u662f\u4e00\u4e2a\u503c\u5f97\u8003\u8651\u7684\u65b9\u6848\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u8bed\u4e49\u5206\u5757\uff1a\u7406\u89e3\u6587\u672c\u542b\u4e49\u7684\u5206\u5757\u65b9\u6cd5<\/h2>\n<p><strong>\u8bed\u4e49\u5206\u5757\u662f\u4e00\u79cd\u66f4\u9ad8\u7ea7\u7684\u5206\u5757\u7b56\u7565\uff0c\u5b83<\/strong>\u4e0d\u518d\u4ec5\u4ec5\u4f9d\u8d56\u6587\u672c\u7684\u4f4d\u7f6e\u4fe1\u606f\uff0c\u800c\u662f\u6df1\u5165\u7406\u89e3\u6587\u672c\u7684\u8bed\u4e49\u542b\u4e49\u3002\u5176\u6838\u5fc3\u601d\u60f3\u662f\uff0c\u5728\u6587\u6863\u8bed\u4e49\u53d1\u751f\u663e\u8457\u53d8\u5316\u65f6\u8fdb\u884c\u5206\u5272\uff0c\u786e\u4fdd\u6bcf\u4e2a\u5757\u90fd\u5c3d\u53ef\u80fd\u56f4\u7ed5\u5355\u4e00\u4e3b\u9898\u3002<\/p>\n<p>\u4e0b\u56fe\u5c55\u793a\u4e86\u8bed\u4e49\u5206\u5757\u7684\u5de5\u4f5c\u539f\u7406\uff1a<\/p>\n<p><center><img decoding=\"async\" title=\"RAGs \u6587\u6863\u5206\u5757\u7b56\u7565\uff1a\u63d0\u5347\u68c0\u7d22\u8d28\u91cf\u7684\u5b9e\u6218\u6307\u5357-2\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/ddda09259ddc745.png\" alt=\"RAGs \u6587\u6863\u5206\u5757\u7b56\u7565\uff1a\u63d0\u5347\u68c0\u7d22\u8d28\u91cf\u7684\u5b9e\u6218\u6307\u5357-2\" \/>\u8bed\u4e49\u5206\u5757\u7684\u5de5\u4f5c\u539f\u7406 \u2014 \u4f5c\u8005 Thuwarakesh \u7ed8\u5236<\/center>\u793a\u4f8b\u4e2d\uff0c\u524d\u4e24\u4e2a\u53e5\u5b50\u8ba8\u8bba\u6c34\u57f9\u519c\u4e1a\uff0c\u63a5\u7740\u4e24\u4e2a\u53e5\u5b50\u8f6c\u5411\u5168\u7403\u95ee\u9898\uff0c\u7136\u540e\u53c8\u56de\u5230\u6c34\u57f9\u3002\u8bed\u4e49\u5206\u5757\u80fd\u591f\u8bc6\u522b\u51fa\u8fd9\u79cd\u8bed\u4e49\u4e3b\u9898\u7684\u8f6c\u53d8\uff0c\u5e76\u5728\u4e3b\u9898\u5207\u6362\u5904\u8fdb\u884c\u5206\u5272\u3002<\/p>\n<p>\u4e0e\u9012\u5f52\u5b57\u7b26\u5206\u5272\u4e0d\u540c\uff0c\u8bed\u4e49\u5206\u5757\u751f\u6210\u7684\u5757\u957f\u5ea6\u901a\u5e38\u662f\u4e0d\u56fa\u5b9a\u7684\u3002\u5b83\u4f1a\u6839\u636e\u8bed\u4e49\u5b8c\u6574\u6027\u6765\u786e\u5b9a\u5757\u7684\u8fb9\u754c\uff0c\u800c\u4e0d\u662f\u9884\u8bbe\u56fa\u5b9a\u7684\u5b57\u7b26\u6216 Token \u6570\u91cf\u3002<\/p>\n<p><strong>\u5b9e\u73b0\u8bed\u4e49\u5206\u5757\u7684\u5173\u952e\u6b65\u9aa4<\/strong><\/p>\n<p><strong>\u8bed\u4e49\u5206\u5757\u7684\u96be\u70b9\u5728\u4e8e\u5982\u4f55<\/strong>\u7a0b\u5e8f\u5316\u5730\u7406\u89e3\u53e5\u5b50\u7684\u8bed\u4e49**\u3002\u8fd9\u901a\u5e38\u501f\u52a9<strong>\u5d4c\u5165\u6a21\u578b<\/strong>\u6765\u5b9e\u73b0\u3002\u5d4c\u5165\u6a21\u578b\uff0c\u5982 OpenAI \u7684\u00a0<strong>text-embedding-3-large<\/strong>\uff0c\u53ef\u4ee5\u5c06\u53e5\u5b50\u8f6c\u6362\u4e3a\u5411\u91cf\u8868\u793a\uff0c\u5411\u91cf\u80fd\u591f\u6355\u6349\u53e5\u5b50\u7684\u8bed\u4e49\u4fe1\u606f\u3002\u8bed\u4e49\u76f8\u4f3c\u7684\u53e5\u5b50\uff0c\u5176\u5411\u91cf\u5728\u7a7a\u95f4\u4e2d\u4e5f\u66f4\u63a5\u8fd1\u3002**<\/p>\n<p><strong>\u8bed\u4e49\u5206\u5757\u7684\u5178\u578b\u6d41\u7a0b\u5305\u62ec\u4ee5\u4e0b\u4e94\u4e2a\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u6784\u5efa\u521d\u59cb\u5757<\/strong>\uff1a\u5c06\u6587\u6863\u521d\u6b65\u5206\u5272\u6210\u53e5\u5b50\u6216\u6bb5\u843d\uff0c\u5e76\u5c06\u76f8\u90bb\u7684\u53e5\u5b50\u6216\u6bb5\u843d\u7ec4\u5408\u6210\u521d\u59cb\u5757\u3002<\/li>\n<li><strong>\u751f\u6210\u5757\u5d4c\u5165<\/strong>\uff1a\u4f7f\u7528\u5d4c\u5165\u6a21\u578b\uff0c\u4e3a\u6bcf\u4e2a\u521d\u59cb\u5757\u751f\u6210\u5411\u91cf\u5d4c\u5165\u3002<\/li>\n<li><strong>\u8ba1\u7b97\u5757\u95f4\u8ddd\u79bb<\/strong>\uff1a\u8ba1\u7b97\u76f8\u90bb\u5757\u4e4b\u95f4\u7684\u8bed\u4e49\u8ddd\u79bb\u3002\u5e38\u7528\u7684\u8ddd\u79bb\u5ea6\u91cf\u65b9\u6cd5\u5305\u62ec\u4f59\u5f26\u8ddd\u79bb\u7b49\u3002\u8ddd\u79bb\u8d8a\u5927\uff0c\u8868\u793a\u8bed\u4e49\u5dee\u5f02\u8d8a\u5927\u3002<\/li>\n<li><strong>\u786e\u5b9a\u5206\u5272\u70b9<\/strong>\uff1a\u8bbe\u5b9a\u4e00\u4e2a\u8ddd\u79bb\u9608\u503c\u3002\u5f53\u76f8\u90bb\u5757\u4e4b\u95f4\u7684\u8ddd\u79bb\u8d85\u8fc7\u9608\u503c\u65f6\uff0c\u5c06\u5b83\u4eec\u65ad\u5f00\uff0c\u5f62\u6210\u65b0\u7684\u8bed\u4e49\u5757\u3002\u9608\u503c\u7684\u9009\u62e9\u9700\u8981\u6839\u636e\u5177\u4f53\u6587\u6863\u548c\u5b9e\u9a8c\u6548\u679c\u6765\u8c03\u6574\u3002<\/li>\n<li><strong>\u53ef\u89c6\u5316\uff08\u53ef\u9009\uff09<\/strong>\uff1a\u5c06\u5757\u4e4b\u95f4\u7684\u8ddd\u79bb\u53ef\u89c6\u5316\uff0c\u6709\u52a9\u4e8e\u66f4\u76f4\u89c2\u5730\u7406\u89e3\u5206\u5757\u6548\u679c\uff0c\u5e76\u8c03\u6574\u9608\u503c\u3002<\/li>\n<\/ul>\n<p><strong>\u4ee5\u4e0b\u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u5b9e\u73b0\u8bed\u4e49\u5206\u5757\uff1a<\/strong><\/p>\n<pre><code># Step 1 : Create initial chunks by combining concecutive sentences.\r\n# ------------------------------------------------------------------\r\n#Split the text into individual sentences.\r\nsentences = re.split(r\"(?&lt;=[.?!])\\s+\", text)\r\ninitial_chunks = [\r\n{\"chunk\": str(sentence), \"index\": i} for i, sentence in enumerate(sentences)\r\n]\r\n# Function to combine chunks with overlapping sentences\r\ndef combine_chunks(chunks):\r\nfor i in range(len(chunks)):\r\ncombined_chunk = \"\"\r\nif i &gt; 0:\r\ncombined_chunk += chunks[i - 1][\"chunk\"]\r\ncombined_chunk += chunks[i][\"chunk\"]\r\nif i &lt; len(chunks) - 1:\r\ncombined_chunk += chunks[i + 1][\"chunk\"]\r\nchunks[i][\"combined_chunk\"] = combined_chunk\r\nreturn chunks\r\n# Combine chunks\r\ncombined_chunks = combine_chunks(initial_chunks)\r\n# Step 2 : Create embeddings for the initial chunks.\r\n# ------------------------------------------------------------------\r\n# Embed the combined chunks\r\nchunk_embeddings = embeddings.embed_documents(\r\n[chunk[\"combined_chunk\"] for chunk in combined_chunks]\r\n# If you haven't created combined_chunk, use the following.\r\n# [chunk[\"chunk\"] for chunk in combined_chunks]\r\n)\r\n# Add embeddings to chunks\r\nfor i, chunk in enumerate(combined_chunks):\r\nchunk[\"embedding\"] = chunk_embeddings[i]\r\n# Step 3 : Calculate distance between the chunks\r\n# ------------------------------------------------------------------\r\ndef calculate_cosine_distances(chunks):\r\ndistances = []\r\nfor i in range(len(chunks) - 1):\r\ncurrent_embedding = chunks[i][\"embedding\"]\r\nnext_embedding = chunks[i + 1][\"embedding\"]\r\nsimilarity = cosine_similarity([current_embedding], [next_embedding])[0][0]\r\ndistance = 1 - similarity\r\ndistances.append(distance)\r\nchunks[i][\"distance_to_next\"] = distance\r\nreturn distances\r\n# Calculate cosine distances\r\ndistances = calculate_cosine_distances(combined_chunks)\r\n# Step 4 : Find chunks with significant different to it's previous ones.\r\n# ----------------------------------------------------------------------\r\nimport numpy as np\r\nthreshold_percentile = 90\r\nthreshold_value = np.percentile(cosine_distances, threshold_percentile)\r\ncrossing_points = [\r\ni for i, distance in enumerate(distances) if distance &gt; threshold_value\r\n]\r\nlen(crossing_points)\r\n# Step 5 (Optional) : Create a plot of chunk distances to get a better view\r\n# -------------------------------------------------------------------------\r\nimport seaborn as sns\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\ndef visualize_cosine_distances_with_thresholds_multicolored(\r\ncosine_distances, threshold_percentile=90\r\n):\r\n# Calculate the threshold value based on the percentile\r\nthreshold_value = np.percentile(cosine_distances, threshold_percentile)\r\n# Identify the points where the cosine distance crosses the threshold\r\ncrossing_points = [0]  # Start with the first segment beginning at index 0\r\ncrossing_points += [\r\ni\r\nfor i, distance in enumerate(cosine_distances)\r\nif distance &gt; threshold_value\r\n]\r\ncrossing_points.append(\r\nlen(cosine_distances)\r\n)  # Ensure the last segment goes to the end\r\n# Set up the plot\r\nplt.figure(figsize=(14, 6))\r\nsns.set(style=\"white\")  # Change to white to turn off gridlines\r\n# Plot the cosine distances\r\nsns.lineplot(\r\nx=range(len(cosine_distances)),\r\ny=cosine_distances,\r\ncolor=\"blue\",\r\nlabel=\"Cosine Distance\",\r\n)\r\n# Plot the threshold line\r\nplt.axhline(\r\ny=threshold_value,\r\ncolor=\"red\",\r\nlinestyle=\"--\",\r\nlabel=f\"{threshold_percentile}th Percentile Threshold\",\r\n)\r\n# Highlight segments between threshold crossings with different colors\r\ncolors = sns.color_palette(\r\n\"hsv\", len(crossing_points) - 1\r\n)  # Use a color palette for segments\r\nfor i in range(len(crossing_points) - 1):\r\nplt.axvspan(\r\ncrossing_points[i], crossing_points[i + 1], color=colors[i], alpha=0.3\r\n)\r\n# Add labels and title\r\nplt.title(\r\n\"Cosine Distances Between Segments with Multicolored Threshold Highlighting\"\r\n)\r\nplt.xlabel(\"Segment Index\")\r\nplt.ylabel(\"Cosine Distance\")\r\nplt.legend()\r\n# Adjust the x-axis limits to remove extra space\r\nplt.xlim(0, len(cosine_distances) - 1)\r\n# Display the plot\r\nplt.show()\r\nreturn crossing_points\r\n# Example usage with cosine_distances and threshold_percentile\r\ncrossing_poings = visualize_cosine_distances_with_thresholds_multicolored(\r\ndistances, threshold_percentile=bp_threashold\r\n)\r\n<\/code><\/pre>\n<p><strong>\u53ef\u89c6\u5316\u8ddd\u79bb\u7684 Seborn \u56fe\u8868\uff1a<\/strong><\/p>\n<p><center><img decoding=\"async\" title=\"RAGs \u6587\u6863\u5206\u5757\u7b56\u7565\uff1a\u63d0\u5347\u68c0\u7d22\u8d28\u91cf\u7684\u5b9e\u6218\u6307\u5357-3\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/6c71ab655ff41a8.png\" alt=\"RAGs \u6587\u6863\u5206\u5757\u7b56\u7565\uff1a\u63d0\u5347\u68c0\u7d22\u8d28\u91cf\u7684\u5b9e\u6218\u6307\u5357-3\" \/>\u7528\u4e8e\u8bf4\u660e\u8bed\u4e49\u5206\u5757Seaborn\u56fe\u8868 \u2014 \u4f5c\u8005 Thuwarakesh \u7ed8\u5236<\/center>\u56fe\u4e2d\uff0c\u5f53\u5757\u95f4\u8ddd\u79bb\u8d85\u8fc7 0.12 \u7684\u9608\u503c\u65f6\uff0c\u5c31\u5c06\u4e4b\u524d\u7684\u5757\u5408\u5e76\u4e3a\u4e00\u4e2a\u66f4\u5927\u7684\u8bed\u4e49\u5757\u3002\u6700\u7ec8\u751f\u6210\u4e86 6 \u4e2a\u957f\u5ea6\u4e0d\u4e00\u7684\u8bed\u4e49\u5757\u3002<\/p>\n<p><strong>\u8bed\u4e49\u5206\u5757\u7684\u4f18\u52bf\u4e0e\u9002\u7528\u573a\u666f<\/strong><\/p>\n<p><strong>\u8bed\u4e49\u5206\u5757\u7684\u4f18\u52bf\u5728\u4e8e\u80fd\u591f<\/strong>\u66f4\u597d\u5730\u6355\u6349\u6587\u6863\u7684\u8bed\u4e49\u7ed3\u6784\uff0c\u5c06\u8bed\u4e49\u76f8\u5173\u7684\u6587\u672c\u7247\u6bb5\u805a\u5408\u5728\u4e00\u8d77\uff0c\u4ece\u800c\u63d0\u9ad8 RAG \u7cfb\u7edf\u7684\u68c0\u7d22\u8d28\u91cf\u3002\u5b83\u66f4\u9002\u7528\u4e8e\u5904\u7406\u4ee5\u4e0b\u7c7b\u578b\u7684\u6587\u6863\uff1a<\/p>\n<ul>\n<li><strong>\u7ed3\u6784\u590d\u6742\u3001\u4e3b\u9898\u591a\u6837\u7684\u6587\u6863<\/strong>\uff1a\u4f8b\u5982\uff0c\u5305\u542b\u591a\u4e2a\u5b50\u4e3b\u9898\u7684\u957f\u7bc7\u62a5\u544a\u3001\u6280\u672f\u6587\u6863\u3001\u4e66\u7c4d\u7b49\u3002<\/li>\n<li><strong>\u8bed\u4e49\u8df3\u8dc3\u6027\u5f3a\u7684\u6587\u6863<\/strong>\uff1a\u4f5c\u8005\u5728\u5199\u4f5c\u65f6\uff0c\u601d\u8def\u53ef\u80fd\u8df3\u8dc3\uff0c\u8bed\u4e49\u5206\u5757\u80fd\u66f4\u597d\u5730\u9002\u5e94\u8fd9\u79cd\u5199\u4f5c\u98ce\u683c\u3002<\/li>\n<\/ul>\n<p><strong>\u76f8\u6bd4\u9012\u5f52\u5b57\u7b26\u5206\u5272\uff0c\u8bed\u4e49\u5206\u5757\u7684<\/strong>\u8ba1\u7b97\u6210\u672c\u66f4\u9ad8**\uff0c\u901f\u5ea6\u4e5f\u66f4\u6162\u3002\u8fd9\u4e3b\u8981\u662f\u56e0\u4e3a\u9700\u8981\u8fdb\u884c\u5d4c\u5165\u5411\u91cf\u7684\u8ba1\u7b97\u548c\u8ddd\u79bb\u5ea6\u91cf\u3002\u56e0\u6b64\uff0c\u5728\u8d44\u6e90\u6709\u9650\u7684\u573a\u666f\u4e0b\uff0c\u9700\u8981\u6743\u8861\u8003\u8651\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>Agentic \u5206\u5757\uff1a\u6a21\u62df\u4eba\u7c7b\u7406\u89e3\u7684\u5206\u5757\u7b56\u7565<\/h2>\n<p><strong>Agentic \u5206\u5757\u662f\u66f4\u8fdb\u4e00\u6b65\u7684\u667a\u80fd\u5316\u5206\u5757\u65b9\u6cd5\u3002\u5b83<\/strong>\u501f\u9274\u4e86\u4eba\u7c7b\u9605\u8bfb\u548c\u7406\u89e3\u6587\u6863\u7684\u65b9\u5f0f\uff0c\u4f7f\u7528 LLM \u4f5c\u4e3a \u201c\u667a\u80fd Agent\u201d \u6765\u8f85\u52a9\u5206\u5757\u3002<\/p>\n<p><strong>\u4eba\u7c7b\u7684\u9605\u8bfb\u4e60\u60ef\u5e76\u975e\u5b8c\u5168\u7ebf\u6027<\/strong>\u3002\u6211\u4eec\u5728\u9605\u8bfb\u65f6\uff0c\u4f1a\u6839\u636e\u4e3b\u9898\u6216\u6982\u5ff5\u8fdb\u884c\u8df3\u8dc3\u5f0f\u9605\u8bfb\uff0c\u5e76\u5728\u8111\u6d77\u4e2d\u6784\u5efa\u6587\u6863\u7684\u903b\u8f91\u7ed3\u6784\u3002Agentic \u5206\u5757\u8bd5\u56fe\u6a21\u62df\u8fd9\u79cd\u4eba\u7c7b\u7684\u7406\u89e3\u8fc7\u7a0b\u3002<\/p>\n<p><strong>\u4e0e\u524d\u4e24\u79cd\u65b9\u6cd5\u4e0d\u540c\uff0cAgentic \u5206\u5757<\/strong>\u4e0d\u5047\u8bbe\u8bed\u4e49\u76f8\u4f3c\u7684\u5185\u5bb9\u5728\u6587\u6863\u4e2d\u662f\u8fde\u7eed\u51fa\u73b0\u7684**\u3002\u5b83\u53ef\u4ee5\u5c06\u6587\u6863\u4e2d\u5206\u6563\u4f46\u8bed\u4e49\u76f8\u5173\u7684\u7247\u6bb5\u805a\u5408\u5728\u4e00\u8d77\uff0c\u5f62\u6210\u66f4\u7b26\u5408\u4eba\u7c7b\u8ba4\u77e5\u7684\u8bed\u4e49\u5757\u3002<\/p>\n<p><strong>Agentic \u5206\u5757\u7684\u5de5\u4f5c\u6d41\u7a0b<\/strong><\/p>\n<p><strong>Agentic \u5206\u5757\u7684\u6838\u5fc3\u601d\u60f3\u662f<\/strong>\u8ba9 LLM \u50cf\u4eba\u4e00\u6837 \u201c\u9605\u8bfb\u201d \u6587\u6863\uff0c\u8bc6\u522b\u6587\u6863\u4e2d\u7684\u6838\u5fc3\u6982\u5ff5\u548c\u4e3b\u9898\uff0c\u5e76\u57fa\u4e8e\u8fd9\u4e9b\u6982\u5ff5\u548c\u4e3b\u9898\u8fdb\u884c\u5206\u5757\u3002\u5178\u578b\u7684 Agentic \u5206\u5757\u6d41\u7a0b\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u547d\u9898\u5316 (Propositioning)<\/strong>\uff1a\u5c06\u6587\u6863\u4e2d\u7684\u6bcf\u4e2a\u53e5\u5b50\u8f6c\u5316\u4e3a\u66f4\u72ec\u7acb\u7684 \u201c\u547d\u9898\u201d (Proposition)\u3002\u4f8b\u5982\uff0c\u5c06\u6307\u4ee3\u4e0d\u660e\u7684\u4ee3\u8bcd\u66ff\u6362\u4e3a\u6307\u4ee3\u5bf9\u8c61\uff0c\u4f7f\u6bcf\u4e2a\u53e5\u5b50\u90fd\u5177\u5907\u66f4\u5b8c\u6574\u7684\u8bed\u4e49\u3002<\/li>\n<li><strong>\u6784\u5efa\u5757\u5bb9\u5668<\/strong>\uff1a\u521b\u5efa\u4e00\u4e2a\u6216\u591a\u4e2a \u201c\u5757\u5bb9\u5668\u201d (Chunk Container)\uff0c\u7528\u4e8e\u5b58\u653e\u8bed\u4e49\u76f8\u5173\u7684\u547d\u9898\u3002\u6bcf\u4e2a\u5757\u5bb9\u5668\u53ef\u4ee5\u6709\u4e00\u4e2a\u6807\u9898\u548c\u6458\u8981\uff0c\u7528\u4e8e\u63cf\u8ff0\u8be5\u5bb9\u5668\u7684\u4e3b\u9898\u3002<\/li>\n<li><strong>Agent \u9a71\u52a8\u7684\u547d\u9898\u5206\u914d<\/strong>\uff1a\u4f7f\u7528 LLM \u4f5c\u4e3a Agent\uff0c\u9010\u4e2a \u201c\u9605\u8bfb\u201d \u547d\u9898\uff0c\u5e76\u5224\u65ad\u8be5\u547d\u9898\u5e94\u5f52\u5c5e\u4e8e\u54ea\u4e2a\u5757\u5bb9\u5668\u3002\n<ul>\n<li><strong>\u5982\u679c Agent \u8ba4\u4e3a\u8be5\u547d\u9898\u4e0e\u5df2\u6709\u7684\u67d0\u4e2a\u5757\u5bb9\u5668\u7684\u4e3b\u9898\u76f8\u5173\uff0c\u5219\u5c06\u5176\u52a0\u5165\u8be5\u5bb9\u5668\u3002<\/strong><\/li>\n<li><strong>\u5982\u679c Agent \u8ba4\u4e3a\u8be5\u547d\u9898\u63d0\u51fa\u4e86\u4e00\u4e2a\u65b0\u7684\u4e3b\u9898\uff0c\u5219\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5757\u5bb9\u5668\u6765\u5b58\u653e\u8be5\u547d\u9898\u3002<\/strong><\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5757\u5bb9\u5668\u540e\u5904\u7406<\/strong>\uff1a\u5bf9\u5757\u5bb9\u5668\u8fdb\u884c\u540e\u5904\u7406\uff0c\u4f8b\u5982\uff0c\u6839\u636e\u5bb9\u5668\u5185\u7684\u547d\u9898\u751f\u6210\u66f4\u7cbe\u70bc\u7684\u5757\u6458\u8981\u548c\u6807\u9898\u3002<\/li>\n<\/ul>\n<p><strong>\u4ee5\u4e0b\u4ee3\u7801\u5c55\u793a\u4e86 Agentic \u5206\u5757\u7684\u5b9e\u73b0\u8fc7\u7a0b\uff1a<\/strong><\/p>\n<pre><code>from langchain import hub\r\nfrom langchain_openai import ChatOpenAI\r\nfrom langchain_core.prompts import ChatPromptTemplate\r\nfrom langchain_core.pydantic_v1 import BaseModel, Field\r\n# Step 1: Convert paragraphs to propositions.\r\n# --------------------------------------------\r\n# Load the propositioning prompt from langchain hub\r\nobj = hub.pull(\"wfh\/proposal-indexing\")\r\n# Pick the LLM\r\nllm = ChatOpenAI(model=\"gpt-4o\")\r\n# A Pydantic model to extract sentences from the passage\r\nclass Sentences(BaseModel):\r\nsentences: List[str]\r\nextraction_llm = llm.with_structured_output(Sentences)\r\n# Create the sentence extraction chain\r\nextraction_chain = obj | extraction_llm\r\n# NOTE: text is your actual document\r\nparagraphs = text.split(\"\\n\\n\")\r\npropositions = []\r\nfor i, p in enumerate(paragraphs):\r\npropositions = extraction_chain.invoke(p\r\npropositions.extend(propositions)\r\n# Step 2: Create a placeholder to store chunks\r\nchunks = {}\r\n# Step 3: Deine helper classes and functions for agentic chunking.\r\nclass ChunkMeta(BaseModel):\r\ntitle: str = Field(description=\"The title of the chunk.\")\r\nsummary: str = Field(description=\"The summary of the chunk.\")\r\ndef create_new_chunk(chunk_id, proposition):\r\nsummary_llm = llm.with_structured_output(ChunkMeta)\r\nsummary_prompt_template = ChatPromptTemplate.from_messages(\r\n[\r\n(\r\n\"system\",\r\n\"Generate a new summary and a title based on the propositions.\",\r\n),\r\n(\r\n\"user\",\r\n\"propositions:{propositions}\",\r\n),\r\n]\r\n)\r\nsummary_chain = summary_prompt_template | summary_llm\r\nchunk_meta = summary_chain.invoke(\r\n{\r\n\"propositions\": [proposition],\r\n}\r\n)\r\nchunks[chunk_id] = {\r\n\"summary\": chunk_meta.summary,\r\n\"title\": chunk_meta.title,\r\n\"propositions\": [proposition],\r\n}\r\ndef add_proposition(chunk_id, proposition):\r\nsummary_llm = llm.with_structured_output(ChunkMeta)\r\nsummary_prompt_template = ChatPromptTemplate.from_messages(\r\n[\r\n(\r\n\"system\",\r\n\"If the current_summary and title is still valid for the propositions return them.\"\r\n\"If not generate a new summary and a title based on the propositions.\",\r\n),\r\n(\r\n\"user\",\r\n\"current_summary:{current_summary}\\n\\ncurrent_title:{current_title}\\n\\npropositions:{propositions}\",\r\n),\r\n]\r\n)\r\nsummary_chain = summary_prompt_template | summary_llm\r\nchunk = chunks[chunk_id]\r\ncurrent_summary = chunk[\"summary\"]\r\ncurrent_title = chunk[\"title\"]\r\ncurrent_propositions = chunk[\"propositions\"]\r\nall_propositions = current_propositions + [proposition]\r\nchunk_meta = summary_chain.invoke(\r\n{\r\n\"current_summary\": current_summary,\r\n\"current_title\": current_title,\r\n\"propositions\": all_propositions,\r\n}\r\n)\r\nchunk[\"summary\"] = chunk_meta.summary\r\nchunk[\"title\"] = chunk_meta.title\r\nchunk[\"propositions\"] = all_propositions\r\n# Step 5: The main functino that creates chunks from propositions.\r\ndef find_chunk_and_push_proposition(proposition):\r\nclass ChunkID(BaseModel):\r\nchunk_id: int = Field(description=\"The chunk id.\")\r\nallocation_llm = llm.with_structured_output(ChunkID)\r\nallocation_prompt = ChatPromptTemplate.from_messages(\r\n[\r\n(\r\n\"system\",\r\n\"You have the chunk ids and the summaries\"\r\n\"Find the chunk that best matches the proposition.\"\r\n\"If no chunk matches, return a new chunk id.\"\r\n\"Return only the chunk id.\",\r\n),\r\n(\r\n\"user\",\r\n\"proposition:{proposition}\" \"chunks_summaries:{chunks_summaries}\",\r\n),\r\n]\r\n)\r\nallocation_chain = allocation_prompt | allocation_llm\r\nchunks_summaries = {\r\nchunk_id: chunk[\"summary\"] for chunk_id, chunk in chunks.items()\r\n}\r\nbest_chunk_id = allocation_chain.invoke(\r\n{\"proposition\": proposition, \"chunks_summaries\": chunks_summaries}\r\n).chunk_id\r\nif best_chunk_id not in chunks:\r\nbest_chunk_id = create_new_chunk(best_chunk_id, proposition)\r\nreturn\r\nadd_proposition(best_chunk_id, proposition)\r\n<\/code><\/pre>\n<p><strong>\u547d\u9898\u5316\u7684\u793a\u4f8b<\/strong><\/p>\n<pre><code>\u539f\u59cb\u6587\u672c\r\n===================\r\nA crow sits near the pond. It's a white one.\r\n\u547d\u9898\u5316\u6587\u672c\r\n==================\r\nA crow sits near the pond. This crow is a white one.\r\n<\/code><\/pre>\n<p><strong>Agentic \u5206\u5757\u7684\u4f18\u52bf\u4e0e\u6311\u6218<\/strong><\/p>\n<p><strong>Agentic \u5206\u5757\u7684<\/strong>\u6700\u5927\u4f18\u52bf\u5728\u4e8e\u5176\u7075\u6d3b\u6027\u548c\u667a\u80fd\u5316**\u3002\u5b83\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3\u6587\u6863\u7684\u6df1\u5c42\u8bed\u4e49\u7ed3\u6784\uff0c\u751f\u6210\u66f4\u7b26\u5408\u4eba\u7c7b\u8ba4\u77e5\u7684\u8bed\u4e49\u5757\uff0c\u5c24\u5176\u64c5\u957f\u5904\u7406\u4ee5\u4e0b\u7c7b\u578b\u7684\u6587\u6863\uff1a**<\/p>\n<ul>\n<li><strong>\u975e\u7ebf\u6027\u7ed3\u6784\u6587\u6863<\/strong>\uff1a\u4f8b\u5982\uff0c\u601d\u8def\u8df3\u8dc3\u3001\u5305\u542b\u5927\u91cf\u80cc\u666f\u77e5\u8bc6\u6216\u9690\u542b\u4fe1\u606f\u7684\u6587\u6863\u3002<\/li>\n<li><strong>\u9700\u8981\u8de8\u6bb5\u843d\u3001\u8de8\u7ae0\u8282\u6574\u5408\u4fe1\u606f\u7684\u6587\u6863<\/strong>\uff1aAgentic \u5206\u5757\u53ef\u4ee5\u5c06\u5206\u6563\u5728\u6587\u6863\u4e0d\u540c\u4f4d\u7f6e\u7684\u3001\u4f46\u8bed\u4e49\u76f8\u5173\u7684\u7247\u6bb5\u805a\u5408\u5728\u4e00\u8d77\u3002<\/li>\n<\/ul>\n<p><strong>\u7136\u800c\uff0cAgentic \u5206\u5757\u4e5f\u9762\u4e34\u7740\u4e00\u4e9b\u6311\u6218\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u6210\u672c\u9ad8\u6602<\/strong>\uff1aAgentic \u5206\u5757\u9700\u8981\u9891\u7e41\u8c03\u7528 LLM\uff0c\u8ba1\u7b97\u6210\u672c\u548c\u65f6\u95f4\u6210\u672c\u90fd\u8f83\u9ad8\u3002<\/li>\n<li><strong>Prompt \u5de5\u7a0b\u4f9d\u8d56<\/strong>\uff1aAgentic \u5206\u5757\u7684\u6548\u679c\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u51b3\u4e8e Prompt \u7684\u8bbe\u8ba1\u3002\u9700\u8981\u7cbe\u7ec6\u5730\u8bbe\u8ba1 Prompt\uff0c\u624d\u80fd\u5f15\u5bfc LLM \u6709\u6548\u5730\u8fdb\u884c\u5206\u5757\u3002<\/li>\n<li><strong>\u7ed3\u679c\u7684\u4e0d\u786e\u5b9a\u6027<\/strong>\uff1aLLM \u7684\u8f93\u51fa\u53ef\u80fd\u5b58\u5728\u4e00\u5b9a\u7684\u4e0d\u786e\u5b9a\u6027\uff0c\u5bfc\u81f4\u5206\u5757\u7ed3\u679c\u4e0d\u7a33\u5b9a\u3002<\/li>\n<\/ul>\n<p><strong>Agentic \u5206\u5757\u7684\u5e94\u7528\u573a\u666f<\/strong><\/p>\n<p><strong>Agentic \u5206\u5757\u867d\u7136\u6210\u672c\u8f83\u9ad8\uff0c\u4f46\u5728\u4e00\u4e9b\u5bf9 RAG \u6548\u679c\u8981\u6c42\u6781\u9ad8\u7684\u573a\u666f\u4e2d\uff0c\u4ecd\u7136\u662f\u503c\u5f97\u8003\u8651\u7684\u9009\u62e9\u3002\u4f8b\u5982\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u4e13\u4e1a\u9886\u57df\u7684\u77e5\u8bc6\u5e93<\/strong>\uff1a\u4f8b\u5982\uff0c\u6cd5\u5f8b\u3001\u533b\u5b66\u3001\u91d1\u878d\u7b49\u9886\u57df\u7684\u77e5\u8bc6\u5e93\uff0c\u5bf9\u68c0\u7d22\u7684\u51c6\u786e\u6027\u548c\u53ec\u56de\u7387\u8981\u6c42\u6781\u9ad8\u3002<\/li>\n<li><strong>\u590d\u6742\u95ee\u7b54\u7cfb\u7edf<\/strong>\uff1a\u9700\u8981\u5904\u7406\u590d\u6742\u7684\u3001\u9700\u8981\u63a8\u7406\u548c\u4fe1\u606f\u6574\u5408\u7684\u95ee\u9898\u7684\u95ee\u7b54\u7cfb\u7edf\u3002<\/li>\n<\/ul>\n<p>\u6df1\u5165\u9605\u8bfb\uff1a<a href=\"https:\/\/www.kdjingpai.com\/agentic-chunking\/\">Agentic Chunking\uff1aAI Agent \u9a71\u52a8\u7684\u8bed\u4e49\u6587\u672c\u5206\u5757<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>\u9488\u5bf9\u4e0d\u540c\u6587\u6863\u683c\u5f0f\u7684\u5206\u5757\u7b56\u7565<\/h2>\n<p>\u4e4b\u524d\u7684\u8ba8\u8bba\u4e3b\u8981\u96c6\u4e2d\u5728\u7eaf\u6587\u672c\u7684\u5206\u5757\u3002\u4f46\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6211\u4eec often \u4f1a\u9047\u5230\u5404\u79cd\u4e0d\u540c\u7684\u6587\u6863\u683c\u5f0f\uff0c\u5982 Markdown\u3001HTML\u3001PDF\u3001\u4ee3\u7801\u7b49\u3002\u9488\u5bf9\u4e0d\u540c\u7684\u683c\u5f0f\uff0c\u9700\u8981\u91c7\u7528\u66f4\u7cbe\u7ec6\u5316\u7684\u5206\u5757\u7b56\u7565\uff0c\u4ee5\u5145\u5206\u5229\u7528\u6587\u6863\u7684\u7ed3\u6784\u4fe1\u606f\u3002<\/p>\n<h3>Markdown \u548c HTML \u6587\u6863\u5206\u5757<\/h3>\n<p><strong>Markdown \u548c HTML \u6587\u6863\u5177\u6709\u7ed3\u6784\u5316\u7684\u6807\u7b7e\u4fe1\u606f\uff0c\u4f8b\u5982\u6807\u9898\u3001\u6bb5\u843d\u3001\u5217\u8868\u3001\u4ee3\u7801\u5757\u7b49\u3002\u6211\u4eec\u53ef\u4ee5<\/strong>\u5229\u7528\u8fd9\u4e9b\u6807\u7b7e\u4f5c\u4e3a\u5206\u5757\u7684\u4f9d\u636e**\uff0c\u5b9e\u73b0\u66f4\u7cbe\u51c6\u7684\u5206\u5757\u3002**<\/p>\n<ul>\n<li><strong>\u6309\u6807\u9898\u5206\u5757<\/strong>\uff1a\u5c06\u6bcf\u4e2a\u6807\u9898\u53ca\u5176\u4e0b\u7684\u5185\u5bb9\u4f5c\u4e3a\u4e00\u4e2a\u72ec\u7acb\u7684\u5757\u3002\u8fd9\u9002\u7528\u4e8e\u7ed3\u6784\u6e05\u6670\u3001\u7ae0\u8282\u5206\u660e\u7684\u6587\u6863\u3002<\/li>\n<li><strong>\u6309\u6bb5\u843d\u5206\u5757<\/strong>\uff1a\u5c06\u6bcf\u4e2a\u6bb5\u843d\u4f5c\u4e3a\u4e00\u4e2a\u5757\u3002\u6bb5\u843d\u901a\u5e38\u662f\u8bed\u4e49\u5b8c\u6574\u7684\u5355\u5143\uff0c\u9002\u5408\u4f5c\u4e3a\u57fa\u672c\u7684\u5206\u5757\u5355\u4f4d\u3002<\/li>\n<li><strong>\u7ec4\u5408\u5206\u5757<\/strong>\uff1a\u7ed3\u5408\u6807\u9898\u548c\u6bb5\u843d\u8fdb\u884c\u5206\u5757\u3002\u4f8b\u5982\uff0c\u5148\u6309\u4e00\u7ea7\u6807\u9898\u5206\u5272\u6587\u6863\uff0c\u7136\u540e\u5728\u6bcf\u4e2a\u4e00\u7ea7\u6807\u9898\u4e0b\u7684\u5185\u5bb9\u4e2d\uff0c\u518d\u6309\u6bb5\u843d\u5206\u5272\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a\u57fa\u4e8e HTML \u6807\u7b7e\u7684\u5206\u5757 (Python)<\/strong><\/p>\n<pre><code>from bs4 import BeautifulSoup\r\nhtml_text = \"\"\"\r\n&lt;h1&gt;Section 1&lt;\/h1&gt;\r\n&lt;p&gt;This is the first paragraph of section 1.&lt;\/p&gt;\r\n&lt;p&gt;This is the second paragraph of section 1.&lt;\/p&gt;\r\n&lt;h2&gt;Subsection 1.1&lt;\/h2&gt;\r\n&lt;ul&gt;\r\n&lt;li&gt;List item 1&lt;\/li&gt;\r\n&lt;li&gt;List item 2&lt;\/li&gt;\r\n&lt;\/ul&gt;\r\n\"\"\"\r\nsoup = BeautifulSoup(html_text, 'html.parser')\r\nchunks = []\r\n# \u6309 h1 \u6807\u9898\u5206\u5757\r\nfor h1_tag in soup.find_all('h1'):\r\nchunk_text = h1_tag.text + \"\\n\"\r\nnext_sibling = h1_tag.find_next_sibling()\r\nwhile next_sibling and next_sibling.name not in ['h1', 'h2']: #  \u5047\u8bbe\u6309 h1 \u548c h2 \u5206\u7ea7\r\nchunk_text += str(next_sibling) + \"\\n\" #  \u4fdd\u7559 HTML \u6807\u7b7e\uff0c\u6216 next_sibling.text  \u53ea\u4fdd\u7559\u6587\u672c\r\nnext_sibling = next_sibling.find_next_sibling()\r\nchunks.append(chunk_text)\r\n#  \u53ef\u4ee5\u7c7b\u4f3c\u5730\u5904\u7406 h2, p, ul, ol \u7b49\u6807\u7b7e\r\nprint(chunks)\r\n<\/code><\/pre>\n<h3>PDF \u6587\u6863\u5206\u5757<\/h3>\n<p><strong>PDF \u6587\u6863\u7684\u5206\u5757\u76f8\u5bf9\u590d\u6742\uff0c\u56e0\u4e3a PDF \u672c\u8d28\u4e0a\u662f\u4e00\u79cd\u6392\u7248\u683c\u5f0f\uff0c\u6587\u672c\u5185\u5bb9\u548c\u6392\u7248\u4fe1\u606f\u6df7\u5408\u5728\u4e00\u8d77\u3002\u76f4\u63a5\u6309\u5b57\u7b26\u6216\u884c\u5206\u5272 PDF \u53ef\u80fd\u7834\u574f\u8bed\u4e49\u5b8c\u6574\u6027\u3002<\/strong><\/p>\n<p><strong>PDF \u5206\u5757\u7684\u5173\u952e\u6b65\u9aa4\u901a\u5e38\u5305\u62ec\uff1a<\/strong><\/p>\n<ul>\n<li><strong>PDF \u6587\u672c\u63d0\u53d6<\/strong>\uff1a\u4f7f\u7528 PDF \u89e3\u6790\u5e93 (\u5982 PyPDF2, pdfminer, \u6216\u66f4\u4e13\u4e1a\u7684 <a href=\"https:\/\/www.kdjingpai.com\/unstructured\/\">unstructured<\/a>.io) \u4ece PDF \u6587\u4ef6\u4e2d\u63d0\u53d6\u6587\u672c\u5185\u5bb9\u3002<\/li>\n<li><strong>\u6587\u672c\u6e05\u6d17\u548c\u9884\u5904\u7406<\/strong>\uff1a\u53bb\u9664\u566a\u58f0\u5b57\u7b26\u3001\u5904\u7406\u6362\u884c\u7b26\u3001\u4fee\u590d OCR \u9519\u8bef\u7b49\u3002<\/li>\n<li><strong>\u7ed3\u6784\u5316\u4fe1\u606f\u63d0\u53d6<\/strong>\uff1a\u5c1d\u8bd5\u4ece PDF \u4e2d\u63d0\u53d6\u7ed3\u6784\u5316\u4fe1\u606f\uff0c\u4f8b\u5982\u6807\u9898\u3001\u9875\u7709\u9875\u811a\u3001\u8868\u683c\u3001\u5217\u8868\u7b49\u3002\u4e00\u4e9b\u9ad8\u7ea7\u7684 PDF \u89e3\u6790\u5e93 (\u5982 unstructured.io) \u53ef\u4ee5\u8f85\u52a9\u8fdb\u884c\u7ed3\u6784\u5316\u4fe1\u606f\u63d0\u53d6\u3002<\/li>\n<li><strong>\u5206\u5757\u7b56\u7565\u9009\u62e9<\/strong>\uff1a\u57fa\u4e8e\u63d0\u53d6\u7684\u6587\u672c\u5185\u5bb9\u548c\u7ed3\u6784\u4fe1\u606f\uff0c\u9009\u62e9\u5408\u9002\u7684\u5206\u5757\u7b56\u7565 (\u5982\u8bed\u4e49\u5206\u5757\u3001\u9012\u5f52\u5b57\u7b26\u5206\u5272\u7b49)\u3002<\/li>\n<\/ul>\n<p><strong>\u63d0\u793a<\/strong>:\u00a0<strong>unstructured.io<\/strong>\u00a0\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5904\u7406\u591a\u79cd\u6587\u6863\u683c\u5f0f (\u5305\u62ec PDF)\uff0c\u5e76\u5c1d\u8bd5\u63d0\u53d6\u6587\u6863\u7684\u7ed3\u6784\u5316\u4fe1\u606f\uff0c\u7b80\u5316 PDF \u5206\u5757\u7684\u6d41\u7a0b\u3002<\/p>\n<h3>\u4ee3\u7801\u6587\u6863\u5206\u5757<\/h3>\n<p><strong>\u4ee3\u7801\u6587\u6863 (\u5982 Python, Java, C++ \u4ee3\u7801\u6587\u4ef6) \u7684\u5206\u5757\uff0c\u9700\u8981\u8003\u8651\u4ee3\u7801\u7684\u8bed\u6cd5\u7ed3\u6784\u548c\u903b\u8f91\u5355\u5143\u3002\u7b80\u5355\u7684\u6309\u884c\u6216\u6309\u5b57\u7b26\u5206\u5272\u4ee3\u7801\uff0c\u5f88\u53ef\u80fd\u7834\u574f\u4ee3\u7801\u7684\u5b8c\u6574\u6027\u548c\u53ef\u6267\u884c\u6027\u3002<\/strong><\/p>\n<p><strong>\u4ee3\u7801\u6587\u6863\u5206\u5757\u7684\u5e38\u89c1\u7b56\u7565\u5305\u62ec\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u6309\u51fd\u6570\/\u7c7b\u5206\u5757<\/strong>\uff1a\u5c06\u6bcf\u4e2a\u51fd\u6570\u6216\u7c7b\u4f5c\u4e3a\u4e00\u4e2a\u72ec\u7acb\u7684\u5757\u3002\u51fd\u6570\u548c\u7c7b\u901a\u5e38\u662f\u4ee3\u7801\u7684\u903b\u8f91\u5355\u5143\u3002<\/li>\n<li><strong>\u6309\u4ee3\u7801\u5757\u5206\u5757<\/strong>\uff1a\u8bc6\u522b\u4ee3\u7801\u4e2d\u7684\u903b\u8f91\u4ee3\u7801\u5757 (\u4f8b\u5982\uff0c\u5faa\u73af\u3001\u6761\u4ef6\u8bed\u53e5\u3001try-except \u5757\u7b49)\uff0c\u5c06\u6bcf\u4e2a\u4ee3\u7801\u5757\u4f5c\u4e3a\u4e00\u4e2a\u5757\u3002<\/li>\n<li><strong>\u7ed3\u5408\u4ee3\u7801\u6ce8\u91ca\u5206\u5757<\/strong>\uff1a\u4ee3\u7801\u6ce8\u91ca\u901a\u5e38\u662f\u5bf9\u4ee3\u7801\u529f\u80fd\u548c\u903b\u8f91\u7684\u89e3\u91ca\u3002\u53ef\u4ee5\u5c06\u4ee3\u7801\u6ce8\u91ca\u53ca\u5176\u76f8\u5173\u7684\u4ee3\u7801\u5757\u4f5c\u4e3a\u4e00\u4e2a\u6574\u4f53\u8fdb\u884c\u5206\u5757\u3002<\/li>\n<\/ul>\n<p><strong>\u5de5\u5177<\/strong>: \u53ef\u4ee5\u4f7f\u7528 tree-sitter \u7b49\u8bed\u6cd5\u89e3\u6790\u5de5\u5177\uff0c\u8f85\u52a9\u4ee3\u7801\u7684\u7ed3\u6784\u5316\u5206\u6790\u548c\u5206\u5757\u3002Tree-sitter \u53ef\u4ee5\u89e3\u6790\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u7684\u4ee3\u7801\uff0c\u5e76\u751f\u6210\u62bd\u8c61\u8bed\u6cd5\u6811 (AST)\uff0c\u65b9\u4fbf\u6211\u4eec\u6839\u636e\u4ee3\u7801\u7684\u8bed\u6cd5\u7ed3\u6784\u8fdb\u884c\u5206\u5757\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u9009\u62e9\u5408\u9002\u7684\u5206\u5757\u5927\u5c0f\u548c\u91cd\u53e0<\/h2>\n<p><strong>\u5206\u5757\u5927\u5c0f (Chunk Size) \u548c\u91cd\u53e0\u5927\u5c0f (Chunk Overlap) \u662f\u5206\u5757\u7b56\u7565\u4e2d\u4e24\u4e2a\u91cd\u8981\u7684\u53c2\u6570\uff0c\u5b83\u4eec\u76f4\u63a5\u5f71\u54cd RAG \u7cfb\u7edf\u7684\u6027\u80fd\u3002<\/strong><\/p>\n<ul>\n<li><strong>\u5206\u5757\u5927\u5c0f<\/strong>\uff1a\u6307\u6bcf\u4e2a\u5757\u5305\u542b\u7684\u6587\u672c\u91cf\u3002\u5206\u5757\u5927\u5c0f\u8fc7\u5c0f\uff0c\u53ef\u80fd\u5bfc\u81f4\u8bed\u4e49\u4fe1\u606f\u4e0d\u5b8c\u6574\uff1b\u5206\u5757\u5927\u5c0f\u8fc7\u5927\uff0c\u5219\u53ef\u80fd\u5f15\u5165\u566a\u58f0\uff0c\u964d\u4f4e\u68c0\u7d22\u7cbe\u5ea6\u3002<\/li>\n<li><strong>\u91cd\u53e0\u5927\u5c0f<\/strong>\uff1a\u6307\u76f8\u90bb\u5757\u4e4b\u95f4\u91cd\u53e0\u7684\u6587\u672c\u91cf\u3002\u91cd\u53e0\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u4fdd\u8bc1\u4e0a\u4e0b\u6587\u7684\u8fde\u7eed\u6027\uff0c\u907f\u514d\u5728\u5757\u8fb9\u754c\u5904\u4e22\u5931\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p><strong>\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684\u5206\u5757\u5927\u5c0f\u548c\u91cd\u53e0\uff1f<\/strong><\/p>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u5206\u5757\u5927\u5c0f\u548c\u91cd\u53e0\uff0c\u6ca1\u6709\u7edd\u5bf9\u6700\u4f18\u7684\u7b54\u6848\uff0c\u901a\u5e38\u9700\u8981\u6839\u636e<\/strong>\u6587\u6863\u7279\u6027<strong>\u548c<\/strong>\u5b9e\u9a8c\u6548\u679c<strong>\u6765\u786e\u5b9a\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u7ecf\u9a8c\u6cd5\u5219\u548c\u5efa\u8bae\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u542f\u53d1\u5f0f\u65b9\u6cd5<\/strong>\uff1a\n<ul>\n<li><strong>\u57fa\u4e8e\u53e5\u5b50\/\u6bb5\u843d\u957f\u5ea6<\/strong>: \u53ef\u4ee5\u5206\u6790\u6587\u6863\u7684\u5e73\u5747\u53e5\u5b50\u957f\u5ea6\u6216\u6bb5\u843d\u957f\u5ea6\uff0c\u4f5c\u4e3a\u5206\u5757\u5927\u5c0f\u7684\u53c2\u8003\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5e73\u5747\u6bb5\u843d\u957f\u5ea6\u4e3a 150 \u4e2a Token\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5c06\u5757\u5927\u5c0f\u8bbe\u7f6e\u4e3a 150-200 \u4e2a Token\u3002<\/li>\n<li><strong>\u8003\u8651 LLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3<\/strong>: \u5757\u5927\u5c0f\u4e0d\u5b9c\u8fc7\u5927\uff0c\u907f\u514d\u8d85\u51fa LLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u9650\u5236\u3002\u540c\u65f6\uff0c\u4e5f\u4e0d\u5b9c\u8fc7\u5c0f\uff0c\u4fdd\u8bc1\u5757\u5305\u542b\u8db3\u591f\u7684\u8bed\u4e49\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5b9e\u9a8c\u548c\u8bc4\u4f30<\/strong>:\n<ul>\n<li><strong>\u8fed\u4ee3\u8c03\u4f18<\/strong>: \u5148\u8bbe\u5b9a\u4e00\u7ec4\u521d\u59cb\u7684\u5206\u5757\u5927\u5c0f\u548c\u91cd\u53e0\u53c2\u6570 (\u4f8b\u5982\uff0c\u5757\u5927\u5c0f 500 Token\uff0c\u91cd\u53e0 50 Token)\uff0c\u6784\u5efa RAG \u7cfb\u7edf\u5e76\u8fdb\u884c\u8bc4\u4f30\u3002\u7136\u540e\uff0c\u9010\u6b65\u8c03\u6574\u53c2\u6570\uff0c\u89c2\u5bdf\u68c0\u7d22\u548c\u95ee\u7b54\u6548\u679c\u7684\u53d8\u5316\uff0c\u9009\u62e9\u6700\u4f18\u7684\u53c2\u6570\u7ec4\u5408\u3002<\/li>\n<li><strong>\u8bc4\u4f30\u6307\u6807<\/strong>: \u4f7f\u7528\u5408\u9002\u7684\u8bc4\u4f30\u6307\u6807\u6765\u91cf\u5316 RAG \u7cfb\u7edf\u7684\u6027\u80fd\uff0c\u4f8b\u5982\u68c0\u7d22\u7684\u53ec\u56de\u7387 (Recall@k)\u3001\u51c6\u786e\u7387 (Precision@k)\u3001NDCG (Normalized Discounted Cumulative Gain) \u7b49\u3002\u8fd9\u4e9b\u6307\u6807\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5ba2\u89c2\u5730\u8bc4\u4f30\u4e0d\u540c\u5206\u5757\u7b56\u7565\u7684\u6548\u679c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Langchain \u4e2d\u7684\u8bc4\u4f30\u5de5\u5177<\/strong><\/p>\n<p>Langchain \u63d0\u4f9b\u4e86\u4e00\u4e9b\u8bc4\u4f30\u5de5\u5177\uff0c\u53ef\u4ee5\u8f85\u52a9 RAG \u7cfb\u7edf\u7684\u8bc4\u4f30\u548c\u53c2\u6570\u8c03\u4f18\u3002\u4f8b\u5982\uff0cDatasetEvaluator\u00a0\u548c\u00a0RetrievalQAChain\u00a0\u7b49\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u81ea\u52a8\u5316\u5730\u8bc4\u4f30\u4e0d\u540c\u5206\u5757\u7b56\u7565\u3001\u68c0\u7d22\u6a21\u578b\u548c LLM \u6a21\u578b\u7684\u7ec4\u5408\u6548\u679c\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u8bc4\u4f30\u5206\u5757\u7b56\u7565\u7684\u6548\u679c<\/h2>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u5206\u5757\u7b56\u7565\u540e\uff0c\u5982\u4f55\u8bc4\u4f30\u5176\u6548\u679c\u5462\uff1f \u201c\u66f4\u597d\u7684\u5206\u5757\u610f\u5473\u7740\u66f4\u597d\u7684\u68c0\u7d22\u201d\uff0c\u4f46\u5982\u4f55\u91cf\u5316 \u201c\u66f4\u597d\u201d \u5462\uff1f \u6211\u4eec\u9700\u8981\u4e00\u4e9b\u6307\u6807\u6765\u8bc4\u4f30\u5206\u5757\u7b56\u7565\u7684\u4f18\u52a3\u3002<\/strong><\/p>\n<p><strong>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u8bc4\u4f30\u6307\u6807\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u8bc4\u4f30\u5206\u5757\u7b56\u7565\u5bf9 RAG \u7cfb\u7edf\u6027\u80fd\u7684\u5f71\u54cd\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u68c0\u7d22\u6307\u6807<\/strong>:\n<ul>\n<li><strong>\u53ec\u56de\u7387 (Recall@k)<\/strong>: \u6307\u5728 Top-k \u4e2a\u68c0\u7d22\u7ed3\u679c\u4e2d\uff0c\u76f8\u5173\u6587\u6863 (\u6216\u5757) \u7684\u6bd4\u4f8b\u3002\u53ec\u56de\u7387\u8d8a\u9ad8\uff0c\u8868\u793a\u5206\u5757\u7b56\u7565\u8d8a\u80fd\u5c06\u76f8\u5173\u4fe1\u606f\u68c0\u7d22\u51fa\u6765\u3002<\/li>\n<li><strong>\u51c6\u786e\u7387 (Precision@k)<\/strong>: \u6307\u5728 Top-k \u4e2a\u68c0\u7d22\u7ed3\u679c\u4e2d\uff0c\u771f\u6b63\u76f8\u5173\u7684\u6587\u6863 (\u6216\u5757) \u7684\u6bd4\u4f8b\u3002\u51c6\u786e\u7387\u8d8a\u9ad8\uff0c\u8868\u793a\u68c0\u7d22\u7ed3\u679c\u7684\u8d28\u91cf\u8d8a\u9ad8\u3002<\/li>\n<li><strong>NDCG (Normalized Discounted Cumulative Gain)<\/strong>: \u662f\u4e00\u79cd\u66f4\u7cbe\u7ec6\u7684\u6392\u5e8f\u8d28\u91cf\u8bc4\u4f30\u6307\u6807\uff0c\u8003\u8651\u4e86\u68c0\u7d22\u7ed3\u679c\u7684\u76f8\u5173\u6027\u7b49\u7ea7\u548c\u4f4d\u7f6e\u3002NDCG \u8d8a\u9ad8\uff0c\u8868\u793a\u68c0\u7d22\u6392\u5e8f\u8d28\u91cf\u8d8a\u597d\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u95ee\u7b54\u6307\u6807<\/strong>:\n<ul>\n<li><strong>\u7b54\u6848\u76f8\u5173\u6027 (Answer Relevance)<\/strong>: \u8bc4\u4f30 LLM \u751f\u6210\u7684\u7b54\u6848\u4e0e\u95ee\u9898\u7684\u76f8\u5173\u7a0b\u5ea6\u3002\u7b54\u6848\u76f8\u5173\u6027\u8d8a\u9ad8\uff0c\u8868\u793a RAG \u7cfb\u7edf\u8d8a\u80fd\u6839\u636e\u68c0\u7d22\u5230\u7684\u4fe1\u606f\u751f\u6210\u6709\u610f\u4e49\u7684\u7b54\u6848\u3002\n<ul>\n<li><strong>\u7b54\u6848\u51c6\u786e\u6027 (Answer Accuracy\/Faithfulness)<\/strong>: \u8bc4\u4f30 LLM \u751f\u6210\u7684\u7b54\u6848\u662f\u5426\u5fe0\u5b9e\u4e8e\u68c0\u7d22\u5230\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\uff0c\u907f\u514d \u201c\u5e7b\u89c9\u201d \u548c\u4e0d\u5b9e\u4fe1\u606f\u3002\u7b54\u6848\u51c6\u786e\u6027\u8d8a\u9ad8\uff0c\u8868\u793a\u5206\u5757\u7b56\u7565\u8d8a\u80fd\u63d0\u4f9b\u53ef\u9760\u7684\u4e0a\u4e0b\u6587\uff0c\u5f15\u5bfc LLM \u751f\u6210\u66f4\u53ef\u4fe1\u7684\u7b54\u6848\u3002<\/li>\n<li><strong>\u7b54\u6848\u6d41\u7545\u6027\u548c\u8fde\u8d2f\u6027 (Answer Fluency and Coherence)<\/strong>: \u867d\u7136\u4e3b\u8981\u53d7 LLM \u81ea\u8eab\u80fd\u529b\u5f71\u54cd\uff0c\u4f46\u597d\u7684\u5206\u5757\u7b56\u7565\u4e5f\u80fd\u95f4\u63a5\u63d0\u5347\u7b54\u6848\u7684\u6d41\u7545\u6027\u548c\u8fde\u8d2f\u6027\u3002\u4f8b\u5982\uff0c\u8bed\u4e49\u5206\u5757\u80fd\u63d0\u4f9b\u66f4\u8fde\u8d2f\u7684\u4e0a\u4e0b\u6587\uff0c\u6709\u52a9\u4e8e LLM \u751f\u6210\u66f4\u81ea\u7136\u7684\u8bed\u8a00\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u8bc4\u4f30\u5de5\u5177\u548c\u65b9\u6cd5<\/strong><\/p>\n<ul>\n<li><strong>\u4eba\u5de5\u8bc4\u4f30<\/strong>: \u6700\u76f4\u63a5\u3001\u6700\u53ef\u9760\u7684\u65b9\u6cd5\u3002\u9080\u8bf7\u4eba\u5de5\u8bc4\u4f30\u8005\uff0c\u6839\u636e\u9884\u8bbe\u7684\u8bc4\u4f30\u6807\u51c6\uff0c\u5bf9 RAG \u7cfb\u7edf\u7684\u68c0\u7d22\u7ed3\u679c\u548c\u95ee\u7b54\u7b54\u6848\u8fdb\u884c\u8bc4\u5206\u3002\u4eba\u5de5\u8bc4\u4f30\u7684\u7f3a\u70b9\u662f\u6210\u672c\u9ad8\u3001\u8017\u65f6\uff0c\u4e14\u4e3b\u89c2\u6027\u8f83\u5f3a\u3002<\/li>\n<li><strong>\u81ea\u52a8\u5316\u8bc4\u4f30<\/strong>: \u4f7f\u7528\u81ea\u52a8\u5316\u8bc4\u4f30\u6307\u6807\u548c\u5de5\u5177\uff0c\u4f8b\u5982\uff1a\n<ul>\n<li><strong>\u68c0\u7d22\u6307\u6807<\/strong>: \u5982\u524d\u8ff0\u7684\u53ec\u56de\u7387\u3001\u51c6\u786e\u7387\u3001NDCG \u7b49\uff0c\u53ef\u4ee5\u4f7f\u7528\u6807\u51c6\u7684\u4fe1\u606f\u68c0\u7d22\u8bc4\u6d4b\u5de5\u5177 (\u5982\u00a0<code>rank_bm25<\/code>,\u00a0<code>sentence-transformers<\/code>\u00a0\u7b49) \u8fdb\u884c\u81ea\u52a8\u5316\u8ba1\u7b97\u3002<\/li>\n<li><strong>\u95ee\u7b54\u6307\u6807<\/strong>: \u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b NLP \u8bc4\u4f30\u6307\u6807 (\u5982 BLEU, ROUGE, METEOR, BERTScore \u7b49) \u6765\u8f85\u52a9\u8bc4\u4f30\u7b54\u6848\u8d28\u91cf\u3002\u4f46\u9700\u8981\u6ce8\u610f\uff0c\u81ea\u52a8\u5316\u95ee\u7b54\u8bc4\u4f30\u6307\u6807\u76ee\u524d\u4ecd\u5b58\u5728\u5c40\u9650\u6027\uff0c\u4e0d\u80fd\u5b8c\u5168\u66ff\u4ee3\u4eba\u5de5\u8bc4\u4f30\u3002<\/li>\n<li><strong>Langchain \u8bc4\u4f30\u5de5\u5177<\/strong>: Langchain \u63d0\u4f9b\u4e86\u4e00\u4e9b\u96c6\u6210\u7684\u8bc4\u4f30\u5de5\u5177\uff0c\u4f8b\u5982\u00a0<code>DatasetEvaluator<\/code>\u00a0\u548c\u00a0<code>RetrievalQAChain<\/code>\uff0c\u53ef\u4ee5\u7b80\u5316 RAG \u7cfb\u7edf\u7684\u81ea\u52a8\u5316\u8bc4\u4f30\u6d41\u7a0b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u8bc4\u4f30\u6d41\u7a0b\u5efa\u8bae<\/strong><\/p>\n<ol>\n<li><strong>\u6784\u5efa\u8bc4\u4f30\u6570\u636e\u96c6<\/strong>: \u51c6\u5907\u4e00\u7ec4\u5305\u542b\u95ee\u9898\u548c\u5bf9\u5e94\u6807\u51c6\u7b54\u6848\u7684\u8bc4\u4f30\u6570\u636e\u96c6\u3002\u6570\u636e\u96c6\u5e94\u5c3d\u53ef\u80fd\u8986\u76d6 RAG \u7cfb\u7edf\u7684\u5178\u578b\u5e94\u7528\u573a\u666f\u548c\u95ee\u9898\u7c7b\u578b\u3002<\/li>\n<li><strong>\u9009\u62e9\u8bc4\u4f30\u6307\u6807<\/strong>: \u6839\u636e\u8bc4\u4f30\u76ee\u7684\uff0c\u9009\u62e9\u5408\u9002\u7684\u68c0\u7d22\u6307\u6807\u548c\u95ee\u7b54\u6307\u6807\u3002\u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\u4eba\u5de5\u8bc4\u4f30\u548c\u81ea\u52a8\u5316\u8bc4\u4f30\u76f8\u7ed3\u5408\u7684\u65b9\u5f0f\u3002<\/li>\n<li><strong>\u8fd0\u884c RAG \u7cfb\u7edf<\/strong>: \u4f7f\u7528\u4e0d\u540c\u7684\u5206\u5757\u7b56\u7565\u3001\u68c0\u7d22\u6a21\u578b\u548c LLM \u6a21\u578b\u7ec4\u5408\uff0c\u5728\u8bc4\u4f30\u6570\u636e\u96c6\u4e0a\u8fd0\u884c RAG \u7cfb\u7edf\uff0c\u8bb0\u5f55\u8bc4\u4f30\u7ed3\u679c\u3002<\/li>\n<li><strong>\u5206\u6790\u548c\u6bd4\u8f83<\/strong>: \u5bf9\u6bd4\u4e0d\u540c\u7b56\u7565\u7684\u8bc4\u4f30\u6307\u6807\uff0c\u5206\u6790\u5176\u4f18\u7f3a\u70b9\uff0c\u5e76\u9009\u62e9\u6700\u4f18\u7684\u7b56\u7565\u7ec4\u5408\u3002<\/li>\n<li><strong>\u8fed\u4ee3\u4f18\u5316<\/strong>: \u6839\u636e\u8bc4\u4f30\u7ed3\u679c\uff0c\u4e0d\u65ad\u8c03\u6574\u5206\u5757\u7b56\u7565\u3001\u68c0\u7d22\u6a21\u578b\u548c LLM \u6a21\u578b\u7684\u53c2\u6570\uff0c\u8fdb\u884c\u8fed\u4ee3\u4f18\u5316\uff0c\u63d0\u5347 RAG \u7cfb\u7edf\u6027\u80fd\u3002<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>\u603b\u7ed3\uff1a\u9009\u62e9\u6700\u9002\u5408\u4f60\u7684\u5206\u5757\u7b56\u7565<\/h2>\n<p>\u672c\u6587\u6df1\u5165\u63a2\u8ba8\u4e86 RAG \u5e94\u7528\u4e2d\u81f3\u5173\u91cd\u8981\u7684\u6587\u6863\u5206\u5757\u6280\u672f\uff0c\u4ece\u57fa\u7840\u7684\u9012\u5f52\u5b57\u7b26\u5206\u5272\uff0c\u5230\u66f4\u667a\u80fd\u7684\u8bed\u4e49\u5206\u5757\u548c Agentic \u5206\u5757\uff0c\u518d\u5230\u9488\u5bf9\u4e0d\u540c\u6587\u6863\u683c\u5f0f\u7684\u7cbe\u7ec6\u5316\u5206\u5757\u7b56\u7565\uff0c\u4ee5\u53ca\u5206\u5757\u5927\u5c0f\u3001\u91cd\u53e0\u53c2\u6570\u7684\u9009\u62e9\u548c\u8bc4\u4f30\u65b9\u6cd5\uff0c\u8fdb\u884c\u4e86\u5168\u9762\u7684\u4ecb\u7ecd\u3002<\/p>\n<p><strong>\u6838\u5fc3\u8981\u70b9\u56de\u987e<\/strong><\/p>\n<ul>\n<li><strong>\u5206\u5757\u8d28\u91cf\u51b3\u5b9a RAG \u8d28\u91cf<\/strong>: \u597d\u7684\u5206\u5757\u7b56\u7565\u662f\u6784\u5efa\u9ad8\u6027\u80fd RAG \u7cfb\u7edf\u7684\u57fa\u77f3\u3002<\/li>\n<li><strong>\u6ca1\u6709\u4e07\u80fd\u7684\u5206\u5757\u7b56\u7565<\/strong>: \u4e0d\u540c\u7684\u5206\u5757\u7b56\u7565\u5404\u6709\u4f18\u7f3a\u70b9\uff0c\u9002\u7528\u4e8e\u4e0d\u540c\u7684\u573a\u666f\u3002\u4f60\u9700\u8981\u6839\u636e\u9879\u76ee\u7684\u5177\u4f53\u9700\u6c42\u3001\u6587\u6863\u7279\u6027\u548c\u8d44\u6e90\u9650\u5236\uff0c\u9009\u62e9\u6700\u5408\u9002\u7684\u7b56\u7565\u3002<\/li>\n<li><strong>\u9012\u5f52\u5b57\u7b26\u5206\u5272<\/strong>: \u7b80\u5355\u3001\u5feb\u901f\u3001\u7ecf\u6d4e\uff0c\u9002\u5408\u539f\u578b\u5f00\u53d1\u548c\u5bf9\u6210\u672c\u654f\u611f\u7684\u9879\u76ee\u3002<\/li>\n<li><strong>\u8bed\u4e49\u5206\u5757<\/strong>: \u7406\u89e3\u6587\u672c\u8bed\u4e49\uff0c\u751f\u6210\u8bed\u4e49\u8fde\u8d2f\u7684\u5757\uff0c\u63d0\u9ad8\u68c0\u7d22\u8d28\u91cf\uff0c\u4f46\u8ba1\u7b97\u6210\u672c\u8f83\u9ad8\u3002<\/li>\n<li><strong>Agentic \u5206\u5757<\/strong>: \u6a21\u62df\u4eba\u7c7b\u7406\u89e3\uff0c\u66f4\u667a\u80fd\u3001\u66f4\u7075\u6d3b\uff0c\u80fd\u5904\u7406\u590d\u6742\u6587\u6863\uff0c\u4f46\u6210\u672c\u9ad8\u6602\uff0cPrompt \u5de5\u7a0b\u590d\u6742\u3002<\/li>\n<li><strong>\u9488\u5bf9\u4e0d\u540c\u683c\u5f0f\u7684\u5206\u5757<\/strong>: \u9488\u5bf9 Markdown, HTML, PDF, \u4ee3\u7801\u7b49\u4e0d\u540c\u683c\u5f0f\uff0c\u9700\u8981\u91c7\u7528\u7cbe\u7ec6\u5316\u7684\u5206\u5757\u7b56\u7565\uff0c\u5229\u7528\u6587\u6863\u7684\u7ed3\u6784\u4fe1\u606f\u3002<\/li>\n<li><strong>\u5206\u5757\u5927\u5c0f\u548c\u91cd\u53e0<\/strong>: \u9700\u8981\u6839\u636e\u6587\u6863\u7279\u6027\u548c\u5b9e\u9a8c\u6548\u679c\u8fdb\u884c\u8c03\u4f18\uff0c\u6ca1\u6709\u7edd\u5bf9\u6700\u4f18\u503c\u3002<\/li>\n<li><strong>\u8bc4\u4f30\u662f\u5173\u952e<\/strong>: \u901a\u8fc7\u8bc4\u4f30\u6307\u6807\u548c\u4eba\u5de5\u8bc4\u4f30\uff0c\u91cf\u5316\u5206\u5757\u7b56\u7565\u7684\u6548\u679c\uff0c\u5e76\u8fdb\u884c\u8fed\u4ee3\u4f18\u5316\u3002<\/li>\n<\/ul>\n<p><strong>\u5982\u4f55\u9009\u62e9\uff1f\u6211\u7684\u5efa\u8bae<\/strong><\/p>\n<ul>\n<li><strong>\u5feb\u901f\u539f\u578b\u9a8c\u8bc1<\/strong>: \u4f18\u5148\u5c1d\u8bd5<strong>\u9012\u5f52\u5b57\u7b26\u5206\u5272<\/strong>\uff0c\u5feb\u901f\u642d\u5efa RAG \u539f\u578b\uff0c\u9a8c\u8bc1\u7cfb\u7edf\u53ef\u884c\u6027\u3002<\/li>\n<li><strong>\u8ffd\u6c42\u66f4\u9ad8\u8d28\u91cf<\/strong>: \u5982\u679c\u5bf9 RAG \u8d28\u91cf\u6709\u8f83\u9ad8\u8981\u6c42\uff0c\u4e14\u8ba1\u7b97\u8d44\u6e90\u5141\u8bb8\uff0c\u53ef\u4ee5\u5c1d\u8bd5<strong>\u8bed\u4e49\u5206\u5757<\/strong>\u3002<\/li>\n<li><strong>\u5904\u7406\u590d\u6742\u6587\u6863<\/strong>: \u5bf9\u4e8e\u7ed3\u6784\u590d\u6742\u3001\u8bed\u4e49\u8df3\u8dc3\u6027\u5f3a\u7684\u6587\u6863\uff0c<strong>Agentic \u5206\u5757<\/strong>\u53ef\u80fd\u662f\u66f4\u4f18\u9009\u62e9\uff0c\u4f46\u9700\u8981\u4ed4\u7ec6\u6743\u8861\u6210\u672c\u548c\u6548\u679c\u3002<\/li>\n<li><strong>\u9488\u5bf9\u7279\u5b9a\u683c\u5f0f<\/strong>: \u5982\u679c\u5904\u7406\u7684\u662f Markdown, HTML, PDF, \u4ee3\u7801\u7b49\u7279\u5b9a\u683c\u5f0f\u7684\u6587\u6863\uff0c\u52a1\u5fc5\u91c7\u7528<strong>\u9488\u5bf9\u6027\u7684\u5206\u5757\u7b56\u7565<\/strong>\uff0c\u5145\u5206\u5229\u7528\u6587\u6863\u7684\u7ed3\u6784\u4fe1\u606f\u3002<\/li>\n<li><strong>\u6301\u7eed\u8fed\u4ee3\u4f18\u5316<\/strong>: \u5206\u5757\u7b56\u7565\u7684\u9009\u62e9\u4e0d\u662f\u4e00\u8e74\u800c\u5c31\u7684\u3002\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u9700\u8981\u4e0d\u65ad<strong>\u5b9e\u9a8c\u3001\u8bc4\u4f30\u548c\u8fed\u4ee3\u4f18\u5316<\/strong>\uff0c\u624d\u80fd\u627e\u5230\u6700\u9002\u5408\u4f60\u7684\u5206\u5757\u65b9\u6848\u3002<\/li>\n<\/ul>\n<p>\u5e0c\u671b\u672c\u6587\u80fd\u5e2e\u52a9\u4f60\u66f4\u6df1\u5165\u5730\u7406\u89e3 RAG \u5206\u5757\u6280\u672f\uff0c\u5e76\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u9009\u62e9\u548c\u5e94\u7528\u5408\u9002\u7684\u5206\u5757\u7b56\u7565\uff0c\u6784\u5efa\u66f4\u5f3a\u5927\u7684 RAG \u5e94\u7528\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u4f60\u7684 RAG \u5e94\u7528\u672a\u80fd\u8fbe\u5230\u9884\u671f\u6548\u679c\uff0c\u6216\u8bb8\u662f\u65f6\u5019\u91cd\u65b0\u5ba1\u89c6\u4f60\u7684\u5206\u5757\u7b56\u7565\u4e86\u3002\u66f4\u597d\u7684\u5206\u5757\u610f\u5473\u7740\u66f4\u7cbe\u51c6\u7684\u68c0\u7d22\uff0c\u6700\u7ec8\u5e26\u6765\u66f4\u9ad8\u8d28\u91cf\u7684\u56de\u590d\u3002 \u7136\u800c\uff0c\u5206\u5757\u6280\u672f\u5e76\u975e\u201c\u4e00\u62db\u9c9c\u5403\u904d\u5929\u201d\uff0c\u6ca1\u6709\u54ea\u4e00\u79cd\u65b9\u6cd5\u662f\u7edd\u5bf9\u6700\u4f18\u7684\u3002\u4f60\u9700\u8981\u6839\u636e\u9879\u76ee\u7684\u5177\u4f53\u9700\u6c42\u3001\u6587\u6863\u7279\u6027\u4ee5\u53ca\u9884\u7b97\u7b49\u56e0&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-26358","post","type-post","status-publish","format-standard","hentry","category-knowledge"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts\/26358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/comments?post=26358"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts\/26358\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/media?parent=26358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/categories?post=26358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/tags?post=26358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}