import{s as xl,c as Jl,u as Cl,g as kl,d as Ul,o as Il}from"../chunks/scheduler.39a43cde.js";import{S as vl,i as Tl,g as s,h as o,j as Xt,f as l,k as Rt,a as n,d as p,t as u,s as a,r as f,A as Ll,c as i,u as h,x as r,y as _l,v as g,w as b,m as jl,n as Gl}from"../chunks/index.23ec2204.js";import{D as Zl,C as T}from"../chunks/DocNotebookDropdown.21a75b74.js";import{H as $}from"../chunks/Heading.c42e7061.js";function Wl(w){let m,y;const x=w[3].default,c=Jl(x,w,w[2],null);return{c(){m=s("div"),c&&c.c(),this.h()},l(d){m=o(d,"DIV",{class:!0});var M=Xt(m);c&&c.l(M),M.forEach(l),this.h()},h(){Rt(m,"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,M){n(d,m,M),c&&c.m(m,null),y=!0},p(d,[M]){c&&c.p&&(!y||M&4)&&Cl(c,x,d,d[2],y?Ul(x,d[2],M,null):kl(d[2]),null)},i(d){y||(p(c,d),y=!0)},o(d){u(c,d),y=!1},d(d){d&&l(m),c&&c.d(d)}}}function Bl(w,m,y){let{$$slots:x={},$$scope:c}=m,{warning:d=!1}=m;const M=d?"orange":"green";return w.$$set=v=>{"warning"in v&&y(1,d=v.warning),"$$scope"in v&&y(2,c=v.$$scope)},[M,d,c,x]}class Hl extends vl{constructor(m){super(),Tl(this,m,Bl,Wl,xl,{warning:1})}}function Xl(w){let m;return{c(){m=jl(`By default, LlamaIndex uses a chunk size of 1024 and a chunk overlap of
20. For more details, see the [LlamaIndex
documentation](https://docs.llamaindex.ai/en/stable/optimizing/basic_strategies/basic_strategies.html#chunk-sizes).`)},l(y){m=Gl(y,`By default, LlamaIndex uses a chunk size of 1024 and a chunk overlap of
20. For more details, see the [LlamaIndex
documentation](https://docs.llamaindex.ai/en/stable/optimizing/basic_strategies/basic_strategies.html#chunk-sizes).`)},m(y,x){n(y,m,x)},d(y){y&&l(m)}}}function Rl(w){let m,y,x,c,d,M,v,_e,C,Vt='<em>Authored by: <a href="https://huggingface.co/jinnovation" rel="nofollow">Jonathan Jin</a></em>',je,k,Ge,U,At=`This notebook demonstrates how to quickly build a RAG-based “librarian” for your
local ebook library.`,Ze,I,qt=`Think about the last time you visited a library and took advantage of the
expertise of the knowledgeable staff there to help you find what you need out of
the troves of textbooks, novels, and other resources at the library. Our RAG
“librarian” will do the same for us, except for our own local collection of
ebooks.`,We,L,Be,_,Pt=`We’d like our librarian to be <strong>lightweight</strong> and <strong>run locally as much as
possible</strong> with <strong>minimal dependencies</strong>. This means that we will leverage
open-source to the fullest extent possible, as well as bias towards models that
can be <strong>executed locally on typical hardware, e.g. M1 Macbooks</strong>.`,He,j,Xe,G,Yt="Our solution will consist of the following components:",Re,Z,Ft=`<li><a href="https://docs.llamaindex.ai/en/stable/index.html" rel="nofollow">LlamaIndex</a>, a data framework for LLM-based applications that’s, unlike
<a href="https://python.langchain.com/docs/get_started/introduction" rel="nofollow">LangChain</a>, designed specifically for RAG;</li> <li><a href="https://ollama.com/" rel="nofollow">Ollama</a>, a user-friendly solution for running LLMs such as Llama 2 locally;</li> <li>The <a href="https://huggingface.co/BAAI/bge-base-en-v1.5" rel="nofollow"><code>BAAI/bge-base-en-v1.5</code></a>
embedding model, which performs <a href="https://huggingface.co/spaces/mteb/leaderboard" rel="nofollow">reasonably well and is reasonably lightweight
in size</a>;</li> <li><a href="https://ollama.com/library/llama2" rel="nofollow">Llama 2</a>, which we’ll run via <a href="https://ollama.com/" rel="nofollow">Ollama</a>.</li>`,Ve,W,Ae,B,St="First let’s install our dependencies.",qe,H,Pe,X,Ye,R,Fe,V,Qt="Next, let’s create our test “library.”",Se,A,Et="For simplicity’s sake, let’s say that our “library” is simply a <strong>nested directory of <code>.epub</code> files</strong>. We can easily see this solution generalizing to, say, a Calibre library with a <code>metadata.db</code> database file. We’ll leave that extension as an exercise for the reader. 😇",Qe,q,zt='Let’s pull two <code>.epub</code> files from <a href="https://www.gutenberg.org/" rel="nofollow">Project Gutenberg</a> for our library.',Ee,P,ze,Y,Ne,F,Nt="RAG with LlamaIndex, at its core, consists of the following broad phases:",De,S,Dt=`<li><strong>Loading</strong>, in which you tell LlamaIndex where your data lives and how to
load it;</li> <li><strong>Indexing</strong>, in which you augment your loaded data to facilitate querying, e.g. with vector embeddings;</li> <li><strong>Querying</strong>, in which you configure an LLM to act as the query interface for
your indexed data.</li>`,Oe,Q,Ot=`This explanation only scratches at the surface of what’s possible with
LlamaIndex. For more in-depth details, I highly recommend reading the
<a href="https://docs.llamaindex.ai/en/stable/getting_started/concepts.html" rel="nofollow">“High-Level Concepts” page of the LlamaIndex
documentation</a>.`,Ke,E,et,z,Kt="Naturally, let’s start with the <strong>loading</strong> phase.",tt,N,el=`I mentioned before that LlamaIndex is designed specifically for RAG. This
immediately becomes obvious from its
<a href="https://docs.llamaindex.ai/en/stable/module_guides/loading/simpledirectoryreader.html" rel="nofollow"><code>SimpleDirectoryReader</code></a>
construct, which ✨ <strong>magically</strong> ✨ supports a whole host of multi-model file
types for free. Conveniently for us, <code>.epub</code> is in the supported set.`,lt,D,nt,O,tl='<code>SimpleDirectoryReader.load_data()</code> converts our ebooks into a set of <a href="https://docs.llamaindex.ai/en/stable/api/llama_index.core.schema.Document.html" rel="nofollow"><code>Document</code>s</a> for LlamaIndex to work with.',at,K,ll="One important thing to note here is that the documents <strong>have not been chunked at this stage</strong> — that will happen during indexing. Read on…",it,ee,st,te,nl="Next up after <strong>loading</strong> the data is to <strong>index</strong> it. This will allow our RAG pipeline to look up the relevant context for our query to pass to our LLM to <strong>augment</strong> their generated response. This is also where document chunking will take place.",ot,le,al=`<a href="https://docs.llamaindex.ai/en/stable/module_guides/indexing/vector_store_index.html" rel="nofollow"><code>VectorStoreIndex</code></a>
is a “default” entrypoint for indexing in LlamaIndex. By default,
<code>VectorStoreIndex</code> uses a simple, in-memory dictionary to store the indices, but
LlamaIndex also supports <a href="https://docs.llamaindex.ai/en/stable/module_guides/storing/vector_stores.html" rel="nofollow">a wide variety of vector storage
solutions</a>
for you to graduate to as you scale.`,rt,J,mt,ne,il=`Like mentioned before, we’ll use the
<a href="https://huggingface.co/BAAI/bge-base-en-v1.5" rel="nofollow"><code>BAAI/bge-small-en-v1.5</code></a> to
generate our embeddings. By default, <a href="https://docs.llamaindex.ai/en/stable/getting_started/starter_example.html" rel="nofollow">LlamaIndex uses
OpenAI</a>
(specifically <code>gpt-3.5-turbo</code>), which we’d like to avoid given our desire for a lightweight, locally-runnable end-to-end solution.`,dt,ae,sl="Thankfully, LlamaIndex supports retrieving embedding models from Hugging Face through the convenient <code>HuggingFaceEmbedding</code> class, so we’ll use that here.",pt,ie,ut,se,ol="We’ll pass that in to <code>VectorStoreIndex</code> as our embedding model to circumvent the OpenAI default behavior.",ft,oe,ht,re,gt,me,rl="Now for the final piece of the RAG puzzle — wiring up the query layer.",bt,de,ml="We’ll use Llama 2 for the purposes of this recipe, but I encourage readers to play around with different models to see which produces the “best” responses here.",ct,pe,dl='First let’s start up the Ollama server. Unfortunately, there is no support in the <a href="https://github.com/ollama/ollama-python" rel="nofollow">Ollama Python client</a> for actually starting and stopping the server itself, so we’ll have to pop out of Python land for this.',yt,ue,pl="In a separate terminal, run: <code>ollama serve</code>. Remember to terminate this after we’re done here!",wt,fe,ul="Now let’s hook Llama 2 up to LlamaIndex and use it as the basis of our query engine.",$t,he,Mt,ge,xt,be,fl="With that, our basic RAG librarian is set up and we can start asking questions about our library. For example:",vt,ce,Tt,ye,hl=`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,we,Ct,$e,gl=`The main character of 'Pride and Prejudice' is Elizabeth Bennet.
`,kt,Me,Ut,xe,bl="We’ve demonstrated how to build a basic RAG-based “librarian” that runs entirely locally, even on Apple silicon Macs. In doing so, we’ve also carried out a “grand tour” of LlamaIndex and how it streamlines the process of setting up RAG-based applications.",It,ve,cl="That said, we’ve really only scratched the surface of what’s possible here. Here are some ideas of how to refine and build upon this foundation.",Lt,Te,_t,Je,yl="To guard against the risk of our librarian hallucinating, how might we require that it provide citations for everything that it says?",jt,Ce,Gt,ke,wl='Ebook library management solutions like <a href="https://calibre-ebook.com/" rel="nofollow">Calibre</a> create additional metadata for ebooks in a library. This can provide information such as publisher or edition that might not be readily available in the text of the book itself. How could we extend our RAG pipeline to account for additional sources of information that aren’t <code>.epub</code> files?',Zt,Ue,Wt,Ie,$l="If we were to collect everything we built here into a script/executable, the resulting script would re-index our library on each invocation. For our tiny test library of two files, this is “fine,” but for any library of non-trivial size this will very quickly become annoying for users. How could we persist the embedding indices and only update them when the contents of the library have meaningfully changed, e.g. new books have been added?",Bt,Le,Ht;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/en/rag_llamaindex_librarian.ipynb"}]}}),v=new $({props:{title:"Building A RAG Ebook “Librarian” Using LlamaIndex",local:"building-a-rag-ebook-librarian-using-llamaindex",headingTag:"h1"}}),k=new $({props:{title:"Introduction",local:"introduction",headingTag:"h2"}}),L=new $({props:{title:"Requirements",local:"requirements",headingTag:"h2"}}),j=new $({props:{title:"Components",local:"components",headingTag:"h2"}}),W=new $({props:{title:"Dependencies",local:"dependencies",headingTag:"h2"}}),H=new T({props:{code:"JTI1cGlwJTIwaW5zdGFsbCUyMC1xJTIwJTVDJTBBJTIwJTIwJTIwJTIwbGxhbWEtaW5kZXglMjAlNUMlMEElMjAlMjAlMjAlMjBFYm9va0xpYiUyMCU1QyUwQSUyMCUyMCUyMCUyMGh0bWwydGV4dCUyMCU1QyUwQSUyMCUyMCUyMCUyMGxsYW1hLWluZGV4LWVtYmVkZGluZ3MtaHVnZ2luZ2ZhY2UlMjAlNUMlMEElMjAlMjAlMjAlMjBsbGFtYS1pbmRleC1sbG1zLW9sbGFtYQ==",highlighted:`%pip install -q \\
    llama-index \\
    EbookLib \\
    html2text \\
    llama-index-embeddings-huggingface \\
    llama-index-llms-ollama`,wrap:!1}}),X=new T({props:{code:"IWJyZXclMjBpbnN0YWxsJTIwb2xsYW1h",highlighted:"!brew install ollama",wrap:!1}}),R=new $({props:{title:"Test Library Setup",local:"test-library-setup",headingTag:"h2"}}),P=new T({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}}),Y=new $({props:{title:"RAG with LlamaIndex",local:"rag-with-llamaindex",headingTag:"h2"}}),E=new $({props:{title:"Loading",local:"loading",headingTag:"h3"}}),D=new T({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}}),ee=new $({props:{title:"Indexing",local:"indexing",headingTag:"h3"}}),J=new Hl({props:{$$slots:{default:[Xl]},$$scope:{ctx:w}}}),ie=new T({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}}),oe=new T({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}}),re=new $({props:{title:"Querying",local:"querying",headingTag:"h3"}}),he=new T({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}}),ge=new $({props:{title:"Final Result",local:"final-result",headingTag:"h2"}}),ce=new T({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}}),we=new T({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}}),Me=new $({props:{title:"Conclusion and Future Improvements",local:"conclusion-and-future-improvements",headingTag:"h2"}}),Te=new $({props:{title:"Forcing Citations",local:"forcing-citations",headingTag:"h3"}}),Ce=new $({props:{title:"Using Extended Metadata",local:"using-extended-metadata",headingTag:"h3"}}),Ue=new $({props:{title:"Efficient Indexing",local:"efficient-indexing",headingTag:"h3"}}),{c(){m=s("meta"),y=a(),x=s("p"),c=a(),f(d.$$.fragment),M=a(),f(v.$$.fragment),_e=a(),C=s("p"),C.innerHTML=Vt,je=a(),f(k.$$.fragment),Ge=a(),U=s("p"),U.textContent=At,Ze=a(),I=s("p"),I.textContent=qt,We=a(),f(L.$$.fragment),Be=a(),_=s("p"),_.innerHTML=Pt,He=a(),f(j.$$.fragment),Xe=a(),G=s("p"),G.textContent=Yt,Re=a(),Z=s("ul"),Z.innerHTML=Ft,Ve=a(),f(W.$$.fragment),Ae=a(),B=s("p"),B.textContent=St,qe=a(),f(H.$$.fragment),Pe=a(),f(X.$$.fragment),Ye=a(),f(R.$$.fragment),Fe=a(),V=s("p"),V.textContent=Qt,Se=a(),A=s("p"),A.innerHTML=Et,Qe=a(),q=s("p"),q.innerHTML=zt,Ee=a(),f(P.$$.fragment),ze=a(),f(Y.$$.fragment),Ne=a(),F=s("p"),F.textContent=Nt,De=a(),S=s("ol"),S.innerHTML=Dt,Oe=a(),Q=s("p"),Q.innerHTML=Ot,Ke=a(),f(E.$$.fragment),et=a(),z=s("p"),z.innerHTML=Kt,tt=a(),N=s("p"),N.innerHTML=el,lt=a(),f(D.$$.fragment),nt=a(),O=s("p"),O.innerHTML=tl,at=a(),K=s("p"),K.innerHTML=ll,it=a(),f(ee.$$.fragment),st=a(),te=s("p"),te.innerHTML=nl,ot=a(),le=s("p"),le.innerHTML=al,rt=a(),f(J.$$.fragment),mt=a(),ne=s("p"),ne.innerHTML=il,dt=a(),ae=s("p"),ae.innerHTML=sl,pt=a(),f(ie.$$.fragment),ut=a(),se=s("p"),se.innerHTML=ol,ft=a(),f(oe.$$.fragment),ht=a(),f(re.$$.fragment),gt=a(),me=s("p"),me.textContent=rl,bt=a(),de=s("p"),de.textContent=ml,ct=a(),pe=s("p"),pe.innerHTML=dl,yt=a(),ue=s("p"),ue.innerHTML=pl,wt=a(),fe=s("p"),fe.textContent=ul,$t=a(),f(he.$$.fragment),Mt=a(),f(ge.$$.fragment),xt=a(),be=s("p"),be.textContent=fl,vt=a(),f(ce.$$.fragment),Tt=a(),ye=s("pre"),ye.textContent=hl,Jt=a(),f(we.$$.fragment),Ct=a(),$e=s("pre"),$e.textContent=gl,kt=a(),f(Me.$$.fragment),Ut=a(),xe=s("p"),xe.textContent=bl,It=a(),ve=s("p"),ve.textContent=cl,Lt=a(),f(Te.$$.fragment),_t=a(),Je=s("p"),Je.textContent=yl,jt=a(),f(Ce.$$.fragment),Gt=a(),ke=s("p"),ke.innerHTML=wl,Zt=a(),f(Ue.$$.fragment),Wt=a(),Ie=s("p"),Ie.textContent=$l,Bt=a(),Le=s("p"),this.h()},l(e){const t=Ll("svelte-u9bgzb",document.head);m=o(t,"META",{name:!0,content:!0}),t.forEach(l),y=i(e),x=o(e,"P",{}),Xt(x).forEach(l),c=i(e),h(d.$$.fragment,e),M=i(e),h(v.$$.fragment,e),_e=i(e),C=o(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-15wt2km"&&(C.innerHTML=Vt),je=i(e),h(k.$$.fragment,e),Ge=i(e),U=o(e,"P",{"data-svelte-h":!0}),r(U)!=="svelte-qfh19j"&&(U.textContent=At),Ze=i(e),I=o(e,"P",{"data-svelte-h":!0}),r(I)!=="svelte-17t611x"&&(I.textContent=qt),We=i(e),h(L.$$.fragment,e),Be=i(e),_=o(e,"P",{"data-svelte-h":!0}),r(_)!=="svelte-1fw445c"&&(_.innerHTML=Pt),He=i(e),h(j.$$.fragment,e),Xe=i(e),G=o(e,"P",{"data-svelte-h":!0}),r(G)!=="svelte-13bey4p"&&(G.textContent=Yt),Re=i(e),Z=o(e,"UL",{"data-svelte-h":!0}),r(Z)!=="svelte-azwmvi"&&(Z.innerHTML=Ft),Ve=i(e),h(W.$$.fragment,e),Ae=i(e),B=o(e,"P",{"data-svelte-h":!0}),r(B)!=="svelte-1yta0e7"&&(B.textContent=St),qe=i(e),h(H.$$.fragment,e),Pe=i(e),h(X.$$.fragment,e),Ye=i(e),h(R.$$.fragment,e),Fe=i(e),V=o(e,"P",{"data-svelte-h":!0}),r(V)!=="svelte-u4a6ea"&&(V.textContent=Qt),Se=i(e),A=o(e,"P",{"data-svelte-h":!0}),r(A)!=="svelte-341xmi"&&(A.innerHTML=Et),Qe=i(e),q=o(e,"P",{"data-svelte-h":!0}),r(q)!=="svelte-1od3m7l"&&(q.innerHTML=zt),Ee=i(e),h(P.$$.fragment,e),ze=i(e),h(Y.$$.fragment,e),Ne=i(e),F=o(e,"P",{"data-svelte-h":!0}),r(F)!=="svelte-1dd5h8w"&&(F.textContent=Nt),De=i(e),S=o(e,"OL",{"data-svelte-h":!0}),r(S)!=="svelte-vs2u02"&&(S.innerHTML=Dt),Oe=i(e),Q=o(e,"P",{"data-svelte-h":!0}),r(Q)!=="svelte-1arec5s"&&(Q.innerHTML=Ot),Ke=i(e),h(E.$$.fragment,e),et=i(e),z=o(e,"P",{"data-svelte-h":!0}),r(z)!=="svelte-vs6beo"&&(z.innerHTML=Kt),tt=i(e),N=o(e,"P",{"data-svelte-h":!0}),r(N)!=="svelte-atznhb"&&(N.innerHTML=el),lt=i(e),h(D.$$.fragment,e),nt=i(e),O=o(e,"P",{"data-svelte-h":!0}),r(O)!=="svelte-17k0m2j"&&(O.innerHTML=tl),at=i(e),K=o(e,"P",{"data-svelte-h":!0}),r(K)!=="svelte-10xvxlh"&&(K.innerHTML=ll),it=i(e),h(ee.$$.fragment,e),st=i(e),te=o(e,"P",{"data-svelte-h":!0}),r(te)!=="svelte-73j9ky"&&(te.innerHTML=nl),ot=i(e),le=o(e,"P",{"data-svelte-h":!0}),r(le)!=="svelte-1axkw64"&&(le.innerHTML=al),rt=i(e),h(J.$$.fragment,e),mt=i(e),ne=o(e,"P",{"data-svelte-h":!0}),r(ne)!=="svelte-dzonf1"&&(ne.innerHTML=il),dt=i(e),ae=o(e,"P",{"data-svelte-h":!0}),r(ae)!=="svelte-fkwvyv"&&(ae.innerHTML=sl),pt=i(e),h(ie.$$.fragment,e),ut=i(e),se=o(e,"P",{"data-svelte-h":!0}),r(se)!=="svelte-1181vy7"&&(se.innerHTML=ol),ft=i(e),h(oe.$$.fragment,e),ht=i(e),h(re.$$.fragment,e),gt=i(e),me=o(e,"P",{"data-svelte-h":!0}),r(me)!=="svelte-1v49o0l"&&(me.textContent=rl),bt=i(e),de=o(e,"P",{"data-svelte-h":!0}),r(de)!=="svelte-qxi4v1"&&(de.textContent=ml),ct=i(e),pe=o(e,"P",{"data-svelte-h":!0}),r(pe)!=="svelte-1esi2jc"&&(pe.innerHTML=dl),yt=i(e),ue=o(e,"P",{"data-svelte-h":!0}),r(ue)!=="svelte-z54bvc"&&(ue.innerHTML=pl),wt=i(e),fe=o(e,"P",{"data-svelte-h":!0}),r(fe)!=="svelte-1xd6b55"&&(fe.textContent=ul),$t=i(e),h(he.$$.fragment,e),Mt=i(e),h(ge.$$.fragment,e),xt=i(e),be=o(e,"P",{"data-svelte-h":!0}),r(be)!=="svelte-1l7sm6m"&&(be.textContent=fl),vt=i(e),h(ce.$$.fragment,e),Tt=i(e),ye=o(e,"PRE",{"data-svelte-h":!0}),r(ye)!=="svelte-czhhw9"&&(ye.textContent=hl),Jt=i(e),h(we.$$.fragment,e),Ct=i(e),$e=o(e,"PRE",{"data-svelte-h":!0}),r($e)!=="svelte-13j10yu"&&($e.textContent=gl),kt=i(e),h(Me.$$.fragment,e),Ut=i(e),xe=o(e,"P",{"data-svelte-h":!0}),r(xe)!=="svelte-hu2ihj"&&(xe.textContent=bl),It=i(e),ve=o(e,"P",{"data-svelte-h":!0}),r(ve)!=="svelte-8meymn"&&(ve.textContent=cl),Lt=i(e),h(Te.$$.fragment,e),_t=i(e),Je=o(e,"P",{"data-svelte-h":!0}),r(Je)!=="svelte-5ludxz"&&(Je.textContent=yl),jt=i(e),h(Ce.$$.fragment,e),Gt=i(e),ke=o(e,"P",{"data-svelte-h":!0}),r(ke)!=="svelte-1qo1u1t"&&(ke.innerHTML=wl),Zt=i(e),h(Ue.$$.fragment,e),Wt=i(e),Ie=o(e,"P",{"data-svelte-h":!0}),r(Ie)!=="svelte-aaxqx0"&&(Ie.textContent=$l),Bt=i(e),Le=o(e,"P",{}),Xt(Le).forEach(l),this.h()},h(){Rt(m,"name","hf:doc:metadata"),Rt(m,"content",Vl)},m(e,t){_l(document.head,m),n(e,y,t),n(e,x,t),n(e,c,t),g(d,e,t),n(e,M,t),g(v,e,t),n(e,_e,t),n(e,C,t),n(e,je,t),g(k,e,t),n(e,Ge,t),n(e,U,t),n(e,Ze,t),n(e,I,t),n(e,We,t),g(L,e,t),n(e,Be,t),n(e,_,t),n(e,He,t),g(j,e,t),n(e,Xe,t),n(e,G,t),n(e,Re,t),n(e,Z,t),n(e,Ve,t),g(W,e,t),n(e,Ae,t),n(e,B,t),n(e,qe,t),g(H,e,t),n(e,Pe,t),g(X,e,t),n(e,Ye,t),g(R,e,t),n(e,Fe,t),n(e,V,t),n(e,Se,t),n(e,A,t),n(e,Qe,t),n(e,q,t),n(e,Ee,t),g(P,e,t),n(e,ze,t),g(Y,e,t),n(e,Ne,t),n(e,F,t),n(e,De,t),n(e,S,t),n(e,Oe,t),n(e,Q,t),n(e,Ke,t),g(E,e,t),n(e,et,t),n(e,z,t),n(e,tt,t),n(e,N,t),n(e,lt,t),g(D,e,t),n(e,nt,t),n(e,O,t),n(e,at,t),n(e,K,t),n(e,it,t),g(ee,e,t),n(e,st,t),n(e,te,t),n(e,ot,t),n(e,le,t),n(e,rt,t),g(J,e,t),n(e,mt,t),n(e,ne,t),n(e,dt,t),n(e,ae,t),n(e,pt,t),g(ie,e,t),n(e,ut,t),n(e,se,t),n(e,ft,t),g(oe,e,t),n(e,ht,t),g(re,e,t),n(e,gt,t),n(e,me,t),n(e,bt,t),n(e,de,t),n(e,ct,t),n(e,pe,t),n(e,yt,t),n(e,ue,t),n(e,wt,t),n(e,fe,t),n(e,$t,t),g(he,e,t),n(e,Mt,t),g(ge,e,t),n(e,xt,t),n(e,be,t),n(e,vt,t),g(ce,e,t),n(e,Tt,t),n(e,ye,t),n(e,Jt,t),g(we,e,t),n(e,Ct,t),n(e,$e,t),n(e,kt,t),g(Me,e,t),n(e,Ut,t),n(e,xe,t),n(e,It,t),n(e,ve,t),n(e,Lt,t),g(Te,e,t),n(e,_t,t),n(e,Je,t),n(e,jt,t),g(Ce,e,t),n(e,Gt,t),n(e,ke,t),n(e,Zt,t),g(Ue,e,t),n(e,Wt,t),n(e,Ie,t),n(e,Bt,t),n(e,Le,t),Ht=!0},p(e,[t]){const Ml={};t&2&&(Ml.$$scope={dirty:t,ctx:e}),J.$set(Ml)},i(e){Ht||(p(d.$$.fragment,e),p(v.$$.fragment,e),p(k.$$.fragment,e),p(L.$$.fragment,e),p(j.$$.fragment,e),p(W.$$.fragment,e),p(H.$$.fragment,e),p(X.$$.fragment,e),p(R.$$.fragment,e),p(P.$$.fragment,e),p(Y.$$.fragment,e),p(E.$$.fragment,e),p(D.$$.fragment,e),p(ee.$$.fragment,e),p(J.$$.fragment,e),p(ie.$$.fragment,e),p(oe.$$.fragment,e),p(re.$$.fragment,e),p(he.$$.fragment,e),p(ge.$$.fragment,e),p(ce.$$.fragment,e),p(we.$$.fragment,e),p(Me.$$.fragment,e),p(Te.$$.fragment,e),p(Ce.$$.fragment,e),p(Ue.$$.fragment,e),Ht=!0)},o(e){u(d.$$.fragment,e),u(v.$$.fragment,e),u(k.$$.fragment,e),u(L.$$.fragment,e),u(j.$$.fragment,e),u(W.$$.fragment,e),u(H.$$.fragment,e),u(X.$$.fragment,e),u(R.$$.fragment,e),u(P.$$.fragment,e),u(Y.$$.fragment,e),u(E.$$.fragment,e),u(D.$$.fragment,e),u(ee.$$.fragment,e),u(J.$$.fragment,e),u(ie.$$.fragment,e),u(oe.$$.fragment,e),u(re.$$.fragment,e),u(he.$$.fragment,e),u(ge.$$.fragment,e),u(ce.$$.fragment,e),u(we.$$.fragment,e),u(Me.$$.fragment,e),u(Te.$$.fragment,e),u(Ce.$$.fragment,e),u(Ue.$$.fragment,e),Ht=!1},d(e){e&&(l(y),l(x),l(c),l(M),l(_e),l(C),l(je),l(Ge),l(U),l(Ze),l(I),l(We),l(Be),l(_),l(He),l(Xe),l(G),l(Re),l(Z),l(Ve),l(Ae),l(B),l(qe),l(Pe),l(Ye),l(Fe),l(V),l(Se),l(A),l(Qe),l(q),l(Ee),l(ze),l(Ne),l(F),l(De),l(S),l(Oe),l(Q),l(Ke),l(et),l(z),l(tt),l(N),l(lt),l(nt),l(O),l(at),l(K),l(it),l(st),l(te),l(ot),l(le),l(rt),l(mt),l(ne),l(dt),l(ae),l(pt),l(ut),l(se),l(ft),l(ht),l(gt),l(me),l(bt),l(de),l(ct),l(pe),l(yt),l(ue),l(wt),l(fe),l($t),l(Mt),l(xt),l(be),l(vt),l(Tt),l(ye),l(Jt),l(Ct),l($e),l(kt),l(Ut),l(xe),l(It),l(ve),l(Lt),l(_t),l(Je),l(jt),l(Gt),l(ke),l(Zt),l(Wt),l(Ie),l(Bt),l(Le)),l(m),b(d,e),b(v,e),b(k,e),b(L,e),b(j,e),b(W,e),b(H,e),b(X,e),b(R,e),b(P,e),b(Y,e),b(E,e),b(D,e),b(ee,e),b(J,e),b(ie,e),b(oe,e),b(re,e),b(he,e),b(ge,e),b(ce,e),b(we,e),b(Me,e),b(Te,e),b(Ce,e),b(Ue,e)}}}const Vl='{"title":"Building A RAG Ebook “Librarian” Using LlamaIndex","local":"building-a-rag-ebook-librarian-using-llamaindex","sections":[{"title":"Introduction","local":"introduction","sections":[],"depth":2},{"title":"Requirements","local":"requirements","sections":[],"depth":2},{"title":"Components","local":"components","sections":[],"depth":2},{"title":"Dependencies","local":"dependencies","sections":[],"depth":2},{"title":"Test Library Setup","local":"test-library-setup","sections":[],"depth":2},{"title":"RAG with LlamaIndex","local":"rag-with-llamaindex","sections":[{"title":"Loading","local":"loading","sections":[],"depth":3},{"title":"Indexing","local":"indexing","sections":[],"depth":3},{"title":"Querying","local":"querying","sections":[],"depth":3}],"depth":2},{"title":"Final Result","local":"final-result","sections":[],"depth":2},{"title":"Conclusion and Future Improvements","local":"conclusion-and-future-improvements","sections":[{"title":"Forcing Citations","local":"forcing-citations","sections":[],"depth":3},{"title":"Using Extended Metadata","local":"using-extended-metadata","sections":[],"depth":3},{"title":"Efficient Indexing","local":"efficient-indexing","sections":[],"depth":3}],"depth":2}],"depth":1}';function Al(w){return Il(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Sl extends vl{constructor(m){super(),Tl(this,m,Al,Rl,xl,{})}}export{Sl as component};
