{"id":51116,"date":"2025-08-28T03:47:19","date_gmt":"2025-08-27T19:47:19","guid":{"rendered":"https:\/\/www.kdjingpai.com\/?p=51116"},"modified":"2025-08-28T03:49:09","modified_gmt":"2025-08-27T19:49:09","slug":"rag-anything","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/de\/rag-anything\/","title":{"rendered":"RAG-Anything\uff1a\u4e00\u4e2a\u80fd\u5904\u7406\u56fe\u6587\u8868\u683c\u7684\u5168\u80fdRAG\u7cfb\u7edf"},"content":{"rendered":"<p>RAG-Anything \u662f\u4e00\u4e2a\u57fa\u4e8e <a href=\"https:\/\/www.kdjingpai.com\/ja\/lightrag\/\">LightRAG<\/a> \u6784\u5efa\u7684\u5168\u9762\u7684\u4e00\u4f53\u5316\u591a\u6a21\u6001\u6587\u6863\u5904\u7406 <a href=\"https:\/\/www.kdjingpai.com\/ja\/rag\/\">RAG<\/a> \u7cfb\u7edf\u3002\u4f20\u7edf\u7684\u95ee\u7b54\u7cfb\u7edf\uff08RAG\uff09\u5927\u591a\u53ea\u80fd\u5904\u7406\u7eaf\u6587\u672c\u5185\u5bb9\uff0c\u4f46\u6211\u4eec\u65e5\u5e38\u63a5\u89e6\u7684\u6587\u6863\uff0c\u6bd4\u5982PDF\u3001Word\u6587\u6863\u6216\u6f14\u793a\u6587\u7a3f\uff0c\u5f80\u5f80\u5305\u542b\u7740\u6587\u5b57\u3001\u56fe\u7247\u3001\u8868\u683c\u3001\u516c\u5f0f\u7b49\u591a\u79cd\u7c7b\u578b\u7684\u5185\u5bb9\u3002\u5982\u679c\u53ea\u63d0\u53d6\u6587\u5b57\uff0c\u5c31\u4f1a\u4e22\u5931\u5f88\u591a\u5173\u952e\u4fe1\u606f\u3002RAG-Anything\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u5b83\u53ef\u4ee5\u5b8c\u6574\u5730\u89e3\u6790\u8fd9\u4e9b\u5305\u542b\u591a\u79cd\u5185\u5bb9\u7684\u590d\u6742\u6587\u6863\uff0c\u65e0\u8bba\u662f\u6587\u672c\u3001\u56fe\u50cf\u3001\u8868\u683c\u8fd8\u662f\u6570\u5b66\u516c\u5f0f\uff0c\u90fd\u80fd\u51c6\u786e\u8bc6\u522b\u548c\u7406\u89e3\u3002\u5b83\u628a\u6587\u6863\u91cc\u7684\u6240\u6709\u5143\u7d20\u62c6\u89e3\u3001\u5206\u6790\uff0c\u7136\u540e\u6784\u5efa\u6210\u4e00\u4e2a\u77e5\u8bc6\u56fe\u8c31\uff0c\u8ba9\u4f60\u5728\u63d0\u95ee\u7684\u65f6\u5019\uff0c\u7cfb\u7edf\u4e0d\u4ec5\u80fd\u7406\u89e3\u6587\u5b57\uff0c\u8fd8\u80fd\u770b\u61c2\u56fe\u7247\u5185\u5bb9\u3001\u5206\u6790\u8868\u683c\u6570\u636e\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u5b83\u5c31\u80fd\u6839\u636e\u6587\u6863\u91cc\u7684\u5168\u90e8\u4fe1\u606f\uff0c\u7ed9\u51fa\u66f4\u5168\u9762\u3001\u66f4\u51c6\u786e\u7684\u56de\u7b54\u3002\u8fd9\u4e2a\u7cfb\u7edf\u7279\u522b\u9002\u5408\u5904\u7406\u5b66\u672f\u8bba\u6587\u3001\u6280\u672f\u624b\u518c\u3001\u8d22\u52a1\u62a5\u544a\u8fd9\u7c7b\u4fe1\u606f\u591a\u6837\u7684\u6587\u4ef6\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-51117\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/08\/ceaf45ebab24aba.png\" alt=\"\" width=\"2498\" height=\"1086\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/08\/ceaf45ebab24aba.png 2498w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/08\/ceaf45ebab24aba-1536x668.png 1536w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/08\/ceaf45ebab24aba-2048x890.png 2048w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/08\/ceaf45ebab24aba-18x8.png 18w\" sizes=\"auto, (max-width: 2498px) 100vw, 2498px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li><strong>\u4e00\u4f53\u5316\u5904\u7406\u6d41\u7a0b<\/strong>: \u4ece\u6587\u6863\u4e0a\u4f20\u3001\u89e3\u6790\uff0c\u5230\u6700\u7ec8\u7684\u667a\u80fd\u95ee\u7b54\uff0c\u6574\u4e2a\u6d41\u7a0b\u662f\u5b8c\u6574\u4e14\u81ea\u52a8\u5316\u7684\u3002<\/li>\n<li><strong>\u652f\u6301\u591a\u79cd\u6587\u4ef6\u683c\u5f0f<\/strong>: \u7528\u6237\u53ef\u4ee5\u4e0a\u4f20PDF\u3001Word\u3001PPT\u3001Excel\u3001\u56fe\u7247\u7b49\u591a\u79cd\u5e38\u89c1\u683c\u5f0f\u7684\u6587\u4ef6\u8fdb\u884c\u5904\u7406\u3002<\/li>\n<li><strong>\u4e13\u95e8\u7684\u5185\u5bb9\u5206\u6790\u5668<\/strong>: \u7cfb\u7edf\u5185\u7f6e\u4e86\u4e13\u95e8\u7528\u4e8e\u8bc6\u522b\u548c\u7406\u89e3\u56fe\u50cf\u3001\u8868\u683c\u3001\u6570\u5b66\u516c\u5f0f\u7b49\u4e0d\u540c\u5185\u5bb9\u7684\u5de5\u5177\u3002<\/li>\n<li><strong>\u6784\u5efa\u591a\u6a21\u6001\u77e5\u8bc6\u56fe\u8c31<\/strong>: \u5b83\u80fd\u81ea\u52a8\u63d0\u53d6\u6587\u4ef6\u4e2d\u7684\u5173\u952e\u4fe1\u606f\uff0c\u5e76\u5c06\u6587\u5b57\u3001\u56fe\u7247\u3001\u8868\u683c\u7b49\u5185\u5bb9\u4e4b\u95f4\u7684\u8054\u7cfb\u5efa\u7acb\u8d77\u6765\uff0c\u5f62\u6210\u4e00\u4e2a\u77e5\u8bc6\u7f51\u7edc\u3002<\/li>\n<li><strong>\u7075\u6d3b\u7684\u5904\u7406\u6a21\u5f0f<\/strong>: \u7528\u6237\u65e2\u53ef\u4ee5\u9009\u62e9\u8ba9\u7cfb\u7edf\u81ea\u52a8\u89e3\u6790\u6574\u4e2a\u6587\u6863\uff0c\u4e5f\u53ef\u4ee5\u628a\u81ea\u5df1\u5df2\u7ecf\u6574\u7406\u597d\u7684\u5185\u5bb9\u76f4\u63a5\u4ea4\u7ed9\u7cfb\u7edf\u5904\u7406\u3002<\/li>\n<li><strong>\u6df7\u5408\u5f0f\u667a\u80fd\u68c0\u7d22<\/strong>: \u5728\u67e5\u627e\u7b54\u6848\u65f6\uff0c\u7cfb\u7edf\u4f1a\u7ed3\u5408\u5173\u952e\u8bcd\u5339\u914d\u548c\u4e0a\u4e0b\u6587\u7406\u89e3\u4e24\u79cd\u65b9\u5f0f\uff0c\u66f4\u7cbe\u51c6\u5730\u5b9a\u4f4d\u4fe1\u606f\u3002<\/li>\n<li><strong>\u89c6\u89c9\u8bed\u8a00\u6a21\u578b\u589e\u5f3a\u67e5\u8be2<\/strong>: \u5f53\u7528\u6237\u63d0\u95ee\u6d89\u53ca\u56fe\u7247\u65f6\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u8c03\u7528\u89c6\u89c9\u6a21\u578b\u6765\u5206\u6790\u56fe\u7247\u5185\u5bb9\uff0c\u5b9e\u73b0\u56fe\u6587\u7ed3\u5408\u7684\u56de\u7b54\u3002<\/li>\n<\/ul>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<p>RAG-Anything \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u89e3\u6790\u5305\u542b\u6587\u5b57\u3001\u56fe\u7247\u3001\u8868\u683c\u7b49\u591a\u79cd\u5185\u5bb9\u7684\u6587\u6863\uff0c\u5e76\u5141\u8bb8\u4f60\u901a\u8fc7\u63d0\u95ee\u7684\u65b9\u5f0f\u4e0e\u8fd9\u4e9b\u6587\u6863\u8fdb\u884c\u4ea4\u4e92\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u6d41\u7a0b\u3002<\/p>\n<h3><strong>\u4e00\u3001 \u5b89\u88c5<\/strong><\/h3>\n<p>\u5b89\u88c5 RAG-Anything \u6709\u4e24\u79cd\u65b9\u5f0f\uff0c\u63a8\u8350\u4f7f\u7528\u7b2c\u4e00\u79cd\uff0c\u56e0\u4e3a\u5b83\u66f4\u7b80\u5355\u3002<\/p>\n<p><strong>\u65b9\u5f0f\u4e00\uff1a\u4ece PyPI \u76f4\u63a5\u5b89\u88c5 (\u63a8\u8350)<\/strong><\/p>\n<p>\u8fd9\u662f\u6700\u5feb\u6377\u7684\u5b89\u88c5\u65b9\u5f0f\u3002\u6253\u5f00\u4f60\u7684\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code># \u57fa\u7840\u5b89\u88c5\r\npip install raganything\r\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u57fa\u7840\u547d\u4ee4\u53ea\u5b89\u88c5\u4e86\u6838\u5fc3\u529f\u80fd\u3002\u73b0\u4ee3\u6587\u6863\u683c\u5f0f\u591a\u6837\uff0c\u4e3a\u4e86\u8ba9\u5b83\u80fd\u5904\u7406\u66f4\u591a\u7c7b\u578b\u7684\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5b89\u88c5\u989d\u5916\u7684\u529f\u80fd\u5305\u3002<\/p>\n<ul>\n<li>\u5982\u679c\u4f60\u60f3\u8ba9\u5b83\u5904\u7406\u6240\u6709\u652f\u6301\u7684\u6587\u4ef6\u7c7b\u578b\uff08\u63a8\u8350\uff09\uff1a<br \/>\n<code>pip install 'raganything[all]'<\/code><\/li>\n<li>\u5982\u679c\u4f60\u53ea\u9700\u8981\u5904\u7406\u56fe\u7247\u683c\u5f0f\uff08\u5982 BMP, TIFF, GIF\u7b49\uff09\uff1a<br \/>\n<code>pip install 'raganything[image]'<\/code><\/li>\n<li>\u5982\u679c\u4f60\u53ea\u9700\u8981\u5904\u7406\u7eaf\u6587\u672c\u6587\u4ef6\uff08\u5982 TXT, MD\uff09\uff1a<br \/>\n<code>pip install 'raganything[text]'<\/code><\/li>\n<\/ul>\n<p><strong>\u65b9\u5f0f\u4e8c\uff1a\u4ece\u6e90\u4ee3\u7801\u5b89\u88c5<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u60f3\u7814\u7a76\u5b83\u7684\u4ee3\u7801\u6216\u8005\u8fdb\u884c\u4e8c\u6b21\u5f00\u53d1\uff0c\u53ef\u4ee5\u9009\u62e9\u8fd9\u79cd\u65b9\u5f0f\u3002<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u628a\u4ee3\u7801\u4ece GitHub \u514b\u9686\u5230\u4f60\u7684\u7535\u8111\u4e0a\uff1a\n<pre><code>git clone https:\/\/github.com\/HKUDS\/RAG-Anything.git\r\n<\/code><\/pre>\n<\/li>\n<li>\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff1a\n<pre><code>cd RAG-Anything\r\n<\/code><\/pre>\n<\/li>\n<li>\u7136\u540e\u901a\u8fc7 pip \u5b89\u88c5\uff1a\n<pre><code>pip install -e .\r\n<\/code><\/pre>\n<\/li>\n<li>\u540c\u6837\u5730\uff0c\u5982\u679c\u9700\u8981\u652f\u6301\u6240\u6709\u6587\u4ef6\u683c\u5f0f\uff0c\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\uff1a<br \/>\n<code>pip install -e '.[all]'<\/code><\/li>\n<\/ol>\n<h3><strong>\u4e8c\u3001 \u73af\u5883\u914d\u7f6e<\/strong><\/h3>\n<p><strong>1. \u5b89\u88c5 LibreOffice<\/strong><\/p>\n<p>RAG-Anything \u5728\u5904\u7406 Office \u6587\u6863\uff08\u5982 .docx, .pptx, .xlsx\uff09\u65f6\uff0c\u9700\u8981\u501f\u52a9 LibreOffice \u8fd9\u4e2a\u514d\u8d39\u7684\u529e\u516c\u8f6f\u4ef6\u3002\u4f60\u5fc5\u987b\u5148\u5728\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5\u5b83\u3002<\/p>\n<ul>\n<li><strong>Windows<\/strong>: \u524d\u5f80\u00a0<a href=\"https:\/\/www.libreoffice.org\/download\/download-libreoffice\/\">LibreOffice \u5b98\u7f51<\/a>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/li>\n<li><strong>macOS<\/strong>: \u4f7f\u7528 Homebrew \u5b89\u88c5\u4f1a\u5f88\u65b9\u4fbf\uff0c\u547d\u4ee4\u662f\u00a0<code>brew install --cask libreoffice<\/code>\u3002<\/li>\n<li><strong>Ubuntu\/Debian<\/strong>: \u4f7f\u7528\u547d\u4ee4\u00a0<code>sudo apt-get install libreoffice<\/code>\u3002<\/li>\n<\/ul>\n<p><strong>2. \u914d\u7f6e API \u5bc6\u94a5<\/strong><\/p>\n<p>RAG-Anything \u5728\u7406\u89e3\u5185\u5bb9\u548c\u751f\u6210\u56de\u7b54\u65f6\uff0c\u9700\u8981\u8c03\u7528\u5927\u8bed\u8a00\u6a21\u578b\uff08LLM\uff09\uff0c\u6bd4\u5982 OpenAI \u7684 GPT \u7cfb\u5217\u6a21\u578b\u3002\u4f60\u9700\u8981\u4e00\u4e2a API \u5bc6\u94a5\u3002<\/p>\n<p>\u5728\u4f60\u7684\u9879\u76ee\u6587\u4ef6\u5939\u91cc\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u00a0<code>.env<\/code>\u00a0\u7684\u6587\u4ef6\uff0c\u7136\u540e\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u590d\u5236\u8fdb\u53bb\uff0c\u5e76\u6362\u6210\u4f60\u81ea\u5df1\u7684\u5bc6\u94a5\u4fe1\u606f\u3002<\/p>\n<pre><code>OPENAI_API_KEY=\"sk-xxxxxxxxxxxxxxxxxxxxxxxx\"\r\n# \u5982\u679c\u4f60\u4f7f\u7528\u4ee3\u7406\u6216\u8005\u7b2c\u4e09\u65b9\u670d\u52a1\uff0c\u8fd8\u9700\u8981\u914d\u7f6e\u8fd9\u4e2a\u5730\u5740\r\nOPENAI_BASE_URL=\"https:\/\/api.your-proxy.com\/v1\"\r\n<\/code><\/pre>\n<h3><strong>\u4e09\u3001 \u4f7f\u7528\u65b9\u6cd5<\/strong><\/h3>\n<p>\u4e0b\u9762\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7684\u4f8b\u5b50\uff0c\u6765\u6f14\u793a\u5982\u4f55\u4f7f\u7528 RAG-Anything \u5904\u7406\u4e00\u4efd\u6587\u6863\u5e76\u8fdb\u884c\u63d0\u95ee\u3002<\/p>\n<p><strong>1. \u51c6\u5907\u5de5\u4f5c<\/strong><\/p>\n<p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u597d RAG-Anything \u5e76\u914d\u7f6e\u4e86 API \u5bc6\u94a5\u3002\u7136\u540e\uff0c\u51c6\u5907\u4e00\u4efd\u4f60\u60f3\u8981\u5904\u7406\u7684\u6587\u6863\uff0c\u6bd4\u5982\u4e00\u4e2a\u540d\u4e3a\u00a0<code>report.pdf<\/code>\u00a0\u7684\u6587\u4ef6\u3002<\/p>\n<p><strong>2. \u7f16\u5199\u4ee3\u7801<\/strong><\/p>\n<p>\u521b\u5efa\u4e00\u4e2a Python \u6587\u4ef6\uff0c\u4f8b\u5982\u00a0<code>main.py<\/code>\uff0c\u7136\u540e\u5c06\u4ee5\u4e0b\u4ee3\u7801\u590d\u5236\u8fdb\u53bb\u3002\u8fd9\u6bb5\u4ee3\u7801\u6f14\u793a\u4e86\u4ece\u914d\u7f6e\u3001\u5904\u7406\u6587\u6863\u5230\u63d0\u95ee\u7684\u5b8c\u6574\u6d41\u7a0b\u3002<\/p>\n<pre><code>import asyncio\r\nfrom raganything import RAGAnything, RAGAnythingConfig\r\nfrom lightrag.llm.openai import openai_complete_if_cache, openai_embed\r\nfrom lightrag.utils import EmbeddingFunc\r\n# \u5f02\u6b65\u51fd\u6570\u662f\u73b0\u4ee3Python\u4e2d\u5904\u7406\u9ad8\u5e76\u53d1\u4efb\u52a1\u7684\u65b9\u5f0f\r\nasync def main():\r\n# 1. \u8bbe\u7f6e\u4f60\u7684API\u5bc6\u94a5\u548c\u4ee3\u7406\u5730\u5740\r\napi_key = \"your-api-key\" # \u66ff\u6362\u6210\u4f60\u7684 OpenAI API Key\r\nbase_url = \"your-base-url\" # \u5982\u679c\u6709\u4ee3\u7406\uff0c\u66ff\u6362\u6210\u4f60\u7684\u4ee3\u7406\u5730\u5740\r\n# 2. \u914d\u7f6e RAG-Anything \u7684\u5de5\u4f5c\u65b9\u5f0f\r\nconfig = RAGAnythingConfig(\r\nworking_dir=\".\/rag_storage\",  # \u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u7528\u6765\u5b58\u653e\u5904\u7406\u540e\u7684\u6570\u636e\r\nparser=\"<a href=\"https:\/\/www.kdjingpai.com\/ja\/mineru\/\">mineru<\/a>\",              # \u4f7f\u7528mineru\u89e3\u6790\u5668\r\nparse_method=\"auto\",          # \u81ea\u52a8\u5224\u65ad\u89e3\u6790\u65b9\u5f0f\r\nenable_image_processing=True, # \u542f\u7528\u56fe\u7247\u5904\u7406\r\nenable_table_processing=True, # \u542f\u7528\u8868\u683c\u5904\u7406\r\n)\r\n# 3. \u5b9a\u4e49\u4e0e\u5927\u8bed\u8a00\u6a21\u578b\u4ea4\u4e92\u7684\u51fd\u6570\r\n# \u6587\u672c\u6a21\u578b\uff0c\u7528\u4e8e\u751f\u6210\u56de\u7b54\r\ndef llm_model_func(prompt, **kwargs):\r\nreturn openai_complete_if_cache(\r\n\"gpt-4o-mini\",\r\nprompt,\r\napi_key=api_key,\r\nbase_url=base_url,\r\n**kwargs,\r\n)\r\n# \u89c6\u89c9\u6a21\u578b\uff0c\u7528\u4e8e\u7406\u89e3\u56fe\u7247\u5185\u5bb9\r\ndef vision_model_func(prompt, image_data=None, **kwargs):\r\nreturn openai_complete_if_cache(\r\n\"gpt-4o\",\r\n\"\",\r\nmessages=[{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": prompt}, {\"type\": \"image_url\", \"image_url\": {\"url\": f\"data:image\/jpeg;base64,{image_data}\"}}]}],\r\napi_key=api_key,\r\nbase_url=base_url,\r\n**kwargs,\r\n)\r\n# \u5d4c\u5165\u6a21\u578b\uff0c\u7528\u4e8e\u5c06\u6587\u672c\u8f6c\u6362\u6210\u5411\u91cf\uff0c\u65b9\u4fbf\u8ba1\u7b97\u673a\u7406\u89e3\u548c\u68c0\u7d22\r\nembedding_func = EmbeddingFunc(\r\nembedding_dim=3072,\r\nfunc=lambda texts: openai_embed(\r\ntexts, model=\"text-embedding-3-large\", api_key=api_key, base_url=base_url\r\n),\r\n)\r\n# 4. \u521d\u59cb\u5316 RAG-Anything \u7cfb\u7edf\r\nrag = RAGAnything(\r\nconfig=config,\r\nllm_model_func=llm_model_func,\r\nvision_model_func=vision_model_func,\r\nembedding_func=embedding_func,\r\n)\r\n# 5. \u5904\u7406\u4f60\u7684\u6587\u6863\r\n# \u5c06 \"path\/to\/your\/document.pdf\" \u66ff\u6362\u6210\u4f60\u81ea\u5df1\u7684\u6587\u4ef6\u8def\u5f84\r\nawait rag.process_document_complete(\r\nfile_path=\"path\/to\/your\/document.pdf\", \r\noutput_dir=\".\/output\"\r\n)\r\n# 6. \u5f00\u59cb\u63d0\u95ee\r\nprint(\"\u6587\u6863\u5904\u7406\u5b8c\u6210\uff0c\u73b0\u5728\u53ef\u4ee5\u5f00\u59cb\u63d0\u95ee\u4e86\u3002\")\r\n# \u793a\u4f8b\u95ee\u9898\uff1a\u4e00\u4e2a\u7eaf\u6587\u672c\u95ee\u9898\r\ntext_result = await rag.aquery(\r\n\"\u8bf7\u603b\u7ed3\u4e00\u4e0b\u8fd9\u4efd\u6587\u6863\u7684\u6838\u5fc3\u89c2\u70b9\uff0c\u5e76\u5206\u6790\u56fe\u8868\u4f20\u8fbe\u4e86\u54ea\u4e9b\u4e3b\u8981\u4fe1\u606f\uff1f\", \r\nmode=\"hybrid\" # hybrid\u6a21\u5f0f\u4f1a\u7ed3\u5408\u591a\u79cd\u65b9\u5f0f\u68c0\u7d22\uff0c\u7ed3\u679c\u66f4\u51c6\r\n)\r\nprint(\"\u95ee\u9898\u7684\u56de\u7b54:\", text_result)\r\nif __name__ == \"__main__\":\r\nasyncio.run(main())\r\n<\/code><\/pre>\n<p><strong>3. \u8fd0\u884c\u4ee3\u7801<\/strong><\/p>\n<p>\u5c06\u4ee3\u7801\u4e2d\u7684\u00a0<code>your-api-key<\/code>\u3001<code>your-base-url<\/code>\u00a0\u548c\u00a0<code>path\/to\/your\/document.pdf<\/code>\u00a0\u66ff\u6362\u6210\u4f60\u81ea\u5df1\u7684\u5b9e\u9645\u4fe1\u606f\u3002\u7136\u540e\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u8fd9\u4e2a\u6587\u4ef6\uff1a<\/p>\n<pre><code>python main.py\r\n<\/code><\/pre>\n<p>\u7a0b\u5e8f\u4f1a\u9996\u5148\u4e0b\u8f7d\u9700\u8981\u7684\u6a21\u578b\uff0c\u7136\u540e\u5f00\u59cb\u89e3\u6790\u4f60\u6307\u5b9a\u7684\u6587\u6863\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u80fd\u4f1a\u6301\u7eed\u51e0\u5206\u949f\uff0c\u5177\u4f53\u65f6\u95f4\u53d6\u51b3\u4e8e\u6587\u6863\u7684\u5927\u5c0f\u548c\u590d\u6742\u7a0b\u5ea6\u3002\u5904\u7406\u5b8c\u6210\u540e\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u4f60\u63d0\u51fa\u7684\u95ee\u9898\u7684\u7b54\u6848\u3002<\/p>\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u5c55\u793a\u4e86 RAG-Anything \u7684\u6838\u5fc3\u7528\u6cd5\u3002\u5b83\u8fd8\u652f\u6301\u66f4\u591a\u9ad8\u7ea7\u529f\u80fd\uff0c\u6bd4\u5982\u6279\u91cf\u5904\u7406\u6574\u4e2a\u6587\u4ef6\u5939\u7684\u6587\u6863\u3001\u76f4\u63a5\u4f20\u5165\u5df2\u89e3\u6790\u597d\u7684\u5185\u5bb9\u3001\u6216\u8005\u5bf9\u7279\u5b9a\u7684\u56fe\u7247\u6216\u8868\u683c\u8fdb\u884c\u63d0\u95ee\uff0c\u4f60\u53ef\u4ee5\u67e5\u9605\u5b98\u65b9\u6587\u6863\u6765\u63a2\u7d22\u8fd9\u4e9b\u9ad8\u7ea7\u7528\u6cd5\u3002<\/p>\n<h2>\u5e94\u7528\u573a\u666f<\/h2>\n<ol>\n<li><strong>\u5b66\u672f\u7814\u7a76<\/strong><br \/>\n\u7814\u7a76\u4eba\u5458\u5728\u9605\u8bfb\u5927\u91cf\u8bba\u6587\u65f6\uff0c\u5f80\u5f80\u9700\u8981\u5904\u7406\u5305\u542b\u590d\u6742\u56fe\u8868\u3001\u6570\u5b66\u516c\u5f0f\u548c\u6587\u5b57\u7684PDF\u6587\u4ef6\u3002RAG-Anything\u53ef\u4ee5\u5b8c\u6574\u89e3\u6790\u8fd9\u4e9b\u8bba\u6587\uff0c\u5e2e\u52a9\u7814\u7a76\u4eba\u5458\u5feb\u901f\u5b9a\u4f4d\u5173\u952e\u4fe1\u606f\u3001\u7406\u89e3\u5b9e\u9a8c\u7ed3\u679c\u56fe\u8868\uff0c\u5e76\u6bd4\u8f83\u4e0d\u540c\u8bba\u6587\u7684\u6570\u636e\uff0c\u6781\u5927\u5730\u63d0\u5347\u4e86\u6587\u732e\u56de\u987e\u548c\u8d44\u6599\u6574\u7406\u7684\u6548\u7387\u3002<\/li>\n<li><strong>\u4f01\u4e1a\u77e5\u8bc6\u7ba1\u7406<\/strong><br \/>\n\u516c\u53f8\u5185\u90e8\u901a\u5e38\u6709\u5927\u91cf\u7684\u6280\u672f\u624b\u518c\u3001\u8d22\u52a1\u62a5\u544a\u3001\u5e02\u573a\u5206\u6790\u548c\u6f14\u793a\u6587\u7a3f\u3002\u8fd9\u4e9b\u6587\u4ef6\u683c\u5f0f\u5404\u5f02\uff0c\u5185\u5bb9\u6df7\u6742\u3002\u4f7f\u7528RAG-Anything\u53ef\u4ee5\u5efa\u7acb\u4e00\u4e2a\u7edf\u4e00\u7684\u4f01\u4e1a\u77e5\u8bc6\u5e93\uff0c\u5458\u5de5\u53ef\u4ee5\u76f4\u63a5\u7528\u81ea\u7136\u8bed\u8a00\u63d0\u95ee\uff0c\u6bd4\u5982\u201c\u67e5\u8be2\u53bb\u5e74\u7b2c\u4e09\u5b63\u5ea6\u7684\u9500\u552e\u6570\u636e\u56fe\u8868\u201d\u6216\u201c\u7ed9\u6211\u770b\u4e00\u4e0bXX\u4ea7\u54c1\u7684\u6280\u672f\u67b6\u6784\u56fe\u201d\uff0c\u7cfb\u7edf\u80fd\u591f\u4ece\u4e0d\u540c\u6587\u6863\u4e2d\u7cbe\u51c6\u5730\u627e\u5230\u5e76\u5448\u73b0\u76f8\u5173\u4fe1\u606f\u3002<\/li>\n<li><strong>\u91d1\u878d\u548c\u6cd5\u5f8b\u884c\u4e1a<\/strong><br \/>\n\u91d1\u878d\u5206\u6790\u5e08\u548c\u5f8b\u5e08\u9700\u8981\u9605\u8bfb\u5197\u957f\u7684\u62a5\u544a\u548c\u5408\u540c\u6587\u4ef6\uff0c\u8fd9\u4e9b\u6587\u4ef6\u91cc\u5145\u6ee1\u4e86\u6570\u636e\u8868\u683c\u3001\u6761\u6b3e\u7ec6\u5219\u548c\u56fe\u8868\u3002RAG-Anything\u53ef\u4ee5\u5e2e\u52a9\u4ed6\u4eec\u5feb\u901f\u63d0\u53d6\u5173\u952e\u6570\u636e\u3001\u8bc6\u522b\u5408\u540c\u4e2d\u7684\u7279\u5b9a\u6761\u6b3e\uff0c\u5e76\u5bf9\u8d22\u52a1\u62a5\u8868\u4e2d\u7684\u8868\u683c\u8fdb\u884c\u5206\u6790\uff0c\u8f85\u52a9\u4ed6\u4eec\u505a\u51fa\u66f4\u51c6\u786e\u7684\u51b3\u7b56\u3002<\/li>\n<li><strong>\u6559\u80b2\u548c\u5b66\u4e60<\/strong><br \/>\n\u5b66\u751f\u548c\u6559\u5e08\u53ef\u4ee5\u5229\u7528RAG-Anything\u6765\u5904\u7406\u6559\u6750\u3001\u8bfe\u4ef6\u548c\u5b66\u4e60\u8d44\u6599\u3002\u5b66\u751f\u53ef\u4ee5\u4e0a\u4f20\u8bfe\u4ef6PDF\u540e\uff0c\u9488\u5bf9\u91cc\u9762\u7684\u56fe\u8868\u548c\u6982\u5ff5\u8fdb\u884c\u63d0\u95ee\uff0c\u7cfb\u7edf\u53ef\u4ee5\u63d0\u4f9b\u8be6\u7ec6\u7684\u89e3\u91ca\u3002\u6559\u5e08\u4e5f\u53ef\u4ee5\u7528\u5b83\u6765\u5feb\u901f\u5236\u4f5c\u95ee\u7b54\u6750\u6599\uff0c\u6216\u8005\u6574\u7406\u4e0d\u540c\u6765\u6e90\u7684\u6559\u5b66\u8d44\u6e90\u3002<\/li>\n<\/ol>\n<h2>QA<\/h2>\n<ol>\n<li><strong>RAG-Anything \u548c\u5176\u4ed6\u666e\u901a\u7684RAG\u5de5\u5177\u6709\u4ec0\u4e48\u4e0d\u540c\uff1f<\/strong><br \/>\n\u6700\u5927\u7684\u4e0d\u540c\u5728\u4e8e\uff0cRAG-Anything\u80fd\u591f\u5904\u7406\u591a\u6a21\u6001\u5185\u5bb9\u3002\u666e\u901aRAG\u5de5\u5177\u901a\u5e38\u53ea\u80fd\u63d0\u53d6\u548c\u7406\u89e3\u6587\u6863\u4e2d\u7684\u7eaf\u6587\u672c\uff0c\u4f1a\u5ffd\u7565\u6389\u56fe\u7247\u3001\u8868\u683c\u3001\u516c\u5f0f\u7b49\u975e\u6587\u672c\u4fe1\u606f\u3002\u800cRAG-Anything\u4e13\u95e8\u8bbe\u8ba1\u4e86\u8bc6\u522b\u8fd9\u4e9b\u5185\u5bb9\u7684\u6a21\u5757\uff0c\u5b83\u80fd\u770b\u61c2\u56fe\u7247\u3001\u89e3\u6790\u8868\u683c\u6570\u636e\uff0c\u4ece\u800c\u5bf9\u6574\u4e2a\u6587\u6863\u6709\u4e00\u4e2a\u66f4\u5168\u9762\u7684\u7406\u89e3\uff0c\u63d0\u4f9b\u7684\u7b54\u6848\u4e5f\u56e0\u6b64\u66f4\u51c6\u786e\u3001\u4fe1\u606f\u66f4\u5b8c\u6574\u3002<\/li>\n<li><strong>\u5904\u7406Office\u6587\u6863\uff08Word, PPT\uff09\u65f6\uff0c\u4e3a\u4ec0\u4e48\u5fc5\u987b\u5b89\u88c5LibreOffice\uff1f<\/strong><br \/>\nRAG-Anything\u672c\u8eab\u4e0d\u76f4\u63a5\u89e3\u6790Office\u6587\u6863\u7684\u590d\u6742\u683c\u5f0f\uff0c\u800c\u662f\u8c03\u7528LibreOffice\u8fd9\u4e2a\u5f3a\u5927\u7684\u5f00\u6e90\u529e\u516c\u8f6f\u4ef6\u3002\u5b83\u5229\u7528LibreOffice\u5c06.docx\u3001.pptx\u7b49\u6587\u4ef6\u8f6c\u6362\u6210\u4e00\u79cd\u66f4\u6807\u51c6\u3001\u66f4\u5bb9\u6613\u5904\u7406\u7684\u4e2d\u95f4\u683c\u5f0f\uff0c\u7136\u540e\u518d\u8fdb\u884c\u5185\u5bb9\u63d0\u53d6\u548c\u5206\u6790\u3002\u6240\u4ee5\uff0cLibreOffice\u662f\u5904\u7406\u8fd9\u4e9b\u6587\u4ef6\u7684\u524d\u7f6e\u4f9d\u8d56\u3002<\/li>\n<li><strong>\u8fd9\u4e2a\u5de5\u5177\u662f\u514d\u8d39\u7684\u5417\uff1f\u4f7f\u7528\u5b83\u9700\u8981\u82b1\u94b1\u5417\uff1f<\/strong><br \/>\nRAG-Anything\u9879\u76ee\u672c\u8eab\u662f\u5f00\u6e90\u514d\u8d39\u7684\uff0c\u4f60\u53ef\u4ee5\u81ea\u7531\u4e0b\u8f7d\u548c\u4f7f\u7528\u5b83\u7684\u4ee3\u7801\u3002\u4f46\u662f\uff0c\u5b83\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u9700\u8981\u8c03\u7528\u5927\u8bed\u8a00\u6a21\u578b\uff08LLM\uff09\u548c\u5d4c\u5165\u6a21\u578b\uff08Embedding Model\uff09\u7684API\uff0c\u6bd4\u5982OpenAI\u7684GPT-4o\u3002\u8fd9\u4e9bAPI\u670d\u52a1\u901a\u5e38\u662f\u6309\u4f7f\u7528\u91cf\u6536\u8d39\u7684\u3002\u6240\u4ee5\u4f60\u7684\u6210\u672c\u4e3b\u8981\u6765\u81ea\u4e8e\u8fd9\u4e9b\u7b2c\u4e09\u65b9API\u7684\u8c03\u7528\u8d39\u7528\u3002<\/li>\n<li><strong>\u5982\u679c\u6211\u7684\u6587\u6863\u91cc\u6709\u624b\u5199\u7684\u516c\u5f0f\u6216\u8005\u4e0d\u6e05\u6670\u7684\u56fe\u8868\uff0c\u5b83\u80fd\u5904\u7406\u5417\uff1f<\/strong><br \/>\n\u5904\u7406\u6548\u679c\u53d6\u51b3\u4e8e\u5185\u5bb9\u7684\u6e05\u6670\u5ea6\u3002\u5bf9\u4e8e\u5370\u5237\u4f53\u7684\u6570\u5b66\u516c\u5f0f\u548c\u6e05\u6670\u7684\u56fe\u8868\uff0c\u5b83\u7684\u8bc6\u522b\u51c6\u786e\u7387\u5f88\u9ad8\u3002\u4f46\u5982\u679c\u56fe\u8868\u975e\u5e38\u6a21\u7cca\uff0c\u6216\u8005\u516c\u5f0f\u662f\u6f66\u8349\u7684\u624b\u5199\u4f53\uff0c\u7cfb\u7edf\u7684OCR\uff08\u5149\u5b66\u5b57\u7b26\u8bc6\u522b\uff09\u6a21\u5757\u53ef\u80fd\u96be\u4ee5\u51c6\u786e\u8bc6\u522b\uff0c\u8fd9\u4f1a\u5f71\u54cd\u6700\u7ec8\u7684\u7406\u89e3\u548c\u95ee\u7b54\u6548\u679c\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>RAG-Anything \u662f\u4e00\u4e2a\u57fa\u4e8e LightRAG \u6784\u5efa\u7684\u5168\u9762\u7684\u4e00\u4f53\u5316\u591a\u6a21\u6001\u6587\u6863\u5904\u7406 RAG \u7cfb\u7edf\u3002\u4f20\u7edf\u7684\u95ee\u7b54\u7cfb\u7edf\uff08RAG\uff09\u5927\u591a\u53ea\u80fd\u5904\u7406\u7eaf\u6587\u672c\u5185\u5bb9\uff0c\u4f46\u6211\u4eec\u65e5\u5e38\u63a5\u89e6\u7684\u6587\u6863\uff0c\u6bd4\u5982PDF\u3001Word\u6587\u6863\u6216\u6f14\u793a\u6587\u7a3f\uff0c\u5f80\u5f80\u5305\u542b\u7740\u6587\u5b57\u3001\u56fe\u7247\u3001\u8868\u683c\u3001\u516c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":32782,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[425,20,459],"tags":[230,260,243],"class_list":["post-51116","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-professional","category-tool","category-rag-project","tag-aikaiyuanxiangmu","tag-zhishitupu","tag-aizhishikuyukefu"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/51116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/comments?post=51116"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/posts\/51116\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media\/32782"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/media?parent=51116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/categories?post=51116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/de\/wp-json\/wp\/v2\/tags?post=51116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}