{"id":19789,"date":"2025-12-11T20:13:28","date_gmt":"2025-12-11T12:13:28","guid":{"rendered":"https:\/\/92it.top\/?p=19789"},"modified":"2025-12-11T20:13:28","modified_gmt":"2025-12-11T12:13:28","slug":"rag-%e5%a6%82%e4%bd%95%e5%88%86%e5%89%b2%e6%96%87%e6%a1%a3","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=19789","title":{"rendered":"RAG \u5982\u4f55\u5206\u5272\u6587\u6863"},"content":{"rendered":"\n<p><strong>\u80cc\u666f<\/strong>&nbsp;<strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5047\u5982\u6211\u4eec\u6709\u4e00\u4e2a\u5458\u5de5\u624b\u518c\uff0c\u505a RAG\uff08\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff09\uff0c\u90a3\u4e48\u5e94\u8be5\u5982\u4f55\u5206\u5757\u51c6\u5907\u6211\u4eec\u7684\u6587\u6863\uff0c\u5e76\u66f4\u65b0\u5230\u5411\u91cf\u6570\u636e\u5e93\u4e2d\u5462\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"822\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-1024x822.png\" alt=\"\" class=\"wp-image-19790\" style=\"width:460px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-1024x822.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-300x241.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-768x616.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-830x666.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-230x185.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-350x281.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22-480x385.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-22.png 1234w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u6838\u5fc3\u7b56\u7565<\/strong>&nbsp;<strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udd39\u6309\u201c\u8bed\u4e49\u7ed3\u6784\/\u6807\u9898\u201d\u5206\u5272 (Structure-based Splitting)<\/p>\n\n\n\n<p>Word\u6587\u6863\u662f\u5c42\u7ea7\u7ed3\u6784\uff08\u7ae0 -&gt; \u8282\uff09\u3002\u8fd9\u662f\u6700\u5929\u7136\u7684\u5206\u5272\u8fb9\u754c\u3002\u4e0d\u8981\u76f2\u76ee\u4f7f\u7528\u56fa\u5b9a\u5b57\u7b26\u6570\uff08\u5982\u6bcf\u5757500\u5b57\uff09\u5207\u5272\uff0c\u5426\u5219\u5bb9\u6613\u628a\u4e00\u6761\u5b8c\u6574\u7684\u89c4\u5b9a\u5207\u6210\u4e24\u534a\uff0c\u5bfc\u81f4\u4e0a\u4e0b\u6587\u4e22\u5931\u3002<\/p>\n\n\n\n<p>\u5efa\u8bae\u65b9\u6848\uff1aMarkdownHeaderTextSplitter (\u6216\u7c7b\u4f3c\u903b\u8f91)<br>\u5982\u679c\u4f60\u7684\u6e90\u6587\u4ef6\u662f Word\/PDF\uff0c\u5148\u5c06\u5176\u8f6c\u6362\u4e3a Markdown \u683c\u5f0f\uff0c\u4fdd\u7559\u6807\u9898\u5c42\u7ea7\uff08# \u7b2c\u4e00\u7ae0\uff0c## 1\u3001\u516c\u53f8\u7b80\u4ecb\uff09\u3002\u5229\u7528 LangChain \u6216 LlamaIndex \u7684 MarkdownHeaderTextSplitter\uff0c\u4ee5\u6807\u9898\u4e3a\u754c\u9650\u8fdb\u884c\u5207\u5206\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p>\ud83d\udd39\u5173\u952e\u6280\u5de7\uff1a\u5143\u6570\u636e\u589e\u5f3a (Metadata Injection)<\/p>\n\n\n\n<p>\u8fd9\u662f\u505a\u89c4\u7ae0\u5236\u5ea6 RAG \u6700\u91cd\u8981\u7684\u4e00\u70b9\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u53ea\u5207\u5206\u51fa\u4e00\u6bb5\u6587\u5b57\uff1a\u201c\u8fdf\u5230 30 \u5206\u949f\u4ee5\u4e0a\u6309\u65f7\u5de5\u5904\u7406\u201d\uff0c\u5f53\u7528\u6237\u95ee\u201c\u8003\u52e4\u600e\u4e48\u7b97\uff1f\u201d\u65f6\uff0c\u68c0\u7d22\u8fd8\u80fd\u5339\u914d\u3002\u4f46\u5982\u679c\u6587\u6863\u91cc\u6709\u4e24\u5904\u201c\u5904\u7f5a\u89c4\u5b9a\u201d\uff08\u4e00\u5904\u5728\u884c\u653f\uff0c\u4e00\u5904\u5728\u4e1a\u52a1\uff09\uff0cLLM \u5c31\u4f1a\u6df7\u6dc6\u3002<\/p>\n\n\n\n<p>\u4f60\u5e94\u8be5\u5c06\u7236\u7ea7\u6807\u9898\u52a0\u5165\u5230\u6bcf\u4e00\u4e2a Chunk \u7684\u5143\u6570\u636e\u6216\u5f00\u5934\u4e2d\u3002<\/p>\n\n\n\n<p>\u9519\u8bef\u7684 Chunk:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        \u8fdf\u523030\u5206\u949f\u6263\u9664\u534a\u5929\u5de5\u8d44...<\/pre>\n\n\n\n<p>\u6b63\u786e\u7684 Chunk (\u5305\u542b\u4e0a\u4e0b\u6587):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        [\u7b2c\u4e8c\u7ae0 \u4eba\u529b\u8d44\u6e90\u7ba1\u7406 - 3\u3001\u8003\u52e4\u7ba1\u7406\u5236\u5ea6]<br>            \u8fdf\u523030\u5206\u949f\u6263\u9664\u534a\u5929\u5de5\u8d44...<\/pre>\n\n\n\n<p>\u5efa\u8bae\uff1a \u5728\u5206\u5272\u65f6\uff0c\u5f3a\u5236\u8ba9\u6bcf\u4e2a\u5207\u7247\u90fd\u5e26\u4e0a\u8def\u5f84\uff1a<code>\u7b2c\u4e00\u7ae0\u4f01\u4e1a\u6587\u5316 &gt; 3\u3001\u5458\u5de5\u5b88\u5219<\/code>\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p>\ud83d\udd39\u8fdb\u9636\u7b56\u7565\uff1a\u7236\u6587\u6863\u68c0\u7d22 (Parent Document Retrieval)<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u89c4\u7ae0\u5236\u5ea6\uff0c\u6700\u6015\u201c\u65ad\u7ae0\u53d6\u4e49\u201d\u3002<\/p>\n\n\n\n<ul>\n<li>\u505a\u6cd5\uff1a\n<ul>\n<li>\u5207\u5206\uff08\u5c0f\uff09\uff1a \u5c06\u6587\u6863\u5207\u5f97\u5f88\u7ec6\uff08\u6bd4\u5982\u6309\u5177\u4f53\u7684\u6bcf\u4e00\u6761\u89c4\u5219\u5207\u5206\uff09\uff0c\u7528\u4e8e\u68c0\u7d22\u3002\u8fd9\u6837\u5339\u914d\u7cbe\u5ea6\u6781\u9ad8\u3002<\/li>\n\n\n\n<li>\u5b58\u50a8\uff08\u5927\uff09\uff1a \u6bcf\u4e00\u4e2a\u5c0f\u5207\u7247\u90fd\u5173\u8054\u5b83\u7684\u201c\u7236\u5757\u201d\uff08\u6bd4\u5982\u6574\u4e2a\u201c\u8003\u52e4\u7ba1\u7406\u5236\u5ea6\u201d\u8fd9\u4e00\u8282\uff09\u3002<\/li>\n\n\n\n<li>\u751f\u6210\uff1a \u5f53\u68c0\u7d22\u5230\u67d0\u6761\u89c4\u5219\u65f6\uff0c\u4e0d\u53ea\u628a\u8fd9\u53e5\u8bdd\u7ed9 LLM\uff0c\u800c\u662f\u628a\u6574\u8282\u5185\u5bb9\u7ed9 LLM\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u597d\u5904\uff1a \u5982\u679c\u7528\u6237\u95ee\u201c\u8bf7\u603b\u7ed3\u4e00\u4e0b\u8003\u52e4\u5236\u5ea6\u201d\uff0c\u5c0f\u5757\u68c0\u7d22\u80fd\u5b9a\u4f4d\u5230\u76f8\u5173\u5185\u5bb9\uff0c\u800c\u5927\u5757\u4e0a\u4e0b\u6587\u80fd\u8ba9 LLM \u5199\u51fa\u5b8c\u6574\u7684\u603b\u7ed3\uff0c\u800c\u4e0d\u662f\u53ea\u56de\u7b54\u67d0\u4e00\u6761\u89c4\u5219\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p>\ud83d\udd39\u603b\u7ed3\u53c2\u6570\u5efa\u8bae (\u4f5c\u4e3a\u8d77\u6b65\u914d\u7f6e)<\/p>\n\n\n\n<p>\u5982\u679c\u4f7f\u7528 LangChain\/LlamaIndex\uff0c\u9488\u5bf9\u6b64\u7c7b\u6587\u6863\u7684\u8d77\u6b65\u914d\u7f6e\u5efa\u8bae\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul>\n<li>Chunk Size (\u5757\u5927\u5c0f): 512 &#8211; 1000 Tokens (\u89c4\u7ae0\u5236\u5ea6\u901a\u5e38\u6bd4\u8f83\u7cbe\u70bc\uff0c\u592a\u5927\u4e86\u5bb9\u6613\u6df7\u6742\u4e0d\u540c\u4e3b\u9898)\u3002<\/li>\n\n\n\n<li>Chunk Overlap (\u91cd\u53e0): 100 &#8211; 150 Tokens (\u9632\u6b62\u4e00\u53e5\u8bdd\u88ab\u5207\u65ad)\u3002<\/li>\n\n\n\n<li>Splitter: \u4f18\u5148 <code>MarkdownHeaderTextSplitter<\/code> (\u6309 #, ## \u5206\u5272)\uff0c\u5982\u679c\u6ca1\u6cd5\u8f6c Markdown\uff0c\u5219\u4f7f\u7528 <code>RecursiveCharacterTextSplitter<\/code>\u3002<\/li>\n\n\n\n<li>Embedding \u6a21\u578b: \u63a8\u8350\u652f\u6301\u4e2d\u6587\u8f83\u597d\u7684\u6a21\u578b\uff08\u5982 BGE-M3, OpenAI text-embedding-3-large\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4e0d\u8981\u628a\u5b83\u4eec\u5f53\u6210\u7eaf\u6587\u672c\uff0c\u8981\u5f53\u6210<strong>\u6811\u72b6\u6570\u636e\u5e93<\/strong>\u6765\u5904\u7406\u3002\u4fdd\u7559\u201c\u7ae0\u8282-\u5c0f\u8282\u201d\u7684\u5c42\u7ea7\u5173\u7cfb\u662f\u56de\u7b54\u51c6\u786e\u7684\u5173\u952e\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e3a\u4ec0\u4e48\u8981\u628aword\u8f6c\u6210markdown<\/strong> <strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u505a RAG \u65f6\uff0c<strong>\u6570\u636e\u6e05\u6d17\u548c\u7ed3\u6784\u5316\uff08ETL\uff09<\/strong> \u5f80\u5f80\u6bd4\u6a21\u578b\u672c\u8eab\u66f4\u91cd\u8981\u3002<\/p>\n\n\n\n<p>\u6211\u5206\u4e24\u90e8\u5206\u6765\u56de\u7b54\uff1a\u5148\u89e3\u91ca<strong>\u4e3a\u4ec0\u4e48<\/strong>\u8981\u8fd9\u4e48\u6298\u817e\u8f6c\u6210 Markdown\uff0c\u518d\u624b\u628a\u624b\u6559\u4f60<strong>\u600e\u4e48\u7528<\/strong>\u4ee3\u7801\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p>\u4e3a\u4ec0\u4e48\u8981\u8d39\u52b2\u628a Word \u8f6c\u6210 Markdown\uff1f<\/p>\n\n\n\n<p>\u76f4\u63a5\u8bfb\u53d6 Word \u6216 PDF \u63d0\u53d6\u7eaf\u6587\u672c\uff08Plain Text\uff09\u7136\u540e\u5207\u5272\uff0c\u901a\u5e38\u4f1a\u6709\u4ee5\u4e0b\u51e0\u4e2a\u81f4\u547d\u95ee\u9898\uff0c\u800c Markdown \u80fd\u5b8c\u7f8e\u89e3\u51b3\uff1a<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p>\ud83d\udd39\u7eaf\u6587\u672c\u4e22\u5931\u4e86\u201c\u5c42\u7ea7\u7ed3\u6784\u201d<\/p>\n\n\n\n<ul>\n<li>Word\/\u7eaf\u6587\u672c\u7684\u95ee\u9898\uff1a \u5728 Word \u91cc\uff0c\u4f60\u770b\u5230\u201c\u7b2c\u4e00\u7ae0\u201d\u662f\u52a0\u7c97\u653e\u5927\u7684\uff0c\u4f46\u5728\u673a\u5668\u773c\u91cc\uff0c\u90a3\u5c31\u662f\u4e00\u4e32\u666e\u901a\u7684\u5b57\u7b26\u3002\u5982\u679c\u4f60\u6309\u6bcf 500 \u5b57\u5207\u5272\uff0c\u5207\u7247\u5668\u6839\u672c\u4e0d\u77e5\u9053\u201c\u8003\u52e4\u5236\u5ea6\u201d\u662f\u4ece\u54ea\u884c\u5f00\u59cb\u3001\u54ea\u884c\u7ed3\u675f\u7684\u3002<\/li>\n\n\n\n<li>Markdown \u7684\u4f18\u52bf\uff1a Markdown \u7528 <code>#<\/code>\u3001<code>##<\/code>\u3001<code>###<\/code> \u663e\u5f0f\u5730\u6807\u8bb0\u4e86\u5c42\u7ea7\u3002\u673a\u5668\u4e00\u770b\u5230 <code>#<\/code> \u5c31\u80fd\u786e\u5b9a\uff1a\u201c\u54e6\uff0c\u8fd9\u91cc\u662f\u4e00\u4e2a\u65b0\u7ae0\u8282\u7684\u5f00\u59cb\u201d\uff0c\u4ece\u800c\u5b9e\u73b0\u6309\u8bed\u4e49\u8fb9\u754c\u7cbe\u51c6\u5207\u5272\uff0c\u800c\u4e0d\u662f\u50bb\u50bb\u5730\u6309\u5b57\u6570\u5207\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>RAG \u6700\u6838\u5fc3\u7684\u75db\u70b9\uff1a\u4e22\u5931\u4e0a\u4e0b\u6587\uff08Context Lost\uff09<\/p>\n\n\n\n<ul>\n<li>\u573a\u666f\uff1a \u5047\u8bbe\u6587\u6863\u91cc\u6709\u4e24\u5904\u63d0\u5230\u201c\u7f5a\u6b3e 100 \u5143\u201d\uff0c\u4e00\u5904\u5728\u300a\u8003\u52e4\u5236\u5ea6\u300b\uff0c\u4e00\u5904\u5728\u300a\u4fdd\u5bc6\u5236\u5ea6\u300b\u3002<\/li>\n\n\n\n<li>\u666e\u901a\u5207\u5272\uff1a \u5207\u51fa\u6765\u4e00\u6bb5\u8bdd\uff1a\u201c<em>\u8fdd\u53cd\u89c4\u5b9a\u8005\u7f5a\u6b3e 100 \u5143<\/em>\u201d\u3002\n<ul>\n<li>\u7528\u6237\u95ee\uff1a\u201c\u8fdf\u5230\u7f5a\u591a\u5c11\uff1f\u201d -&gt; \u68c0\u7d22\u5230\u4e86\u8fd9\u6bb5\u8bdd\u3002<\/li>\n\n\n\n<li>LLM \u56de\u7b54\uff1a\u201c\u7f5a 100\u3002\u201d\uff08<strong>\u9519\uff01<\/strong> \u4e5f\u8bb8\u8fdf\u5230\u53ea\u7f5a 50\uff0c\u90a3\u6bb5\u8bdd\u5176\u5b9e\u662f\u8bf4\u6cc4\u5bc6\u7684\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>MarkdownHeader \u5207\u5272\uff1a \u5b83\u4f1a\u81ea\u52a8\u628a\u6807\u9898\u201c\u7ee7\u627f\u201d\u4e0b\u6765\u3002\n<ul>\n<li>\u5207\u51fa\u6765\u7684\u5757\u81ea\u5e26\u5143\u6570\u636e\uff1a<code>{'Header 1': '\u4fdd\u5bc6\u5236\u5ea6', 'Content': '\u8fdd\u53cd\u89c4\u5b9a\u8005\u7f5a\u6b3e100\u5143'}<\/code>\u3002<\/li>\n\n\n\n<li>LLM \u5c31\u80fd\u6839\u636e\u5143\u6570\u636e\u5224\u65ad\uff1a\u201c\u8fd9\u6bb5\u662f\u4fdd\u5bc6\u5236\u5ea6\u7684\uff0c\u8ddf\u8003\u52e4\u65e0\u5173\u3002\u201d<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p>\ud83d\udd39\u5927\u6a21\u578b\uff08LLM\uff09\u5929\u751f\u4eb2\u548c Markdown<\/p>\n\n\n\n<p>GPT\u3001Claude \u7b49\u6a21\u578b\u5728\u8bad\u7ec3\u65f6\u9605\u8bfb\u4e86\u6d77\u91cf\u7684 GitHub \u4ee3\u7801\u548c Markdown \u6587\u6863\u3002\u76f8\u6bd4\u4e8e\u4e71\u4e03\u516b\u7cdf\u7684\u7eaf\u6587\u672c\uff0cLLM \u5bf9 Markdown \u7684\u683c\u5f0f\uff08\u5217\u8868\u3001\u52a0\u7c97\u3001\u8868\u683c\uff09\u7406\u89e3\u80fd\u529b\u6781\u5f3a\uff0c\u80fd\u66f4\u597d\u5730\u63d0\u53d6\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>Chunk Overlap\uff08\u5757\u91cd\u53e0\uff09\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Chunk Overlap\uff08\u5757\u91cd\u53e0\uff09<\/strong> \u662f RAG \u6587\u6863\u5206\u5272\u4e2d\u4e00\u4e2a\u975e\u5e38\u5173\u952e\u7684\u53c2\u6570\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u5c31\u662f<strong>\u8ba9\u76f8\u90bb\u7684\u4e24\u4e2a\u5207\u7247\uff08Chunk\uff09\u4e4b\u95f4\u6709\u4e00\u90e8\u5206\u5185\u5bb9\u662f\u91cd\u590d\u7684<\/strong>\u3002<\/p>\n\n\n\n<p>\ud83d\udd39\u5f62\u8c61\u7684\u6bd4\u55bb<\/p>\n\n\n\n<p>\u60f3\u8c61\u4f60\u5728\u8d34\u74f7\u7816\u6216\u94fa\u74e6\u7247\u3002\u5982\u679c\u4f60\u628a\u74e6\u7247\u8fb9\u7f18\u5bf9\u5f97\u9f50\u9f50\u7684\uff08\u65e0\u91cd\u53e0\uff09\uff0c\u4e00\u65e6\u623f\u5b50\u70ed\u80c0\u51b7\u7f29\uff0c\u7f1d\u9699\u5c31\u4f1a\u6f0f\u96e8\u3002<br><strong>Chunk Overlap \u5c31\u662f\u8ba9\u74e6\u7247\u4e92\u76f8\u538b\u4f4f\u4e00\u90e8\u5206<\/strong>\uff0c\u786e\u4fdd\u6ca1\u6709\u4efb\u4f55\u7f1d\u9699\uff08\u4fe1\u606f\uff09\u6f0f\u6389\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u4e3a\u4ec0\u4e48\u8981\u7528 Overlap\uff1f\uff08\u89e3\u51b3\u201c\u65ad\u7ae0\u53d6\u4e49\u201d\u7684\u95ee\u9898\uff09<\/strong><\/p>\n\n\n\n<p>\u673a\u5668\u5207\u5206\u6587\u6863\u901a\u5e38\u662f\u5f88\u201c\u50bb\u201d\u7684\uff0c\u5b83\u53ef\u80fd\u4f1a\u521a\u597d\u5728\u53e5\u5b50\u7684\u4e2d\u95f4\u3001\u6216\u8005\u4e00\u4e2a\u91cd\u8981\u7684<strong>\u5173\u952e\u8bcd\u4e2d\u95f4<\/strong>\u5207\u4e86\u4e00\u5200\u3002<\/p>\n\n\n\n<p>\u4e3e\u4e2a\u5177\u4f53\u7684\u4f8b\u5b50\uff1a\u5047\u8bbe\u4f60\u7684\u5458\u5de5\u624b\u518c\u91cc\u6709\u4e00\u53e5\u8bdd\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u201c\u4e25\u7981\u5728\u529e\u516c\u533a\u57df\u5438\u70df\uff0c\u8fdd\u8005\u7f5a\u6b3e500\u5143\u3002\u201d<\/pre>\n\n\n\n<p>\u5982\u679c\u4e0d\u8bbe\u7f6e Overlap\uff0c\u673a\u5668\u53ef\u80fd\u521a\u597d\u5728\u7b2c 10 \u4e2a\u5b57\u5207\u5f00\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Chunk A (\u5207\u72471): ...\u5176\u4ed6\u89c4\u5b9a\u3002\u4e25\u7981\u5728\u529e\u516c\u533a\u57df\u5438<br>Chunk B (\u5207\u72472): \u70df\uff0c\u8fdd\u8005\u7f5a\u6b3e500\u5143\u3002...<\/pre>\n\n\n\n<p>\u8fd9\u65f6\u5019\u4f1a\u53d1\u751f\u4ec0\u4e48\u707e\u96be\uff1f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u8bed\u4e49\u4e22\u5931\uff1a Chunk A \u53ea\u8bf4\u4e86\u201c\u5438\u201d\uff0c\u6ca1\u8bf4\u662f\u201c\u5438\u70df\u201d\u3002Chunk B \u8bf4\u4e86\u201c\u70df\u201d\uff0c\u4f46\u6ca1\u8bf4\u201c\u4e25\u7981\u201d\u3002<br>\u68c0\u7d22\u5931\u6548\uff1a \u5f53\u7528\u6237\u95ee\u201c\u5438\u70df\u600e\u4e48\u5904\u7f5a\uff1f\u201d\u65f6\uff0c\u5411\u91cf\u6570\u636e\u5e93\u53ef\u80fd\u627e\u4e0d\u5230\u8fd9\u4e24\u4e2a\u5757\uff0c\u56e0\u4e3a\u5173\u952e\u8bcd\u201c\u5438\u70df\u201d\u88ab\u5207\u65ad\u4e86\uff0c\u4e24\u4e2a\u5757\u7684\u5411\u91cf\uff08Embedding\uff09\u90fd\u8ddf\u201c\u5438\u70df\u201d\u8fd9\u4e2a\u6982\u5ff5\u76f8\u5dee\u751a\u8fdc\u3002<\/pre>\n\n\n\n<p>\u5982\u679c\u8bbe\u7f6e\u4e86 Overlap (\u6bd4\u5982\u91cd\u53e0 5 \u4e2a\u5b57)\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Chunk A: ...\u5176\u4ed6\u89c4\u5b9a\u3002\u4e25\u7981\u5728\u529e\u516c\u533a\u57df\u5438\u70df\uff0c\u8fdd\u8005<br>Chunk B: \u5438\u70df\uff0c\u8fdd\u8005\u7f5a\u6b3e500\u5143\u3002...<\/pre>\n\n\n\n<p>\u7ed3\u679c\uff1a \u4e24\u4e2a\u5757\u91cc\u90fd\u5b8c\u6574\u4fdd\u7559\u4e86\u201c\u5438\u70df\u201d\u548c\u201c\u8fdd\u8005\u201d\u8fd9\u79cd\u5173\u952e\u8fde\u63a5\u8bcd\uff0c\u4fdd\u8bc1\u4e86\u8bed\u4e49\u7684\u8fde\u8d2f\u6027\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u56fe\u89e3<\/strong><\/p>\n\n\n\n<p>\u5047\u8bbe <code>Chunk Size = 10<\/code>\uff0c<code>Overlap = 4<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u539f\u6587\uff1a A B C D E F G H I J K L M N\n\nChunk 1:  [ A B C D E F G H I J ]\n                      |\u91cd\u53e0\u90e8\u5206|\nChunk 2:              [ G H I J K L M N ... ]<\/pre>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u770b\u5230\uff0c<code>G H I J<\/code> \u8fd9\u90e8\u5206\u5185\u5bb9\u5728\u4e24\u4e2a\u5757\u91cc\u90fd\u51fa\u73b0\u4e86\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u8bbe\u7f6e\u591a\u5c11\u6bd4\u8f83\u5408\u9002\uff1f<\/strong><\/p>\n\n\n\n<p>\u901a\u5e38\u5efa\u8bae Overlap \u8bbe\u7f6e\u4e3a Chunk Size \u7684 10% \u5230 20%\u3002<\/p>\n\n\n\n<p>\u9488\u5bf9\u4f60\u7684\u5458\u5de5\u624b\u518c\/\u89c4\u7ae0\u5236\u5ea6\u573a\u666f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u5982\u679c\u4f60\u7684 Chunk Size \u662f 500 \u5b57\u7b26\uff1a<br>    \u5efa\u8bae Overlap = 50 \u5230 100 \u5b57\u7b26\u3002<br>    \u89c4\u7ae0\u5236\u5ea6\u901a\u5e38\u53e5\u5b50\u6bd4\u8f83\u77ed\uff0c50 \u4e2a\u5b57\u7b26\u901a\u5e38\u80fd\u8986\u76d6\u534a\u4e2a\u53e5\u5b50\uff0c\u8db3\u591f\u8d77\u5230\u201c\u627f\u4e0a\u542f\u4e0b\u201d\u7684\u4f5c\u7528\u3002<br><br>\u5982\u679c\u4f60\u7684 Chunk Size \u662f 1000 \u5b57\u7b26\uff1a<br>    \u5efa\u8bae Overlap = 150 - 200 \u5b57\u7b26\u3002<\/pre>\n\n\n\n<p>Chunk Overlap \u7684\u4f5c\u7528\u5c31\u662f\u7ed9\u5207\u5206\u540e\u7684\u6587\u6863\u4e70\u4e00\u4efd\u201c\u4fdd\u9669\u201d\uff0c\u9632\u6b62\u673a\u5668\u5728\u5207\u5206\u65f6\u628a\u91cd\u8981\u7684\u4e0a\u4e0b\u6587\u8054\u7cfb\uff08\u6bd4\u5982\u4e3b\u8bed\u548c\u8c13\u8bed\u3001\u6761\u4ef6\u548c\u7ed3\u679c\uff09\u7ed9\u5207\u65ad\u4e86\u3002\u867d\u7136\u8fd9\u4f1a\u7a0d\u5fae\u589e\u52a0\u4e00\u70b9\u70b9\u6570\u636e\u5e93\u7684\u5b58\u50a8\u7a7a\u95f4\uff08\u56e0\u4e3a\u6709\u91cd\u590d\u5185\u5bb9\uff09\uff0c\u4f46\u4e3a\u4e86\u68c0\u7d22\u7684\u51c6\u786e\u6027\uff0c\u8fd9\u662f\u7edd\u5bf9\u503c\u5f97\u7684\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>Word \u8f6c Markdown\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><code>MarkItDown<\/code> \u662f\u5fae\u8f6f\uff08Microsoft\uff09\u6700\u8fd1\u5f00\u6e90\u7684\u4e00\u4e2a Python \u5e93\uff0c\u5b83\u7684\u8bbe\u8ba1\u76ee\u6807\u5c31\u662f<strong>\u6781\u5176\u7b80\u5355<\/strong>\u5730\u628a\u5404\u79cd\u4e71\u4e03\u516b\u7cdf\u7684\u6587\u4ef6\uff08Word, PDF, Excel, PPT\uff09\u7edf\u7edf\u8f6c\u6210\u6807\u51c6\u7684 Markdown\u3002<\/p>\n\n\n\n<p><span style=\"font-size: revert; color: initial;\">\u8fd9\u5c31\u597d\u6bd4\u7ed9 RAG \u7cfb\u7edf\u88c5\u4e86\u4e00\u4e2a\u201c\u4e07\u80fd\u7ffb\u8bd1\u5668\u201d\uff0c\u628a\u6240\u6709\u6587\u4ef6\u90fd\u53d8\u6210\u5927\u6a21\u578b\u6700\u7231\u8bfb\u7684\u683c\u5f0f\u3002<\/span><\/p>\n\n\n\n<p>\u9996\u5148\u5728\u4f60\u7684 Python \u73af\u5883\u4e2d\u5b89\u88c5\u5b83\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pip install markitdown<\/pre>\n\n\n\n<p>\u6700\u7b80\u5355\u7684\u7528\u6cd5\uff08\u5904\u7406 Word\/PDF\uff09<\/p>\n\n\n\n<p>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u6587\u4ef6\u53eb <code>\u5458\u5de5\u624b\u518c.docx<\/code> \u6216\u8005 <code>\u5458\u5de5\u624b\u518c.pdf<\/code>\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from markitdown import MarkItDown\n\n# 1. \u521d\u59cb\u5316\u8f6c\u6362\u5668\nmd = MarkItDown()\n\n# 2. \u8f6c\u6362\u6587\u4ef6 (\u652f\u6301 .pptx, .docx, .xlsx, .pdf \u7b49)\n# \u53ea\u8981\u628a\u6587\u4ef6\u8def\u5f84\u4f20\u8fdb\u53bb\uff0c\u5b83\u4f1a\u81ea\u52a8\u8bc6\u522b\u683c\u5f0f\nresult = md.convert(\"\u5458\u5de5\u624b\u518c.docx\")\n\n# 3. \u6253\u5370\u7ed3\u679c\n# result.text_content \u5c31\u662f\u8f6c\u6362\u597d\u7684 Markdown \u6587\u672c\nprint(result.text_content)\n\n# 4. (\u53ef\u9009) \u4fdd\u5b58\u6210 .md \u6587\u4ef6\uff0c\u65b9\u4fbf\u540e\u7eed\u67e5\u770b\u6216\u7ed9 Splitter \u4f7f\u7528\nwith open(\"\u5458\u5de5\u624b\u518c_converted.md\", \"w\", encoding=\"utf-8\") as f:\n    f.write(result.text_content)\n\nprint(\"\u8f6c\u6362\u5b8c\u6210\uff0c\u5df2\u4fdd\u5b58\u4e3a md \u6587\u4ef6\")<\/pre>\n\n\n\n<p>\u5b83\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/p>\n\n\n\n<ul>\n<li>Word \u91cc\u7684<strong>\u4e00\u7ea7\u6807\u9898<\/strong>\u4f1a\u88ab\u8f6c\u6210 <code># \u6807\u9898<\/code><\/li>\n\n\n\n<li>Word \u91cc\u7684<strong>\u4e8c\u7ea7\u6807\u9898<\/strong>\u4f1a\u88ab\u8f6c\u6210 <code>## \u6807\u9898<\/code><\/li>\n\n\n\n<li>Word \u91cc\u7684<strong>\u8868\u683c<\/strong>\u4f1a\u88ab\u8f6c\u6210 Markdown \u7684\u8868\u683c\u683c\u5f0f <code>| \u52171 | \u52172 |<\/code><\/li>\n\n\n\n<li>Word \u91cc\u7684<strong>\u56fe\u7247<\/strong>\u901a\u5e38\u4f1a\u88ab\u5ffd\u7565\u6216\u4fdd\u7559\u5360\u4f4d\u7b26\uff08\u9664\u975e\u4f7f\u7528\u9ad8\u7ea7\u7684\u591a\u6a21\u6001\u529f\u80fd\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8f6c\u5b8c\u4ee5\u540e\uff0c\u53d1\u73b0\u662fmd\u6587\u4ef6\u8fd9\u6837\u7684\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"806\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-1024x806.png\" alt=\"\" class=\"wp-image-19806\" style=\"width:522px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-1024x806.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-300x236.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-768x604.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-1536x1208.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-830x653.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-230x181.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-350x275.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23-480x378.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-23.png 1833w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">**\u7b2c\u4e00\u7ae0 \u4f01\u4e1a\u6587\u5316**    &lt;-- \u673a\u5668\uff1a\u8fd9\u662f\u666e\u901a\u6587\u672c\uff0c\u8df3\u8fc7\u3002\n\u5185\u5bb9\u5185\u5bb9...\n\n**1\u3001\u516c\u53f8\u7b80\u4ecb**        &lt;-- \u673a\u5668\uff1a\u8fd9\u662f\u666e\u901a\u6587\u672c\uff0c\u8df3\u8fc7\u3002\n\u5185\u5bb9\u5185\u5bb9...<\/pre>\n\n\n\n<p>\u673a\u5668\u627e\u4e0d\u5230\u4efb\u4f55 <code>#<\/code>\uff0c\u8ba4\u4e3a\u6574\u7bc7\u6587\u7ae0\u5c31\u662f\u4e00\u5927\u5768\u6ca1\u6709\u7ed3\u6784\u7684\u6587\u5b57\u3002\u6240\u4ee5\u5b83\u53ea\u80fd\u653e\u5f03\u7ed3\u6784\u5207\u5272\uff0c\u5bfc\u81f4\u4f60\u53ea\u5f97\u5230\u4e86 1 \u4e2a\u5de8\u5927\u7684\u5757\uff0c\u5143\u6570\u636e\u662f <code>{}<\/code>\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u89e3\u51b3\u65b9\u68481\uff1a\u4fee\u6539\u539f\u59cbword\u6587\u4ef6<\/p>\n\n\n\n<ul>\n<li>\u5728 Word \u9876\u90e8\u5de5\u5177\u680f\uff0c\u70b9\u51fb \u201c\u6807\u9898 1\u201d (Heading 1)\u3002<\/li>\n\n\n\n<li>\u9009\u4e2d\u201c1\u3001\u516c\u53f8\u7b80\u4ecb\u201d\uff0c\u70b9\u51fb \u201c\u6807\u9898 2\u201d (Heading 2)\u3002<\/li>\n\n\n\n<li>\u4fdd\u5b58\uff0c\u91cd\u65b0\u8fd0\u884c MarkItDown \u8f6c\u6362\uff0c\u518d\u8fd0\u884c\u5206\u5272\u4ee3\u7801\u3002\u8fd9\u6837\u8f6c\u51fa\u6765\u7684\u5c31\u662f\u6807\u51c6\u7684 # \u548c ##\uff0c\u5206\u5272\u5668\u7acb\u9a6c\u5c31\u80fd\u8bc6\u522b\uff0c\u5143\u6570\u636e\u4e5f\u5c31\u6709\u4e86\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u89e3\u51b3\u65b9\u68482\uff1a\u628aword\u53d8\u6210\u4e00\u5f20\u5f20\u56fe\u7247\uff0c\u6254\u7ed9\u5927\u6a21\u578b\u751f\u6210markdown\u3002<\/p>\n\n\n\n<p>\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38<strong>\u66b4\u529b\u4f46\u6709\u6548<\/strong>\u7684\u65b9\u6848\uff0c\u4e1a\u5185\u79f0\u4e3a <strong>&#8220;Visual ETL&#8221; (\u57fa\u4e8e\u89c6\u89c9\u7684\u6570\u636e\u6e05\u6d17)<\/strong>\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u5305\u542b\u590d\u6742\u6392\u7248\u3001\u6d41\u7a0b\u56fe\uff08\u5982\u4f60\u7684\u7ec4\u7ec7\u67b6\u6784\u56fe\uff09\u3001\u624b\u5199\u7b7e\u540d\u6216\u8868\u683c\u7684 Word \u6587\u6863\uff0c\u8fd9\u79cd\u65b9\u6cd5\u7684\u6548\u679c<strong>\u8fdc\u597d\u4e8e<\/strong>\u4f20\u7edf\u7684 Python \u89e3\u6790\u5e93\u3002\u4f46\u5b83\u7684\u6210\u672c\u8f83\u9ad8\uff08Token \u6d88\u8017\u5927\uff09\u3002<\/p>\n\n\n\n<p>\u6838\u5fc3\u7b56\u7565\uff1aWord -&gt; PDF -&gt; \u56fe\u7247 -&gt; LLM -&gt; Markdown<\/p>\n\n\n\n<p>Prompt \u6a21\u677f (\u5efa\u8bae\u76f4\u63a5\u590d\u5236):<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Role: \u4f60\u662f\u4e00\u4e2a\u4e13\u4e1a\u7684\u6587\u6863\u6570\u5b57\u5316\u4e13\u5bb6\u3002\n\nTask: \u6211\u4f1a\u7ed9\u4f60\u4e00\u5f20\u4f01\u4e1a\u6587\u6863\u7684\u56fe\u7247\uff08\u7b2c {page_num} \u9875\uff09\u3002\u8bf7\u5c06\u5176\u5185\u5bb9\u7cbe\u51c6\u8f6c\u6362\u4e3a Markdown \u683c\u5f0f\u3002\n\nRules:\n\n    \u4fdd\u7559\u5c42\u7ea7\uff1a \u6839\u636e\u89c6\u89c9\u4e0a\u7684\u5b57\u4f53\u5927\u5c0f\u548c\u52a0\u7c97\uff0c\u4e25\u683c\u5224\u65ad\u6807\u9898\u5c42\u7ea7\uff08\u4f7f\u7528 #, ##, ###\uff09\u3002\u4e0d\u8981\u628a\u666e\u901a\u52a0\u7c97\u6587\u672c\u8bef\u5224\u4e3a\u6807\u9898\u3002\n    \u56fe\u8868\u8f6c\u8bd1\uff1a \u5982\u679c\u9047\u5230\u201c\u7ec4\u7ec7\u67b6\u6784\u56fe\u201d\u3001\u201c\u6d41\u7a0b\u56fe\u201d\uff0c\u4e0d\u8981\u5ffd\u7565\uff0c\u4e5f\u4e0d\u8981\u53ea\u5199\u201c\u56fe\u7247\u201d\u3002\u5fc5\u987b\u5c06\u5176\u8f6c\u5316\u4e3a Markdown \u5217\u8868\u6216\u6587\u5b57\u63cf\u8ff0\uff0c\u8be6\u7ec6\u8bf4\u660e\u5c42\u7ea7\u548c\u5173\u7cfb\uff08\u4f8b\u5982\uff1aCEO\u4e0b\u8bbe...\uff09\u3002\n    \u8868\u683c\u5904\u7406\uff1a \u9047\u5230\u8868\u683c\uff0c\u5fc5\u987b\u8fd8\u539f\u4e3a Markdown Table\u3002\n    \u539f\u6837\u8f93\u51fa\uff1a \u4e0d\u8981\u5199\u201c\u8fd9\u662f\u6587\u6863\u7684\u7b2c\u51e0\u9875\u201d\u8fd9\u79cd\u5e9f\u8bdd\uff0c\u76f4\u63a5\u8f93\u51fa\u6587\u6863\u5185\u5bb9\u3002\n    \u8de8\u9875\u5904\u7406\uff1a \u5982\u679c\u9875\u9762\u672b\u5c3e\u53e5\u5b50\u6ca1\u5199\u5b8c\uff0c\u4e0d\u8981\u5f3a\u884c\u8865\u5168\uff0c\u4fdd\u7559\u539f\u6837\uff0c\u6211\u4f1a\u5728\u540e\u671f\u62fc\u63a5\u3002\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"426\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-1024x426.png\" alt=\"\" class=\"wp-image-19809\" style=\"width:542px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-1024x426.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-300x125.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-768x320.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-1536x639.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-2048x853.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-830x346.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-230x96.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-350x146.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-24-480x200.png 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u7b2c\u4e00\u7ae0 \u4f01\u4e1a\u6587\u5316\n\n## 1\u3001\u516c\u53f8\u7b80\u4ecb\n\u4e0a\u6d77\u65af\u4fca\u6155\u667a\u80fd\u79d1\u6280\u6709\u9650\u516c\u53f8\uff0c\u6210\u7acb\u4e8e 2015 \u5e74 1 \u6708 9 \u65e5\uff0c\u5750\u843d\u4e8e\u4e0a\u6d77\u6d66\u4e1c\u3002\u4e92\u8054\u9b54\u65b9\u81f4\u529b\u4e8e\u6253\u9020\u4f01\u4e1a\u6d88\u8d39\u5168\u7a0b\u7ba1\u7406\u6570\u5b57\u5316\u4e2d\u53f0\u3002\u4e2d\u53f0\u7cfb\u7edf\u5206\u4e3a\u8d39\u63a7\u7cfb\u7edf\u3001\u5546\u65c5\u7cfb\u7edf\u3001\u91c7\u8d2d\u7cfb\u7edf\u3001\u7ed3\u7b97\u53ca\u5bf9\u8d26\u7cfb\u7edf\u7b49\u6a21\u5757\u3002\n\n\u901a\u8fc7\u8d39\u63a7\u7cfb\u7edf\u638c\u63e1\u548c\u53d1\u8d77\u8d39\u7528\u8d44\u6e90\u3001\u5546\u65c5\u548c\u91c7\u8d2d\u7cfb\u7edf\u53c2\u4e0e\u7ba1\u7406\u4f9b\u5e94\u5546\u3001\u7ed3\u7b97\u548c\u5bf9\u8d26\u7cfb\u7edf\u63d0\u4f9b\u6570\u636e\u7ba1\u7406\u3001\u6536\u4ed8\u6b3e\u3001\u4f9b\u5e94\u94fe\u91d1\u878d\u7b49\u670d\u52a1\uff0c\u5b9e\u73b0\u5927\u4e2d\u578b\u4f01\u4e1a\u6d88\u8d39\u652f\u51fa\u7684\u5168\u8fc7\u7a0b\u3001\u5168\u751f\u547d\u5468\u671f\u7ba1\u7406\u3002\u4e92\u8054\u9b54\u65b9\u6df1\u5ea6\u53c2\u4e0e\u8fd9\u4e9b\u7ba1\u7406\uff0c\u83b7\u53d6\u8f6f\u4ef6\u6536\u5165\u3001\u4f9b\u5e94\u5546\u63a5\u5165\u6536\u5165\u3001\u4ea4\u6613\u5206\u6210\u6536\u5165\u3001\u652f\u4ed8\u7ed3\u7b97\u6536\u5165\u4ee5\u53ca\u4f9b\u5e94\u94fe\u91d1\u878d\u670d\u52a1\u6536\u5165\uff0c\u573a\u666f\u4e30\u5bcc\uff0c\u6536\u5165\u6765\u6e90\u591a\u6837\uff0c\u5e02\u573a\u6f5c\u529b\u5de8\u5927\u3002\n\n\u901a\u8fc7\u524d\u671f\u7cfb\u7edf\u5b9e\u65bd\u8015\u8018\uff0c\u4e92\u8054\u9b54\u65b9\u5df2\u7ecf\u5728\u94f6\u884c\u3001\u4fdd\u9669\u3001\u4fe1\u6258\u3001\u4f01\u4e1a\u96c6\u56e2\u7b49\u884c\u4e1a\u62e5\u6709 40 \u591a\u5bb6\u5ba2\u6237\uff08\u4ee3\u8868\u5ba2\u6237\u6709\u592a\u4fdd\u96c6\u56e2\u3001\u5927\u5730\u4fdd\u9669\u3001\u4eba\u4fdd\u517b\u8001\u3001\u5305\u5546\u94f6\u884c\u3001\u957f\u6c99\u94f6\u884c\u3001\u4e2d\u4fe1\u4fe1\u6258\uff09\uff0c\u6b63\u5728\u8fd9\u4e9b\u5ba2\u6237\u62d3\u5c55\u4f01\u4e1a\u6d88\u8d39\u5168\u573a\u666f\u670d\u52a1\u3002\n\n## 2\u3001\u516c\u53f8\u7ec4\u7ec7\u67b6\u6784\u56fe\n\u516c\u53f8\u7684\u7ec4\u7ec7\u67b6\u6784\u5c42\u7ea7\u5982\u4e0b\uff1a\n\n1.  **\u9876\u5c42\u7ed3\u6784**\uff1a\u4e0a\u6d77\u65af\u4fca\u6155\u667a\u80fd\u79d1\u6280\u6709\u9650\u516c\u53f8 -> \u603b\u7ecf\u529e\n2.  **\u6838\u5fc3\u7ba1\u7406\u5c42**\uff1a\u4e0b\u8bbe CEO\u3001COO\u3001CTO \u4e09\u5927\u6838\u5fc3\u804c\u4f4d\u3002\n3.  **\u5404\u804c\u80fd\u90e8\u95e8\u5212\u5206**\uff1a\n    *   **CEO (\u9996\u5e2d\u6267\u884c\u5b98) \u7ba1\u8f96**\uff1a\n        *   \u8d22\u52a1\u90e8\n        *   \u884c\u653f\u4eba\u4e8b\u90e8\n    *   **COO (\u9996\u5e2d\u8fd0\u8425\u5b98) \u7ba1\u8f96**\uff1a\n        *   \u9500\u552e\u90e8\uff08\u4e0b\u8bbe\u4e24\u4e2a\u5927\u533a\uff09\uff1a\n            *   \u5357\u65b9\u5927\u533a\n            *   \u5317\u65b9\u5927\u533a\n    *   **CTO (\u9996\u5e2d\u6280\u672f\u5b98) \u7ba1\u8f96**\uff1a\n        *   \u6280\u672f\u90e8\uff08\u4e0b\u8bbe\u4e09\u4e2a\u4e2d\u5fc3\uff09\uff1a\n            *   \u7814\u53d1\u4e2d\u5fc3\n            *   \u8fd0\u7ef4\u4e2d\u5fc3\n            *   \u9879\u76ee\u4e2d\u5fc3\n<\/pre>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u628amd\u6587\u4ef6chunks\u5206\u5757 \ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u628a\u5206\u5272\u597d\u7684md\u6587\u4ef6\u5408\u5e76\u6210\u4e00\u4e2a\u6574\u4f53total.md\uff0creview\u4e00\u4e0b\uff0c\u770b\u5230\u4e0d\u5408\u9002\u7684\u5730\u65b9\u8c03\u6574\u4e00\u4e0b\u3002<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"501\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-28.png\" alt=\"\" class=\"wp-image-19817\" style=\"width:340px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-28.png 624w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-28-300x241.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-28-230x185.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-28-350x281.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-28-480x385.png 480w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/figure><\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"645\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-1024x645.png\" alt=\"\" class=\"wp-image-19818\" style=\"width:378px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-1024x645.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-300x189.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-768x484.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-1536x968.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-830x523.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-230x145.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-350x221.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29-480x302.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-29.png 1671w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div><\/div>\n<\/div>\n\n\n\n<p>\u7136\u540e\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\u5206\u5272\u5757\uff0c\u5e76\u751f\u6210chunks\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import os\nfrom langchain_text_splitters import MarkdownHeaderTextSplitter, RecursiveCharacterTextSplitter\n\n# \u5b9a\u4e49\u6587\u4ef6\u8def\u5f84 (\u8bb0\u5f97\u52a0 r \u9632\u6b62\u8f6c\u4e49)\nfile_path = r\"C:\\work\\langchai\\RAG\\md\\total.md\"\n\n# \u8bfb\u53d6\u672c\u5730 Markdown \u6587\u4ef6\nif not os.path.exists(file_path):\n    print(f\"\u274c \u9519\u8bef\uff1a\u627e\u4e0d\u5230\u6587\u4ef6 {file_path}\")\nelse:\n    try:\n        # \u3010\u5173\u952e\u3011encoding=\"utf-8\" \u4e0d\u80fd\u5c11\uff0c\u5426\u5219\u4e2d\u6587\u4f1a\u4e71\u7801\n        with open(file_path, \"r\", encoding=\"utf-8\") as f:\n            markdown_text = f.read()\n            \n        print(f\"\u2705 \u6210\u529f\u8bfb\u53d6\u6587\u4ef6\uff0c\u5171 {len(markdown_text)} \u4e2a\u5b57\u7b26\")\n\n        # \u6309\u6807\u9898\u7ed3\u6784\u5207\u5206\n        headers_to_split_on = [\n            (\"#\", \"Chapter\"),\n            (\"##\", \"Section\"),\n            (\"###\", \"Subsection\"), # \u5982\u679c\u6709\u4e09\u7ea7\u6807\u9898\n        ]\n\n        md_splitter = MarkdownHeaderTextSplitter(headers_to_split_on=headers_to_split_on)\n        md_docs = md_splitter.split_text(markdown_text)\n        \n        print(f\"\u2705 \uff08\u7ed3\u6784\u5206\u5272\uff09\u5b8c\u6210\uff0c\u5171 {len(md_docs)} \u4e2a\u7ae0\u8282\u5757\")\n\n        # \u6309\u957f\u5ea6 + Overlap \u4e8c\u6b21\u5207\u5206\n        text_splitter = RecursiveCharacterTextSplitter(\n            chunk_size=500,      # \u6bcf\u5757\u7ea6500\u5b57\n            chunk_overlap=50,    # \u91cd\u53e050\u5b57\n            separators=[\"\\n\\n\", \"\\n\", \"\u3002\", \"\uff01\", \"\uff0c\"]\n        )\n\n        final_docs = text_splitter.split_documents(md_docs)\n\n        print(f\"\u2705 \uff08\u957f\u5ea6\u5206\u5272\uff09\u5b8c\u6210\uff0c\u5171 {len(final_docs)} \u4e2a\u6700\u7ec8\u5207\u7247\\n\")\n\n        output_path = r\"C:\\work\\langchai\\RAG\\md\\chunks_preview.txt\"\n        with open(output_path, \"w\", encoding=\"utf-8\") as f:\n            for i, doc in enumerate(final_docs, start=1):\n                f.write(f\"--- Chunk {i}\/{len(final_docs)} ---\\n\")\n                f.write(f\"\u3010\u5143\u6570\u636e\u3011: {doc.metadata}\\n\")\n                f.write(\"\u3010\u5185\u5bb9\u3011:\\n\")\n                f.write(doc.page_content + \"\\n\")\n                f.write(\"-\" * 80 + \"\\n\\n\")\n\n        print(\"\u2705 \u5df2\u5c06\u6240\u6709 Chunk \u5199\u5165\uff1a\", output_path)\n\n    except Exception as e:\n        print(f\"\u274c \u5904\u7406\u51fa\u9519: {e}\")<\/pre>\n\n\n\n<p>\u68c0\u67e5\u4e0b\u751f\u6210\u597d\u7684chunks_preview.txt<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"711\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-1024x711.png\" alt=\"\" class=\"wp-image-19821\" style=\"width:506px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-1024x711.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-300x208.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-768x533.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-1536x1066.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-2048x1421.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-830x576.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-230x160.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-350x243.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-31-480x333.png 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u628achunks\u5757\u767b\u5f55\u5230Qdrant\u5411\u91cf\u6570\u636e\u5e93\u4e2d \ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5982\u679cchunks\u5757\u6ca1\u95ee\u9898\u7684\u8bdd\uff0c\u53ef\u4ee5\u8fdb\u4e00\u6b65\u767b\u5f55\u5230Qdrant\u5411\u91cf\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<p>\u7528\u4e0b\u9762\u7684\u4ee3\u7801\u6267\u884c\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import os\nfrom langchain_text_splitters import MarkdownHeaderTextSplitter, RecursiveCharacterTextSplitter\n# ========== \u65b0\u589e\uff1a\u5199\u5165 Qdrant ==========\nfrom qdrant_client import QdrantClient\nfrom langchain_qdrant import QdrantVectorStore\nfrom langchain_huggingface import HuggingFaceEmbeddings\n\n# \u5b9a\u4e49\u6587\u4ef6\u8def\u5f84 (\u8bb0\u5f97\u52a0 r \u9632\u6b62\u8f6c\u4e49)\nfile_path = r\"C:\\work\\langchai\\RAG\\md\\total.md\"\n\n# Qdrant \u914d\u7f6e\nQDRANT_URL = \"http:\/\/xxx:6333\/\" # \u4f60\u7684\u96c6\u7fa4\u5730\u5740\nQDRANT_API_KEY = \"xxx\" # \u4f60\u7684 API Key\nCOLLECTION_NAME = \"Employee Handbook\" # \u96c6\u5408\u540d\u79f0\n\n# \u5bf9\u5e94\u7ef4\u5ea61024\nembeddings = HuggingFaceEmbeddings(\n    model_name=\"BAAI\/bge-m3\",\n    model_kwargs={\"device\": \"cpu\"},\n    encode_kwargs={\"normalize_embeddings\": True}\n)\n\n# \u521b\u5efa Qdrant \u5ba2\u6237\u7aef\nclient = QdrantClient(\n    url=QDRANT_URL,\n    api_key=QDRANT_API_KEY,\n)\n\n# \u8bfb\u53d6\u672c\u5730 Markdown \u6587\u4ef6\nif not os.path.exists(file_path):\n    print(f\"\u274c \u9519\u8bef\uff1a\u627e\u4e0d\u5230\u6587\u4ef6 {file_path}\")\nelse:\n    try:\n        # \u3010\u5173\u952e\u3011encoding=\"utf-8\" \u4e0d\u80fd\u5c11\uff0c\u5426\u5219\u4e2d\u6587\u4f1a\u4e71\u7801\n        with open(file_path, \"r\", encoding=\"utf-8\") as f:\n            markdown_text = f.read()\n            \n        print(f\"\u2705 \u6210\u529f\u8bfb\u53d6\u6587\u4ef6\uff0c\u5171 {len(markdown_text)} \u4e2a\u5b57\u7b26\")\n\n        # \u6309\u6807\u9898\u7ed3\u6784\u5207\u5206\n        headers_to_split_on = [\n            (\"#\", \"Chapter\"),\n            (\"##\", \"Section\"),\n            (\"###\", \"Subsection\"), # \u5982\u679c\u6709\u4e09\u7ea7\u6807\u9898\n        ]\n\n        md_splitter = MarkdownHeaderTextSplitter(headers_to_split_on=headers_to_split_on)\n        md_docs = md_splitter.split_text(markdown_text)\n        \n        print(f\"\u2705 \uff08\u7ed3\u6784\u5206\u5272\uff09\u5b8c\u6210\uff0c\u5171 {len(md_docs)} \u4e2a\u7ae0\u8282\u5757\")\n\n        # \u6309\u957f\u5ea6 + Overlap \u4e8c\u6b21\u5207\u5206\n        text_splitter = RecursiveCharacterTextSplitter(\n            chunk_size=500,      # \u6bcf\u5757\u7ea6500\u5b57\n            chunk_overlap=50,    # \u91cd\u53e050\u5b57\n            separators=[\"\\n\\n\", \"\\n\", \"\u3002\", \"\uff01\", \"\uff0c\"]\n        )\n\n        final_docs = text_splitter.split_documents(md_docs)\n\n        print(f\"\u2705 \uff08\u957f\u5ea6\u5206\u5272\uff09\u5b8c\u6210\uff0c\u5171 {len(final_docs)} \u4e2a\u6700\u7ec8\u5207\u7247\\n\")\n\n        # \u5148\u521b\u5efa\u5411\u91cf\u5e93\u5bf9\u8c61\n        vectorstore = QdrantVectorStore(\n            client=client,\n            collection_name=COLLECTION_NAME,\n            embedding=embeddings,\n        )\n\n        # \u628a\u6587\u6863\u5199\u8fdb\u53bb\n        vectorstore.add_documents(final_docs)\n\n        print(\"\u2705 \u5df2\u5c06\u5207\u7247\u5199\u5165 Qdrant\")\n\n    except Exception as e:\n        print(f\"\u274c \u5904\u7406\u51fa\u9519: {e}\")<\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u90fd\u6b63\u5e38\u767b\u5f55\u5230Qdrant\u5411\u91cf\u6570\u636e\u5e93\u4e2d\u4e86\uff0c\u4ef6\u6570\u548c<strong>chunks<\/strong>\u6570\u91cf\u662f\u4e00\u6837\u7684\uff0c\u90fd\u662f46<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"273\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-1024x273.png\" alt=\"\" class=\"wp-image-19823\" style=\"width:636px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-1024x273.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-300x80.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-768x205.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-1536x410.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-2048x547.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-830x222.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-230x61.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-350x93.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-32-480x128.png 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"560\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-1024x560.png\" alt=\"\" class=\"wp-image-19825\" style=\"width:644px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-1024x560.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-300x164.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-768x420.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-1536x840.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-2048x1120.png 2048w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-830x454.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-230x126.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-350x191.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/12\/image-34-480x262.png 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>RAG\u4e3a\u4ec0\u4e48\u8981\u5206\u5757\u5462? \u6574\u4e2a\u6587\u672c\u6254\u5230\u5411\u91cf\u6570\u636e\u5e93\u4e2d\u5462\uff1f \ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u5411\u91cf\u68c0\u7d22\u7684\u201c\u7c92\u5ea6\u201d\u95ee\u9898<\/p>\n\n\n\n<p>Embedding \u662f\u5bf9\u201c\u4e00\u6bb5\u6587\u672c\u201d\u505a\u538b\u7f29\uff0c\u53d8\u6210\u4e00\u4e2a\u5411\u91cf\u3002<\/p>\n\n\n\n<ul>\n<li>\u5982\u679c\u4f60\u628a\u6574\u672c\u5458\u5de5\u624b\u518c\uff08\u51e0\u4e07\u5b57\uff09\u505a\u6210\u4e00\u4e2a\u5411\u91cf\uff1a\n<ul>\n<li>\u8fd9\u4e2a\u5411\u91cf\u91cc\u6df7\u7740\u201c\u516c\u53f8\u7b80\u4ecb + \u67b6\u6784\u56fe + \u8003\u52e4 + \u85aa\u916c + \u79bb\u804c\u2026\u2026\u201d<\/li>\n\n\n\n<li>\u7528\u6237\u95ee\u201c\u8fdf\u5230\u600e\u4e48\u7f5a\uff1f\u201d<br>\u68c0\u7d22\u53ea\u80fd\u547d\u4e2d\u201c\u8fd9\u672c\u4e66\u6574\u4f53\u201d\uff0c\u7136\u540e\u4f60\u8fd8\u8981\u81ea\u5df1\u5728\u8fd9\u51e0\u4e07\u5b57\u91cc\u518d\u5168\u6587\u641c\u7d22\u4e00\u904d\uff0c\u7b49\u4e8e\u53c8\u56de\u5230\u4e86\u4f20\u7edf\u68c0\u7d22\u3002<\/li>\n\n\n\n<li>\u5411\u91cf\u76f8\u4f3c\u5ea6\u5728\u201c\u592a\u5927\u4e00\u5768\u6587\u672c\u201d\u4e0a\u5176\u5b9e\u4e0d\u654f\u611f\uff1a\u5f88\u591a\u4e0d\u540c\u95ee\u9898\u90fd\u4f1a\u547d\u4e2d<strong>\u540c\u4e00\u4e2a\u5927\u5757<\/strong>\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u5927\u6a21\u578b\u4e0a\u4e0b\u6587\u957f\u5ea6\u6709\u9650<\/p>\n\n\n\n<p>\u5373\u4fbf\u4f60\u4e0d\u505a\u68c0\u7d22\uff0c\u53ea\u60f3\u201c\u628a\u6574\u672c\u624b\u518c\u4e00\u6b21\u6027\u585e\u7ed9\u6a21\u578b\u201d\uff1a<\/p>\n\n\n\n<ul>\n<li>GPT-4o \/ Claude 3.5 \u4e0a\u4e0b\u6587\u662f\u51e0\u4e07 token\uff0c\u4f46\uff1a\n<ul>\n<li>\u4f60\u7684\u5e93\u4e0d\u6b62\u4e00\u4efd\u624b\u518c\uff0c\u5c06\u6765\u6709\u66f4\u591a\u6587\u6863\uff1b<\/li>\n\n\n\n<li>\u68c0\u7d22\u65f6\u901a\u5e38\u4f1a\u53d6 top-3 \/ top-5 \u4e2a chunk\uff0c\u4e00\u62fc\u5bb9\u6613\u8d85\u9650\uff1b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5373\u4f7f\u52c9\u5f3a\u585e\u5f97\u4e0b\uff0c<strong>\u6a21\u578b\u5728\u8d85\u957f\u4e0a\u4e0b\u6587\u91cc\u4f1a\u201c\u4e22\u4e2d\u95f4\u5185\u5bb9\u201d<\/strong>\uff08\u957f\u6587\u672c\u9057\u5fd8\u95ee\u9898\uff0cLost in the Middle\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8ba9\u201c\u6bcf\u6b21\u9001\u8fdb\u6a21\u578b\u7684\u6587\u672c\u201d\u63a7\u5236\u5728\u4e00\u4e2a\u5408\u7406\u8303\u56f4\uff08\u6bd4\u5982 2k\u20134k token \u4ee5\u5185\uff09\uff0c\u65e2\u4e0d\u8d85\u4e0a\u4e0b\u6587\uff0c\u4e5f\u4e0d\u6df9\u6ca1\u91cd\u70b9\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u4e0d\u5206\u5757\u4f1a\u727a\u7272\u201c\u5b9a\u4f4d\u80fd\u529b\u201d<\/p>\n\n\n\n<p>\u60f3\u8c61\u4e24\u79cd\u6781\u7aef\uff1a<\/p>\n\n\n\n<p>A. \u5168\u6587\u4e00\u4e2a\u5411\u91cf<\/p>\n\n\n\n<ul>\n<li>\u68c0\u7d22\u7ed3\u679c\uff1a\u6c38\u8fdc\u53ea\u8fd4\u56de\u540c\u4e00\u4e2a\u6587\u6863\u3002<\/li>\n\n\n\n<li>\u6a21\u578b\u8981\u5728\u4e00\u5927\u5768\u91cc\u81ea\u5df1\u627e\u201c\u54ea\u4e00\u6bb5\u8bf4\u4e86\u8fdf\u5230\u7f5a\u6b3e 50 \u5143\u201d\uff0c\u7b49\u4e8e\u8ba9\u5b83\u81ea\u5df1\u505a\u5168\u6587\u68c0\u7d22\uff0c\u5bb9\u6613\u6f0f\u3001\u5bb9\u6613\u5e7b\u89c9\u3002<\/li>\n<\/ul>\n\n\n\n<p>B. \u5408\u7406\u7c92\u5ea6\u7684\u5206\u5757\uff08\u6bd4\u5982\u6bcf 400\uff5e800 \u5b57\uff0c\u4e00\u4e2a\u6761\u6b3e\u6216\u51e0\u6761\u9ad8\u5ea6\u76f8\u5173\u7684\u6761\u6b3e\uff09<\/p>\n\n\n\n<ul>\n<li>\u68c0\u7d22\uff1a\u95ee\u201c\u79bb\u804c\u6d41\u7a0b\u201d\uff0c\u80fd\u76f4\u63a5\u547d\u4e2d\u201c\u79bb\u804c\u7ba1\u7406\u201d\u7684\u51e0\u5757\uff0c\u800c\u4e0d\u4f1a\u547d\u4e2d\u201c\u516c\u53f8\u7b80\u4ecb\u201d\u3002<\/li>\n\n\n\n<li>\u6a21\u578b\uff1a\u76f4\u63a5\u57fa\u4e8e\u51e0\u5757\u76f8\u5173\u5185\u5bb9\u7ec4\u7ec7\u7b54\u6848\uff0c\u9519\u8bef\u7387\u548c\u5e7b\u89c9\u90fd\u4f1a\u4e0b\u964d\u5f88\u591a\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u4e3a\u4ec0\u4e48\u4e0d\u662f\u201c\u8d8a\u5c0f\u8d8a\u597d\u201d\uff1f<\/p>\n\n\n\n<p>\u4f60\u53ef\u80fd\u4f1a\u95ee\uff1a\u90a3\u6211\u6309\u201c\u6bcf\u4e00\u53e5\u8bdd\u4e00\u4e2a\u5411\u91cf\u201d\u662f\u4e0d\u662f\u6700\u597d\uff1f<\/p>\n\n\n\n<p>\u4e5f\u4e0d\u884c\uff1a<\/p>\n\n\n\n<ul>\n<li>\u53e5\u5b50\u592a\u77ed\uff0cembedding \u4fe1\u606f\u91cf\u4e0d\u8db3\uff0c\u201c\u8fd9\u53e5\u201d\u548c\u201c\u90a3\u53e5\u201d\u5728\u5411\u91cf\u7a7a\u95f4\u91cc\u7279\u522b\u50cf\uff0c\u5bb9\u6613\u53ec\u56de\u566a\u58f0\u3002<\/li>\n\n\n\n<li>\u4f8b\u5982\uff1a\u201c\u516c\u53f8\u6709\u6743\u89e3\u9664\u52b3\u52a8\u5408\u540c\u3002\u201d<br>\u8fd9\u7c7b\u53e5\u5b50\u5355\u72ec\u62ff\u51fa\u6765\uff0c\u8ddf\u5f88\u591a\u522b\u7684\u5236\u5ea6\u53e5\u5b50\u5728\u5411\u91cf\u4e0a\u975e\u5e38\u63a5\u8fd1\u3002<\/li>\n\n\n\n<li>\u53e6\u5916\uff0c\u56de\u7b54\u95ee\u9898\u901a\u5e38\u9700\u8981<strong>\u524d\u540e\u51e0\u53e5\u4e00\u8d77\u770b<\/strong>\uff0c\u53ea\u7ed9\u6a21\u578b\u4e00\u53e5\u8bdd\uff0c\u5b83\u4e5f\u65e0\u6cd5\u5224\u65ad\u4e0a\u4e0b\u6587\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u6240\u4ee5\u5206\u5757\u7684\u76ee\u6807\u662f\uff1a\u201c\u8db3\u591f\u957f\u6765\u8868\u8fbe\u5b8c\u6574\u8bed\u4e49\uff0c\u53c8\u8db3\u591f\u77ed\u6765\u7cbe\u786e\u5b9a\u4f4d\u201d\u3002<\/strong><\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u5927\u6a21\u578b\u80fd\u7406\u89e3\u5927\u6587\u6863\u7684\u5168\u90e8\u5185\u5bb9\u5417\uff1f \ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u80fd\u201c\u90e8\u5206\u7406\u89e3\u201d\uff0c\u4f46<strong>\u505a\u4e0d\u5230\u50cf\u4eba\u90a3\u6837\u5b8c\u5168\u3001\u7cbe\u786e\u5730\u638c\u63e1\u4e00\u6574\u672c\u957f\u6587\u6863\u7684\u6240\u6709\u7ec6\u8282<\/strong>\uff0c\u4e3b\u8981\u53d7\u4e24\u7c7b\u9650\u5236\uff1a<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u786c\u9650\u5236\uff1a\u4e0a\u4e0b\u6587\u957f\u5ea6\uff08context length\uff09<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6a21\u578b\u90fd\u6709\u6700\u5927\u201c\u53ef\u770b\u201d\u7684 token \u6570\uff1a<\/p>\n\n\n\n<ul>\n<li>GPT\u20114o \/ Claude 3.5 Sonnet\uff1a\u51e0\u5341 K\uff5e\u4e0a\u767e K token<\/li>\n\n\n\n<li>\u4f60\u7684\u4e00\u672c\u5458\u5de5\u624b\u518c\uff1a\u51e0\u4e07\u5b57\u4ee5\u5185\uff0c\u4e00\u822c<strong>\u53ef\u4ee5\u4e00\u6b21\u6027\u585e\u8fdb\u53bb<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u4f46\u6709\u4e24\u4e2a\u73b0\u5b9e\u95ee\u9898\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u4e00\u65e6\u8d85\u51fa\u7a97\u53e3\uff0c\u591a\u4f59\u7684\u5185\u5bb9\u76f4\u63a5\u770b\u4e0d\u5230<\/strong><br>\u585e\u8fdb\u53bb\u7684\u4e1c\u897f\u592a\u591a\uff0c\u6a21\u578b\u5c31\u50cf\u201c\u53ea\u8bfb\u4e86\u524d\u9762 N \u9875\uff0c\u540e\u9762\u6839\u672c\u6ca1\u7ffb\u5230\u201d\u3002<\/li>\n\n\n\n<li><strong>\u5373\u4f7f\u6ca1\u8d85\uff0c\u6a21\u578b\u5bf9\u5f88\u957f\u4e0a\u4e0b\u6587\u7684\u8bb0\u5fc6\u662f\u201c\u6709\u504f\u7684\u201d<\/strong><br>\u7814\u7a76\u91cc\u6709\u4e2a\u73b0\u8c61\u53eb <em>Lost in the Middle<\/em>\uff1a\n<ul>\n<li>\u5f00\u5934\u548c\u7ed3\u5c3e\u7684\u4fe1\u606f\u4fdd\u7559\u5f97\u6bd4\u8f83\u597d<\/li>\n\n\n\n<li>\u4e2d\u95f4\u7684\u5185\u5bb9\u5bb9\u6613\u88ab\u5ffd\u7565\u3001\u6743\u91cd\u53d8\u4f4e<br>\u6240\u4ee5\u201c\u80fd\u653e\u8fdb\u53bb \u2260 \u80fd\u540c\u7b49\u91cd\u89c6\u6bcf\u4e00\u6bb5\u201d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u8f6f\u9650\u5236\uff1a\u63a8\u7406\u6ce8\u610f\u529b\u548c\u6307\u4ee4<\/p>\n\n\n\n<p>\u5c31\u7b97\u4f60\u628a\u6574\u672c\u6587\u6863\u5b8c\u6574\u585e\u8fdb\u6a21\u578b\uff0c\u6548\u679c\u4e5f\u9ad8\u5ea6\u4f9d\u8d56\u4e8e<strong>\u4f60\u95ee\u7684\u95ee\u9898\u548c\u63d0\u793a\u8bcd<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u95ee\uff1a\u201c\u603b\u7ed3\u4e00\u4e0b\u516c\u53f8\u6240\u6709\u5236\u5ea6\u201d<br>\u2192 \u6a21\u578b\u4f1a\u6311\u91cd\u8981\u7684\u3001\u663e\u773c\u7684\u5185\u5bb9\u6982\u62ec\uff0c\u7ec6\u8282\u5927\u91cf\u4e22\u5931\uff0c\u5f88\u96be\u7a77\u4e3e\u5168\u90e8\u6761\u6b3e\u3002<\/li>\n\n\n\n<li>\u95ee\uff1a\u201c\u8bd5\u7528\u671f\u6700\u957f\u591a\u4e45\u3001\u7ed3\u7b97\u5de5\u8d44\u600e\u4e48\u53d1\uff1f\u201d<br>\u2192 \u5982\u679c\u76f8\u5173\u6bb5\u843d\u672c\u8eab\u8fd8\u5728\u4e0a\u4e0b\u6587\u8303\u56f4\u5185\uff0c\u5b83\u901a\u5e38\u80fd\u51c6\u786e\u627e\u5230\u90a3\u51e0\u6761\u6765\u56de\u7b54\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>\u4e3a\u4ec0\u4e48\u8fd8\u8981 RAG + \u5206\u5757<\/p>\n\n\n\n<p>\u6b63\u662f\u56e0\u4e3a\u6a21\u578b\u5bf9\u201c\u8d85\u957f\u5168\u6587\u201d\u7684\u7406\u89e3\u6709\u4ee5\u4e0a\u95ee\u9898\uff0c\u624d\u6709\u4e86 RAG\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u5148\u7528\u5411\u91cf\u68c0\u7d22\uff0c\u5728\u5927\u6587\u6863\u91cc\u9501\u5b9a\u51e0\u6bb5\u6700\u76f8\u5173\u7684\u5185\u5bb9<\/strong><br>\u2192 \u51cf\u5c11\u65e0\u5173\u566a\u58f0\uff0c\u907f\u514d\u628a\u6574\u672c\u4e66\u90fd\u4e22\u7ed9\u6a21\u578b\u3002<\/li>\n\n\n\n<li><strong>\u7ed9\u6a21\u578b\u770b\u7684\u53ea\u662f\u82e5\u5e72\u5757\u9ad8\u76f8\u5173\u7247\u6bb5<\/strong><br>\u2192 \u6bcf\u5757\u51e0\u767e token\uff0c\u6a21\u578b\u80fd\u201c\u7cbe\u8bfb\u201d\uff0c\u56de\u7b54\u7ec6\u8282\u66f4\u51c6\uff0c\u5e7b\u89c9\u66f4\u5c11\u3002<\/li>\n\n\n\n<li><strong>\u5206\u5757+\u5143\u6570\u636e<\/strong>\uff0c\u8ba9\u6a21\u578b\u65e2\u77e5\u9053\u201c\u8fd9\u53e5\u8bdd\u600e\u4e48\u8bf4\u201d\uff0c\u4e5f\u77e5\u9053\u201c\u5b83\u5c5e\u4e8e\u54ea\u4e00\u7ae0\u54ea\u4e00\u8282\u201d\uff0c<br>\u2192 \u56de\u7b54\u65f6\u65e2\u5177\u4f53\u53c8\u6709\u4e0a\u4e0b\u6587\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f&nbsp;\ud83d\udd16 \u5047\u5982\u6211\u4eec\u6709\u4e00\u4e2a\u5458\u5de5\u624b\u518c\uff0c\u505a RAG\uff08\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff09\uff0c\u90a3\u4e48\u5e94\u8be5\u5982\u4f55\u5206\u5757\u51c6\u5907\u6211\u4eec\u7684\u6587\u6863\uff0c\u5e76\u66f4\u65b0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/19789"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19789"}],"version-history":[{"count":24,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/19789\/revisions"}],"predecessor-version":[{"id":19828,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/19789\/revisions\/19828"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}