import{s as re,n as pe,o as de}from"../chunks/scheduler.37c15a92.js";import{S as ce,i as fe,g as i,s,r as J,A as Me,h as m,f as n,c as a,j as oe,u as Z,x as u,k as ue,y as ge,a as l,v as j,d as I,t as B,w as L}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 be}from"../chunks/getInferenceSnippets.d4d07d1e.js";function he(D){let o,G,H,W,r,_,p,ee="<strong><em>LlamaHub</em> est un registre de centaines d’intégrations, d’<em>agents</em> et de <em>tools</em> que vous pouvez utiliser dans LlamaIndex.</strong>",k,d,te='<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/llama-index/llama-hub.png" alt="LlamaHub"/>',V,c,ne="Nous utiliserons diverses intégrations dans ce cours, alors examinons d’abord le <em>LlamaHub</em> et comment il peut nous aider.",E,f,le="Voyons comment trouver et installer les dépendances pour les <em>components</em> dont nous avons besoin.",C,M,S,g,se=`Les instructions d’installation de LlamaIndex sont disponibles comme un <strong>aperçu bien structuré sur <a href="https://llamahub.ai/" rel="nofollow"><em>LlamaHub</em></a></strong>.
Cela peut être un peu démoralisant au début, mais la plupart des <strong>commandes d’installation suivent généralement un format facile à retenir</strong> :`,Q,b,Y,h,ae='Essayons d’installer les dépendances pour un <em>component</em> <em>LLM</em> et <em>embedding</em> en utilisant l’<a href="https://llamahub.ai/l/llms/llama-index-llms-huggingface-api?from=llms" rel="nofollow">intégration API d’inférence <em>Hugging Face</em></a>.',P,v,F,T,X,y,ie=`Une fois installé, nous pouvons voir les modèles d’utilisation. Vous remarquerez que les chemins d’importation suivent la commande d’installation !
Ci-dessous, nous pouvons voir un exemple d’utilisation de <strong>l’API d’inférence <em>Hugging Face</em> pour un <em>component</em> <em>LLM</em></strong>.`,R,w,z,$,me=`Parfait, nous savons maintenant comment trouver, installer et utiliser les intégrations pour les <em>components</em> dont nous avons besoin.
<strong>Approfondissons les <em>components</em></strong> et voyons comment nous pouvons les utiliser pour construire nos propres agents.`,q,U,A,x,N;return r=new K({props:{title:"Introduction au LlamaHub",local:"introduction-au-llamahub",headingTag:"h1"}}),M=new K({props:{title:"Installation",local:"installation",headingTag:"h2"}}),b=new O({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LSU3QmNvbXBvbmVudC10eXBlJTdELSU3QmZyYW1ld29yay1uYW1lJTdE",highlighted:"pip install llama-index-{component-type}-{framework-name}",wrap:!1}}),v=new O({props:{code:"cGlwJTIwaW5zdGFsbCUyMGxsYW1hLWluZGV4LWxsbXMtaHVnZ2luZ2ZhY2UtYXBpJTIwbGxhbWEtaW5kZXgtZW1iZWRkaW5ncy1odWdnaW5nZmFjZQ==",highlighted:"pip install llama-index-llms-huggingface-api llama-index-embeddings-huggingface",wrap:!1}}),T=new K({props:{title:"Utilisation",local:"utilisation",headingTag:"h2"}}),w=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 be({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/fr/unit2/llama-index/llama-hub.mdx"}}),{c(){o=i("meta"),G=s(),H=i("p"),W=s(),J(r.$$.fragment),_=s(),p=i("p"),p.innerHTML=ee,k=s(),d=i("p"),d.innerHTML=te,V=s(),c=i("p"),c.innerHTML=ne,E=s(),f=i("p"),f.innerHTML=le,C=s(),J(M.$$.fragment),S=s(),g=i("p"),g.innerHTML=se,Q=s(),J(b.$$.fragment),Y=s(),h=i("p"),h.innerHTML=ae,P=s(),J(v.$$.fragment),F=s(),J(T.$$.fragment),X=s(),y=i("p"),y.innerHTML=ie,R=s(),J(w.$$.fragment),z=s(),$=i("p"),$.innerHTML=me,q=s(),J(U.$$.fragment),A=s(),x=i("p"),this.h()},l(e){const t=Me("svelte-u9bgzb",document.head);o=m(t,"META",{name:!0,content:!0}),t.forEach(n),G=a(e),H=m(e,"P",{}),oe(H).forEach(n),W=a(e),Z(r.$$.fragment,e),_=a(e),p=m(e,"P",{"data-svelte-h":!0}),u(p)!=="svelte-1jrtpb2"&&(p.innerHTML=ee),k=a(e),d=m(e,"P",{"data-svelte-h":!0}),u(d)!=="svelte-jjjeyj"&&(d.innerHTML=te),V=a(e),c=m(e,"P",{"data-svelte-h":!0}),u(c)!=="svelte-1xkimsb"&&(c.innerHTML=ne),E=a(e),f=m(e,"P",{"data-svelte-h":!0}),u(f)!=="svelte-1mjah1n"&&(f.innerHTML=le),C=a(e),Z(M.$$.fragment,e),S=a(e),g=m(e,"P",{"data-svelte-h":!0}),u(g)!=="svelte-nlbgvw"&&(g.innerHTML=se),Q=a(e),Z(b.$$.fragment,e),Y=a(e),h=m(e,"P",{"data-svelte-h":!0}),u(h)!=="svelte-vj7p2k"&&(h.innerHTML=ae),P=a(e),Z(v.$$.fragment,e),F=a(e),Z(T.$$.fragment,e),X=a(e),y=m(e,"P",{"data-svelte-h":!0}),u(y)!=="svelte-1o0hs5m"&&(y.innerHTML=ie),R=a(e),Z(w.$$.fragment,e),z=a(e),$=m(e,"P",{"data-svelte-h":!0}),u($)!=="svelte-u6ctr5"&&($.innerHTML=me),q=a(e),Z(U.$$.fragment,e),A=a(e),x=m(e,"P",{}),oe(x).forEach(n),this.h()},h(){ue(o,"name","hf:doc:metadata"),ue(o,"content",ve)},m(e,t){ge(document.head,o),l(e,G,t),l(e,H,t),l(e,W,t),j(r,e,t),l(e,_,t),l(e,p,t),l(e,k,t),l(e,d,t),l(e,V,t),l(e,c,t),l(e,E,t),l(e,f,t),l(e,C,t),j(M,e,t),l(e,S,t),l(e,g,t),l(e,Q,t),j(b,e,t),l(e,Y,t),l(e,h,t),l(e,P,t),j(v,e,t),l(e,F,t),j(T,e,t),l(e,X,t),l(e,y,t),l(e,R,t),j(w,e,t),l(e,z,t),l(e,$,t),l(e,q,t),j(U,e,t),l(e,A,t),l(e,x,t),N=!0},p:pe,i(e){N||(I(r.$$.fragment,e),I(M.$$.fragment,e),I(b.$$.fragment,e),I(v.$$.fragment,e),I(T.$$.fragment,e),I(w.$$.fragment,e),I(U.$$.fragment,e),N=!0)},o(e){B(r.$$.fragment,e),B(M.$$.fragment,e),B(b.$$.fragment,e),B(v.$$.fragment,e),B(T.$$.fragment,e),B(w.$$.fragment,e),B(U.$$.fragment,e),N=!1},d(e){e&&(n(G),n(H),n(W),n(_),n(p),n(k),n(d),n(V),n(c),n(E),n(f),n(C),n(S),n(g),n(Q),n(Y),n(h),n(P),n(F),n(X),n(y),n(R),n(z),n($),n(q),n(A),n(x)),n(o),L(r,e),L(M,e),L(b,e),L(v,e),L(T,e),L(w,e),L(U,e)}}}const ve='{"title":"Introduction au LlamaHub","local":"introduction-au-llamahub","sections":[{"title":"Installation","local":"installation","sections":[],"depth":2},{"title":"Utilisation","local":"utilisation","sections":[],"depth":2}],"depth":1}';function Te(D){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends ce{constructor(o){super(),fe(this,o,Te,he,re,{})}}export{Ze as component};
