import{s as Tl,c as Jl,u as vl,g as Cl,d as Ul,o as _l}from"../chunks/scheduler.39a43cde.js";import{S as xl,i as cl,g as i,h as m,j as Ht,f as l,k as Vt,a as n,d as o,t as r,s as a,r as $,A as jl,c as s,u,x as p,y as Ll,v as g,w as b,m as Il,n as Gl}from"../chunks/index.23ec2204.js";import{D as Zl,C as J}from"../chunks/DocNotebookDropdown.7c3158f8.js";import{H as y,E as kl}from"../chunks/index.724daca9.js";function Wl(w){let f,h;const x=w[3].default,M=Jl(x,w,w[2],null);return{c(){f=i("div"),M&&M.c(),this.h()},l(d){f=m(d,"DIV",{class:!0});var T=Ht(f);M&&M.l(T),T.forEach(l),this.h()},h(){Vt(f,"class","course-tip "+(w[0]==="orange"?"course-tip-orange":"")+" bg-gradient-to-br dark:bg-gradient-to-r before:border-"+w[0]+"-500 dark:before:border-"+w[0]+"-800 from-"+w[0]+"-50 dark:from-gray-900 to-white dark:to-gray-950 border border-"+w[0]+"-50 text-"+w[0]+"-700 dark:text-gray-400")},m(d,T){n(d,f,T),M&&M.m(f,null),h=!0},p(d,[T]){M&&M.p&&(!h||T&4)&&vl(M,x,d,d[2],h?Ul(x,d[2],T,null):Cl(d[2]),null)},i(d){h||(o(M,d),h=!0)},o(d){r(M,d),h=!1},d(d){d&&l(f),M&&M.d(d)}}}function Bl(w,f,h){let{$$slots:x={},$$scope:M}=f,{warning:d=!1}=f;const T=d?"orange":"green";return w.$$set=c=>{"warning"in c&&h(1,d=c.warning),"$$scope"in c&&h(2,M=c.$$scope)},[T,d,M,x]}class Xl extends xl{constructor(f){super(),cl(this,f,Bl,Wl,Tl,{warning:1})}}function Hl(w){let f;return{c(){f=Il("LlamaIndex 默认的块大小是 1024 个字符，块与块之间有 20 个字符的重叠。如果需要了解更多细节，可以查看 [LlamaIndex 的文档](https://docs.llamaindex.ai/en/stable/optimizing/basic_strategies/basic_strategies.html#chunk-sizes)。")},l(h){f=Gl(h,"LlamaIndex 默认的块大小是 1024 个字符，块与块之间有 20 个字符的重叠。如果需要了解更多细节，可以查看 [LlamaIndex 的文档](https://docs.llamaindex.ai/en/stable/optimizing/basic_strategies/basic_strategies.html#chunk-sizes)。")},m(h,x){n(h,f,x)},d(h){h&&l(f)}}}function Vl(w){let f,h,x,M,d,T,c,Ie,C,Rt='<em>作者: <a href="https://huggingface.co/jinnovation" rel="nofollow">Jonathan Jin</a></em>',Ge,U,Ze,_,At=`这份教程将指导你如何快速为你的电子书库创建一个基于 RAG 图书助手。
就像图书馆的图书管理员帮你找书一样，这个助手也能帮你从你的电子书里找到你需要的书。`,ke,j,We,L,Yt="这个助手要做得<strong>轻巧</strong>，<strong>尽量在本地运行</strong>，而且<strong>不要用太多其他的东西</strong>。我们会尽量用免费的开源软件，选择那种在<strong>本地普通电脑上，比如 M1 型号的 MacBook 上就能运行的模型</strong>。",Be,I,Xe,G,Pt="我们的解决方案将包括以下组件：",He,Z,St='<li><a href="https://docs.llamaindex.ai/en/stable/index.html" rel="nofollow">LlamaIndex</a>，一个基于LLM的应用数据框架，与 <a href="https://python.langchain.com/docs/get_started/introduction" rel="nofollow">LangChain</a> 不同，它是专门为 RAG 设计的；</li> <li><a href="https://ollama.com/" rel="nofollow">Ollama</a>，一个简单易用的工具，可以让你在本地运行语言模型，比如Llama 2；</li> <li><a href="https://huggingface.co/BAAI/bge-base-en-v1.5" rel="nofollow"><code>BAAI/bge-base-en-v1.5</code></a> 嵌入模型，它的表现<a href="https://huggingface.co/spaces/mteb/leaderboard" rel="nofollow">相当好，并且大小适中</a>；</li> <li><a href="https://ollama.com/library/llama2" rel="nofollow">Llama 2</a>，我们将通过 <a href="https://ollama.com/" rel="nofollow">Ollama</a> 运行它。</li>',Ve,k,Re,W,Qt="首先安装依赖库",Ae,B,Ye,X,Pe,H,Se,V,qt="我们接下来要弄个测试用的“书库”。",Qe,R,Et="简单点说，我们的“书库”就是一个放有 <code>.epub</code> 格式电子书文件的<strong>文件夹</strong>。这个方法很容易就能扩展到像 Calibre 那种带有个 <code>metadata.db</code> 数据库文件的书库。怎么扩展这个问题，我们留给读者自己思考。😇",qe,A,Ft='现在，我们先从<a href="https://www.gutenberg.org/" rel="nofollow">古腾堡计划网站</a>下载两本<code>.epub</code>格式的电子书放到我们的书库里。',Ee,Y,Fe,P,ze,S,zt="使用 LlamaIndex 的 RAG 主要包括以下三个阶段：",Ne,Q,Nt="<li><strong>加载</strong>，在这个阶段你告诉 LlamaIndex 你的数据在哪里以及如何加载它；</li> <li><strong>索引</strong>，在这个阶段你扩充加载的数据以方便查询，例如使用向量嵌入；</li> <li><strong>查询</strong>，在这个阶段你配置一个 LLM 作为你索引数据的查询接口。</li>",De,q,Dt='以上解释仅是对 LlamaIndex 可实现功能的表面说明。要想了解更多深入细节，我强烈推荐阅读 LlamaIndex 文档中的<a href="https://docs.llamaindex.ai/en/stable/getting_started/concepts.html" rel="nofollow">“高级概念”页面</a>。',Oe,E,Ke,F,Ot="好的，我们首先从<strong>加载</strong>阶段开始。",et,z,Kt='之前提到，LlamaIndex 是专为 RAG 这种混合检索生成模型设计的。这一点从它的<a href="https://docs.llamaindex.ai/en/stable/module_guides/loading/simpledirectoryreader.html" rel="nofollow"><code>SimpleDirectoryReader</code></a>功能就可以明显看出，它能<strong>神奇地</strong>免费支持很多种文件类型。幸运的是， <code>.epub</code> 文件格式也在支持范围内。',tt,N,lt,D,el='<code>SimpleDirectoryReader.load_data()</code> 将我们的电子书转换成一组 LlamaIndex 可以处理的 <a href="https://docs.llamaindex.ai/en/stable/api/llama_index.core.schema.Document.html" rel="nofollow"><code>Document</code>s</a>。',nt,O,tl="这里有一个重要的事情要注意，就是这个阶段的文档<strong>还没有被分块</strong>——这将在索引阶段进行。继续往下看…",at,K,st,ee,ll="在把数据<strong>加载</strong>进来之后，接下来我们要做的是<strong>建立索引</strong>。这样我们的 RAG 系统就能找到与用户查询相关的信息，然后把这些信息传给语言模型（LLM），以便它能够<strong>增强</strong>回答的内容。同时，这一步也将对文档进行分块。",it,te,nl=`在 LlamaIndex 中，<a href="https://docs.llamaindex.ai/en/stable/module_guides/indexing/vector_store_index.html" rel="nofollow"><code>VectorStoreIndex</code></a> 是用来建立索引的一个“默认”工具。这个工具默认使用一个简单、基于内存的字典来保存索引，但随着你的使用规模扩大，LlamaIndex 还支持
<a href="https://docs.llamaindex.ai/en/stable/module_guides/storing/vector_stores.html" rel="nofollow">多种向量存储解决方案</a>。`,mt,v,pt,le,al='如前所述，我们选择使用 <a href="https://huggingface.co/BAAI/bge-base-en-v1.5" rel="nofollow"><code>BAAI/bge-small-en-v1.5</code></a> 生成嵌入，以避免使用默认的 OpenAI（特别是 gpt-3.5-turbo）模型，因为我们需要一个轻量级、可在本地运行的完整解决方案。',ot,ne,sl="幸运的是，LlamaIndex 可以通过 <code>HuggingFaceEmbedding</code> 类方便地从 Hugging Face 获取嵌入模型，因此我们将使用它。",rt,ae,ft,se,il="我们将把这个模型传递给 <code>VectorStoreIndex</code>，作为我们的嵌入模型，以绕过 OpenAI 的默认行为。",dt,ie,$t,me,ut,pe,ml="现在我们要完成 RAG 智能助手的最后一部分——设置查询接口。",gt,oe,pl="在这个教程中，我们将使用 Llama 2 作为语言模型，但我建议你试试不同的模型，看看哪个能给出最好的回答。",bt,re,ol='首先，我们需要在一个新的终端窗口中启动 Ollama 服务器。不过，<a href="https://github.com/ollama/ollama-python" rel="nofollow">Ollama 的 Python 客户端</a>不支持直接启动和关闭服务器，所以我们需要在 Python 环境之外操作。',Mt,fe,rl="打开一个新的终端窗口，输入命令：<code>ollama serve</code>。等我们这里操作完成后，别忘了关闭服务器！",ht,de,fl="现在，让我们将 Llama 2 连接到 LlamaIndex，并使用它作为我们查询引擎的基础。",wt,$e,yt,ue,Tt,ge,dl="有了这些，我们的基本的 RAG 电子书库智能助手就设置好了，我们可以开始询问有关我们电子书库的问题了。例如：",xt,be,ct,Me,$l=`Based on the context provided, there are two books available:

1. "Pride and Prejudice" by Jane Austen
2. "Les Misérables" by Victor Hugo

The context used to derive this answer includes:

* The file path for each book, which provides information about the location of the book files on the computer.
* The titles of the books, which are mentioned in the context as being available for reading.
* A list of words associated with each book, such as "epub" and "notebooks", which provide additional information about the format and storage location of each book.
`,Jt,he,vt,we,ul=`The main character of 'Pride and Prejudice' is Elizabeth Bennet.
`,Ct,ye,Ut,Te,gl="我们成功地展示了如何创建一个完全在本地运行的基本 RAG 的电子书库智能助手，甚至在苹果的 Apple silicon Macs 上也能运行。在这个过程中，我们还全面了解了 LlamaIndex 是如何帮助我们简化建立基于 RAG 的应用程序的。",_t,xe,bl="尽管如此，我们其实只是接触到了一些皮毛。下面是一些关于如何改进和在这个基础上进一步发展的想法。",jt,ce,Lt,Je,Ml="为了避免图书馆员的虚构响应，我们怎样才能要求它为其回答提供引用？",It,ve,Gt,Ce,hl='像 <a href="https://calibre-ebook.com/" rel="nofollow">Calibre</a> 这样的电子书库管理工具会为电子书创建更多的元数据。这些元数据可以提供一些在书中文本里找不到的信息，比如出版商或版本。我们怎样才能扩展我们的 RAG 流程，使其也能利用那些不是 .epub 文件的额外信息源呢？',Zt,Ue,kt,_e,wl="如果我们把这里做的所有东西写成一个脚本或可执行程序，那么每次运行这个脚本时，它都会重新索引我们的图书馆。对于只有两个文件的微型测试库来说，这样还行，但对于稍大一点的图书馆来说，每次都重新索引会让用户感到非常烦恼。我们怎样才能让索引持久化，并且只在图书馆内容有重要变化时，比如添加了新书，才去更新索引呢？",Wt,je,Bt,Le,Xt;return d=new Zl({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/cookbook/blob/main/notebooks/zh-CN/rag_llamaindex_librarian.ipynb"}]}}),c=new y({props:{title:"用 LlamaIndex 构建一个 RAG 电子书库智能助手",local:"用-llamaindex-构建一个-rag-电子书库智能助手",headingTag:"h1"}}),U=new y({props:{title:"简介",local:"简介",headingTag:"h2"}}),j=new y({props:{title:"要求",local:"要求",headingTag:"h2"}}),I=new y({props:{title:"组件",local:"组件",headingTag:"h2"}}),k=new y({props:{title:"依赖",local:"依赖",headingTag:"h2"}}),B=new J({props:{code:"JTI1cGlwJTIwaW5zdGFsbCUyMC1xJTIwJTVDJTBBJTIwJTIwJTIwJTIwbGxhbWEtaW5kZXglMjAlNUMlMEElMjAlMjAlMjAlMjBFYm9va0xpYiUyMCU1QyUwQSUyMCUyMCUyMCUyMGh0bWwydGV4dCUyMCU1QyUwQSUyMCUyMCUyMCUyMGxsYW1hLWluZGV4LWVtYmVkZGluZ3MtaHVnZ2luZ2ZhY2UlMjAlNUMlMEElMjAlMjAlMjAlMjBsbGFtYS1pbmRleC1sbG1zLW9sbGFtYQ==",highlighted:`%pip install -q \\
    llama-index \\
    EbookLib \\
    html2text \\
    llama-index-embeddings-huggingface \\
    llama-index-llms-ollama`,wrap:!1}}),X=new J({props:{code:"IWJyZXclMjBpbnN0YWxsJTIwb2xsYW1h",highlighted:"!brew install ollama",wrap:!1}}),H=new y({props:{title:"设置测试书库",local:"设置测试书库",headingTag:"h2"}}),Y=new J({props:{code:"IW1rZGlyJTIwLXAlMjAlMjIudGVzdCUyRmxpYnJhcnklMkZqYW5lLWF1c3RlbiUyMiUwQSFta2RpciUyMC1wJTIwJTIyLnRlc3QlMkZsaWJyYXJ5JTJGdmljdG9yLWh1Z28lMjIlMEEhd2dldCUyMGh0dHBzJTNBJTJGJTJGd3d3Lmd1dGVuYmVyZy5vcmclMkZlYm9va3MlMkYxMzQyLmVwdWIubm9pbWFnZXMlMjAtTyUyMCUyMi50ZXN0JTJGbGlicmFyeSUyRmphbmUtYXVzdGVuJTJGcHJpZGUtYW5kLXByZWp1ZGljZS5lcHViJTIyJTBBIXdnZXQlMjBodHRwcyUzQSUyRiUyRnd3dy5ndXRlbmJlcmcub3JnJTJGZWJvb2tzJTJGMTM1LmVwdWIubm9pbWFnZXMlMjAtTyUyMCUyMi50ZXN0JTJGbGlicmFyeSUyRnZpY3Rvci1odWdvJTJGbGVzLW1pc2VyYWJsZXMuZXB1YiUyMg==",highlighted:`!mkdir -p <span class="hljs-string">&quot;.test/library/jane-austen&quot;</span>
!mkdir -p <span class="hljs-string">&quot;.test/library/victor-hugo&quot;</span>
!wget https://www.gutenberg.org/ebooks/<span class="hljs-number">1342.</span>epub.noimages -O <span class="hljs-string">&quot;.test/library/jane-austen/pride-and-prejudice.epub&quot;</span>
!wget https://www.gutenberg.org/ebooks/<span class="hljs-number">135.</span>epub.noimages -O <span class="hljs-string">&quot;.test/library/victor-hugo/les-miserables.epub&quot;</span>`,wrap:!1}}),P=new y({props:{title:"用 LlamaIndex 构建 RAG",local:"用-llamaindex-构建-rag",headingTag:"h2"}}),E=new y({props:{title:"加载",local:"加载",headingTag:"h3"}}),N=new J({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUlMjBpbXBvcnQlMjBTaW1wbGVEaXJlY3RvcnlSZWFkZXIlMEElMEFsb2FkZXIlMjAlM0QlMjBTaW1wbGVEaXJlY3RvcnlSZWFkZXIoJTBBJTIwJTIwJTIwJTIwaW5wdXRfZGlyJTNEJTIyLiUyRi50ZXN0JTJGJTIyJTJDJTBBJTIwJTIwJTIwJTIwcmVjdXJzaXZlJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHJlcXVpcmVkX2V4dHMlM0QlNUIlMjIuZXB1YiUyMiU1RCUyQyUwQSklMEElMEFkb2N1bWVudHMlMjAlM0QlMjBsb2FkZXIubG9hZF9kYXRhKCk=",highlighted:`<span class="hljs-keyword">from</span> llama_index.core <span class="hljs-keyword">import</span> SimpleDirectoryReader

loader = SimpleDirectoryReader(
    input_dir=<span class="hljs-string">&quot;./.test/&quot;</span>,
    recursive=<span class="hljs-literal">True</span>,
    required_exts=[<span class="hljs-string">&quot;.epub&quot;</span>],
)

documents = loader.load_data()`,wrap:!1}}),K=new y({props:{title:"索引",local:"索引",headingTag:"h3"}}),v=new Xl({props:{$$slots:{default:[Hl]},$$scope:{ctx:w}}}),ae=new J({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmVtYmVkZGluZ3MuaHVnZ2luZ2ZhY2UlMjBpbXBvcnQlMjBIdWdnaW5nRmFjZUVtYmVkZGluZyUwQSUwQWVtYmVkZGluZ19tb2RlbCUyMCUzRCUyMEh1Z2dpbmdGYWNlRW1iZWRkaW5nKG1vZGVsX25hbWUlM0QlMjJCQUFJJTJGYmdlLXNtYWxsLWVuLXYxLjUlMjIp",highlighted:`<span class="hljs-keyword">from</span> llama_index.embeddings.huggingface <span class="hljs-keyword">import</span> HuggingFaceEmbedding

embedding_model = HuggingFaceEmbedding(model_name=<span class="hljs-string">&quot;BAAI/bge-small-en-v1.5&quot;</span>)`,wrap:!1}}),ie=new J({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUlMjBpbXBvcnQlMjBWZWN0b3JTdG9yZUluZGV4JTBBJTBBaW5kZXglMjAlM0QlMjBWZWN0b3JTdG9yZUluZGV4LmZyb21fZG9jdW1lbnRzKCUwQSUyMCUyMCUyMCUyMGRvY3VtZW50cyUyQyUwQSUyMCUyMCUyMCUyMGVtYmVkX21vZGVsJTNEZW1iZWRkaW5nX21vZGVsJTJDJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> llama_index.core <span class="hljs-keyword">import</span> VectorStoreIndex

index = VectorStoreIndex.from_documents(
    documents,
    embed_model=embedding_model,
)`,wrap:!1}}),me=new y({props:{title:"查询",local:"查询",headingTag:"h3"}}),$e=new J({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmxsbXMub2xsYW1hJTIwaW1wb3J0JTIwT2xsYW1hJTBBJTBBbGxhbWElMjAlM0QlMjBPbGxhbWEoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0QlMjJsbGFtYTIlMjIlMkMlMEElMjAlMjAlMjAlMjByZXF1ZXN0X3RpbWVvdXQlM0Q0MC4wJTJDJTBBKSUwQSUwQXF1ZXJ5X2VuZ2luZSUyMCUzRCUyMGluZGV4LmFzX3F1ZXJ5X2VuZ2luZShsbG0lM0RsbGFtYSk=",highlighted:`<span class="hljs-keyword">from</span> llama_index.llms.ollama <span class="hljs-keyword">import</span> Ollama

llama = Ollama(
    model=<span class="hljs-string">&quot;llama2&quot;</span>,
    request_timeout=<span class="hljs-number">40.0</span>,
)

query_engine = index.as_query_engine(llm=llama)`,wrap:!1}}),ue=new y({props:{title:"最终结果",local:"最终结果",headingTag:"h2"}}),be=new J({props:{code:"cHJpbnQoJTBBJTIwJTIwJTIwJTIwcXVlcnlfZW5naW5lLnF1ZXJ5KCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMldoYXQlMjBhcmUlMjB0aGUlMjB0aXRsZXMlMjBvZiUyMGFsbCUyMHRoZSUyMGJvb2tzJTIwYXZhaWxhYmxlJTNGJTIwU2hvdyUyMG1lJTIwdGhlJTIwY29udGV4dCUyMHVzZWQlMjB0byUyMGRlcml2ZSUyMHlvdXIlMjBhbnN3ZXIuJTIyJTBBJTIwJTIwJTIwJTIwKSUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(
<span class="hljs-meta">... </span>    query_engine.query(
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;What are the titles of all the books available? Show me the context used to derive your answer.&quot;</span>
<span class="hljs-meta">... </span>    )
<span class="hljs-meta">... </span>)`,wrap:!1}}),he=new J({props:{code:"cHJpbnQocXVlcnlfZW5naW5lLnF1ZXJ5KCUyMldobyUyMGlzJTIwdGhlJTIwbWFpbiUyMGNoYXJhY3RlciUyMG9mJTIwJ1ByaWRlJTIwYW5kJTIwUHJlanVkaWNlJyUzRiUyMikp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(query_engine.query(<span class="hljs-string">&quot;Who is the main character of &#x27;Pride and Prejudice&#x27;?&quot;</span>))',wrap:!1}}),ye=new y({props:{title:"总结和未来可能的提升",local:"总结和未来可能的提升",headingTag:"h2"}}),ce=new y({props:{title:"强制引用",local:"强制引用",headingTag:"h3"}}),ve=new y({props:{title:"使用扩充的元数据",local:"使用扩充的元数据",headingTag:"h3"}}),Ue=new y({props:{title:"高效索引",local:"高效索引",headingTag:"h3"}}),je=new kl({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/zh-CN/rag_llamaindex_librarian.md"}}),{c(){f=i("meta"),h=a(),x=i("p"),M=a(),$(d.$$.fragment),T=a(),$(c.$$.fragment),Ie=a(),C=i("p"),C.innerHTML=Rt,Ge=a(),$(U.$$.fragment),Ze=a(),_=i("p"),_.textContent=At,ke=a(),$(j.$$.fragment),We=a(),L=i("p"),L.innerHTML=Yt,Be=a(),$(I.$$.fragment),Xe=a(),G=i("p"),G.textContent=Pt,He=a(),Z=i("ul"),Z.innerHTML=St,Ve=a(),$(k.$$.fragment),Re=a(),W=i("p"),W.textContent=Qt,Ae=a(),$(B.$$.fragment),Ye=a(),$(X.$$.fragment),Pe=a(),$(H.$$.fragment),Se=a(),V=i("p"),V.textContent=qt,Qe=a(),R=i("p"),R.innerHTML=Et,qe=a(),A=i("p"),A.innerHTML=Ft,Ee=a(),$(Y.$$.fragment),Fe=a(),$(P.$$.fragment),ze=a(),S=i("p"),S.textContent=zt,Ne=a(),Q=i("ol"),Q.innerHTML=Nt,De=a(),q=i("p"),q.innerHTML=Dt,Oe=a(),$(E.$$.fragment),Ke=a(),F=i("p"),F.innerHTML=Ot,et=a(),z=i("p"),z.innerHTML=Kt,tt=a(),$(N.$$.fragment),lt=a(),D=i("p"),D.innerHTML=el,nt=a(),O=i("p"),O.innerHTML=tl,at=a(),$(K.$$.fragment),st=a(),ee=i("p"),ee.innerHTML=ll,it=a(),te=i("p"),te.innerHTML=nl,mt=a(),$(v.$$.fragment),pt=a(),le=i("p"),le.innerHTML=al,ot=a(),ne=i("p"),ne.innerHTML=sl,rt=a(),$(ae.$$.fragment),ft=a(),se=i("p"),se.innerHTML=il,dt=a(),$(ie.$$.fragment),$t=a(),$(me.$$.fragment),ut=a(),pe=i("p"),pe.textContent=ml,gt=a(),oe=i("p"),oe.textContent=pl,bt=a(),re=i("p"),re.innerHTML=ol,Mt=a(),fe=i("p"),fe.innerHTML=rl,ht=a(),de=i("p"),de.textContent=fl,wt=a(),$($e.$$.fragment),yt=a(),$(ue.$$.fragment),Tt=a(),ge=i("p"),ge.textContent=dl,xt=a(),$(be.$$.fragment),ct=a(),Me=i("pre"),Me.textContent=$l,Jt=a(),$(he.$$.fragment),vt=a(),we=i("pre"),we.textContent=ul,Ct=a(),$(ye.$$.fragment),Ut=a(),Te=i("p"),Te.textContent=gl,_t=a(),xe=i("p"),xe.textContent=bl,jt=a(),$(ce.$$.fragment),Lt=a(),Je=i("p"),Je.textContent=Ml,It=a(),$(ve.$$.fragment),Gt=a(),Ce=i("p"),Ce.innerHTML=hl,Zt=a(),$(Ue.$$.fragment),kt=a(),_e=i("p"),_e.textContent=wl,Wt=a(),$(je.$$.fragment),Bt=a(),Le=i("p"),this.h()},l(e){const t=jl("svelte-u9bgzb",document.head);f=m(t,"META",{name:!0,content:!0}),t.forEach(l),h=s(e),x=m(e,"P",{}),Ht(x).forEach(l),M=s(e),u(d.$$.fragment,e),T=s(e),u(c.$$.fragment,e),Ie=s(e),C=m(e,"P",{"data-svelte-h":!0}),p(C)!=="svelte-1fxggfq"&&(C.innerHTML=Rt),Ge=s(e),u(U.$$.fragment,e),Ze=s(e),_=m(e,"P",{"data-svelte-h":!0}),p(_)!=="svelte-t7vqnu"&&(_.textContent=At),ke=s(e),u(j.$$.fragment,e),We=s(e),L=m(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-181ybcs"&&(L.innerHTML=Yt),Be=s(e),u(I.$$.fragment,e),Xe=s(e),G=m(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-31j3g1"&&(G.textContent=Pt),He=s(e),Z=m(e,"UL",{"data-svelte-h":!0}),p(Z)!=="svelte-tc6qwv"&&(Z.innerHTML=St),Ve=s(e),u(k.$$.fragment,e),Re=s(e),W=m(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-1yop8fk"&&(W.textContent=Qt),Ae=s(e),u(B.$$.fragment,e),Ye=s(e),u(X.$$.fragment,e),Pe=s(e),u(H.$$.fragment,e),Se=s(e),V=m(e,"P",{"data-svelte-h":!0}),p(V)!=="svelte-bgqcan"&&(V.textContent=qt),Qe=s(e),R=m(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-qr3d2u"&&(R.innerHTML=Et),qe=s(e),A=m(e,"P",{"data-svelte-h":!0}),p(A)!=="svelte-qsdbu3"&&(A.innerHTML=Ft),Ee=s(e),u(Y.$$.fragment,e),Fe=s(e),u(P.$$.fragment,e),ze=s(e),S=m(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-1vf385b"&&(S.textContent=zt),Ne=s(e),Q=m(e,"OL",{"data-svelte-h":!0}),p(Q)!=="svelte-13qt93n"&&(Q.innerHTML=Nt),De=s(e),q=m(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-1bhq17n"&&(q.innerHTML=Dt),Oe=s(e),u(E.$$.fragment,e),Ke=s(e),F=m(e,"P",{"data-svelte-h":!0}),p(F)!=="svelte-wlzo9w"&&(F.innerHTML=Ot),et=s(e),z=m(e,"P",{"data-svelte-h":!0}),p(z)!=="svelte-1pf4mk1"&&(z.innerHTML=Kt),tt=s(e),u(N.$$.fragment,e),lt=s(e),D=m(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-1ds1k09"&&(D.innerHTML=el),nt=s(e),O=m(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-1g3ei9p"&&(O.innerHTML=tl),at=s(e),u(K.$$.fragment,e),st=s(e),ee=m(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-1ljw3zw"&&(ee.innerHTML=ll),it=s(e),te=m(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-1277j1h"&&(te.innerHTML=nl),mt=s(e),u(v.$$.fragment,e),pt=s(e),le=m(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-16otklm"&&(le.innerHTML=al),ot=s(e),ne=m(e,"P",{"data-svelte-h":!0}),p(ne)!=="svelte-m191gf"&&(ne.innerHTML=sl),rt=s(e),u(ae.$$.fragment,e),ft=s(e),se=m(e,"P",{"data-svelte-h":!0}),p(se)!=="svelte-j2nhc9"&&(se.innerHTML=il),dt=s(e),u(ie.$$.fragment,e),$t=s(e),u(me.$$.fragment,e),ut=s(e),pe=m(e,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-1uj4qna"&&(pe.textContent=ml),gt=s(e),oe=m(e,"P",{"data-svelte-h":!0}),p(oe)!=="svelte-9fzwy5"&&(oe.textContent=pl),bt=s(e),re=m(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-egg81c"&&(re.innerHTML=ol),Mt=s(e),fe=m(e,"P",{"data-svelte-h":!0}),p(fe)!=="svelte-nrvcvb"&&(fe.innerHTML=rl),ht=s(e),de=m(e,"P",{"data-svelte-h":!0}),p(de)!=="svelte-2yfztk"&&(de.textContent=fl),wt=s(e),u($e.$$.fragment,e),yt=s(e),u(ue.$$.fragment,e),Tt=s(e),ge=m(e,"P",{"data-svelte-h":!0}),p(ge)!=="svelte-3apvjl"&&(ge.textContent=dl),xt=s(e),u(be.$$.fragment,e),ct=s(e),Me=m(e,"PRE",{"data-svelte-h":!0}),p(Me)!=="svelte-czhhw9"&&(Me.textContent=$l),Jt=s(e),u(he.$$.fragment,e),vt=s(e),we=m(e,"PRE",{"data-svelte-h":!0}),p(we)!=="svelte-13j10yu"&&(we.textContent=ul),Ct=s(e),u(ye.$$.fragment,e),Ut=s(e),Te=m(e,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-1g80xm3"&&(Te.textContent=gl),_t=s(e),xe=m(e,"P",{"data-svelte-h":!0}),p(xe)!=="svelte-fbi3xx"&&(xe.textContent=bl),jt=s(e),u(ce.$$.fragment,e),Lt=s(e),Je=m(e,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-onk5ks"&&(Je.textContent=Ml),It=s(e),u(ve.$$.fragment,e),Gt=s(e),Ce=m(e,"P",{"data-svelte-h":!0}),p(Ce)!=="svelte-1yn6jew"&&(Ce.innerHTML=hl),Zt=s(e),u(Ue.$$.fragment,e),kt=s(e),_e=m(e,"P",{"data-svelte-h":!0}),p(_e)!=="svelte-tjr3o1"&&(_e.textContent=wl),Wt=s(e),u(je.$$.fragment,e),Bt=s(e),Le=m(e,"P",{}),Ht(Le).forEach(l),this.h()},h(){Vt(f,"name","hf:doc:metadata"),Vt(f,"content",Rl)},m(e,t){Ll(document.head,f),n(e,h,t),n(e,x,t),n(e,M,t),g(d,e,t),n(e,T,t),g(c,e,t),n(e,Ie,t),n(e,C,t),n(e,Ge,t),g(U,e,t),n(e,Ze,t),n(e,_,t),n(e,ke,t),g(j,e,t),n(e,We,t),n(e,L,t),n(e,Be,t),g(I,e,t),n(e,Xe,t),n(e,G,t),n(e,He,t),n(e,Z,t),n(e,Ve,t),g(k,e,t),n(e,Re,t),n(e,W,t),n(e,Ae,t),g(B,e,t),n(e,Ye,t),g(X,e,t),n(e,Pe,t),g(H,e,t),n(e,Se,t),n(e,V,t),n(e,Qe,t),n(e,R,t),n(e,qe,t),n(e,A,t),n(e,Ee,t),g(Y,e,t),n(e,Fe,t),g(P,e,t),n(e,ze,t),n(e,S,t),n(e,Ne,t),n(e,Q,t),n(e,De,t),n(e,q,t),n(e,Oe,t),g(E,e,t),n(e,Ke,t),n(e,F,t),n(e,et,t),n(e,z,t),n(e,tt,t),g(N,e,t),n(e,lt,t),n(e,D,t),n(e,nt,t),n(e,O,t),n(e,at,t),g(K,e,t),n(e,st,t),n(e,ee,t),n(e,it,t),n(e,te,t),n(e,mt,t),g(v,e,t),n(e,pt,t),n(e,le,t),n(e,ot,t),n(e,ne,t),n(e,rt,t),g(ae,e,t),n(e,ft,t),n(e,se,t),n(e,dt,t),g(ie,e,t),n(e,$t,t),g(me,e,t),n(e,ut,t),n(e,pe,t),n(e,gt,t),n(e,oe,t),n(e,bt,t),n(e,re,t),n(e,Mt,t),n(e,fe,t),n(e,ht,t),n(e,de,t),n(e,wt,t),g($e,e,t),n(e,yt,t),g(ue,e,t),n(e,Tt,t),n(e,ge,t),n(e,xt,t),g(be,e,t),n(e,ct,t),n(e,Me,t),n(e,Jt,t),g(he,e,t),n(e,vt,t),n(e,we,t),n(e,Ct,t),g(ye,e,t),n(e,Ut,t),n(e,Te,t),n(e,_t,t),n(e,xe,t),n(e,jt,t),g(ce,e,t),n(e,Lt,t),n(e,Je,t),n(e,It,t),g(ve,e,t),n(e,Gt,t),n(e,Ce,t),n(e,Zt,t),g(Ue,e,t),n(e,kt,t),n(e,_e,t),n(e,Wt,t),g(je,e,t),n(e,Bt,t),n(e,Le,t),Xt=!0},p(e,[t]){const yl={};t&2&&(yl.$$scope={dirty:t,ctx:e}),v.$set(yl)},i(e){Xt||(o(d.$$.fragment,e),o(c.$$.fragment,e),o(U.$$.fragment,e),o(j.$$.fragment,e),o(I.$$.fragment,e),o(k.$$.fragment,e),o(B.$$.fragment,e),o(X.$$.fragment,e),o(H.$$.fragment,e),o(Y.$$.fragment,e),o(P.$$.fragment,e),o(E.$$.fragment,e),o(N.$$.fragment,e),o(K.$$.fragment,e),o(v.$$.fragment,e),o(ae.$$.fragment,e),o(ie.$$.fragment,e),o(me.$$.fragment,e),o($e.$$.fragment,e),o(ue.$$.fragment,e),o(be.$$.fragment,e),o(he.$$.fragment,e),o(ye.$$.fragment,e),o(ce.$$.fragment,e),o(ve.$$.fragment,e),o(Ue.$$.fragment,e),o(je.$$.fragment,e),Xt=!0)},o(e){r(d.$$.fragment,e),r(c.$$.fragment,e),r(U.$$.fragment,e),r(j.$$.fragment,e),r(I.$$.fragment,e),r(k.$$.fragment,e),r(B.$$.fragment,e),r(X.$$.fragment,e),r(H.$$.fragment,e),r(Y.$$.fragment,e),r(P.$$.fragment,e),r(E.$$.fragment,e),r(N.$$.fragment,e),r(K.$$.fragment,e),r(v.$$.fragment,e),r(ae.$$.fragment,e),r(ie.$$.fragment,e),r(me.$$.fragment,e),r($e.$$.fragment,e),r(ue.$$.fragment,e),r(be.$$.fragment,e),r(he.$$.fragment,e),r(ye.$$.fragment,e),r(ce.$$.fragment,e),r(ve.$$.fragment,e),r(Ue.$$.fragment,e),r(je.$$.fragment,e),Xt=!1},d(e){e&&(l(h),l(x),l(M),l(T),l(Ie),l(C),l(Ge),l(Ze),l(_),l(ke),l(We),l(L),l(Be),l(Xe),l(G),l(He),l(Z),l(Ve),l(Re),l(W),l(Ae),l(Ye),l(Pe),l(Se),l(V),l(Qe),l(R),l(qe),l(A),l(Ee),l(Fe),l(ze),l(S),l(Ne),l(Q),l(De),l(q),l(Oe),l(Ke),l(F),l(et),l(z),l(tt),l(lt),l(D),l(nt),l(O),l(at),l(st),l(ee),l(it),l(te),l(mt),l(pt),l(le),l(ot),l(ne),l(rt),l(ft),l(se),l(dt),l($t),l(ut),l(pe),l(gt),l(oe),l(bt),l(re),l(Mt),l(fe),l(ht),l(de),l(wt),l(yt),l(Tt),l(ge),l(xt),l(ct),l(Me),l(Jt),l(vt),l(we),l(Ct),l(Ut),l(Te),l(_t),l(xe),l(jt),l(Lt),l(Je),l(It),l(Gt),l(Ce),l(Zt),l(kt),l(_e),l(Wt),l(Bt),l(Le)),l(f),b(d,e),b(c,e),b(U,e),b(j,e),b(I,e),b(k,e),b(B,e),b(X,e),b(H,e),b(Y,e),b(P,e),b(E,e),b(N,e),b(K,e),b(v,e),b(ae,e),b(ie,e),b(me,e),b($e,e),b(ue,e),b(be,e),b(he,e),b(ye,e),b(ce,e),b(ve,e),b(Ue,e),b(je,e)}}}const Rl='{"title":"用 LlamaIndex 构建一个 RAG 电子书库智能助手","local":"用-llamaindex-构建一个-rag-电子书库智能助手","sections":[{"title":"简介","local":"简介","sections":[],"depth":2},{"title":"要求","local":"要求","sections":[],"depth":2},{"title":"组件","local":"组件","sections":[],"depth":2},{"title":"依赖","local":"依赖","sections":[],"depth":2},{"title":"设置测试书库","local":"设置测试书库","sections":[],"depth":2},{"title":"用 LlamaIndex 构建 RAG","local":"用-llamaindex-构建-rag","sections":[{"title":"加载","local":"加载","sections":[],"depth":3},{"title":"索引","local":"索引","sections":[],"depth":3},{"title":"查询","local":"查询","sections":[],"depth":3}],"depth":2},{"title":"最终结果","local":"最终结果","sections":[],"depth":2},{"title":"总结和未来可能的提升","local":"总结和未来可能的提升","sections":[{"title":"强制引用","local":"强制引用","sections":[],"depth":3},{"title":"使用扩充的元数据","local":"使用扩充的元数据","sections":[],"depth":3},{"title":"高效索引","local":"高效索引","sections":[],"depth":3}],"depth":2}],"depth":1}';function Al(w){return _l(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ql extends xl{constructor(f){super(),cl(this,f,Al,Vl,Tl,{})}}export{ql as component};
