{"id":51354,"date":"2025-08-10T21:35:53","date_gmt":"2025-08-10T13:35:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/51354.html"},"modified":"2025-08-10T21:35:53","modified_gmt":"2025-08-10T13:35:53","slug":"rag%ef%bc%9a%e5%a4%a7%e6%a8%a1%e5%9e%8b%e7%9a%84%e5%a4%96%e6%8c%82%e7%a5%9e%e5%99%a8%ef%bc%8c%e8%a7%a3%e9%94%81ai%e6%96%b0%e5%a7%bf%e5%8a%bf","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/51354.html","title":{"rendered":"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf"},"content":{"rendered":"<h2>RAG&#xff1a;\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668&#xff0c;\u89e3\u9501AI\u65b0\u59ff\u52bf<\/h2>\n<h3>\u4e00\u3001RAG \u662f\u4ec0\u4e48<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810133547-6898a033be447.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>RAG&#xff0c;\u5168\u79f0 Retrieval-Augmented Generation&#xff0c;\u5373\u68c0\u7d22\u589e\u5f3a\u751f\u6210&#xff0c;\u662f\u4e00\u79cd\u5c06\u68c0\u7d22\u6280\u672f\u4e0e\u751f\u6210\u6a21\u578b\u76f8\u7ed3\u5408\u7684\u6280\u672f\u6846\u67b6&#xff0c;\u7b80\u5355\u6765\u8bf4&#xff0c;\u5b83\u5c31\u50cf\u662f\u7ed9\u5927\u6a21\u578b\u914d\u5907\u7684\u4e00\u4e2a \u201c\u5916\u6302\u77e5\u8bc6\u5e93\u201d\u3002<\/p>\n<p>\u4f20\u7edf\u7684\u5927\u8bed\u8a00\u6a21\u578b\u5728\u56de\u7b54\u95ee\u9898\u65f6&#xff0c;\u53ea\u80fd\u4f9d\u8d56\u81ea\u8eab\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u5b66\u4e60\u5230\u7684\u77e5\u8bc6 &#xff0c;\u4e00\u65e6\u9047\u5230\u8bad\u7ec3\u6570\u636e\u4e2d\u6ca1\u6709\u6db5\u76d6\u7684\u5185\u5bb9&#xff0c;\u5c31\u53ef\u80fd\u51fa\u73b0\u56de\u7b54\u4e0d\u51c6\u786e\u3001\u7f3a\u4e4f\u9488\u5bf9\u6027&#xff0c;\u751a\u81f3 \u201c\u80e1\u8a00\u4e71\u8bed\u201d \u7684\u60c5\u51b5&#xff0c;\u4e5f\u5c31\u662f\u6211\u4eec\u5e38\u8bf4\u7684 \u201c\u5e7b\u89c9\u201d \u73b0\u8c61\u3002\u800c RAG \u7684\u51fa\u73b0&#xff0c;\u5f88\u597d\u5730\u89e3\u51b3\u4e86\u8fd9\u4e9b\u95ee\u9898\u3002<\/p>\n<p>RAG \u7684\u6838\u5fc3\u539f\u7406\u662f\u5728\u5927\u6a21\u578b\u751f\u6210\u56de\u7b54\u4e4b\u524d&#xff0c;\u5148\u4ece\u5916\u90e8\u77e5\u8bc6\u6e90&#xff08;\u5982\u6570\u636e\u5e93\u3001\u6587\u6863\u5e93\u3001\u4e92\u8054\u7f51\u7b49&#xff09;\u4e2d\u68c0\u7d22\u4e0e\u95ee\u9898\u76f8\u5173\u7684\u4fe1\u606f&#xff0c;\u7136\u540e\u5c06\u8fd9\u4e9b\u68c0\u7d22\u5230\u7684\u4fe1\u606f\u4f5c\u4e3a\u989d\u5916\u7684\u4e0a\u4e0b\u6587\u8f93\u5165\u5230\u6a21\u578b\u4e2d &#xff0c;\u5e2e\u52a9\u6a21\u578b\u751f\u6210\u66f4\u52a0\u51c6\u786e\u3001\u4e30\u5bcc\u548c\u7b26\u5408\u4e0a\u4e0b\u6587\u7684\u56de\u7b54\u3002\u5c31\u597d\u6bd4\u4f60\u5728\u8003\u8bd5\u65f6&#xff0c;\u9047\u5230\u4e0d\u4f1a\u7684\u9898\u76ee&#xff0c;\u53ef\u4ee5\u67e5\u9605\u53c2\u8003\u8d44\u6599&#xff0c;\u518d\u7ed9\u51fa\u7b54\u6848&#xff0c;\u800c\u4e0d\u662f\u5355\u7eaf\u4f9d\u9760\u81ea\u5df1\u7684\u8bb0\u5fc6\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f&#xff0c;RAG \u80fd\u591f\u8ba9\u5927\u6a21\u578b\u5728\u5904\u7406\u5404\u79cd\u4efb\u52a1\u65f6&#xff0c;\u751f\u6210\u7684\u7ed3\u679c\u66f4\u52a0\u8d34\u8fd1\u771f\u5b9e\u9700\u6c42&#xff0c;\u5927\u5927\u63d0\u5347\u4e86\u6a21\u578b\u7684\u5b9e\u7528\u6027\u548c\u53ef\u9760\u6027 \u3002<\/p>\n<h3>\u4e8c\u3001RAG \u8bde\u751f&#xff0c;\u89e3\u51b3\u5927\u6a21\u578b\u75db\u70b9<\/h3>\n<p>\u5927\u8bed\u8a00\u6a21\u578b\u867d\u7136\u5728\u81ea\u7136\u8bed\u8a00\u5904\u7406\u4efb\u52a1\u4e2d\u5c55\u73b0\u51fa\u4e86\u60ca\u4eba\u7684\u80fd\u529b &#xff0c;\u4f46\u5b83\u4eec\u5e76\u975e\u5b8c\u7f8e\u65e0\u7f3a&#xff0c;\u5728\u5b9e\u9645\u5e94\u7528\u4e2d&#xff0c;\u5927\u6a21\u578b\u66b4\u9732\u51fa\u4e86\u4e0d\u5c11\u5c40\u9650\u6027\u3002<\/p>\n<p>\u9996\u5148\u662f\u77e5\u8bc6\u65f6\u6548\u6027\u95ee\u9898\u3002\u5927\u6a21\u578b\u7684\u8bad\u7ec3\u6570\u636e\u5f80\u5f80\u6765\u81ea\u8fc7\u53bb\u67d0\u4e2a\u65f6\u95f4\u6bb5\u7684\u8bed\u6599\u5e93 &#xff0c;\u8fd9\u5c31\u5bfc\u81f4\u5b83\u4eec\u5bf9\u4e8e\u8bad\u7ec3\u5b8c\u6210\u4e4b\u540e\u53d1\u751f\u7684\u65b0\u4e8b\u4ef6\u3001\u65b0\u8d8b\u52bf\u4ee5\u53ca\u65b0\u7684\u7814\u7a76\u6210\u679c\u7b49\u4fe1\u606f\u4e86\u89e3\u751a\u5c11\u3002\u6bd4\u5982&#xff0c;\u82e5\u8bad\u7ec3\u6570\u636e\u622a\u6b62\u5230 2022 \u5e74&#xff0c;\u90a3\u4e48\u5bf9\u4e8e 2023 \u5e74\u624d\u51fa\u73b0\u7684\u65b0\u79d1\u6280\u4ea7\u54c1\u3001\u65b0\u653f\u7b56\u6cd5\u89c4\u7b49\u95ee\u9898&#xff0c;\u5927\u6a21\u578b\u5c31\u53ef\u80fd\u65e0\u6cd5\u7ed9\u51fa\u51c6\u786e\u4e14\u6700\u65b0\u7684\u56de\u7b54 \u3002<\/p>\n<p>\u5176\u6b21\u662f\u77e5\u8bc6\u51c6\u786e\u6027\u3002\u7531\u4e8e\u5927\u6a21\u578b\u662f\u57fa\u4e8e\u5927\u89c4\u6a21\u6570\u636e\u8fdb\u884c\u8bad\u7ec3\u5b66\u4e60&#xff0c;\u901a\u8fc7\u6982\u7387\u8ba1\u7b97\u6765\u751f\u6210\u56de\u7b54&#xff0c;\u5e76\u975e\u771f\u6b63\u7406\u89e3\u77e5\u8bc6&#xff0c;\u6240\u4ee5\u5728\u56de\u7b54\u95ee\u9898\u65f6\u5bb9\u6613\u4ea7\u751f \u201c\u5e7b\u89c9\u201d&#xff0c;\u4e5f\u5c31\u662f\u7f16\u9020\u4e00\u4e9b\u770b\u4f3c\u5408\u7406\u4f46\u5b9e\u9645\u4e0a\u5e76\u4e0d\u5b58\u5728\u6216\u9519\u8bef\u7684\u4fe1\u606f\u3002\u4f8b\u5982&#xff0c;\u5728\u8be2\u95ee\u67d0\u4e9b\u590d\u6742\u7684\u79d1\u5b66\u539f\u7406\u3001\u5386\u53f2\u4e8b\u4ef6\u7ec6\u8282\u65f6&#xff0c;\u5927\u6a21\u578b\u53ef\u80fd\u4f1a\u7ed9\u51fa\u9519\u8bef\u7684\u89e3\u91ca\u6216\u4e0d\u51c6\u786e\u7684\u63cf\u8ff0 \u3002<\/p>\n<p>\u6700\u540e&#xff0c;\u5f53\u6d89\u53ca\u5230\u4e13\u4e1a\u9886\u57df\u77e5\u8bc6\u65f6&#xff0c;\u901a\u7528\u5927\u6a21\u578b\u7684\u8868\u73b0\u4e5f\u5f80\u5f80\u5dee\u5f3a\u4eba\u610f\u3002\u4e13\u4e1a\u9886\u57df\u77e5\u8bc6\u901a\u5e38\u5177\u6709\u9ad8\u5ea6\u7684\u4e13\u4e1a\u6027\u548c\u590d\u6742\u6027&#xff0c;\u9700\u8981\u6df1\u5165\u7684\u4e13\u4e1a\u7406\u89e3\u548c\u80cc\u666f\u77e5\u8bc6 \u3002\u50cf\u533b\u7597\u3001\u6cd5\u5f8b\u3001\u91d1\u878d\u7b49\u9886\u57df&#xff0c;\u5bf9\u4e8e\u77e5\u8bc6\u7684\u51c6\u786e\u6027\u548c\u4e13\u4e1a\u6027\u8981\u6c42\u6781\u9ad8&#xff0c;\u901a\u7528\u5927\u6a21\u578b\u5982\u679c\u6ca1\u6709\u7ecf\u8fc7\u4e13\u4e1a\u6570\u636e\u7684\u5145\u5206\u8bad\u7ec3&#xff0c;\u5f88\u96be\u63d0\u4f9b\u4e13\u4e1a\u3001\u53ef\u9760\u7684\u7b54\u6848 \u3002<\/p>\n<p>\u6b63\u662f\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898&#xff0c;RAG \u6280\u672f\u5e94\u8fd0\u800c\u751f\u3002\u5b83\u901a\u8fc7\u68c0\u7d22\u5916\u90e8\u77e5\u8bc6\u5e93&#xff0c;\u5f15\u5165\u5b9e\u65f6\u548c\u51c6\u786e\u7684\u4fe1\u606f&#xff0c;\u8ba9\u5927\u6a21\u578b\u5728\u751f\u6210\u56de\u7b54\u65f6\u80fd\u591f\u6709\u66f4\u591a\u7684\u53c2\u8003\u4f9d\u636e&#xff0c;\u4ece\u800c\u6709\u6548\u63d0\u5347\u56de\u7b54\u7684\u51c6\u786e\u6027\u3001\u65f6\u6548\u6027\u4ee5\u53ca\u4e13\u4e1a\u6027&#xff0c;\u4e3a\u5927\u6a21\u578b\u5728\u5b9e\u9645\u573a\u666f\u4e2d\u7684\u5e94\u7528\u5f00\u8f9f\u4e86\u66f4\u5e7f\u9614\u7684\u9053\u8def \u3002<\/p>\n<h3>\u4e09\u3001RAG \u5de5\u4f5c\u539f\u7406\u5927\u63ed\u79d8<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810133551-6898a037edcb0.png\" alt=\"\" \/><\/p>\n<h4>&#xff08;\u4e00&#xff09;\u6784\u5efa\u77e5\u8bc6\u5e93<\/h4>\n<p>\u8981\u60f3\u8ba9 RAG \u6280\u672f\u53d1\u6325\u4f5c\u7528&#xff0c;\u9996\u5148\u5f97\u6784\u5efa\u4e00\u4e2a\u5f3a\u5927\u7684\u53ef\u68c0\u7d22\u77e5\u8bc6\u5e93&#xff0c;\u5c31\u597d\u6bd4\u642d\u5efa\u4e00\u5ea7\u77e5\u8bc6\u5b9d\u5e93&#xff0c;\u65b9\u4fbf\u540e\u7eed\u5feb\u901f\u4ece\u4e2d\u83b7\u53d6\u6240\u9700\u4fe1\u606f \u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4e3b\u8981\u5305\u542b\u4ee5\u4e0b\u51e0\u4e2a\u5173\u952e\u6b65\u9aa4 &#xff1a;<\/p>\n<li>\n<p>\u77e5\u8bc6\u6574\u7406&#xff1a;\u628a\u5404\u79cd\u6765\u6e90\u7684\u77e5\u8bc6&#xff0c;\u4ee5\u6587\u4ef6\u683c\u5f0f\u5b58\u50a8\u8d77\u6765&#xff0c;\u50cf\u5e38\u89c1\u7684 word\u3001pdf\u3001ppt\u3001excel \u6587\u6863&#xff0c;\u6216\u8005\u5728\u7ebf\u7f51\u9875\u5185\u5bb9\u7b49&#xff0c;\u8fd9\u4e9b\u90fd\u662f\u6784\u5efa\u77e5\u8bc6\u5e93\u7684\u539f\u6750\u6599 \u3002<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u6e05\u6d17\u53ca\u683c\u5f0f\u5316&#xff1a;\u4e0d\u540c\u683c\u5f0f\u7684\u6570\u636e\u5185\u5bb9\u9700\u8981\u63d0\u53d6\u4e3a\u7eaf\u6587\u672c&#xff0c;\u65b9\u4fbf\u540e\u7eed\u5904\u7406\u3002\u540c\u65f6&#xff0c;\u8fd8\u5f97\u6e05\u7406\u6570\u636e\u4e2d\u7684\u566a\u58f0\u3001\u9519\u8bef\u548c\u5197\u4f59\u4fe1\u606f&#xff0c;\u6bd4\u5982\u5220\u9664\u6587\u6863\u4e2d\u4e0d\u5fc5\u8981\u7684\u9875\u7709\u9875\u811a\u3001\u4fee\u6b63\u9519\u522b\u5b57\u7b49&#xff0c;\u8ba9\u6570\u636e\u53d8\u5f97\u5e72\u51c0\u6574\u6d01 \u3002<\/p>\n<\/li>\n<li>\n<p>\u5185\u5bb9\u5207\u5206&#xff1a;\u5c06\u6574\u7406\u597d\u7684\u6587\u672c\u5185\u5bb9\u6309\u6bb5\u843d\u3001\u4e3b\u4f53\u6216\u8005\u903b\u8f91\u5355\u5143\u5207\u5206\u6210\u8f83\u5c0f\u7684\u77e5\u8bc6\u7247\u6bb5&#xff08;Chunk&#xff09; \u3002\u56e0\u4e3a\u5927\u6a21\u578b\u5904\u7406\u80fd\u529b\u6709\u9650&#xff0c;\u628a\u957f\u6587\u672c\u5207\u5206\u6210\u5c0f\u7247\u6bb5&#xff0c;\u66f4\u4fbf\u4e8e\u6a21\u578b\u7406\u89e3\u548c\u5904\u7406&#xff0c;\u4e5f\u80fd\u63d0\u9ad8\u68c0\u7d22\u6548\u7387 \u3002<\/p>\n<\/li>\n<li>\n<p>\u5411\u91cf\u5316&#xff1a;\u501f\u52a9 Embedding \u6a21\u578b&#xff0c;\u5c06\u6bcf\u4e2a\u77e5\u8bc6\u7247\u6bb5\u8f6c\u5316\u4e3a\u5411\u91cf\u8868\u793a \u3002\u5411\u91cf\u662f\u4e00\u79cd\u5c06\u590d\u6742\u4fe1\u606f\u8f6c\u5316\u4e3a\u8ba1\u7b97\u673a\u53ef\u5904\u7406\u7684\u6570\u503c\u5f62\u5f0f\u7684\u5de5\u5177&#xff0c;\u672c\u8d28\u4e0a\u662f \u201c\u9ad8\u7ef4\u7a7a\u95f4\u4e2d\u7684\u6709\u5e8f\u6570\u503c\u6570\u7ec4\u201d \u3002\u6bd4\u5982\u53e5\u5b50 \u201c\u6211\u559c\u6b22 AI\u201d \u4f1a\u88ab\u8f6c\u5316\u4e3a\u5411\u91cf&#xff0c;\u50cf\u7528 Word2Vec \u6280\u672f\u751f\u6210 [0.8, -0.3, 1.2, \u2026] \u8fd9\u6837\u7684\u6570\u5b57\u4e32&#xff0c;\u5411\u91cf\u4e2d\u7684\u6bcf\u4e2a\u6570\u5b57\u4ee3\u8868\u4e00\u4e2a\u9690\u85cf\u7684\u8bed\u4e49\u7279\u5f81 \u3002\u901a\u8fc7\u5411\u91cf\u5316&#xff0c;\u5c31\u80fd\u628a\u6587\u672c\u8f6c\u5316\u6210\u8ba1\u7b97\u673a\u80fd\u7406\u89e3\u7684\u6570\u5b57\u5f62\u5f0f&#xff0c;\u8fd8\u80fd\u901a\u8fc7\u8ba1\u7b97\u5411\u91cf\u4e4b\u95f4\u7684\u76f8\u4f3c\u5ea6&#xff0c;\u627e\u51fa\u8bed\u4e49\u76f8\u8fd1\u7684\u6587\u672c\u7247\u6bb5 \u3002<\/p>\n<\/li>\n<li>\n<p>\u5173\u8054\u5143\u6570\u636e&#xff1a;\u7ed9\u6bcf\u4e2a\u5411\u91cf\u5173\u8054\u76f8\u5173\u5143\u6570\u636e&#xff0c;\u6bd4\u5982\u6587\u6863\u540d\u79f0\u3001\u521b\u5efa\u65f6\u95f4\u3001\u4f5c\u8005\u3001\u6765\u6e90\u7b49 \u3002\u8fd9\u4e9b\u5143\u6570\u636e\u80fd\u4e3a\u540e\u7eed\u7684\u68c0\u7d22\u548c\u4f7f\u7528\u63d0\u4f9b\u66f4\u591a\u6709\u7528\u4fe1\u606f&#xff0c;\u6bd4\u5982\u6839\u636e\u6587\u6863\u521b\u5efa\u65f6\u95f4\u7b5b\u9009\u51fa\u6700\u65b0\u7684\u8d44\u6599 \u3002<\/p>\n<\/li>\n<li>\n<p>\u8f7d\u5165\u5411\u91cf\u6570\u636e\u5e93\u5e76\u5efa\u7acb\u7d22\u5f15&#xff1a;\u628a\u5411\u91cf\u5316\u540e\u7684\u77e5\u8bc6\u7247\u6bb5\u53ca\u5176\u5bf9\u5e94\u7684\u5143\u6570\u636e\u8f7d\u5165\u5411\u91cf\u6570\u636e\u5e93&#xff0c;\u5982 FAISS\u3001Pinecone\u3001Weaviate \u7b49 \u3002\u5411\u91cf\u6570\u636e\u5e93\u4e13\u95e8\u7528\u4e8e\u5b58\u50a8\u548c\u7ba1\u7406\u5411\u91cf\u6570\u636e&#xff0c;\u80fd\u591f\u9ad8\u6548\u5730\u8fdb\u884c\u5411\u91cf\u68c0\u7d22 \u3002\u5efa\u7acb\u7d22\u5f15\u5219\u662f\u4e3a\u4e86\u52a0\u5feb\u68c0\u7d22\u901f\u5ea6&#xff0c;\u5c31\u50cf\u7ed9\u56fe\u4e66\u9986\u7684\u4e66\u7c4d\u7f16\u5236\u76ee\u5f55&#xff0c;\u65b9\u4fbf\u5feb\u901f\u627e\u5230\u60f3\u8981\u7684\u4e66 \u3002<\/p>\n<\/li>\n<li>\n<p>\u90e8\u7f72\u96c6\u6210&#xff1a;\u5c06\u5411\u91cf\u6570\u636e\u5e93\u96c6\u6210\u5230 AI \u4ea7\u54c1\u6d41\u7a0b\u4e2d&#xff0c;\u4e0e\u751f\u6210\u6a21\u578b\u642d\u914d\u4f7f\u7528 \u3002\u8fd9\u6837&#xff0c;\u5f53\u7528\u6237\u63d0\u95ee\u65f6&#xff0c;\u7cfb\u7edf\u5c31\u80fd\u5feb\u901f\u4ece\u5411\u91cf\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u76f8\u5173\u77e5\u8bc6&#xff0c;\u5e76\u4ea4\u7ed9\u751f\u6210\u6a21\u578b\u8fdb\u884c\u5904\u7406 \u3002<\/p>\n<\/li>\n<h4>&#xff08;\u4e8c&#xff09;\u6a21\u578b\u8c03\u7528<\/h4>\n<p>\u5f53\u7528\u6237\u63d0\u51fa\u95ee\u9898\u540e&#xff0c;RAG \u7cfb\u7edf\u5c31\u4f1a\u8fdb\u5165\u6a21\u578b\u8c03\u7528\u9636\u6bb5&#xff0c;\u8fd9\u4e2a\u9636\u6bb5\u4e3b\u8981\u5305\u542b\u4ee5\u4e0b\u64cd\u4f5c &#xff1a;<\/p>\n<li>\n<p>\u5411\u91cf\u8f6c\u6362&#xff1a;\u7cfb\u7edf\u4f1a\u5c06\u7528\u6237\u8f93\u5165\u7684 Prompt \u8f6c\u5316\u6210\u5411\u91cf \u3002\u540c\u6837\u662f\u5229\u7528 Embedding \u6a21\u578b&#xff0c;\u628a\u7528\u6237\u7684\u95ee\u9898\u4e5f\u53d8\u6210\u548c\u77e5\u8bc6\u5e93\u4e2d\u77e5\u8bc6\u7247\u6bb5\u4e00\u6837\u7684\u5411\u91cf\u5f62\u5f0f&#xff0c;\u65b9\u4fbf\u5728\u5411\u91cf\u6570\u636e\u5e93\u91cc\u8fdb\u884c\u76f8\u4f3c\u5ea6\u6bd4\u8f83 \u3002<\/p>\n<\/li>\n<li>\n<p>\u76f8\u4f3c\u7247\u6bb5\u68c0\u7d22&#xff1a;\u5c06\u7528\u6237\u95ee\u9898\u8f6c\u5316\u540e\u7684\u5411\u91cf&#xff0c;\u5728\u5411\u91cf\u6570\u636e\u5e93\u91cc\u8fdb\u884c\u76f8\u4f3c\u5ea6\u68c0\u7d22 \u3002\u5411\u91cf\u6570\u636e\u5e93\u4f1a\u6839\u636e\u5411\u91cf\u4e4b\u95f4\u7684\u76f8\u4f3c\u5ea6&#xff0c;\u627e\u51fa\u4e0e\u7528\u6237\u95ee\u9898\u6700\u76f8\u5173\u7684 1 \u6761\u6216\u8005\u591a\u6761\u77e5\u8bc6\u7247\u6bb5 &#xff0c;\u4e5f\u5c31\u662f\u53ec\u56de\u76f8\u5173\u5185\u5bb9 \u3002\u6bd4\u5982&#xff0c;\u7528\u6237\u95ee \u201c\u82f9\u679c\u7684\u8425\u517b\u4ef7\u503c\u6709\u54ea\u4e9b&#xff1f;\u201d&#xff0c;\u5411\u91cf\u6570\u636e\u5e93\u5c31\u4f1a\u68c0\u7d22\u51fa\u4e0e \u201c\u82f9\u679c\u8425\u517b\u4ef7\u503c\u201d \u76f8\u5173\u7684\u77e5\u8bc6\u7247\u6bb5 \u3002<\/p>\n<\/li>\n<li>\n<p>\u5408\u5e76\u8f93\u5165&#xff1a;\u5c06\u68c0\u7d22\u51fa\u7684\u77e5\u8bc6\u7247\u6bb5\u4e0e\u539f Prompt \u5408\u5e76\u5728\u4e00\u8d77&#xff0c;\u7ec4\u6210\u65b0\u7684 Prompt \u3002\u8fd9\u6837&#xff0c;\u65b0\u7684 Prompt \u5c31\u5305\u542b\u4e86\u7528\u6237\u95ee\u9898\u4ee5\u53ca\u4ece\u77e5\u8bc6\u5e93\u4e2d\u68c0\u7d22\u5230\u7684\u76f8\u5173\u4fe1\u606f&#xff0c;\u4e3a\u5927\u6a21\u578b\u63d0\u4f9b\u4e86\u66f4\u4e30\u5bcc\u7684\u4e0a\u4e0b\u6587 \u3002<\/p>\n<\/li>\n<li>\n<p>\u751f\u6210\u56de\u590d&#xff1a;\u628a\u65b0\u7684 Prompt \u8f93\u5165\u5230\u5927\u6a21\u578b\u4e2d&#xff0c;\u5927\u6a21\u578b\u57fa\u4e8e\u8fd9\u4e9b\u4fe1\u606f\u8fdb\u884c\u7406\u89e3\u548c\u63a8\u7406&#xff0c;\u751f\u6210\u6700\u7ec8\u7684\u56de\u7b54 \u3002\u7531\u4e8e\u5927\u6a21\u578b\u5728\u751f\u6210\u56de\u7b54\u65f6\u53c2\u8003\u4e86\u4ece\u77e5\u8bc6\u5e93\u4e2d\u68c0\u7d22\u5230\u7684\u76f8\u5173\u77e5\u8bc6&#xff0c;\u6240\u4ee5\u56de\u7b54\u4f1a\u66f4\u52a0\u51c6\u786e\u3001\u4e30\u5bcc\u548c\u6709\u9488\u5bf9\u6027 \u3002<\/p>\n<\/li>\n<h3>\u56db\u3001RAG \u4f18\u52bf\u5927\u76d8\u70b9<\/h3>\n<h4>&#xff08;\u4e00&#xff09;\u7ecf\u6d4e\u9ad8\u6548<\/h4>\n<p>\u5728\u4f20\u7edf\u7684\u5927\u6a21\u578b\u5e94\u7528\u4e2d&#xff0c;\u5982\u679c\u60f3\u8981\u6a21\u578b\u5b66\u4e60\u65b0\u7684\u77e5\u8bc6&#xff0c;\u5f80\u5f80\u9700\u8981\u6536\u96c6\u5927\u91cf\u7684\u65b0\u6570\u636e&#xff0c;\u7136\u540e\u5bf9\u6574\u4e2a\u6a21\u578b\u8fdb\u884c\u91cd\u65b0\u8bad\u7ec3 \u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4e0d\u4ec5\u9700\u8981\u8017\u8d39\u5927\u91cf\u7684\u8ba1\u7b97\u8d44\u6e90&#xff0c;\u50cf\u4f7f\u7528\u9ad8\u6027\u80fd\u7684 GPU \u96c6\u7fa4&#xff0c;\u8fd8\u9700\u8981\u6295\u5165\u5927\u91cf\u7684\u65f6\u95f4\u548c\u4e13\u4e1a\u4eba\u529b \u3002\u4ee5\u8bad\u7ec3\u4e00\u4e2a\u4e2d\u7b49\u89c4\u6a21\u7684\u8bed\u8a00\u6a21\u578b\u4e3a\u4f8b&#xff0c;\u53ef\u80fd\u9700\u8981\u6570\u5343\u5757 GPU \u5e76\u884c\u8ba1\u7b97\u6570\u5468\u65f6\u95f4&#xff0c;\u6210\u672c\u9ad8\u8fbe\u6570\u5341\u4e07\u5143\u751a\u81f3\u66f4\u591a\u3002<\/p>\n<p>\u800c RAG \u5219\u5927\u5927\u964d\u4f4e\u4e86\u8fd9\u65b9\u9762\u7684\u6210\u672c \u3002\u5f53\u6709\u65b0\u7684\u4fe1\u606f\u9700\u8981\u6dfb\u52a0\u65f6&#xff0c;\u6211\u4eec\u53ea\u9700\u8981\u5c06\u65b0\u7684\u6570\u636e\u6309\u7167\u4e00\u5b9a\u7684\u683c\u5f0f\u6574\u7406\u597d&#xff0c;\u6dfb\u52a0\u5230\u5916\u90e8\u7684\u77e5\u8bc6\u5e93\u4e2d\u5373\u53ef \u3002\u65e0\u9700\u5bf9\u5927\u6a21\u578b\u672c\u8eab\u8fdb\u884c\u5927\u89c4\u6a21\u7684\u91cd\u65b0\u8bad\u7ec3&#xff0c;\u8fd9\u5c31\u8282\u7701\u4e86\u5927\u91cf\u7684\u6280\u672f\u548c\u8d22\u52a1\u6210\u672c \u3002\u6bd4\u5982&#xff0c;\u4e00\u4e2a\u4f01\u4e1a\u60f3\u8981\u8ba9\u5927\u6a21\u578b\u4e86\u89e3\u6700\u65b0\u7684\u4ea7\u54c1\u4fe1\u606f&#xff0c;\u53ea\u9700\u8981\u5c06\u4ea7\u54c1\u7684\u66f4\u65b0\u6587\u6863\u6dfb\u52a0\u5230\u77e5\u8bc6\u5e93&#xff0c;\u6a21\u578b\u5c31\u80fd\u5728\u540e\u7eed\u7684\u56de\u7b54\u4e2d\u8fd0\u7528\u8fd9\u4e9b\u65b0\u77e5\u8bc6&#xff0c;\u800c\u4e0d\u7528\u82b1\u8d39\u5927\u91cf\u8d44\u6e90\u53bb\u91cd\u65b0\u8bad\u7ec3\u6a21\u578b \u3002<\/p>\n<h4>&#xff08;\u4e8c&#xff09;\u5b9e\u65f6\u66f4\u65b0<\/h4>\n<p>\u5728\u4fe1\u606f\u7206\u70b8\u7684\u65f6\u4ee3&#xff0c;\u6570\u636e\u7684\u65f6\u6548\u6027\u81f3\u5173\u91cd\u8981 \u3002RAG \u6280\u672f\u6700\u5927\u7684\u4eae\u70b9\u4e4b\u4e00&#xff0c;\u5c31\u662f\u80fd\u8ba9\u5927\u6a21\u578b\u4e0e\u5b9e\u65f6\u6570\u636e\u7d27\u5bc6\u76f8\u8fde \u3002\u901a\u8fc7\u8fde\u63a5\u5b9e\u65f6\u6570\u636e\u6e90&#xff0c;\u5982\u65b0\u95fb\u7f51\u7ad9\u7684 API \u63a5\u53e3\u3001\u91d1\u878d\u5e02\u573a\u7684\u5b9e\u65f6\u6570\u636e\u63a5\u53e3\u7b49&#xff0c;\u5927\u6a21\u578b\u53ef\u4ee5\u83b7\u53d6\u5230\u6700\u65b0\u7684\u4fe1\u606f \u3002<\/p>\n<p>\u4f8b\u5982&#xff0c;\u5728\u91d1\u878d\u9886\u57df&#xff0c;\u6295\u8d44\u8005\u60f3\u8981\u4e86\u89e3\u67d0\u53ea\u80a1\u7968\u7684\u6700\u65b0\u4ef7\u683c\u8d70\u52bf\u3001\u516c\u53f8\u7684\u6700\u65b0\u8d22\u62a5\u6570\u636e\u7b49&#xff0c;\u4f7f\u7528 RAG \u6280\u672f\u7684\u5927\u6a21\u578b\u5c31\u80fd\u53ca\u65f6\u83b7\u53d6\u8fd9\u4e9b\u5b9e\u65f6\u6570\u636e&#xff0c;\u5e76\u7ed9\u51fa\u51c6\u786e\u7684\u56de\u7b54 \u3002\u53c8\u6bd4\u5982&#xff0c;\u5728\u65b0\u95fb\u8d44\u8baf\u9886\u57df&#xff0c;\u5f53\u6709\u7a81\u53d1\u65b0\u95fb\u4e8b\u4ef6\u53d1\u751f\u65f6&#xff0c;\u5927\u6a21\u578b\u53ef\u4ee5\u8fc5\u901f\u4ece\u65b0\u95fb\u6e90\u83b7\u53d6\u76f8\u5173\u62a5\u9053&#xff0c;\u4e3a\u7528\u6237\u63d0\u4f9b\u6700\u65b0\u7684\u4e8b\u4ef6\u8fdb\u5c55\u548c\u89e3\u8bfb \u3002\u8fd9\u79cd\u5b9e\u65f6\u66f4\u65b0\u7684\u80fd\u529b&#xff0c;\u786e\u4fdd\u4e86\u5927\u6a21\u578b\u7684\u56de\u7b54\u59cb\u7ec8\u5177\u6709\u9ad8\u5ea6\u7684\u76f8\u5173\u6027\u548c\u51c6\u786e\u6027&#xff0c;\u4f7f\u5176\u5728\u5e94\u5bf9\u5404\u79cd\u65f6\u6548\u6027\u8981\u6c42\u9ad8\u7684\u573a\u666f\u65f6&#xff0c;\u90fd\u80fd\u6e38\u5203\u6709\u4f59 \u3002<\/p>\n<h4>&#xff08;\u4e09&#xff09;\u63d0\u9ad8\u53ef\u4fe1\u5ea6<\/h4>\n<p>\u5728\u9762\u5bf9\u5927\u6a21\u578b\u7ed9\u51fa\u7684\u56de\u7b54\u65f6&#xff0c;\u5f88\u591a\u7528\u6237\u5e38\u5e38\u4f1a\u5fc3\u5b58\u7591\u8651&#xff1a;\u8fd9\u4e2a\u7b54\u6848\u51c6\u786e\u5417&#xff1f;\u6709\u6ca1\u6709\u53ef\u9760\u7684\u4f9d\u636e&#xff1f;RAG \u6280\u672f\u5f88\u597d\u5730\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898 \u3002<\/p>\n<p>\u5f53\u5927\u6a21\u578b\u57fa\u4e8e RAG \u6280\u672f\u751f\u6210\u56de\u7b54\u65f6&#xff0c;\u5b83\u4f1a\u540c\u65f6\u5217\u51fa\u56de\u7b54\u6240\u4f9d\u636e\u7684\u4fe1\u606f\u6765\u6e90 &#xff0c;\u8fd9\u4e9b\u6765\u6e90\u53ef\u4ee5\u662f\u5177\u4f53\u7684\u6587\u6863\u3001\u7f51\u9875\u94fe\u63a5\u3001\u7814\u7a76\u62a5\u544a\u7b49 \u3002\u7528\u6237\u901a\u8fc7\u67e5\u770b\u8fd9\u4e9b\u6765\u6e90&#xff0c;\u5c31\u80fd\u9a8c\u8bc1\u7b54\u6848\u7684\u53ef\u9760\u6027&#xff0c;\u589e\u5f3a\u5bf9\u5927\u6a21\u578b\u8f93\u51fa\u5185\u5bb9\u7684\u4fe1\u4efb \u3002\u4f8b\u5982&#xff0c;\u5f53\u7528\u6237\u8be2\u95ee\u67d0\u4e2a\u79d1\u5b66\u95ee\u9898\u65f6&#xff0c;\u5927\u6a21\u578b\u4e0d\u4ec5\u4f1a\u7ed9\u51fa\u7b54\u6848&#xff0c;\u8fd8\u4f1a\u5217\u51fa\u53c2\u8003\u7684\u79d1\u5b66\u6587\u732e\u3001\u7814\u7a76\u673a\u6784\u7684\u62a5\u544a\u7b49&#xff0c;\u8ba9\u7528\u6237\u80fd\u591f\u8fdb\u4e00\u6b65\u67e5\u9605\u76f8\u5173\u8d44\u6599&#xff0c;\u6df1\u5165\u4e86\u89e3\u95ee\u9898 \u3002\u8fd9\u79cd\u900f\u660e\u7684\u4fe1\u606f\u5448\u73b0\u65b9\u5f0f&#xff0c;\u6709\u6548\u63d0\u5347\u4e86\u5927\u6a21\u578b\u56de\u7b54\u7684\u53ef\u4fe1\u5ea6&#xff0c;\u8ba9\u7528\u6237\u4f7f\u7528\u8d77\u6765\u66f4\u52a0\u653e\u5fc3 \u3002<\/p>\n<h4>&#xff08;\u56db&#xff09;\u7075\u6d3b\u53ef\u63a7<\/h4>\n<p>\u5bf9\u4e8e\u5f00\u53d1\u4eba\u5458\u6765\u8bf4&#xff0c;RAG \u63d0\u4f9b\u4e86\u6781\u5927\u7684\u7075\u6d3b\u6027\u548c\u53ef\u63a7\u6027 \u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d&#xff0c;\u4e0d\u540c\u7684\u7528\u6237\u53ef\u80fd\u6709\u4e0d\u540c\u7684\u9700\u6c42\u548c\u4f7f\u7528\u573a\u666f&#xff0c;\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u6839\u636e\u8fd9\u4e9b\u9700\u6c42&#xff0c;\u7075\u6d3b\u5730\u66f4\u6539 RAG \u7cfb\u7edf\u7684\u4fe1\u606f\u6e90 \u3002<\/p>\n<p>\u6bd4\u5982&#xff0c;\u5728\u4f01\u4e1a\u5185\u90e8\u5e94\u7528\u4e2d&#xff0c;\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5c06\u4fe1\u606f\u6e90\u8bbe\u7f6e\u4e3a\u4f01\u4e1a\u7684\u5185\u90e8\u6587\u6863\u5e93\u3001\u77e5\u8bc6\u5e93\u7b49&#xff0c;\u786e\u4fdd\u5458\u5de5\u83b7\u53d6\u7684\u4fe1\u606f\u90fd\u662f\u4f01\u4e1a\u5185\u90e8\u7684\u673a\u5bc6\u4fe1\u606f\u548c\u4e13\u4e1a\u77e5\u8bc6 \u3002\u540c\u65f6&#xff0c;\u901a\u8fc7\u8bbe\u7f6e\u4e0d\u540c\u7684\u6388\u6743\u7ea7\u522b&#xff0c;\u5f00\u53d1\u4eba\u5458\u8fd8\u53ef\u4ee5\u9650\u5236\u5bf9\u654f\u611f\u4fe1\u606f\u7684\u68c0\u7d22 \u3002\u4f8b\u5982&#xff0c;\u666e\u901a\u5458\u5de5\u53ea\u80fd\u68c0\u7d22\u4e00\u822c\u6027\u7684\u5de5\u4f5c\u8d44\u6599&#xff0c;\u800c\u7ba1\u7406\u5c42\u5219\u53ef\u4ee5\u8bbf\u95ee\u66f4\u9ad8\u7ea7\u522b\u7684\u5546\u4e1a\u673a\u5bc6\u548c\u6218\u7565\u89c4\u5212\u6587\u6863 \u3002\u8fd9\u79cd\u7075\u6d3b\u53ef\u63a7\u7684\u7279\u6027&#xff0c;\u4f7f\u5f97 RAG \u80fd\u591f\u6ee1\u8db3\u4e0d\u540c\u7528\u6237\u5728\u4e0d\u540c\u573a\u666f\u4e0b\u7684\u591a\u6837\u5316\u9700\u6c42&#xff0c;\u4e3a\u5927\u6a21\u578b\u7684\u5e7f\u6cdb\u5e94\u7528\u63d0\u4f9b\u4e86\u6709\u529b\u652f\u6301 \u3002<\/p>\n<h3>\u4e94\u3001\u4ee3\u7801\u5b9e\u64cd&#xff1a;\u624b\u628a\u624b\u6559\u4f60\u5b9e\u73b0 RAG<\/h3>\n<h4>&#xff08;\u4e00&#xff09;\u51c6\u5907\u5de5\u4f5c<\/h4>\n<p>\u5728\u5f00\u59cb\u5b9e\u73b0 RAG \u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u786e\u4fdd\u73af\u5883\u914d\u7f6e\u6b63\u786e&#xff0c;\u5e76\u5b89\u88c5\u6240\u9700\u7684\u4f9d\u8d56\u5305\u3002\u4e3b\u8981\u6d89\u53ca Python \u5305\u7684\u5b89\u88c5\u3001OpenAI \u8d26\u6237\u7533\u8bf7\u4ee5\u53ca\u914d\u7f6e\u6587\u4ef6\u7684\u521b\u5efa \u3002<\/p>\n<li>\u5b89\u88c5\u76f8\u5173 Python \u5305&#xff1a;\u672c\u6587\u4f7f\u7528langchain\u4f5c\u4e3a\u6838\u5fc3\u6846\u67b6&#xff0c;openai\u8c03\u7528 OpenAI \u7684 API&#xff0c;weaviate &#8211; client\u8fde\u63a5\u548c\u64cd\u4f5c Weaviate \u5411\u91cf\u6570\u636e\u5e93 \u3002\u53ef\u4ee5\u4f7f\u7528pip\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5&#xff1a;<\/li>\n<p>pip install langchain openai weaviate &#8211; client<\/p>\n<li>\n<p>\u7533\u8bf7 OpenAI \u8d26\u6237\u83b7\u53d6 API \u5bc6\u94a5&#xff1a;\u8bbf\u95ee OpenAI \u5b98\u7f51&#xff08;https:\/\/openai.com\/ &#xff09;&#xff0c;\u6ce8\u518c\u5e76\u767b\u5f55\u8d26\u6237 \u3002\u767b\u5f55\u540e&#xff0c;\u70b9\u51fb\u53f3\u4e0a\u89d2\u5934\u50cf&#xff0c;\u9009\u62e9 \u201cAPI\u201d \u8fdb\u5165\u63a7\u5236\u53f0 \u3002\u5728 \u201cAPI Keys\u201d \u90e8\u5206&#xff0c;\u70b9\u51fb \u201cCreate new secret key\u201d \u751f\u6210 API \u5bc6\u94a5 &#xff0c;\u8bf7\u59a5\u5584\u4fdd\u7ba1\u8be5\u5bc6\u94a5&#xff0c;\u540e\u7eed\u4ee3\u7801\u4e2d\u4f1a\u7528\u5230 \u3002<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa.env \u6587\u4ef6\u5b58\u653e\u914d\u7f6e\u4fe1\u606f&#xff1a;\u4e3a\u4e86\u5b89\u5168\u548c\u65b9\u4fbf\u7ba1\u7406&#xff0c;\u6211\u4eec\u521b\u5efa\u4e00\u4e2a.env\u6587\u4ef6\u6765\u5b58\u653e OpenAI API \u5bc6\u94a5 \u3002\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa.env\u6587\u4ef6&#xff0c;\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9 &#xff1a;<\/p>\n<\/li>\n<p>OPENAI\\\\_API\\\\_KEY&#061;&#039;your\\\\_openai\\\\_api\\\\_key&#039;<\/p>\n<p>\u6ce8\u610f\u5c06your_openai_api_key\u66ff\u6362\u4e3a\u5b9e\u9645\u751f\u6210\u7684 API \u5bc6\u94a5 \u3002\u7136\u540e&#xff0c;\u5728 Python \u4ee3\u7801\u4e2d\u4f7f\u7528dotenv\u5e93\u52a0\u8f7d\u8be5\u6587\u4ef6\u4e2d\u7684\u73af\u5883\u53d8\u91cf \u3002\u9996\u5148\u5b89\u88c5dotenv\u5e93&#xff1a;<\/p>\n<p>pip install python &#8211; dotenv<\/p>\n<p>\u5728\u4ee3\u7801\u5f00\u5934\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u52a0\u8f7d\u73af\u5883\u53d8\u91cf&#xff1a;<\/p>\n<p>import os<\/p>\n<p>from dotenv import load\\\\_dotenv<\/p>\n<p>load\\\\_dotenv()<\/p>\n<p>openai\\\\_api\\\\_key &#061; os.getenv(&#039;OPENAI\\\\_API\\\\_KEY&#039;)<\/p>\n<h4>&#xff08;\u4e8c&#xff09;\u5411\u91cf\u6570\u636e\u5e93\u64cd\u4f5c<\/h4>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u6211\u4eec\u9700\u8981\u5c06\u6587\u672c\u6570\u636e\u8fdb\u884c\u5904\u7406&#xff0c;\u5e76\u5b58\u50a8\u5230\u5411\u91cf\u6570\u636e\u5e93\u4e2d&#xff0c;\u4ee5\u4fbf\u540e\u7eed\u68c0\u7d22 \u3002\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528LangChain\u7684TextLoader\u52a0\u8f7d\u6587\u672c\u6570\u636e&#xff0c;CharacterTextSplitter\u5bf9\u6587\u6863\u8fdb\u884c\u5206\u5757&#xff0c;OpenAIEmbeddings\u751f\u6210\u5411\u91cf\u5d4c\u5165&#xff0c;\u6700\u540e\u5c06\u6570\u636e\u5b58\u50a8\u5230 Weaviate \u5411\u91cf\u6570\u636e\u5e93 \u3002<\/p>\n<li>\u52a0\u8f7d\u6587\u672c\u6570\u636e&#xff1a;\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u6587\u672c\u6587\u4ef6example.txt&#xff0c;\u4f7f\u7528TextLoader\u8fdb\u884c\u52a0\u8f7d &#xff1a;<\/li>\n<p>from langchain.document\\\\_loaders import TextLoader<\/p>\n<p>loader &#061; TextLoader(&#039;example.txt&#039;)<\/p>\n<p>documents &#061; loader.load()<\/p>\n<li>\u6587\u6863\u5206\u5757&#xff1a;\u4f7f\u7528CharacterTextSplitter\u5c06\u6587\u6863\u5206\u5272\u6210\u8f83\u5c0f\u7684\u5757&#xff0c;\u4ee5\u4fbf\u66f4\u597d\u5730\u5904\u7406\u548c\u5b58\u50a8 \u3002\u8fd9\u91cc\u8bbe\u7f6e\u6bcf\u4e2a\u5757\u7684\u5927\u5c0f\u4e3a 1000 \u4e2a\u5b57\u7b26&#xff0c;\u91cd\u53e0\u90e8\u5206\u4e3a 200 \u4e2a\u5b57\u7b26 &#xff1a;<\/li>\n<p>from langchain.text\\\\_splitter import CharacterTextSplitter<\/p>\n<p>text\\\\_splitter &#061; CharacterTextSplitter(chunk\\\\_size &#061; 1000, chunk\\\\_overlap &#061; 200)<\/p>\n<p>texts &#061; text\\\\_splitter.split\\\\_documents(documents)<\/p>\n<li>\u751f\u6210\u5411\u91cf\u5d4c\u5165&#xff1a;\u5229\u7528OpenAIEmbeddings\u5c06\u5206\u5757\u540e\u7684\u6587\u672c\u8f6c\u6362\u4e3a\u5411\u91cf\u8868\u793a &#xff1a;<\/li>\n<p>from langchain.embeddings.openai import OpenAIEmbeddings<\/p>\n<p>embeddings &#061; OpenAIEmbeddings(openai\\\\_api\\\\_key &#061; openai\\\\_api\\\\_key)<\/p>\n<li>\u5b58\u50a8\u5230 Weaviate \u5411\u91cf\u6570\u636e\u5e93&#xff1a;\u9996\u5148&#xff0c;\u786e\u4fdd Weaviate \u670d\u52a1\u5df2\u7ecf\u542f\u52a8 \u3002\u7136\u540e&#xff0c;\u4f7f\u7528weaviate &#8211; client\u5c06\u6570\u636e\u5b58\u50a8\u5230 Weaviate \u4e2d &#xff1a;<\/li>\n<p>import weaviate<\/p>\n<p>from langchain.vectorstores import Weaviate<\/p>\n<p>client &#061; weaviate.Client(url &#061; &#034;http:\/\/localhost:8080&#034;)<\/p>\n<p>vectorstore &#061; Weaviate.from\\\\_documents(texts, embeddings, client &#061; client, index\\\\_name &#061; &#034;ExampleIndex&#034;)<\/p>\n<p>\u8fd9\u91cc\u5047\u8bbe Weaviate \u670d\u52a1\u8fd0\u884c\u5728\u672c\u5730\u7684http:\/\/localhost:8080&#xff0c;\u5e76\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a \u201cExampleIndex\u201d \u7684\u7d22\u5f15 \u3002<\/p>\n<h4>&#xff08;\u4e09&#xff09;RAG \u5b9e\u73b0\u6b65\u9aa4<\/h4>\n<p>\u5b8c\u6210\u4e0a\u8ff0\u51c6\u5907\u5de5\u4f5c\u540e&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u5b9e\u73b0 RAG \u7684\u6838\u5fc3\u903b\u8f91\u4e86 &#xff0c;\u4e3b\u8981\u5305\u62ec\u5b9a\u4e49\u68c0\u7d22\u5668\u7ec4\u4ef6\u3001\u51c6\u5907\u63d0\u793a\u6a21\u677f\u4ee5\u53ca\u5c06\u68c0\u7d22\u589e\u5f3a\u63d0\u793a\u8f93\u5165\u5927\u6a21\u578b\u751f\u6210\u56de\u7b54 \u3002<\/p>\n<li>\u5b9a\u4e49\u68c0\u7d22\u5668\u7ec4\u4ef6&#xff1a;\u4ece\u5411\u91cf\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u4e0e\u7528\u6237\u67e5\u8be2\u76f8\u5173\u7684\u4e0a\u4e0b\u6587 \u3002\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u5411\u91cf\u6570\u636e\u5e93\u7684\u9ed8\u8ba4\u68c0\u7d22\u65b9\u5f0f &#xff1a;<\/li>\n<p>retriever &#061; vectorstore.as\\\\_retriever()<\/p>\n<li>\u51c6\u5907\u63d0\u793a\u6a21\u677f&#xff1a;\u6784\u5efa\u4e00\u4e2a\u63d0\u793a\u6a21\u677f&#xff0c;\u5c06\u68c0\u7d22\u5230\u7684\u4e0a\u4e0b\u6587\u4e0e\u7528\u6237\u67e5\u8be2\u7ed3\u5408\u8d77\u6765&#xff0c;\u5f62\u6210\u6700\u7ec8\u8f93\u5165\u7ed9\u5927\u6a21\u578b\u7684\u63d0\u793a \u3002\u4f8b\u5982&#xff1a;<\/li>\n<p>from langchain.prompts import PromptTemplate<\/p>\n<p>prompt\\\\_template &#061; &#034;&#034;&#034;Context information is below.<\/p>\n<p>{context}<\/p>\n<p>Based on the context information and not prior knowledge, answer the following question:<\/p>\n<p>{question}<\/p>\n<p>&#034;&#034;&#034;<\/p>\n<p>prompt &#061; PromptTemplate(template &#061; prompt\\\\_template, input\\\\_variables &#061; \\\\[&#034;context&#034;, &#034;question&#034;])<\/p>\n<li>\u751f\u6210\u56de\u7b54&#xff1a;\u5c06\u7528\u6237\u67e5\u8be2\u548c\u68c0\u7d22\u5230\u7684\u4e0a\u4e0b\u6587\u4f20\u5165\u63d0\u793a\u6a21\u677f&#xff0c;\u7136\u540e\u5c06\u751f\u6210\u7684\u63d0\u793a\u8f93\u5165\u5230\u5927\u6a21\u578b\u4e2d&#xff0c;\u83b7\u53d6\u56de\u7b54 \u3002\u8fd9\u91cc\u4f7f\u7528 OpenAI \u7684ChatCompletion API &#xff1a;<\/li>\n<p>from langchain.chains import RetrievalQA<\/p>\n<p>from langchain.chat\\\\_models import ChatOpenAI<\/p>\n<p>llm &#061; ChatOpenAI(openai\\\\_api\\\\_key &#061; openai\\\\_api\\\\_key, model\\\\_name &#061; &#034;gpt-3.5-turbo&#034;)<\/p>\n<p>qa\\\\_chain &#061; RetrievalQA.from\\\\_chain\\\\_type(llm, retriever &#061; retriever, chain\\\\_type\\\\_kwargs &#061; {&#034;prompt&#034;: prompt})<\/p>\n<p>question &#061; &#034;What is the main idea of the text?&#034;<\/p>\n<p>result &#061; qa\\\\_chain.run(question)<\/p>\n<p>print(result)<\/p>\n<p>\u4e0a\u8ff0\u4ee3\u7801\u4e2d&#xff0c;\u9996\u5148\u5b9a\u4e49\u4e86\u4e00\u4e2aRetrievalQA\u5bf9\u8c61qa_chain&#xff0c;\u5b83\u7ed3\u5408\u4e86\u5927\u6a21\u578bllm\u548c\u68c0\u7d22\u5668retriever&#xff0c;\u5e76\u4f7f\u7528\u4e86\u4e4b\u524d\u5b9a\u4e49\u7684\u63d0\u793a\u6a21\u677f \u3002\u7136\u540e&#xff0c;\u8bbe\u7f6e\u4e00\u4e2a\u793a\u4f8b\u95ee\u9898\u5e76\u8fd0\u884cqa_chain&#xff0c;\u6700\u7ec8\u6253\u5370\u51fa\u5927\u6a21\u578b\u751f\u6210\u7684\u56de\u7b54 \u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4&#xff0c;\u6211\u4eec\u5c31\u5b8c\u6210\u4e86\u4e00\u4e2a\u7b80\u5355\u7684 RAG \u7cfb\u7edf\u7684\u5b9e\u73b0 &#xff0c;\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u5bf9\u4ee3\u7801\u8fdb\u884c\u8fdb\u4e00\u6b65\u4f18\u5316\u548c\u6269\u5c55 \u3002<\/p>\n<h3>\u516d\u3001\u5e94\u7528\u9886\u57df\u4e0e\u5c55\u671b<\/h3>\n<p>RAG \u6280\u672f\u51ed\u501f\u5176\u72ec\u7279\u7684\u4f18\u52bf&#xff0c;\u5728\u4f17\u591a\u9886\u57df\u90fd\u5c55\u73b0\u51fa\u4e86\u5de8\u5927\u7684\u5e94\u7528\u6f5c\u529b &#xff0c;\u4e3a\u5404\u884c\u4e1a\u7684\u667a\u80fd\u5316\u53d1\u5c55\u63d0\u4f9b\u4e86\u6709\u529b\u652f\u6301 \u3002<\/p>\n<p>\u5728\u667a\u80fd\u5ba2\u670d\u9886\u57df&#xff0c;RAG \u53ef\u4ee5\u8ba9\u5ba2\u670d\u673a\u5668\u4eba\u5feb\u901f\u68c0\u7d22\u4f01\u4e1a\u7684\u4ea7\u54c1\u77e5\u8bc6\u5e93\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u7b54\u5e93\u7b49&#xff0c;\u9488\u5bf9\u7528\u6237\u7684\u95ee\u9898\u7ed9\u51fa\u51c6\u786e\u3001\u8be6\u7ec6\u7684\u56de\u7b54 \u3002\u65e0\u8bba\u662f\u89e3\u7b54\u7528\u6237\u5bf9\u4ea7\u54c1\u529f\u80fd\u7684\u7591\u95ee&#xff0c;\u8fd8\u662f\u5904\u7406\u552e\u540e\u95ee\u9898&#xff0c;RAG \u90fd\u80fd\u5927\u5927\u63d0\u5347\u5ba2\u670d\u673a\u5668\u4eba\u7684\u670d\u52a1\u8d28\u91cf\u548c\u6548\u7387&#xff0c;\u51cf\u8f7b\u4eba\u5de5\u5ba2\u670d\u7684\u5de5\u4f5c\u538b\u529b \u3002<\/p>\n<p>\u6559\u80b2\u9886\u57df&#xff0c;RAG \u53ef\u4f5c\u4e3a\u667a\u80fd\u8f85\u5bfc\u5de5\u5177&#xff0c;\u6839\u636e\u5b66\u751f\u7684\u95ee\u9898&#xff0c;\u4ece\u6559\u6750\u3001\u5b66\u672f\u8bba\u6587\u7b49\u8d44\u6599\u4e2d\u68c0\u7d22\u76f8\u5173\u5185\u5bb9&#xff0c;\u4e3a\u5b66\u751f\u63d0\u4f9b\u8be6\u7ec6\u51c6\u786e\u7684\u89e3\u7b54 \u3002\u8fd8\u80fd\u901a\u8fc7\u5206\u6790\u5b66\u751f\u7684\u5b66\u4e60\u60c5\u51b5\u548c\u95ee\u9898\u7c7b\u578b&#xff0c;\u63d0\u4f9b\u4e2a\u6027\u5316\u7684\u5b66\u4e60\u5efa\u8bae\u548c\u7ec3\u4e60\u63a8\u8350&#xff0c;\u5e2e\u52a9\u5b66\u751f\u66f4\u597d\u5730\u638c\u63e1\u77e5\u8bc6&#xff0c;\u63d0\u9ad8\u5b66\u4e60\u6548\u7387 \u3002<\/p>\n<p>\u533b\u7597\u884c\u4e1a\u4e2d&#xff0c;\u533b\u751f\u501f\u52a9 RAG \u6280\u672f&#xff0c;\u53ef\u4ee5\u8bbf\u95ee\u6700\u65b0\u7684\u533b\u5b66\u6587\u732e\u3001\u4e34\u5e8a\u6307\u5357\u548c\u75c5\u4f8b\u6570\u636e \u3002\u5728\u8bca\u65ad\u75be\u75c5\u65f6&#xff0c;\u7cfb\u7edf\u68c0\u7d22\u76f8\u5173\u4fe1\u606f&#xff0c;\u4e3a\u533b\u751f\u63d0\u4f9b\u53c2\u8003&#xff0c;\u8f85\u52a9\u533b\u751f\u505a\u51fa\u66f4\u51c6\u786e\u7684\u8bca\u65ad\u548c\u6cbb\u7597\u65b9\u6848 \u3002\u6b64\u5916&#xff0c;RAG \u8fd8\u80fd\u7528\u4e8e\u533b\u5b66\u7814\u7a76&#xff0c;\u5e2e\u52a9\u79d1\u7814\u4eba\u5458\u5feb\u901f\u68c0\u7d22\u548c\u5206\u6790\u5927\u91cf\u7684\u533b\u5b66\u8d44\u6599&#xff0c;\u63a8\u52a8\u533b\u5b66\u9886\u57df\u7684\u7814\u7a76\u8fdb\u5c55 \u3002<\/p>\n<p>\u6cd5\u5f8b\u884c\u4e1a\u91cc&#xff0c;\u6cd5\u5f8b\u4e13\u4e1a\u4eba\u58eb\u4f7f\u7528 RAG \u80fd\u591f\u5feb\u901f\u68c0\u7d22\u6cd5\u89c4\u3001\u5224\u4f8b\u548c\u6587\u4e66\u6458\u8981 \u3002\u5728\u5904\u7406\u6848\u4ef6\u65f6&#xff0c;\u5f8b\u5e08\u53ef\u4ee5\u901a\u8fc7 RAG \u8fc5\u901f\u627e\u5230\u76f8\u5173\u7684\u6cd5\u5f8b\u6761\u6587\u548c\u7c7b\u4f3c\u6848\u4f8b&#xff0c;\u4e3a\u6848\u4ef6\u7684\u5206\u6790\u548c\u8fa9\u62a4\u63d0\u4f9b\u6709\u529b\u652f\u6301 &#xff0c;\u663e\u8457\u8282\u7ea6\u65f6\u95f4\u6210\u672c&#xff0c;\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387 \u3002<\/p>\n<p>\u5c55\u671b\u672a\u6765&#xff0c;RAG \u6280\u672f\u8fd8\u6709\u5f88\u5927\u7684\u53d1\u5c55\u7a7a\u95f4 \u3002\u5728\u68c0\u7d22\u673a\u5236\u65b9\u9762&#xff0c;\u672a\u6765\u7684\u7814\u7a76\u5c06\u81f4\u529b\u4e8e\u8fdb\u4e00\u6b65\u63d0\u5347\u68c0\u7d22\u7684\u7cbe\u5ea6\u548c\u6548\u7387 \u3002\u901a\u8fc7\u4f18\u5316\u68c0\u7d22\u7b97\u6cd5&#xff0c;\u5229\u7528\u66f4\u5148\u8fdb\u7684\u673a\u5668\u5b66\u4e60\u548c\u6df1\u5ea6\u5b66\u4e60\u6280\u672f&#xff0c;\u8ba9 RAG \u80fd\u591f\u5728\u6d77\u91cf\u7684\u6570\u636e\u4e2d\u66f4\u5feb\u901f\u3001\u51c6\u786e\u5730\u627e\u5230\u6700\u76f8\u5173\u7684\u4fe1\u606f \u3002<\/p>\n<p>\u591a\u6a21\u6001\u6570\u636e\u878d\u5408\u4e5f\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u53d1\u5c55\u65b9\u5411 \u3002\u968f\u7740\u6280\u672f\u7684\u4e0d\u65ad\u8fdb\u6b65&#xff0c;RAG \u6709\u671b\u4e0e\u591a\u6a21\u6001 AI \u76f8\u7ed3\u5408&#xff0c;\u5c06\u6587\u672c\u3001\u56fe\u50cf\u3001\u89c6\u9891\u7b49\u591a\u79cd\u7c7b\u578b\u7684\u6570\u636e\u8fdb\u884c\u7efc\u5408\u5904\u7406 \u3002\u4f8b\u5982&#xff0c;\u5728\u533b\u7597\u9886\u57df&#xff0c;\u7ed3\u5408\u60a3\u8005\u7684\u75c5\u5386\u6587\u672c\u4fe1\u606f\u548c\u533b\u5b66\u5f71\u50cf\u6570\u636e&#xff0c;\u4e3a\u533b\u751f\u63d0\u4f9b\u66f4\u5168\u9762\u3001\u51c6\u786e\u7684\u8bca\u65ad\u8f85\u52a9&#xff1b;\u5728\u6559\u80b2\u9886\u57df&#xff0c;\u901a\u8fc7\u878d\u5408\u6587\u672c\u8bb2\u89e3\u548c\u52a8\u753b\u6f14\u793a\u7b49\u591a\u6a21\u6001\u4fe1\u606f&#xff0c;\u4e3a\u5b66\u751f\u521b\u9020\u66f4\u52a0\u4e30\u5bcc\u3001\u751f\u52a8\u7684\u5b66\u4e60\u4f53\u9a8c \u3002<\/p>\n<p>\u6b64\u5916&#xff0c;\u968f\u7740\u5404\u884c\u4e1a\u5bf9\u667a\u80fd\u5316\u9700\u6c42\u7684\u4e0d\u65ad\u589e\u52a0&#xff0c;RAG \u7684\u884c\u4e1a\u5b9a\u5236\u5316\u5e94\u7528\u5c06\u6210\u4e3a\u8d8b\u52bf \u3002\u9488\u5bf9\u4e0d\u540c\u884c\u4e1a\u7684\u7279\u70b9\u548c\u9700\u6c42&#xff0c;\u5f00\u53d1\u51fa\u66f4\u5177\u9488\u5bf9\u6027\u7684 RAG \u89e3\u51b3\u65b9\u6848&#xff0c;\u8ba9 RAG \u66f4\u597d\u5730\u670d\u52a1\u4e8e\u5404\u4e2a\u884c\u4e1a\u7684\u5b9e\u9645\u4e1a\u52a1\u573a\u666f&#xff0c;\u63a8\u52a8\u884c\u4e1a\u7684\u667a\u80fd\u5316\u8f6c\u578b\u548c\u53d1\u5c55 \u3002<\/p>\n<h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<p>RAG \u4f5c\u4e3a\u4e00\u79cd\u521b\u65b0\u7684\u6280\u672f\u6846\u67b6&#xff0c;\u4e3a\u5927\u6a21\u578b\u7684\u53d1\u5c55\u6ce8\u5165\u4e86\u65b0\u7684\u6d3b\u529b \u3002\u5b83\u5de7\u5999\u5730\u5c06\u68c0\u7d22\u6280\u672f\u4e0e\u751f\u6210\u6a21\u578b\u76f8\u7ed3\u5408&#xff0c;\u6709\u6548\u5f25\u8865\u4e86\u5927\u6a21\u578b\u5728\u77e5\u8bc6\u65f6\u6548\u6027\u3001\u51c6\u786e\u6027\u548c\u4e13\u4e1a\u6027\u7b49\u65b9\u9762\u7684\u4e0d\u8db3 \u3002\u901a\u8fc7\u6784\u5efa\u5f3a\u5927\u7684\u77e5\u8bc6\u5e93\u548c\u9ad8\u6548\u7684\u68c0\u7d22\u673a\u5236&#xff0c;RAG \u80fd\u591f\u8ba9\u5927\u6a21\u578b\u5728\u751f\u6210\u56de\u7b54\u65f6&#xff0c;\u5145\u5206\u5229\u7528\u5916\u90e8\u77e5\u8bc6&#xff0c;\u4ece\u800c\u751f\u6210\u66f4\u52a0\u51c6\u786e\u3001\u4e30\u5bcc\u548c\u53ef\u9760\u7684\u5185\u5bb9 \u3002<\/p>\n<p>\u4ece\u5b9e\u9645\u5e94\u7528\u6765\u770b&#xff0c;RAG \u5728\u667a\u80fd\u5ba2\u670d\u3001\u6559\u80b2\u3001\u533b\u7597\u3001\u6cd5\u5f8b\u7b49\u591a\u4e2a\u9886\u57df\u90fd\u5c55\u73b0\u51fa\u4e86\u5de8\u5927\u7684\u6f5c\u529b &#xff0c;\u4e3a\u5404\u884c\u4e1a\u7684\u667a\u80fd\u5316\u8f6c\u578b\u63d0\u4f9b\u4e86\u6709\u529b\u652f\u6301 \u3002\u800c\u901a\u8fc7\u672c\u6587\u7684\u4ee3\u7801\u5b9e\u64cd&#xff0c;\u76f8\u4fe1\u5927\u5bb6\u5df2\u7ecf\u5bf9 RAG \u7684\u5b9e\u73b0\u6709\u4e86\u66f4\u76f4\u89c2\u7684\u8ba4\u8bc6 &#xff0c;\u80fd\u591f\u4eb2\u8eab\u4f53\u9a8c\u5230 RAG \u6280\u672f\u7684\u9b45\u529b\u548c\u5e94\u7528\u4ef7\u503c \u3002<\/p>\n<p>\u968f\u7740\u4eba\u5de5\u667a\u80fd\u6280\u672f\u7684\u4e0d\u65ad\u53d1\u5c55&#xff0c;RAG \u6280\u672f\u4e5f\u5c06\u6301\u7eed\u6f14\u8fdb &#xff0c;\u672a\u6765&#xff0c;\u5b83\u6709\u671b\u5728\u66f4\u591a\u9886\u57df\u53d1\u6325\u91cd\u8981\u4f5c\u7528 &#xff0c;\u4e3a\u6211\u4eec\u5e26\u6765\u66f4\u591a\u7684\u60ca\u559c\u548c\u53d8\u9769 \u3002\u5e0c\u671b\u5927\u5bb6\u901a\u8fc7\u672c\u6587\u5bf9 RAG \u6709\u4e86\u5168\u9762\u6df1\u5165\u7684\u4e86\u89e3\u540e&#xff0c;\u80fd\u591f\u79ef\u6781\u63a2\u7d22\u548c\u5b9e\u8df5 RAG \u6280\u672f &#xff0c;\u5c06\u5176\u5e94\u7528\u5230\u66f4\u591a\u7684\u5b9e\u9645\u573a\u666f\u4e2d&#xff0c;\u5171\u540c\u63a8\u52a8\u4eba\u5de5\u667a\u80fd\u6280\u672f\u7684\u53d1\u5c55\u548c\u521b\u65b0 \u3002<\/p>\n<h3>\u66f4\u591a\u5927\u6a21\u578b\u77e5\u8bc6\u5206\u4eab<\/h3>\n<p>\u6ce1\u6ce1\u641c\u7d22\u3010\u7801\u4e0a\u6709\u6a21\u529b\u3011<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.1k\u6b21\uff0c\u70b9\u8d5e28\u6b21\uff0c\u6536\u85cf9\u6b21\u3002RAG \u4f5c\u4e3a\u4e00\u79cd\u521b\u65b0\u7684\u6280\u672f\u6846\u67b6\uff0c\u4e3a\u5927\u6a21\u578b\u7684\u53d1\u5c55\u6ce8\u5165\u4e86\u65b0\u7684\u6d3b\u529b\u3002\u5b83\u5de7\u5999\u5730\u5c06\u68c0\u7d22\u6280\u672f\u4e0e\u751f\u6210\u6a21\u578b\u76f8\u7ed3\u5408\uff0c\u6709\u6548\u5f25\u8865\u4e86\u5927\u6a21\u578b\u5728\u77e5\u8bc6\u65f6\u6548\u6027\u3001\u51c6\u786e\u6027\u548c\u4e13\u4e1a\u6027\u7b49\u65b9\u9762\u7684\u4e0d\u8db3\u3002\u901a\u8fc7\u6784\u5efa\u5f3a\u5927\u7684\u77e5\u8bc6\u5e93\u548c\u9ad8\u6548\u7684\u68c0\u7d22\u673a\u5236\uff0cRAG \u80fd\u591f\u8ba9\u5927\u6a21\u578b\u5728\u751f\u6210\u56de\u7b54\u65f6\uff0c\u5145\u5206\u5229\u7528\u5916\u90e8\u77e5\u8bc6\uff0c\u4ece\u800c\u751f\u6210\u66f4\u52a0\u51c6\u786e\u3001\u4e30\u5bcc\u548c\u53ef\u9760\u7684\u5185\u5bb9\u3002\u4ece\u5b9e\u9645\u5e94\u7528\u6765\u770b\uff0cRAG \u5728\u667a\u80fd\u5ba2\u670d\u3001\u6559\u80b2\u3001\u533b\u7597\u3001\u6cd5\u5f8b\u7b49\u591a\u4e2a\u9886\u57df\u90fd\u5c55\u73b0\u51fa\u4e86\u5de8\u5927\u7684\u6f5c\u529b \uff0c\u4e3a\u5404\u884c\u4e1a\u7684\u667a\u80fd\u5316\u8f6c\u578b\u63d0\u4f9b\u4e86\u6709\u529b\u652f\u6301\u3002<\/p>\n","protected":false},"author":2,"featured_media":51352,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[66,50,51],"topic":[],"class_list":["post-51354","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ai","tag-50","tag-51"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/51354.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.1k\u6b21\uff0c\u70b9\u8d5e28\u6b21\uff0c\u6536\u85cf9\u6b21\u3002RAG \u4f5c\u4e3a\u4e00\u79cd\u521b\u65b0\u7684\u6280\u672f\u6846\u67b6\uff0c\u4e3a\u5927\u6a21\u578b\u7684\u53d1\u5c55\u6ce8\u5165\u4e86\u65b0\u7684\u6d3b\u529b\u3002\u5b83\u5de7\u5999\u5730\u5c06\u68c0\u7d22\u6280\u672f\u4e0e\u751f\u6210\u6a21\u578b\u76f8\u7ed3\u5408\uff0c\u6709\u6548\u5f25\u8865\u4e86\u5927\u6a21\u578b\u5728\u77e5\u8bc6\u65f6\u6548\u6027\u3001\u51c6\u786e\u6027\u548c\u4e13\u4e1a\u6027\u7b49\u65b9\u9762\u7684\u4e0d\u8db3\u3002\u901a\u8fc7\u6784\u5efa\u5f3a\u5927\u7684\u77e5\u8bc6\u5e93\u548c\u9ad8\u6548\u7684\u68c0\u7d22\u673a\u5236\uff0cRAG \u80fd\u591f\u8ba9\u5927\u6a21\u578b\u5728\u751f\u6210\u56de\u7b54\u65f6\uff0c\u5145\u5206\u5229\u7528\u5916\u90e8\u77e5\u8bc6\uff0c\u4ece\u800c\u751f\u6210\u66f4\u52a0\u51c6\u786e\u3001\u4e30\u5bcc\u548c\u53ef\u9760\u7684\u5185\u5bb9\u3002\u4ece\u5b9e\u9645\u5e94\u7528\u6765\u770b\uff0cRAG \u5728\u667a\u80fd\u5ba2\u670d\u3001\u6559\u80b2\u3001\u533b\u7597\u3001\u6cd5\u5f8b\u7b49\u591a\u4e2a\u9886\u57df\u90fd\u5c55\u73b0\u51fa\u4e86\u5de8\u5927\u7684\u6f5c\u529b \uff0c\u4e3a\u5404\u884c\u4e1a\u7684\u667a\u80fd\u5316\u8f6c\u578b\u63d0\u4f9b\u4e86\u6709\u529b\u652f\u6301\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/51354.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-10T13:35:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810133547-6898a033be447.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/51354.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/51354.html\",\"name\":\"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-10T13:35:53+00:00\",\"dateModified\":\"2025-08-10T13:35:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/51354.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/51354.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/51354.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/51354.html","og_locale":"zh_CN","og_type":"article","og_title":"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.1k\u6b21\uff0c\u70b9\u8d5e28\u6b21\uff0c\u6536\u85cf9\u6b21\u3002RAG \u4f5c\u4e3a\u4e00\u79cd\u521b\u65b0\u7684\u6280\u672f\u6846\u67b6\uff0c\u4e3a\u5927\u6a21\u578b\u7684\u53d1\u5c55\u6ce8\u5165\u4e86\u65b0\u7684\u6d3b\u529b\u3002\u5b83\u5de7\u5999\u5730\u5c06\u68c0\u7d22\u6280\u672f\u4e0e\u751f\u6210\u6a21\u578b\u76f8\u7ed3\u5408\uff0c\u6709\u6548\u5f25\u8865\u4e86\u5927\u6a21\u578b\u5728\u77e5\u8bc6\u65f6\u6548\u6027\u3001\u51c6\u786e\u6027\u548c\u4e13\u4e1a\u6027\u7b49\u65b9\u9762\u7684\u4e0d\u8db3\u3002\u901a\u8fc7\u6784\u5efa\u5f3a\u5927\u7684\u77e5\u8bc6\u5e93\u548c\u9ad8\u6548\u7684\u68c0\u7d22\u673a\u5236\uff0cRAG \u80fd\u591f\u8ba9\u5927\u6a21\u578b\u5728\u751f\u6210\u56de\u7b54\u65f6\uff0c\u5145\u5206\u5229\u7528\u5916\u90e8\u77e5\u8bc6\uff0c\u4ece\u800c\u751f\u6210\u66f4\u52a0\u51c6\u786e\u3001\u4e30\u5bcc\u548c\u53ef\u9760\u7684\u5185\u5bb9\u3002\u4ece\u5b9e\u9645\u5e94\u7528\u6765\u770b\uff0cRAG \u5728\u667a\u80fd\u5ba2\u670d\u3001\u6559\u80b2\u3001\u533b\u7597\u3001\u6cd5\u5f8b\u7b49\u591a\u4e2a\u9886\u57df\u90fd\u5c55\u73b0\u51fa\u4e86\u5de8\u5927\u7684\u6f5c\u529b \uff0c\u4e3a\u5404\u884c\u4e1a\u7684\u667a\u80fd\u5316\u8f6c\u578b\u63d0\u4f9b\u4e86\u6709\u529b\u652f\u6301\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/51354.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-10T13:35:53+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810133547-6898a033be447.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/51354.html","url":"https:\/\/www.wsisp.com\/helps\/51354.html","name":"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-10T13:35:53+00:00","dateModified":"2025-08-10T13:35:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/51354.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/51354.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/51354.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"RAG\uff1a\u5927\u6a21\u578b\u7684\u5916\u6302\u795e\u5668\uff0c\u89e3\u9501AI\u65b0\u59ff\u52bf"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/51354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=51354"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/51354\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/51352"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=51354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=51354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=51354"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=51354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}