import{s as rt,n as ft,o as ot}from"../chunks/scheduler.37c15a92.js";import{S as gt,i as Mt,g as m,s as n,r as L,A as $t,h as i,f as l,c as s,j as pt,u as j,x as u,k as ut,y as ht,a,v as I,d as v,t as H,w as _}from"../chunks/index.2bf4358c.js";import{C as D}from"../chunks/CodeBlock.4e987730.js";import{H as K}from"../chunks/Heading.8ada512a.js";import{E as Tt}from"../chunks/getInferenceSnippets.42ccd5ac.js";function ct(O){let p,B,Z,C,r,U,f,tt="<strong>LlamaHub 是一个包含数百个集成组件、智能体和工具的注册中心，这些资源均可用于LlamaIndex框架。</strong>",E,o,et='<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/llama-index/llama-hub.png" alt="LlamaHub"/>',W,g,lt="在本课程中我们将使用多种集成组件，因此让我们首先了解LlamaHub及其如何助力开发。",k,M,at="接下来我们将学习如何查找和安装所需组件的依赖项。",P,$,Y,h,nt=`LlamaIndex的安装说明可通过结构清晰的<strong><a href="https://llamahub.ai/" rel="nofollow">LlamaHub官网</a></strong>获取。
初次接触可能会感到有些复杂，但大多数<strong>安装命令都遵循易于记忆的格式</strong>：`,V,T,A,c,st='让我们尝试使用 <a href="https://llamahub.ai/l/llms/llama-index-llms-huggingface-api?from=llms" rel="nofollow">Hugging Face 推理 API 集成</a> 安装 LLM 组件的依赖项。',X,w,S,b,F,d,mt=`安装后，我们可以看到使用模式。您会注意到导入路径跟在安装命令后面！
下面，我们可以看到<strong>LLM 组件的 Hugging Face 推理 API</strong> 的使用示例。`,Q,J,N,x,it=`太棒了，我们现在知道如何查找、安装和使用我们所需组件的集成。
<strong>让我们深入了解这些组件</strong>，看看如何使用它们来构建我们自己的智能体。`,R,y,q,G,z;return r=new K({props:{title:"LlamaHub 简介",local:"llamahub-简介",headingTag:"h1"}}),$=new K({props:{title:"安装",local:"安装",headingTag:"h2"}}),T=new D({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LSU3QmNvbXBvbmVudC10eXBlJTdELSU3QmZyYW1ld29yay1uYW1lJTdE",highlighted:"pip install llama-index-{component-type}-{framework-name}",wrap:!1}}),w=new D({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LWxsbXMtaHVnZ2luZ2ZhY2UtYXBp",highlighted:"pip install llama-index-llms-huggingface-api",wrap:!1}}),b=new K({props:{title:"用法",local:"用法",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 Tt({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/zh-CN/unit2/llama-index/llama-hub.mdx"}}),{c(){p=m("meta"),B=n(),Z=m("p"),C=n(),L(r.$$.fragment),U=n(),f=m("p"),f.innerHTML=tt,E=n(),o=m("p"),o.innerHTML=et,W=n(),g=m("p"),g.textContent=lt,k=n(),M=m("p"),M.textContent=at,P=n(),L($.$$.fragment),Y=n(),h=m("p"),h.innerHTML=nt,V=n(),L(T.$$.fragment),A=n(),c=m("p"),c.innerHTML=st,X=n(),L(w.$$.fragment),S=n(),L(b.$$.fragment),F=n(),d=m("p"),d.innerHTML=mt,Q=n(),L(J.$$.fragment),N=n(),x=m("p"),x.innerHTML=it,R=n(),L(y.$$.fragment),q=n(),G=m("p"),this.h()},l(t){const e=$t("svelte-u9bgzb",document.head);p=i(e,"META",{name:!0,content:!0}),e.forEach(l),B=s(t),Z=i(t,"P",{}),pt(Z).forEach(l),C=s(t),j(r.$$.fragment,t),U=s(t),f=i(t,"P",{"data-svelte-h":!0}),u(f)!=="svelte-1n5v0e0"&&(f.innerHTML=tt),E=s(t),o=i(t,"P",{"data-svelte-h":!0}),u(o)!=="svelte-jjjeyj"&&(o.innerHTML=et),W=s(t),g=i(t,"P",{"data-svelte-h":!0}),u(g)!=="svelte-ochip2"&&(g.textContent=lt),k=s(t),M=i(t,"P",{"data-svelte-h":!0}),u(M)!=="svelte-167xabk"&&(M.textContent=at),P=s(t),j($.$$.fragment,t),Y=s(t),h=i(t,"P",{"data-svelte-h":!0}),u(h)!=="svelte-586v7"&&(h.innerHTML=nt),V=s(t),j(T.$$.fragment,t),A=s(t),c=i(t,"P",{"data-svelte-h":!0}),u(c)!=="svelte-utzny0"&&(c.innerHTML=st),X=s(t),j(w.$$.fragment,t),S=s(t),j(b.$$.fragment,t),F=s(t),d=i(t,"P",{"data-svelte-h":!0}),u(d)!=="svelte-1842y1e"&&(d.innerHTML=mt),Q=s(t),j(J.$$.fragment,t),N=s(t),x=i(t,"P",{"data-svelte-h":!0}),u(x)!=="svelte-1ryb3ro"&&(x.innerHTML=it),R=s(t),j(y.$$.fragment,t),q=s(t),G=i(t,"P",{}),pt(G).forEach(l),this.h()},h(){ut(p,"name","hf:doc:metadata"),ut(p,"content",wt)},m(t,e){ht(document.head,p),a(t,B,e),a(t,Z,e),a(t,C,e),I(r,t,e),a(t,U,e),a(t,f,e),a(t,E,e),a(t,o,e),a(t,W,e),a(t,g,e),a(t,k,e),a(t,M,e),a(t,P,e),I($,t,e),a(t,Y,e),a(t,h,e),a(t,V,e),I(T,t,e),a(t,A,e),a(t,c,e),a(t,X,e),I(w,t,e),a(t,S,e),I(b,t,e),a(t,F,e),a(t,d,e),a(t,Q,e),I(J,t,e),a(t,N,e),a(t,x,e),a(t,R,e),I(y,t,e),a(t,q,e),a(t,G,e),z=!0},p:ft,i(t){z||(v(r.$$.fragment,t),v($.$$.fragment,t),v(T.$$.fragment,t),v(w.$$.fragment,t),v(b.$$.fragment,t),v(J.$$.fragment,t),v(y.$$.fragment,t),z=!0)},o(t){H(r.$$.fragment,t),H($.$$.fragment,t),H(T.$$.fragment,t),H(w.$$.fragment,t),H(b.$$.fragment,t),H(J.$$.fragment,t),H(y.$$.fragment,t),z=!1},d(t){t&&(l(B),l(Z),l(C),l(U),l(f),l(E),l(o),l(W),l(g),l(k),l(M),l(P),l(Y),l(h),l(V),l(A),l(c),l(X),l(S),l(F),l(d),l(Q),l(N),l(x),l(R),l(q),l(G)),l(p),_(r,t),_($,t),_(T,t),_(w,t),_(b,t),_(J,t),_(y,t)}}}const wt='{"title":"LlamaHub 简介","local":"llamahub-简介","sections":[{"title":"安装","local":"安装","sections":[],"depth":2},{"title":"用法","local":"用法","sections":[],"depth":2}],"depth":1}';function bt(O){return ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class jt extends gt{constructor(p){super(),Mt(this,p,bt,ct,rt,{})}}export{jt as component};
