import{s as re,n as ue,o as fe}from"../chunks/scheduler.37c15a92.js";import{S as he,i as ce,g as i,s as a,r as J,A as de,h as o,f as n,c as s,j as me,u as Z,x as p,k as pe,y as ge,a as l,v as I,d as B,t as j,w as x}from"../chunks/index.2bf4358c.js";import{C as O}from"../chunks/CodeBlock.4e987730.js";import{H as K}from"../chunks/Heading.8ada512a.js";import{E as we}from"../chunks/index.f9c0018f.js";function Me(D){let m,k,L,G,r,H,u,ee="<strong>LlamaHub is a registry of hundreds of integrations, agents and tools that you can use within LlamaIndex.</strong>",_,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,c,le="Let’s see how to find and install the dependencies for the components we need.",V,d,S,g,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>:`,Y,w,Q,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>.',P,b,F,y,X,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>.`,R,$,z,v,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.`,A,U,N,W,q;return r=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 O({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LSU3QmNvbXBvbmVudC10eXBlJTdELSU3QmZyYW1ld29yay1uYW1lJTdE",highlighted:"pip install llama-index-{component-type}-{framework-name}",wrap:!1}}),b=new O({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LWxsbXMtaHVnZ2luZ2ZhY2UtYXBpJTIwbGxhbWEtaW5kZXgtZW1iZWRkaW5ncy1odWdnaW5nZmFjZQ==",highlighted:"pip install llama-index-llms-huggingface-api llama-index-embeddings-huggingface",wrap:!1}}),y=new K({props:{title:"Usage",local:"usage",headingTag:"h2"}}),$=new O({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmxsbXMuaHVnZ2luZ2ZhY2VfYXBpJTIwaW1wb3J0JTIwSHVnZ2luZ0ZhY2VJbmZlcmVuY2VBUEklMEFpbXBvcnQlMjBvcyUwQWZyb20lMjBkb3RlbnYlMjBpbXBvcnQlMjBsb2FkX2RvdGVudiUwQSUwQSUyMyUyMExvYWQlMjB0aGUlMjAuZW52JTIwZmlsZSUwQWxvYWRfZG90ZW52KCklMEElMEElMjMlMjBSZXRyaWV2ZSUyMEhGX1RPS0VOJTIwZnJvbSUyMHRoZSUyMGVudmlyb25tZW50JTIwdmFyaWFibGVzJTBBaGZfdG9rZW4lMjAlM0QlMjBvcy5nZXRlbnYoJTIySEZfVE9LRU4lMjIpJTBBJTBBbGxtJTIwJTNEJTIwSHVnZ2luZ0ZhY2VJbmZlcmVuY2VBUEkoJTBBJTIwJTIwJTIwJTIwbW9kZWxfbmFtZSUzRCUyMlF3ZW4lMkZRd2VuMi41LUNvZGVyLTMyQi1JbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC43JTJDJTBBJTIwJTIwJTIwJTIwbWF4X3Rva2VucyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHRva2VuJTNEaGZfdG9rZW4lMkMlMEEpJTBBJTBBcmVzcG9uc2UlMjAlM0QlMjBsbG0uY29tcGxldGUoJTIySGVsbG8lMkMlMjBob3clMjBhcmUlMjB5b3UlM0YlMjIpJTBBcHJpbnQocmVzcG9uc2UpJTBBJTIzJTIwSSUyMGFtJTIwZ29vZCUyQyUyMGhvdyUyMGNhbiUyMEklMjBoZWxwJTIweW91JTIwdG9kYXklM0Y=",highlighted:`<span class="hljs-keyword">from</span> llama_index.llms.huggingface_api <span class="hljs-keyword">import</span> HuggingFaceInferenceAPI
<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> dotenv <span class="hljs-keyword">import</span> load_dotenv

<span class="hljs-comment"># Load the .env file</span>
load_dotenv()

<span class="hljs-comment"># Retrieve HF_TOKEN from the environment variables</span>
hf_token = os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>)

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=hf_token,
)

response = llm.complete(<span class="hljs-string">&quot;Hello, how are you?&quot;</span>)
<span class="hljs-built_in">print</span>(response)
<span class="hljs-comment"># I am good, how can I help you today?</span>`,wrap:!1}}),U=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(),L=i("p"),G=a(),J(r.$$.fragment),H=a(),u=i("p"),u.innerHTML=ee,_=a(),f=i("p"),f.innerHTML=te,C=a(),h=i("p"),h.textContent=ne,E=a(),c=i("p"),c.textContent=le,V=a(),J(d.$$.fragment),S=a(),g=i("p"),g.innerHTML=ae,Y=a(),J(w.$$.fragment),Q=a(),M=i("p"),M.innerHTML=se,P=a(),J(b.$$.fragment),F=a(),J(y.$$.fragment),X=a(),T=i("p"),T.innerHTML=ie,R=a(),J($.$$.fragment),z=a(),v=i("p"),v.innerHTML=oe,A=a(),J(U.$$.fragment),N=a(),W=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),L=o(e,"P",{}),me(L).forEach(n),G=s(e),Z(r.$$.fragment,e),H=s(e),u=o(e,"P",{"data-svelte-h":!0}),p(u)!=="svelte-6kawnq"&&(u.innerHTML=ee),_=s(e),f=o(e,"P",{"data-svelte-h":!0}),p(f)!=="svelte-jjjeyj"&&(f.innerHTML=te),C=s(e),h=o(e,"P",{"data-svelte-h":!0}),p(h)!=="svelte-fohn1k"&&(h.textContent=ne),E=s(e),c=o(e,"P",{"data-svelte-h":!0}),p(c)!=="svelte-5c6p8c"&&(c.textContent=le),V=s(e),Z(d.$$.fragment,e),S=s(e),g=o(e,"P",{"data-svelte-h":!0}),p(g)!=="svelte-169w10d"&&(g.innerHTML=ae),Y=s(e),Z(w.$$.fragment,e),Q=s(e),M=o(e,"P",{"data-svelte-h":!0}),p(M)!=="svelte-5m0iju"&&(M.innerHTML=se),P=s(e),Z(b.$$.fragment,e),F=s(e),Z(y.$$.fragment,e),X=s(e),T=o(e,"P",{"data-svelte-h":!0}),p(T)!=="svelte-1dpkd4c"&&(T.innerHTML=ie),R=s(e),Z($.$$.fragment,e),z=s(e),v=o(e,"P",{"data-svelte-h":!0}),p(v)!=="svelte-13kdhye"&&(v.innerHTML=oe),A=s(e),Z(U.$$.fragment,e),N=s(e),W=o(e,"P",{}),me(W).forEach(n),this.h()},h(){pe(m,"name","hf:doc:metadata"),pe(m,"content",be)},m(e,t){ge(document.head,m),l(e,k,t),l(e,L,t),l(e,G,t),I(r,e,t),l(e,H,t),l(e,u,t),l(e,_,t),l(e,f,t),l(e,C,t),l(e,h,t),l(e,E,t),l(e,c,t),l(e,V,t),I(d,e,t),l(e,S,t),l(e,g,t),l(e,Y,t),I(w,e,t),l(e,Q,t),l(e,M,t),l(e,P,t),I(b,e,t),l(e,F,t),I(y,e,t),l(e,X,t),l(e,T,t),l(e,R,t),I($,e,t),l(e,z,t),l(e,v,t),l(e,A,t),I(U,e,t),l(e,N,t),l(e,W,t),q=!0},p:ue,i(e){q||(B(r.$$.fragment,e),B(d.$$.fragment,e),B(w.$$.fragment,e),B(b.$$.fragment,e),B(y.$$.fragment,e),B($.$$.fragment,e),B(U.$$.fragment,e),q=!0)},o(e){j(r.$$.fragment,e),j(d.$$.fragment,e),j(w.$$.fragment,e),j(b.$$.fragment,e),j(y.$$.fragment,e),j($.$$.fragment,e),j(U.$$.fragment,e),q=!1},d(e){e&&(n(k),n(L),n(G),n(H),n(u),n(_),n(f),n(C),n(h),n(E),n(c),n(V),n(S),n(g),n(Y),n(Q),n(M),n(P),n(F),n(X),n(T),n(R),n(z),n(v),n(A),n(N),n(W)),n(m),x(r,e),x(d,e),x(w,e),x(b,e),x(y,e),x($,e),x(U,e)}}}const be='{"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 ye(D){return fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends he{constructor(m){super(),ce(this,m,ye,Me,re,{})}}export{Ze as component};
