import{s as ue,n as pe,o as fe}from"../chunks/scheduler.37c15a92.js";import{S as he,i as ge,g as i,s as a,r as I,A as de,h as o,f as n,c as s,j as me,u as L,x as r,k as re,y as ce,a as l,v as j,d as v,t as H,w as Z}from"../chunks/index.2bf4358c.js";import{C as D}from"../chunks/CodeBlock.4f5fc1ad.js";import{H as K}from"../chunks/Heading.8ada512a.js";import{E as we}from"../chunks/EditOnGithub.9958bcdc.js";function Me(O){let m,k,W,G,u,U,p,ee="<strong>LlamaHub is a registry of hundreds of integrations, agents and tools that you can use within LlamaIndex.</strong>",B,f,te='<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/llama-index/llama-hub.png" alt="LlamaHub"/>',C,h,ne="We will be using various integrations in this course, so let’s first look at the LlamaHub and how it can help us.",E,g,le="Let’s see how to find and install the dependencies for the components we need.",P,d,Y,c,ae=`LlamaIndex installation instructions are available as a well-structured <strong>overview on <a href="https://llamahub.ai/" rel="nofollow">LlamaHub</a></strong>.
This might be a bit overwhelming at first, but most of the <strong>installation commands generally follow an easy-to-remember format</strong>:`,V,w,X,M,se='Let’s try to install the dependencies for an LLM and embedding component using the <a href="https://llamahub.ai/l/llms/llama-index-llms-huggingface-api?from=llms" rel="nofollow">Hugging Face inference API integration</a>.',A,$,F,b,S,T,ie=`Once installed, we can see the usage patterns. You’ll notice that the import paths follow the install command!
Underneath, we can see an example of the usage of <strong>the Hugging Face inference API for an LLM component</strong>.`,Q,J,R,x,oe=`Wonderful, we now know how to find, install and use the integrations for the components we need.
<strong>Let’s dive deeper into the components</strong> and see how we can use them to build our own agents.`,q,y,N,_,z;return u=new K({props:{title:"Introduction to the LlamaHub",local:"introduction-to-the-llamahub",headingTag:"h1"}}),d=new K({props:{title:"Installation",local:"installation",headingTag:"h2"}}),w=new D({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LSU3QmNvbXBvbmVudC10eXBlJTdELSU3QmZyYW1ld29yay1uYW1lJTdE",highlighted:"pip install llama-index-{component-type}-{framework-name}",wrap:!1}}),$=new D({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LWxsbXMtaHVnZ2luZ2ZhY2UtYXBpJTIwbGxhbWEtaW5kZXgtZW1iZWRkaW5ncy1odWdnaW5nZmFjZQ==",highlighted:"pip install llama-index-llms-huggingface-api llama-index-embeddings-huggingface",wrap:!1}}),b=new K({props:{title:"Usage",local:"usage",headingTag:"h2"}}),J=new D({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmxsbXMuaHVnZ2luZ2ZhY2VfYXBpJTIwaW1wb3J0JTIwSHVnZ2luZ0ZhY2VJbmZlcmVuY2VBUEklMEElMEFsbG0lMjAlM0QlMjBIdWdnaW5nRmFjZUluZmVyZW5jZUFQSSglMEElMjAlMjAlMjAlMjBtb2RlbF9uYW1lJTNEJTIyUXdlbiUyRlF3ZW4yLjUtQ29kZXItMzJCLUluc3RydWN0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjclMkMlMEElMjAlMjAlMjAlMjBtYXhfdG9rZW5zJTNEMTAwJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW4lM0QlMjJoZl94eHglMjIlMkMlMEEpJTBBJTBBbGxtLmNvbXBsZXRlKCUyMkhlbGxvJTJDJTIwaG93JTIwYXJlJTIweW91JTNGJTIyKSUwQSUyMyUyMEklMjBhbSUyMGdvb2QlMkMlMjBob3clMjBjYW4lMjBJJTIwaGVscCUyMHlvdSUyMHRvZGF5JTNG",highlighted:`<span class="hljs-keyword">from</span> llama_index.llms.huggingface_api <span class="hljs-keyword">import</span> HuggingFaceInferenceAPI

llm = HuggingFaceInferenceAPI(
    model_name=<span class="hljs-string">&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</span>,
    temperature=<span class="hljs-number">0.7</span>,
    max_tokens=<span class="hljs-number">100</span>,
    token=<span class="hljs-string">&quot;hf_xxx&quot;</span>,
)

llm.complete(<span class="hljs-string">&quot;Hello, how are you?&quot;</span>)
<span class="hljs-comment"># I am good, how can I help you today?</span>`,wrap:!1}}),y=new we({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/en/unit2/llama-index/llama-hub.mdx"}}),{c(){m=i("meta"),k=a(),W=i("p"),G=a(),I(u.$$.fragment),U=a(),p=i("p"),p.innerHTML=ee,B=a(),f=i("p"),f.innerHTML=te,C=a(),h=i("p"),h.textContent=ne,E=a(),g=i("p"),g.textContent=le,P=a(),I(d.$$.fragment),Y=a(),c=i("p"),c.innerHTML=ae,V=a(),I(w.$$.fragment),X=a(),M=i("p"),M.innerHTML=se,A=a(),I($.$$.fragment),F=a(),I(b.$$.fragment),S=a(),T=i("p"),T.innerHTML=ie,Q=a(),I(J.$$.fragment),R=a(),x=i("p"),x.innerHTML=oe,q=a(),I(y.$$.fragment),N=a(),_=i("p"),this.h()},l(e){const t=de("svelte-u9bgzb",document.head);m=o(t,"META",{name:!0,content:!0}),t.forEach(n),k=s(e),W=o(e,"P",{}),me(W).forEach(n),G=s(e),L(u.$$.fragment,e),U=s(e),p=o(e,"P",{"data-svelte-h":!0}),r(p)!=="svelte-6kawnq"&&(p.innerHTML=ee),B=s(e),f=o(e,"P",{"data-svelte-h":!0}),r(f)!=="svelte-jjjeyj"&&(f.innerHTML=te),C=s(e),h=o(e,"P",{"data-svelte-h":!0}),r(h)!=="svelte-fohn1k"&&(h.textContent=ne),E=s(e),g=o(e,"P",{"data-svelte-h":!0}),r(g)!=="svelte-5c6p8c"&&(g.textContent=le),P=s(e),L(d.$$.fragment,e),Y=s(e),c=o(e,"P",{"data-svelte-h":!0}),r(c)!=="svelte-169w10d"&&(c.innerHTML=ae),V=s(e),L(w.$$.fragment,e),X=s(e),M=o(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-5m0iju"&&(M.innerHTML=se),A=s(e),L($.$$.fragment,e),F=s(e),L(b.$$.fragment,e),S=s(e),T=o(e,"P",{"data-svelte-h":!0}),r(T)!=="svelte-1dpkd4c"&&(T.innerHTML=ie),Q=s(e),L(J.$$.fragment,e),R=s(e),x=o(e,"P",{"data-svelte-h":!0}),r(x)!=="svelte-13kdhye"&&(x.innerHTML=oe),q=s(e),L(y.$$.fragment,e),N=s(e),_=o(e,"P",{}),me(_).forEach(n),this.h()},h(){re(m,"name","hf:doc:metadata"),re(m,"content",$e)},m(e,t){ce(document.head,m),l(e,k,t),l(e,W,t),l(e,G,t),j(u,e,t),l(e,U,t),l(e,p,t),l(e,B,t),l(e,f,t),l(e,C,t),l(e,h,t),l(e,E,t),l(e,g,t),l(e,P,t),j(d,e,t),l(e,Y,t),l(e,c,t),l(e,V,t),j(w,e,t),l(e,X,t),l(e,M,t),l(e,A,t),j($,e,t),l(e,F,t),j(b,e,t),l(e,S,t),l(e,T,t),l(e,Q,t),j(J,e,t),l(e,R,t),l(e,x,t),l(e,q,t),j(y,e,t),l(e,N,t),l(e,_,t),z=!0},p:pe,i(e){z||(v(u.$$.fragment,e),v(d.$$.fragment,e),v(w.$$.fragment,e),v($.$$.fragment,e),v(b.$$.fragment,e),v(J.$$.fragment,e),v(y.$$.fragment,e),z=!0)},o(e){H(u.$$.fragment,e),H(d.$$.fragment,e),H(w.$$.fragment,e),H($.$$.fragment,e),H(b.$$.fragment,e),H(J.$$.fragment,e),H(y.$$.fragment,e),z=!1},d(e){e&&(n(k),n(W),n(G),n(U),n(p),n(B),n(f),n(C),n(h),n(E),n(g),n(P),n(Y),n(c),n(V),n(X),n(M),n(A),n(F),n(S),n(T),n(Q),n(R),n(x),n(q),n(N),n(_)),n(m),Z(u,e),Z(d,e),Z(w,e),Z($,e),Z(b,e),Z(J,e),Z(y,e)}}}const $e='{"title":"Introduction to the LlamaHub","local":"introduction-to-the-llamahub","sections":[{"title":"Installation","local":"installation","sections":[],"depth":2},{"title":"Usage","local":"usage","sections":[],"depth":2}],"depth":1}';function be(O){return fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Le extends he{constructor(m){super(),ge(this,m,be,Me,ue,{})}}export{Le as component};
