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