import{s as vl,o as Yl,n as C}from"../chunks/scheduler.37c15a92.js";import{S as xl,i as Sl,g as b,s as u,r as y,A as Nl,h as I,f as o,c as J,j as Xl,u as U,x as f,k as Tl,y as _l,a as c,v as d,d as w,t as m,w as T,m as hl,n as bl}from"../chunks/index.2bf4358c.js";import{T as Rl}from"../chunks/Tip.363c041f.js";import{C as B}from"../chunks/CodeBlock.4e987730.js";import{H as O}from"../chunks/Heading.8ada512a.js";import{H as ml,a as V}from"../chunks/HfOption.02c8e375.js";import{E as Fl}from"../chunks/getInferenceSnippets.54ddb825.js";function ql(h){let e,n,t,r="Sortie attendue :",M,p,s;return e=new B({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBEdWNrRHVja0dvU2VhcmNoVG9vbCUwQSUwQSUyMyUyMEluaXRpYWxpc2VyJTIwbCdvdXRpbCUyMGRlJTIwcmVjaGVyY2hlJTIwRHVja0R1Y2tHbyUwQXNlYXJjaF90b29sJTIwJTNEJTIwRHVja0R1Y2tHb1NlYXJjaFRvb2woKSUwQSUwQSUyMyUyMEV4ZW1wbGUlMjBkJ3VzYWdlJTBBcmVzdWx0cyUyMCUzRCUyMHNlYXJjaF90b29sKCUyMlF1aSUyMGVzdCUyMGwnYWN0dWVsJTIwUHIlQzMlQTlzaWRlbnQlMjBkZSUyMGxhJTIwRnJhbmNlJTIwJTNGJTIyKSUwQXByaW50KHJlc3VsdHMp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> DuckDuckGoSearchTool

<span class="hljs-comment"># Initialiser l&#x27;outil de recherche DuckDuckGo</span>
search_tool = DuckDuckGoSearchTool()

<span class="hljs-comment"># Exemple d&#x27;usage</span>
results = search_tool(<span class="hljs-string">&quot;Qui est l&#x27;actuel Président de la France ?&quot;</span>)
<span class="hljs-built_in">print</span>(results)`,wrap:!1}}),p=new B({props:{code:"TCdhY3R1ZWwlMjBQciVDMyVBOXNpZGVudCUyMGRlJTIwbGElMjBGcmFuY2UlMjBlc3QlMjBFbW1hbnVlbCUyME1hY3Jvbi4=",highlighted:'<span class="hljs-keyword">L</span>&#x27;actuel <span class="hljs-keyword">Pr</span>ésident <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> France <span class="hljs-keyword">est</span> Emmanuel Macron.',wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function Hl(h){let e,n,t,r="Sortie attendue :",M,p,s;return e=new B({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LnRvb2xzLmR1Y2tkdWNrZ28lMjBpbXBvcnQlMjBEdWNrRHVja0dvU2VhcmNoVG9vbFNwZWMlMEFmcm9tJTIwbGxhbWFfaW5kZXguY29yZS50b29scyUyMGltcG9ydCUyMEZ1bmN0aW9uVG9vbCUwQSUwQSUyMyUyMEluaXRpYWxpc2VyJTIwbCdvdXRpbCUyMGRlJTIwcmVjaGVyY2hlJTIwRHVja0R1Y2tHbyUwQXRvb2xfc3BlYyUyMCUzRCUyMER1Y2tEdWNrR29TZWFyY2hUb29sU3BlYygpJTBBJTBBc2VhcmNoX3Rvb2wlMjAlM0QlMjBGdW5jdGlvblRvb2wuZnJvbV9kZWZhdWx0cyh0b29sX3NwZWMuZHVja2R1Y2tnb19mdWxsX3NlYXJjaCklMEElMjMlMjBFeGVtcGxlJTIwZCd1c2FnZSUwQXJlc3BvbnNlJTIwJTNEJTIwc2VhcmNoX3Rvb2woJTIyUXVpJTIwZXN0JTIwbCdhY3R1ZWwlMjBQciVDMyVBOXNpZGVudCUyMGRlJTIwbGElMjBGcmFuY2UlMjAlM0YlMjIpJTBBcHJpbnQocmVzcG9uc2UucmF3X291dHB1dCU1Qi0xJTVEJTVCJ2JvZHknJTVEKQ==",highlighted:`<span class="hljs-keyword">from</span> llama_index.tools.duckduckgo <span class="hljs-keyword">import</span> DuckDuckGoSearchToolSpec
<span class="hljs-keyword">from</span> llama_index.core.tools <span class="hljs-keyword">import</span> FunctionTool

<span class="hljs-comment"># Initialiser l&#x27;outil de recherche DuckDuckGo</span>
tool_spec = DuckDuckGoSearchToolSpec()

search_tool = FunctionTool.from_defaults(tool_spec.duckduckgo_full_search)
<span class="hljs-comment"># Exemple d&#x27;usage</span>
response = search_tool(<span class="hljs-string">&quot;Qui est l&#x27;actuel Président de la France ?&quot;</span>)
<span class="hljs-built_in">print</span>(response.raw_output[-<span class="hljs-number">1</span>][<span class="hljs-string">&#x27;body&#x27;</span>])`,wrap:!1}}),p=new B({props:{code:"TGUlMjBQciVDMyVBOXNpZGVudCUyMGRlJTIwbGElMjBSJUMzJUE5cHVibGlxdWUlMjBmcmFuJUMzJUE3YWlzZSUyMGVzdCUyMGxlJTIwY2hlZiUyMGQnJUMzJTg5dGF0JTIwZGUlMjBsYSUyMEZyYW5jZS4lMjBMJ2FjdHVlbCUyMFByJUMzJUE5c2lkZW50JTIwZXN0JTIwRW1tYW51ZWwlMjBNYWNyb24lMjBkZXB1aXMlMjBsZSUyMDE0JTIwbWFpJTIwMjAxNyUyMGFwciVDMyVBOHMlMjBhdm9pciUyMGJhdHR1JTIwTWFyaW5lJTIwTGUlMjBQZW4lMjBhdSUyMHNlY29uZCUyMHRvdXIlMjBkZSUyMGwnJUMzJUE5bGVjdGlvbiUyMHByJUMzJUE5c2lkZW50aWVsbGUlMjBsZSUyMDclMjBtYWklMjAyMDE3LiUyMExpc3RlJTIwZGVzJTIwcHIlQzMlQTlzaWRlbnRzJTIwZnJhbiVDMyVBN2FpcyUyMChDaW5xdWklQzMlQThtZSUyMFIlQzMlQTlwdWJsaXF1ZSklMjBOJUMyJUIwJTIwUG9ydHJhaXQlMjBOb20lMjAuLi4=",highlighted:'Le <span class="hljs-keyword">Pr</span>ésident <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> République française <span class="hljs-keyword">est</span> le chef <span class="hljs-keyword">d</span>&#x27;État <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> France. <span class="hljs-keyword">L</span>&#x27;actuel <span class="hljs-keyword">Pr</span>ésident <span class="hljs-keyword">est</span> Emmanuel Macron depuis le 14 mai 2017 après avoir battu Marine Le Pen au second tour <span class="hljs-keyword">de</span> <span class="hljs-keyword">l</span>&#x27;élection <span class="hljs-keyword">pr</span>ésidentielle le 7 mai 2017. Liste <span class="hljs-keyword">des</span> <span class="hljs-keyword">pr</span>ésidents français (Cinquième République) <span class="hljs-keyword">N</span>° Portrait Nom ...',wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function Dl(h){let e,n,t,r="Sortie attendue :",M,p,s;return e=new B({props:{code:"ZnJvbSUyMGxhbmdjaGFpbl9jb21tdW5pdHkudG9vbHMlMjBpbXBvcnQlMjBEdWNrRHVja0dvU2VhcmNoUnVuJTBBJTBBc2VhcmNoX3Rvb2wlMjAlM0QlMjBEdWNrRHVja0dvU2VhcmNoUnVuKCklMEFyZXN1bHRzJTIwJTNEJTIwc2VhcmNoX3Rvb2wuaW52b2tlKCUyMlF1aSUyMGVzdCUyMGwnYWN0dWVsJTIwUHIlQzMlQTlzaWRlbnQlMjBkZSUyMGxhJTIwRnJhbmNlJTIwJTNGJTIyKSUwQXByaW50KHJlc3VsdHMp",highlighted:`<span class="hljs-keyword">from</span> langchain_community.tools <span class="hljs-keyword">import</span> DuckDuckGoSearchRun

search_tool = DuckDuckGoSearchRun()
results = search_tool.invoke(<span class="hljs-string">&quot;Qui est l&#x27;actuel Président de la France ?&quot;</span>)
<span class="hljs-built_in">print</span>(results)`,wrap:!1}}),p=new B({props:{code:"RW1tYW51ZWwlMjBNYWNyb24lMjAobiVDMyVBOSUyMGxlJTIwMjElMjBkJUMzJUE5Y2VtYnJlJTIwMTk3NyUyMCVDMyVBMCUyMEFtaWVucyUyQyUyMEZyYW5jZSklMjBlc3QlMjB1biUyMGJhbnF1aWVyJTIwZXQlMjBob21tZSUyMHBvbGl0aXF1ZSUyMGZyYW4lQzMlQTdhaXMlMjBxdWklMjBhJTIwJUMzJUE5dCVDMyVBOSUyMCVDMyVBOWx1JTIwcHIlQzMlQTlzaWRlbnQlMjBkZSUyMGxhJTIwRnJhbmNlJTIwZW4lMjAyMDE3Li4u",highlighted:'Emmanuel Macron (<span class="hljs-keyword">n</span>é le 21 <span class="hljs-keyword">d</span>écembre 1977 à Amiens, France) <span class="hljs-keyword">est</span> un banquier et homme politique français <span class="hljs-keyword">qui</span> a été élu <span class="hljs-keyword">pr</span>ésident <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> France <span class="hljs-keyword">en</span> 2017...',wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function Ol(h){let e,n,t,r,M,p;return e=new V({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[ql]},$$scope:{ctx:h}}}),t=new V({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[Hl]},$$scope:{ctx:h}}}),M=new V({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[Dl]},$$scope:{ctx:h}}}),{c(){y(e.$$.fragment),n=u(),y(t.$$.fragment),r=u(),y(M.$$.fragment)},l(s){U(e.$$.fragment,s),n=J(s),U(t.$$.fragment,s),r=J(s),U(M.$$.fragment,s)},m(s,l){d(e,s,l),c(s,n,l),d(t,s,l),c(s,r,l),d(M,s,l),p=!0},p(s,l){const i={};l&2&&(i.$$scope={dirty:l,ctx:s}),e.$set(i);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),t.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){p||(w(e.$$.fragment,s),w(t.$$.fragment,s),w(M.$$.fragment,s),p=!0)},o(s){m(e.$$.fragment,s),m(t.$$.fragment,s),m(M.$$.fragment,s),p=!1},d(s){s&&(o(n),o(r)),T(e,s),T(t,s),T(M,s)}}}function Pl(h){let e,n,t="l'Unité 1",r;return{c(){e=hl("Par souci de simplicité, nous utilisons une API météorologique factice pour cet exemple. Si vous voulez utiliser une véritable API, vous pourriez implémenter un outil utilisant l'API OpenWeatherMap comme dans "),n=b("a"),n.textContent=t,r=hl("."),this.h()},l(M){e=bl(M,"Par souci de simplicité, nous utilisons une API météorologique factice pour cet exemple. Si vous voulez utiliser une véritable API, vous pourriez implémenter un outil utilisant l'API OpenWeatherMap comme dans "),n=I(M,"A",{href:!0,"data-svelte-h":!0}),f(n)!=="svelte-17x00k5"&&(n.textContent=t),r=bl(M,"."),this.h()},h(){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l0JUMzJUE5byUyMCVDMyVBMCUyMCU3QmxvY2F0aW9uJTdEJTNBJTIwJTdCZGF0YSU1Qidjb25kaXRpb24nJTVEJTdEJTJDJTIwJTdCZGF0YSU1Qid0ZW1wX2MnJTVEJTdEJUMyJUIwQyUyMiUwQSUwQSUyMyUyMEluaXRpYWxpc2VyJTIwbCdvdXRpbCUwQXdlYXRoZXJfaW5mb190b29sJTIwJTNEJTIwV2VhdGhlckluZm9Ub29sKCk=",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> Tool
<span class="hljs-keyword">import</span> random

<span class="hljs-keyword">class</span> <span class="hljs-title class_">WeatherInfoTool</span>(<span class="hljs-title class_ inherited__">Tool</span>):
    name = <span class="hljs-string">&quot;weather_info&quot;</span>
    description = <span class="hljs-string">&quot;Récupère des informations météorologiques factices pour un lieu donné.&quot;</span>
    inputs = {
        <span class="hljs-string">&quot;location&quot;</span>: {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
            <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;Le lieu pour lequel obtenir les informations météorologiques.&quot;</span>
        }
    }
    output_type = <span class="hljs-string">&quot;string&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, location: <span class="hljs-built_in">str</span></span>):
        <span class="hljs-comment"># Données météorologiques factices</span>
        weather_conditions = [
            {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Pluvieux&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">15</span>},
            {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Clair&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">25</span>},
            {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Venteux&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">20</span>}
        ]
        <span class="hljs-comment"># Sélectionner aléatoirement une condition météorologique</span>
        data = random.choice(weather_conditions)
        <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Météo à <span class="hljs-subst">{location}</span>: <span class="hljs-subst">{data[<span class="hljs-string">&#x27;condition&#x27;</span>]}</span>, <span class="hljs-subst">{data[<span class="hljs-string">&#x27;temp_c&#x27;</span>]}</span>°C&quot;</span>

<span class="hljs-comment"># Initialiser l&#x27;outil</span>
weather_info_tool = WeatherInfoTool()`,wrap:!1}}),{c(){y(e.$$.fragment)},l(t){U(e.$$.fragment,t)},m(t,r){d(e,t,r),n=!0},p:C,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){m(e.$$.fragment,t),n=!1},d(t){T(e,t)}}}function Kl(h){let e,n;return e=new B({props:{code:"aW1wb3J0JTIwcmFuZG9tJTBBZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUudG9vbHMlMjBpbXBvcnQlMjBGdW5jdGlvblRvb2wlMEElMEFkZWYlMjBnZXRfd2VhdGhlcl9pbmZvKGxvY2F0aW9uJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJSJUMzJUE5Y3VwJUMzJUE4cmUlMjBkZXMlMjBpbmZvcm1hdGlvbnMlMjBtJUMzJUE5dCVDMyVBOW9yb2xvZ2lxdWVzJTIwZmFjdGljZXMlMjBwb3VyJTIwdW4lMjBsaWV1JTIwZG9ubiVDMyVBOS4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjAlMjMlMjBEb25uJUMzJUE5ZXMlMjBtJUMzJUE5dCVDMyVBOW9yb2xvZ2lxdWVzJTIwZmFjdGljZXMlMEElMjAlMjAlMjAlMjB3ZWF0aGVyX2NvbmRpdGlvbnMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJjb25kaXRpb24lMjIlM0ElMjAlMjJQbHV2aWV1eCUyMiUyQyUyMCUyMnRlbXBfYyUyMiUzQSUyMDE1JTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIyY29uZGl0aW9uJTIyJTNBJTIwJTIyQ2xhaXIlMjIlMkMlMjAlMjJ0ZW1wX2MlMjIlM0ElMjAyNSU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMmNvbmRpdGlvbiUyMiUzQSUyMCUyMlZlbnRldXglMjIlMkMlMjAlMjJ0ZW1wX2MlMjIlM0ElMjAyMCU3RCUwQSUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCUyMyUyMFMlQzMlQTlsZWN0aW9ubmVyJTIwYWwlQzMlQTlhdG9pcmVtZW50JTIwdW5lJTIwY29uZGl0aW9uJTIwbSVDMyVBOXQlQzMlQTlvcm9sb2dpcXVlJTBBJTIwJTIwJTIwJTIwZGF0YSUyMCUzRCUyMHJhbmRvbS5jaG9pY2Uod2VhdGhlcl9jb25kaXRpb25zKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGYlMjJNJUMzJUE5dCVDMyVBOW8lMjAlQzMlQTAlMjAlN0Jsb2NhdGlvbiU3RCUzQSUyMCU3QmRhdGElNUInY29uZGl0aW9uJyU1RCU3RCUyQyUyMCU3QmRhdGElNUIndGVtcF9jJyU1RCU3RCVDMiVCMEMlMjIlMEElMEElMjMlMjBJbml0aWFsaXNlciUyMGwnb3V0aWwlMEF3ZWF0aGVyX2luZm9fdG9vbCUyMCUzRCUyMEZ1bmN0aW9uVG9vbC5mcm9tX2RlZmF1bHRzKGdldF93ZWF0aGVyX2luZm8p",highlighted:`<span class="hljs-keyword">import</span> random
<span class="hljs-keyword">from</span> llama_index.core.tools <span class="hljs-keyword">import</span> FunctionTool

<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_weather_info</span>(<span class="hljs-params">location: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Récupère des informations météorologiques factices pour un lieu donné.&quot;&quot;&quot;</span>
    <span class="hljs-comment"># Données météorologiques factices</span>
    weather_conditions = [
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Pluvieux&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">15</span>},
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Clair&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">25</span>},
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Venteux&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">20</span>}
    ]
    <span class="hljs-comment"># Sélectionner aléatoirement une condition météorologique</span>
    data = random.choice(weather_conditions)
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Météo à <span class="hljs-subst">{location}</span>: <span class="hljs-subst">{data[<span class="hljs-string">&#x27;condition&#x27;</span>]}</span>, <span class="hljs-subst">{data[<span class="hljs-string">&#x27;temp_c&#x27;</span>]}</span>°C&quot;</span>

<span class="hljs-comment"># Initialiser l&#x27;outil</span>
weather_info_tool = FunctionTool.from_defaults(get_weather_info)`,wrap:!1}}),{c(){y(e.$$.fragment)},l(t){U(e.$$.fragment,t)},m(t,r){d(e,t,r),n=!0},p:C,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){m(e.$$.fragment,t),n=!1},d(t){T(e,t)}}}function ls(h){let e,n;return e=new B({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi50b29scyUyMGltcG9ydCUyMFRvb2wlMEFpbXBvcnQlMjByYW5kb20lMEElMEFkZWYlMjBnZXRfd2VhdGhlcl9pbmZvKGxvY2F0aW9uJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJSJUMzJUE5Y3VwJUMzJUE4cmUlMjBkZXMlMjBpbmZvcm1hdGlvbnMl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RhdGElNUIndGVtcF9jJyU1RCU3RCVDMiVCMEMlMjIlMEElMEElMjMlMjBJbml0aWFsaXNlciUyMGwnb3V0aWwlMEF3ZWF0aGVyX2luZm9fdG9vbCUyMCUzRCUyMFRvb2woJTBBJTIwJTIwJTIwJTIwbmFtZSUzRCUyMmdldF93ZWF0aGVyX2luZm8lMjIlMkMlMEElMjAlMjAlMjAlMjBmdW5jJTNEZ2V0X3dlYXRoZXJfaW5mbyUyQyUwQSUyMCUyMCUyMCUyMGRlc2NyaXB0aW9uJTNEJTIyUiVDMyVBOWN1cCVDMyVBOHJlJTIwZGVzJTIwaW5mb3JtYXRpb25zJTIwbSVDMyVBOXQlQzMlQTlvcm9sb2dpcXVlcyUyMGZhY3RpY2VzJTIwcG91ciUyMHVuJTIwbGlldSUyMGRvbm4lQzMlQTkuJTIyJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> langchain.tools <span class="hljs-keyword">import</span> Tool
<span class="hljs-keyword">import</span> random

<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_weather_info</span>(<span class="hljs-params">location: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Récupère des informations météorologiques factices pour un lieu donné.&quot;&quot;&quot;</span>
    <span class="hljs-comment"># Données météorologiques factices</span>
    weather_conditions = [
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Pluvieux&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">15</span>},
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Clair&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">25</span>},
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Venteux&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">20</span>}
    ]
    <span class="hljs-comment"># Sélectionner aléatoirement une condition météorologique</span>
    data = random.choice(weather_conditions)
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Météo à <span class="hljs-subst">{location}</span>: <span class="hljs-subst">{data[<span class="hljs-string">&#x27;condition&#x27;</span>]}</span>, <span class="hljs-subst">{data[<span class="hljs-string">&#x27;temp_c&#x27;</span>]}</span>°C&quot;</span>

<span class="hljs-comment"># Initialiser l&#x27;outil</span>
weather_info_tool = Tool(
    name=<span class="hljs-string">&quot;get_weather_info&quot;</span>,
    func=get_weather_info,
    description=<span class="hljs-string">&quot;Récupère des informations météorologiques factices pour un lieu donné.&quot;</span>
)`,wrap:!1}}),{c(){y(e.$$.fragment)},l(t){U(e.$$.fragment,t)},m(t,r){d(e,t,r),n=!0},p:C,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){m(e.$$.fragment,t),n=!1},d(t){T(e,t)}}}function ss(h){let e,n,t,r,M,p;return e=new V({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[Ll]},$$scope:{ctx:h}}}),t=new V({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[Kl]},$$scope:{ctx:h}}}),M=new V({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[ls]},$$scope:{ctx:h}}}),{c(){y(e.$$.fragment),n=u(),y(t.$$.fragment),r=u(),y(M.$$.fragment)},l(s){U(e.$$.fragment,s),n=J(s),U(t.$$.fragment,s),r=J(s),U(M.$$.fragment,s)},m(s,l){d(e,s,l),c(s,n,l),d(t,s,l),c(s,r,l),d(M,s,l),p=!0},p(s,l){const i={};l&2&&(i.$$scope={dirty:l,ctx:s}),e.$set(i);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),t.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){p||(w(e.$$.fragment,s),w(t.$$.fragment,s),w(M.$$.fragment,s),p=!0)},o(s){m(e.$$.fragment,s),m(t.$$.fragment,s),m(M.$$.fragment,s),p=!1},d(s){s&&(o(n),o(r)),T(e,s),T(t,s),T(M,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TIwJTdCbW9kZWwuZG93bmxvYWRzJTNBJTJDJTdEJTIwdCVDMyVBOWwlQzMlQTljaGFyZ2VtZW50cy4lMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBlbHNlJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwZiUyMkF1Y3VuJTIwbW9kJUMzJUE4bGUlMjB0cm91diVDMyVBOSUyMHBvdXIlMjBsJ2F1dGV1ciUyMCU3QmF1dGhvciU3RC4lMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBleGNlcHQlMjBFeGNlcHRpb24lMjBhcyUyMGUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBmJTIyRXJyZXVyJTIwbG9ycyUyMGRlJTIwbGElMjByJUMzJUE5Y3VwJUMzJUE5cmF0aW9uJTIwZGVzJTIwbW9kJUMzJUE4bGVzJTIwcG91ciUyMCU3QmF1dGhvciU3RCUzQSUyMCU3QnN0cihlKSU3RCUyMiUwQSUwQSUyMyUyMEluaXRpYWxpc2VyJTIwbCdvdXRpbCUwQWh1Yl9zdGF0c190b29sJTIwJTNEJTIwSHViU3RhdHNUb29sKCklMEElMEElMjMlMjBFeGVtcGxlJTIwZCd1c2FnZSUwQXByaW50KGh1Yl9zdGF0c190b29sKCUyMmZhY2Vib29rJTIyKSklMjAlMjMlMjBFeGVtcGxlJTIwJTNBJTIwT2J0ZW5pciUyMGxlJTIwbW9kJUMzJUE4bGUlMjBsZSUyMHBsdXMlMjB0JUMzJUE5bCVDMyVBOWNoYXJnJUMzJUE5JTIwcGFyJTIwRmFjZWJvb2s=",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> Tool
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> list_models

<span class="hljs-keyword">class</span> <span class="hljs-title class_">HubStatsTool</span>(<span class="hljs-title class_ inherited__">Tool</span>):
    name = <span class="hljs-string">&quot;hub_stats&quot;</span>
    description = <span class="hljs-string">&quot;Récupère le modèle le plus téléchargé d&#x27;un auteur spécifique sur le Hugging Face Hub.&quot;</span>
    inputs = {
        <span class="hljs-string">&quot;author&quot;</span>: {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
            <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;Le nom d&#x27;utilisateur de l&#x27;auteur/organisation du modèle pour trouver des modèles.&quot;</span>
        }
    }
    output_type = <span class="hljs-string">&quot;string&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, author: <span class="hljs-built_in">str</span></span>):
        <span class="hljs-keyword">try</span>:
            <span class="hljs-comment"># Lister les modèles de l&#x27;auteur spécifié, triés par téléchargements</span>
            models = <span class="hljs-built_in">list</span>(list_models(author=author, sort=<span class="hljs-string">&quot;downloads&quot;</span>, direction=-<span class="hljs-number">1</span>, limit=<span class="hljs-number">1</span>))
            
            <span class="hljs-keyword">if</span> models:
                model = models[<span class="hljs-number">0</span>]
                <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Le modèle le plus téléchargé par <span class="hljs-subst">{author}</span> est <span class="hljs-subst">{model.<span class="hljs-built_in">id</span>}</span> avec <span class="hljs-subst">{model.downloads:,}</span> téléchargements.&quot;</span>
            <span class="hljs-keyword">else</span>:
                <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Aucun modèle trouvé pour l&#x27;auteur <span class="hljs-subst">{author}</span>.&quot;</span>
        <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
            <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Erreur lors de la récupération des modèles pour <span class="hljs-subst">{author}</span>: <span class="hljs-subst">{<span class="hljs-built_in">str</span>(e)}</span>&quot;</span>

<span class="hljs-comment"># Initialiser l&#x27;outil</span>
hub_stats_tool = HubStatsTool()

<span class="hljs-comment"># Exemple d&#x27;usage</span>
<span class="hljs-built_in">print</span>(hub_stats_tool(<span class="hljs-string">&quot;facebook&quot;</span>)) <span class="hljs-comment"># Exemple : Obtenir le modèle le plus téléchargé par Facebook</span>`,wrap:!1}}),p=new B({props:{code:"TGUlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHQlQzMlQTlsJUMzJUE5Y2hhcmclQzMlQTklMjBwYXIlMjBmYWNlYm9vayUyMGVzdCUyMGZhY2Vib29rJTJGZXNtZm9sZF92MSUyMGF2ZWMlMjAxMiUyQzU0NCUyQzU1MCUyMHQlQzMlQTlsJUMzJUE5Y2hhcmdlbWVudHMu",highlighted:'<span class="hljs-keyword">Le</span> <span class="hljs-built_in">mod</span>è<span class="hljs-keyword">le</span> <span class="hljs-keyword">le</span> plus téléchargé par facebook est facebook/esmfold_v1 avec <span class="hljs-number">12</span>,<span class="hljs-number">544</span>,<span class="hljs-number">550</span> téléchargements.',wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function as(h){let e,n,t,r="Sortie attendue :",M,p,s;return e=new B({props:{code:"aW1wb3J0JTIwcmFuZG9tJTBBZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUudG9vbHMlMjBpbXBvcnQlMjBGdW5jdGlvblRvb2wlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTI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llama_index.core.tools <span class="hljs-keyword">import</span> FunctionTool
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> list_models

<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_hub_stats</span>(<span class="hljs-params">author: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Récupère le modèle le plus téléchargé d&#x27;un auteur spécifique sur le Hugging Face Hub.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">try</span>:
        <span class="hljs-comment"># Lister les modèles de l&#x27;auteur spécifié, triés par téléchargements</span>
        models = <span class="hljs-built_in">list</span>(list_models(author=author, sort=<span class="hljs-string">&quot;downloads&quot;</span>, direction=-<span class="hljs-number">1</span>, limit=<span class="hljs-number">1</span>))

        <span class="hljs-keyword">if</span> models:
            model = models[<span class="hljs-number">0</span>]
            <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Le modèle le plus téléchargé par <span class="hljs-subst">{author}</span> est <span class="hljs-subst">{model.<span class="hljs-built_in">id</span>}</span> avec <span class="hljs-subst">{model.downloads:,}</span> téléchargements.&quot;</span>
        <span class="hljs-keyword">else</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Aucun modèle trouvé pour l&#x27;auteur <span class="hljs-subst">{author}</span>.&quot;</span>
    <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
        <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Erreur lors de la récupération des modèles pour <span class="hljs-subst">{author}</span>: <span class="hljs-subst">{<span class="hljs-built_in">str</span>(e)}</span>&quot;</span>

<span class="hljs-comment"># Initialiser l&#x27;outil</span>
hub_stats_tool = FunctionTool.from_defaults(get_hub_stats)

<span class="hljs-comment"># Exemple d&#x27;usage</span>
<span class="hljs-built_in">print</span>(hub_stats_tool(<span class="hljs-string">&quot;facebook&quot;</span>)) <span class="hljs-comment"># Exemple : Obtenir le modèle le plus téléchargé par Facebook</span>`,wrap:!1}}),p=new B({props:{code:"TGUlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHQlQzMlQTlsJUMzJUE5Y2hhcmclQzMlQTklMjBwYXIlMjBmYWNlYm9vayUyMGVzdCUyMGZhY2Vib29rJTJGZXNtZm9sZF92MSUyMGF2ZWMlMjAxMiUyQzU0NCUyQzU1MCUyMHQlQzMlQTlsJUMzJUE5Y2hhcmdlbWVudHMu",highlighted:'<span class="hljs-keyword">Le</span> <span class="hljs-built_in">mod</span>è<span class="hljs-keyword">le</span> <span class="hljs-keyword">le</span> plus téléchargé par facebook est facebook/esmfold_v1 avec <span class="hljs-number">12</span>,<span class="hljs-number">544</span>,<span class="hljs-number">550</span> téléchargements.',wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function ts(h){let e,n,t,r="Sortie attendue :",M,p,s;return e=new B({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi50b29scyUyMGltcG9ydCUyMFRvb2wlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwbGlzdF9tb2RlbHMlMEElMEFkZWYlMjBnZXRfaHViX3N0YXRzKGF1dGhvciUzQSUyMHN0ciklMjAtJTNFJTIwc3RyJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyUiVDMyVBOWN1cCVDMyVBOHJlJTIwbGUlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHQlQzM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sdXMlMjB0JUMzJUE5bCVDMyVBOWNoYXJnJUMzJUE5JTIwcGFyJTIwRmFjZWJvb2s=",highlighted:`<span class="hljs-keyword">from</span> langchain.tools <span class="hljs-keyword">import</span> Tool
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> list_models

<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_hub_stats</span>(<span class="hljs-params">author: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Récupère le modèle le plus téléchargé d&#x27;un auteur spécifique sur le Hugging Face Hub.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">try</span>:
        <span class="hljs-comment"># Lister les modèles de l&#x27;auteur spécifié, triés par téléchargements</span>
        models = <span class="hljs-built_in">list</span>(list_models(author=author, sort=<span class="hljs-string">&quot;downloads&quot;</span>, direction=-<span class="hljs-number">1</span>, limit=<span class="hljs-number">1</span>))

        <span class="hljs-keyword">if</span> models:
            model = models[<span class="hljs-number">0</span>]
            <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Le modèle le plus téléchargé par <span class="hljs-subst">{author}</span> est <span class="hljs-subst">{model.<span class="hljs-built_in">id</span>}</span> avec <span class="hljs-subst">{model.downloads:,}</span> téléchargements.&quot;</span>
        <span class="hljs-keyword">else</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Aucun modèle trouvé pour l&#x27;auteur <span class="hljs-subst">{author}</span>.&quot;</span>
    <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
        <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Erreur lors de la récupération des modèles pour <span class="hljs-subst">{author}</span>: <span class="hljs-subst">{<span class="hljs-built_in">str</span>(e)}</span>&quot;</span>

<span class="hljs-comment"># Initialiser l&#x27;outil</span>
hub_stats_tool = Tool(
    name=<span class="hljs-string">&quot;get_hub_stats&quot;</span>,
    func=get_hub_stats,
    description=<span class="hljs-string">&quot;Récupère le modèle le plus téléchargé d&#x27;un auteur spécifique sur le Hugging Face Hub.&quot;</span>
)

<span class="hljs-comment"># Exemple d&#x27;usage</span>
<span class="hljs-built_in">print</span>(hub_stats_tool.invoke(<span class="hljs-string">&quot;facebook&quot;</span>)) <span class="hljs-comment"># Exemple : Obtenir le modèle le plus téléchargé par Facebook</span>`,wrap:!1}}),p=new B({props:{code:"TGUlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHQlQzMlQTlsJUMzJUE5Y2hhcmclQzMlQTklMjBwYXIlMjBmYWNlYm9vayUyMGVzdCUyMGZhY2Vib29rJTJGZXNtZm9sZF92MSUyMGF2ZWMlMjAxMyUyMDEwOSUyMDg2MSUyMHQlQzMlQTlsJUMzJUE5Y2hhcmdlbWVudHMu",highlighted:'<span class="hljs-keyword">Le</span> <span class="hljs-built_in">mod</span>è<span class="hljs-keyword">le</span> <span class="hljs-keyword">le</span> plus téléchargé par facebook est facebook/esmfold_v1 avec <span class="hljs-number">13</span> <span class="hljs-number">109</span> <span class="hljs-number">861</span> téléchargements.',wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function ns(h){let e,n,t,r,M,p;return e=new V({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[es]},$$scope:{ctx:h}}}),t=new V({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[as]},$$scope:{ctx:h}}}),M=new V({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[ts]},$$scope:{ctx:h}}}),{c(){y(e.$$.fragment),n=u(),y(t.$$.fragment),r=u(),y(M.$$.fragment)},l(s){U(e.$$.fragment,s),n=J(s),U(t.$$.fragment,s),r=J(s),U(M.$$.fragment,s)},m(s,l){d(e,s,l),c(s,n,l),d(t,s,l),c(s,r,l),d(M,s,l),p=!0},p(s,l){const i={};l&2&&(i.$$scope={dirty:l,ctx:s}),e.$set(i);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),t.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){p||(w(e.$$.fragment,s),w(t.$$.fragment,s),w(M.$$.fragment,s),p=!0)},o(s){m(e.$$.fragment,s),m(t.$$.fragment,s),m(M.$$.fragment,s),p=!1},d(s){s&&(o(n),o(r)),T(e,s),T(t,s),T(M,s)}}}function Ms(h){let e,n,t,r="Sortie attendue :",M,p,s;return e=new B({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpc2VyJTIwbGUlMjBtb2QlQzMlQThsZSUyMEh1Z2dpbmclMjBGYWNlJTBBbW9kZWwlMjAlM0QlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCgpJTBBJTBBJTIzJTIwQ3IlQzMlQTllciUyMEFsZnJlZCUyMGF2ZWMlMjB0b3VzJTIwbGVzJTIwb3V0aWxzJTBBYWxmcmVkJTIwJTNEJTIwQ29kZUFnZW50KCUwQSUyMCUyMCUyMCUyMHRvb2xzJTNEJTVCc2VhcmNoX3Rvb2wlMkMlMjB3ZWF0aGVyX2luZm9fdG9vbCUyQyUyMGh1Yl9zdGF0c190b29sJTVEJTJDJTIwJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUwQSklMEElMEElMjMlMjBFeGVtcGxlJTIwZGUlMjByZXF1JUMzJUFBdGUlMjBxdSdBbGZyZWQlMjBwb3VycmFpdCUyMHJlY2V2b2lyJTIwcGVuZGFudCUyMGxlJTIwZ2FsYSUwQXJlc3BvbnNlJTIwJTNEJTIwYWxmcmVkLnJ1biglMjJRdSdlc3QtY2UlMjBxdWUlMjBGYWNlYm9vayUyMGV0JTIwcXVlbCUyMGVzdCUyMGxldXIlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHBvcHVsYWlyZSUyMCUzRiUyMiklMEElMEFwcmludCglMjIlRjAlOUYlOEUlQTklMjBSJUMzJUE5cG9uc2UlMjBkJ0FsZnJlZCUyMCUzQSUyMiklMEFwcmludChyZXNwb25zZSk=",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, InferenceClientModel

<span class="hljs-comment"># Initialiser le modèle Hugging Face</span>
model = InferenceClientModel()

<span class="hljs-comment"># Créer Alfred avec tous les outils</span>
alfred = CodeAgent(
    tools=[search_tool, weather_info_tool, hub_stats_tool], 
    model=model
)

<span class="hljs-comment"># Exemple de requête qu&#x27;Alfred pourrait recevoir pendant le gala</span>
response = alfred.run(<span class="hljs-string">&quot;Qu&#x27;est-ce que Facebook et quel est leur modèle le plus populaire ?&quot;</span>)

<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;🎩 Réponse d&#x27;Alfred :&quot;</span>)
<span class="hljs-built_in">print</span>(response)`,wrap:!1}}),p=new B({props:{code:"JUYwJTlGJThFJUE5JTIwUiVDMyVBOXBvbnNlJTIwZCdBbGZyZWQlMjAlM0ElMEFGYWNlYm9vayUyMGVzdCUyMHVuJTIwc2l0ZSUyMHdlYiUyMGRlJTIwciVDMyVBOXNlYXUlMjBzb2NpYWwlMjBvJUMzJUI5JTIwbGVzJTIwdXRpbGlzYXRldXJzJTIwcGV1dmVudCUyMHNlJTIwY29ubmVjdGVyJTJDJTIwcGFydGFnZXIlMjBkZXMlMjBpbmZvcm1hdGlvbnMlMjBldCUyMGludGVyYWdpciUyMGF2ZWMlMjBkJ2F1dHJlcy4lMjBMZSUyMG1vZCVDMyVBOGxlJTIwbGUlMjBwbHVzJTIwdCVDMyVBOWwlQzMlQTljaGFyZyVDMyVBOSUyMHBhciUyMEZhY2Vib29rJTIwc3VyJTIwbGUlMjBIdWdnaW5nJTIwRmFjZSUyMEh1YiUyMGVzdCUyMEVTTUZvbGRfdjEu",highlighted:`🎩 Réponse <span class="hljs-keyword">d</span>&#x27;Alfred :
Facebook <span class="hljs-keyword">est</span> un site web <span class="hljs-keyword">de</span> réseau social où les utilisateurs peuvent <span class="hljs-keyword">se</span> connecter, partager <span class="hljs-keyword">des</span> informations et interagir avec <span class="hljs-keyword">d</span>&#x27;autres. Le modèle le plus té<span class="hljs-keyword">l</span>échargé par Facebook sur le Hugging Face Hub <span class="hljs-keyword">est</span> ESMFold_v1.`,wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function ps(h){let e,n,t,r="Sortie attendue :",M,p,s;return e=new B({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUuYWdlbnQud29ya2Zsb3clMjBpbXBvcnQlMjBBZ2VudFdvcmtmbG93JTBBZnJvbSUyMGxsYW1hX2luZGV4LmxsbXMuaHVnZ2luZ2ZhY2VfYXBpJTIwaW1wb3J0JTIwSHVnZ2luZ0ZhY2VJbmZlcmVuY2VBUEklMEElMEElMjMlMjBJbml0aWFsaXNlciUyMGxlJTIwbW9kJUMzJUE4bGUlMjBIdWdnaW5nJTIwRmFjZSUwQWxsbSUyMCUzRCUyMEh1Z2dpbmdGYWNlSW5mZXJlbmNlQVBJKG1vZGVsX25hbWUlM0QlMjJRd2VuJTJGUXdlbjIuNS1Db2Rlci0zMkItSW5zdHJ1Y3QlMjIpJTBBJTIzJTIwQ3IlQzMlQTllciUyMEFsZnJlZCUyMGF2ZWMlMjB0b3VzJTIwbGVzJTIwb3V0aWxzJTBBYWxmcmVkJTIwJTNEJTIwQWdlbnRXb3JrZmxvdy5mcm9tX3Rvb2xzX29yX2Z1bmN0aW9ucyglMEElMjAlMjAlMjAlMjAlNUJzZWFyY2hfdG9vbCUyQyUyMHdlYXRoZXJfaW5mb190b29sJTJDJTIwaHViX3N0YXRzX3Rvb2wlNUQlMkMlMEElMjAlMjAlMjAlMjBsbG0lM0RsbG0lMEEpJTBBJTBBJTIzJTIwRXhlbXBsZSUyMGRlJTIwcmVxdSVDMyVBQXRlJTIwcXUnQWxmcmVkJTIwcG91cnJhaXQlMjByZWNldm9pciUyMHBlbmRhbnQlMjBsZSUyMGdhbGElMEFyZXNwb25zZSUyMCUzRCUyMGF3YWl0JTIwYWxmcmVkLnJ1biglMjJRdSdlc3QtY2UlMjBxdWUlMjBGYWNlYm9vayUyMGV0JTIwcXVlbCUyMGVzdCUyMGxldXIlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHBvcHVsYWlyZSUyMCUzRiUyMiklMEElMEFwcmludCglMjIlRjAlOUYlOEUlQTklMjBSJUMzJUE5cG9uc2UlMjBkJ0FsZnJlZCUyMCUzQSUyMiklMEFwcmludChyZXNwb25zZSk=",highlighted:`<span class="hljs-keyword">from</span> llama_index.core.agent.workflow <span class="hljs-keyword">import</span> AgentWorkflow
<span class="hljs-keyword">from</span> llama_index.llms.huggingface_api <span class="hljs-keyword">import</span> HuggingFaceInferenceAPI

<span class="hljs-comment"># Initialiser le modèle Hugging Face</span>
llm = HuggingFaceInferenceAPI(model_name=<span class="hljs-string">&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</span>)
<span class="hljs-comment"># Créer Alfred avec tous les outils</span>
alfred = AgentWorkflow.from_tools_or_functions(
    [search_tool, weather_info_tool, hub_stats_tool],
    llm=llm
)

<span class="hljs-comment"># Exemple de requête qu&#x27;Alfred pourrait recevoir pendant le gala</span>
response = <span class="hljs-keyword">await</span> alfred.run(<span class="hljs-string">&quot;Qu&#x27;est-ce que Facebook et quel est leur modèle le plus populaire ?&quot;</span>)

<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;🎩 Réponse d&#x27;Alfred :&quot;</span>)
<span class="hljs-built_in">print</span>(response)`,wrap:!1}}),p=new B({props:{code:"JUYwJTlGJThFJUE5JTIwUiVDMyVBOXBvbnNlJTIwZCdBbGZyZWQlMjAlM0ElMEFGYWNlYm9vayUyMGVzdCUyMHVuJTIwc2VydmljZSUyMGRlJTIwciVDMyVBOXNlYXUlMjBzb2NpYWwlMjBldCUyMHVuZSUyMGVudHJlcHJpc2UlMjB0ZWNobm9sb2dpcXVlJTIwYmFzJUMzJUE5ZSUyMCVDMyVBMCUyME1lbmxvJTIwUGFyayUyQyUyMGVuJTIwQ2FsaWZvcm5pZS4lMjBFbGxlJTIwYSUyMCVDMyVBOXQlQzMlQTklMjBmb25kJUMzJUE5ZSUyMHBhciUyME1hcmslMjBadWNrZXJiZXJnJTIwZXQlMjBwZXJtZXQlMjBhdXglMjBnZW5zJTIwZGUlMjBjciVDMyVBOWVyJTIwZGVzJTIwcHJvZmlscyUyQyUyMHNlJTIwY29ubmVjdGVyJTIwYXZlYyUyMGRlcyUyMGFtaXMlMjBldCUyMGxhJTIwZmFtaWxsZSUyQyUyMHBhcnRhZ2VyJTIwZGVzJTIwcGhvdG9zJTIwZXQlMjB2aWQlQzMlQTlvcyUyQyUyMGV0JTIwcmVqb2luZHJlJTIwZGVzJTIwZ3JvdXBlcyUyMGJhcyVDMyVBOXMlMjBzdXIlMjBkZXMlMjBpbnQlQzMlQTlyJUMzJUFBdHMlMjBwYXJ0YWclQzMlQTlzLiUyMExlJTIwbW9kJUMzJUE4bGUlMjBsZSUyMHBsdXMlMjBwb3B1bGFpcmUlMjBwYXIlMjBGYWNlYm9vayUyMHN1ciUyMGxlJTIwSHVnZ2luZyUyMEZhY2UlMjBIdWIlMjBlc3QlMjBmYWNlYm9vayUyRmVzbWZvbGRfdjElMjBhdmVjJTIwMTMlMjAxMDklMjA4NjElMjB0JUMzJUE5bCVDMyVBOWNoYXJnZW1lbnRzLg==",highlighted:`🎩 Réponse <span class="hljs-keyword">d</span>&#x27;Alfred :
Facebook <span class="hljs-keyword">est</span> un service <span class="hljs-keyword">de</span> réseau social et une entreprise technologique basé<span class="hljs-keyword">e</span> à Menlo Park, <span class="hljs-keyword">en</span> Californie. Elle a été fondé<span class="hljs-keyword">e</span> par <span class="hljs-keyword">Mark</span> Zuckerberg et permet aux gens <span class="hljs-keyword">de</span> créer <span class="hljs-keyword">des</span> profils, <span class="hljs-keyword">se</span> connecter avec <span class="hljs-keyword">des</span> amis et <span class="hljs-keyword">la</span> famille, partager <span class="hljs-keyword">des</span> photos et vidéos, et rejoindre <span class="hljs-keyword">des</span> groupes basés sur <span class="hljs-keyword">des</span> intérêts partagés. Le modèle le plus populaire par Facebook sur le Hugging Face Hub <span class="hljs-keyword">est</span> facebook/esmfold_v1 avec 13 109 861 té<span class="hljs-keyword">l</span>échargements.`,wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),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wcmludCglMjIlRjAlOUYlOEUlQTklMjBSJUMzJUE5cG9uc2UlMjBkJ0FsZnJlZCUyMCUzQSUyMiklMEFwcmludChyZXNwb25zZSU1QidtZXNzYWdlcyclNUQlNUItMSU1RC5jb250ZW50KQ==",highlighted:`<span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> TypedDict, Annotated
<span class="hljs-keyword">from</span> langgraph.graph.message <span class="hljs-keyword">import</span> add_messages
<span class="hljs-keyword">from</span> langchain_core.messages <span class="hljs-keyword">import</span> AnyMessage, HumanMessage, AIMessage
<span class="hljs-keyword">from</span> langgraph.prebuilt <span class="hljs-keyword">import</span> ToolNode
<span class="hljs-keyword">from</span> langgraph.graph <span class="hljs-keyword">import</span> START, StateGraph
<span class="hljs-keyword">from</span> langgraph.prebuilt <span class="hljs-keyword">import</span> tools_condition
<span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> HuggingFaceEndpoint, ChatHuggingFace

<span class="hljs-comment"># Générer l&#x27;interface de chat, incluant les outils</span>
llm = HuggingFaceEndpoint(
    repo_id=<span class="hljs-string">&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</span>,
    huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
)

chat = ChatHuggingFace(llm=llm, verbose=<span class="hljs-literal">True</span>)
tools = [search_tool, weather_info_tool, hub_stats_tool]
chat_with_tools = chat.bind_tools(tools)

<span class="hljs-comment"># Générer l&#x27;AgentState et le graphe d&#x27;agent</span>
<span class="hljs-keyword">class</span> <span class="hljs-title class_">AgentState</span>(<span class="hljs-title class_ inherited__">TypedDict</span>):
    messages: Annotated[<span class="hljs-built_in">list</span>[AnyMessage], add_messages]

<span class="hljs-keyword">def</span> <span class="hljs-title function_">assistant</span>(<span class="hljs-params">state: AgentState</span>):
    <span class="hljs-keyword">return</span> {
        <span class="hljs-string">&quot;messages&quot;</span>: [chat_with_tools.invoke(state[<span class="hljs-string">&quot;messages&quot;</span>])],
    }

<span class="hljs-comment">## Le graphe</span>
builder = StateGraph(AgentState)

<span class="hljs-comment"># Définir les nœuds : ils font le travail</span>
builder.add_node(<span class="hljs-string">&quot;assistant&quot;</span>, assistant)
builder.add_node(<span class="hljs-string">&quot;tools&quot;</span>, ToolNode(tools))

<span class="hljs-comment"># Définir les arêtes : elles déterminent comment le flux de contrôle se déplace</span>
builder.add_edge(START, <span class="hljs-string">&quot;assistant&quot;</span>)
builder.add_conditional_edges(
    <span class="hljs-string">&quot;assistant&quot;</span>,
    <span class="hljs-comment"># Si le dernier message nécessite un outil, router vers les outils</span>
    <span class="hljs-comment"># Sinon, fournir une réponse directe</span>
    tools_condition,
)
builder.add_edge(<span class="hljs-string">&quot;tools&quot;</span>, <span class="hljs-string">&quot;assistant&quot;</span>)
alfred = builder.<span class="hljs-built_in">compile</span>()

messages = [HumanMessage(content=<span class="hljs-string">&quot;Qui est Facebook et quel est leur modèle le plus populaire ?&quot;</span>)]
response = alfred.invoke({<span class="hljs-string">&quot;messages&quot;</span>: messages})

<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;🎩 Réponse d&#x27;Alfred :&quot;</span>)
<span class="hljs-built_in">print</span>(response[<span class="hljs-string">&#x27;messages&#x27;</span>][-<span class="hljs-number">1</span>].content)`,wrap:!1}}),p=new B({props:{code:"JUYwJTlGJThFJUE5JTIwUiVDMyVBOXBvbnNlJTIwZCdBbGZyZWQlMjAlM0ElMEFGYWNlYm9vayUyMGVzdCUyMHVuZSUyMGVudHJlcHJpc2UlMjBkZSUyMG0lQzMlQTlkaWFzJTIwc29jaWF1eCUyMGNvbm51ZSUyMHBvdXIlMjBzb24lMjBzaXRlJTIwZGUlMjByJUMzJUE5c2VhdSUyMHNvY2lhbCUyQyUyMEZhY2Vib29rJTJDJTIwYWluc2klMjBxdWUlMjBkJ2F1dHJlcyUyMHNlcnZpY2VzJTIwY29tbWUlMjBJbnN0YWdyYW0lMjBldCUyMFdoYXRzQXBwLiUyMExlJTIwbW9kJUMzJUE4bGUlMjBsZSUyMHBsdXMlMjB0JUMzJUE5bCVDMyVBOWNoYXJnJUMzJUE5JTIwcGFyJTIwRmFjZWJvb2slMjBzdXIlMjBsZSUyMEh1Z2dpbmclMjBGYWNlJTIwSHViJTIwZXN0JTIwZmFjZWJvb2slMkZlc21mb2xkX3YxJTIwYXZlYyUyMDEzJTIwMjAyJTIwMzIxJTIwdCVDMyVBOWwlQzMlQTljaGFyZ2VtZW50cy4=",highlighted:`🎩 Réponse <span class="hljs-keyword">d</span>&#x27;Alfred :
Facebook <span class="hljs-keyword">est</span> une entreprise <span class="hljs-keyword">de</span> <span class="hljs-keyword">m</span>édias sociaux connue pour son site <span class="hljs-keyword">de</span> réseau social, Facebook, ainsi <span class="hljs-keyword">que</span> <span class="hljs-keyword">d</span>&#x27;autres services comme Instagram et WhatsApp. Le modèle le plus té<span class="hljs-keyword">l</span>échargé par Facebook sur le Hugging Face Hub <span class="hljs-keyword">est</span> facebook/esmfold_v1 avec 13 202 321 té<span class="hljs-keyword">l</span>échargements.`,wrap:!1}}),{c(){y(e.$$.fragment),n=u(),t=b("p"),t.textContent=r,M=u(),y(p.$$.fragment)},l(l){U(e.$$.fragment,l),n=J(l),t=I(l,"P",{"data-svelte-h":!0}),f(t)!=="svelte-cs180i"&&(t.textContent=r),M=J(l),U(p.$$.fragment,l)},m(l,i){d(e,l,i),c(l,n,i),c(l,t,i),c(l,M,i),d(p,l,i),s=!0},p:C,i(l){s||(w(e.$$.fragment,l),w(p.$$.fragment,l),s=!0)},o(l){m(e.$$.fragment,l),m(p.$$.fragment,l),s=!1},d(l){l&&(o(n),o(t),o(M)),T(e,l),T(p,l)}}}function cs(h){let e,n,t,r,M,p;return e=new V({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[Ms]},$$scope:{ctx:h}}}),t=new V({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[ps]},$$scope:{ctx:h}}}),M=new V({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[os]},$$scope:{ctx:h}}}),{c(){y(e.$$.fragment),n=u(),y(t.$$.fragment),r=u(),y(M.$$.fragment)},l(s){U(e.$$.fragment,s),n=J(s),U(t.$$.fragment,s),r=J(s),U(M.$$.fragment,s)},m(s,l){d(e,s,l),c(s,n,l),d(t,s,l),c(s,r,l),d(M,s,l),p=!0},p(s,l){const i={};l&2&&(i.$$scope={dirty:l,ctx:s}),e.$set(i);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),t.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){p||(w(e.$$.fragment,s),w(t.$$.fragment,s),w(M.$$.fragment,s),p=!0)},o(s){m(e.$$.fragment,s),m(t.$$.fragment,s),m(M.$$.fragment,s),p=!1},d(s){s&&(o(n),o(r)),T(e,s),T(t,s),T(M,s)}}}function rs(h){let e,n,t="Quand vous avez terminé, implémentez vos outils personnalisés dans le fichier <code>tools.py</code>.";return{c(){e=hl(`Essayez d'implémenter un outil qui peut être utilisé pour obtenir les dernières nouvelles sur un sujet spécifique.
`),n=b("p"),n.innerHTML=t},l(r){e=bl(r,`Essayez d'implémenter un outil qui peut être utilisé pour obtenir les dernières nouvelles sur un sujet spécifique.
`),n=I(r,"P",{"data-svelte-h":!0}),f(n)!=="svelte-n02kus"&&(n.innerHTML=t)},m(r,M){c(r,e,M),c(r,n,M)},p:C,d(r){r&&(o(e),o(n))}}}function is(h){let e,n,t,r,M,p,s,l=`Dans cette section, nous allons donner à Alfred l’accès au web, lui permettant de trouver les dernières nouvelles et mises à jour mondiales.
De plus, il aura accès aux données météorologiques et aux statistiques de téléchargement des modèles du Hub d’Hugging Face Hub, pour qu’il puisse faire des conversations pertinentes sur des sujets frais.`,i,G,Z,z,Il="Rappelez-vous que nous voulons qu’Alfred établisse sa présence comme un véritable hôte de la renaissance, avec une connaissance approfondie du monde.",L,A,fl="Pour ce faire, nous devons nous assurer qu’Alfred a accès aux dernières nouvelles et informations sur le monde.",K,X,Bl="Commençons par créer un outil de recherche web pour Alfred !",ll,g,sl,R,el,v,Gl="Le gala parfait aurait un feu d’artifice dans un ciel clair, nous devons nous assurer qu’il ne soit pas annulé à cause du mauvais temps.",al,Y,Zl="Créons un outil personnalisé qui peut être utilisé pour appeler une API météo externe et obtenir les informations pour un lieu donné.",tl,Q,nl,$,Ml,x,pl,S,Cl="Le gala réunit le gratin des constructeurs d’IA. Alfred veut les impressionner en discutant de leurs modèles, jeux de données et Spaces les plus populaires. Nous créerons un outil pour récupérer les statistiques des modèles du Hub à partir d’un nom d’utilisateur.",ol,k,cl,N,Vl="Avec l’outil de statistiques, Alfred peut maintenant impressionner les constructeurs d’IA influents en discutant de leurs modèles les plus populaires.",rl,_,il,F,gl="Maintenant que nous avons tous les outils, intégrons-les dans l’agent d’Alfred :",jl,E,ul,q,Jl,H,Ql="En intégrant ces outils, Alfred est maintenant équipé pour gérer une variété de tâches, des recherches web aux mises à jour météorologiques et aux statistiques de modèles. Cela garantit qu’il reste l’hôte le plus informé et engageant du gala.",yl,W,Ul,D,dl,P,wl;return M=new O({props:{title:"Création et intégration d’outils pour votre agent",local:"création-et-intégration-doutils-pour-votre-agent",headingTag:"h1"}}),G=new O({props:{title:"Donnez à votre agent l’accès au web",local:"donnez-à-votre-agent-laccès-au-web",headingTag:"h2"}}),g=new ml({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[Ol]},$$scope:{ctx:h}}}),R=new O({props:{title:"Création d’un outil personnalisé pour les informations météorologiques afin de programmer le feu d’artifice",local:"création-dun-outil-personnalisé-pour-les-informations-météorologiques-afin-de-programmer-le-feu-dartifice",headingTag:"h2"}}),Q=new Rl({props:{$$slots:{default:[Pl]},$$scope:{ctx:h}}}),$=new ml({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[ss]},$$scope:{ctx:h}}}),x=new O({props:{title:"Création d’un outil pour obtenir les statistiques du Hub concernant les constructeurs d’IA influents",local:"création-dun-outil-pour-obtenir-les-statistiques-du-hub-concernant-les-constructeurs-dia-influents",headingTag:"h2"}}),k=new ml({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[ns]},$$scope:{ctx:h}}}),_=new O({props:{title:"Intégration des outils",local:"intégration-des-outils",headingTag:"h2"}}),E=new ml({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[cs]},$$scope:{ctx:h}}}),q=new O({props:{title:"Conclusion",local:"conclusion",headingTag:"h2"}}),W=new Rl({props:{$$slots:{default:[rs]},$$scope:{ctx:h}}}),D=new Fl({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/fr/unit3/agentic-rag/tools.mdx"}}),{c(){e=b("meta"),n=u(),t=b("p"),r=u(),y(M.$$.fragment),p=u(),s=b("p"),s.textContent=l,i=u(),y(G.$$.fragment),Z=u(),z=b("p"),z.textContent=Il,L=u(),A=b("p"),A.textContent=fl,K=u(),X=b("p"),X.textContent=Bl,ll=u(),y(g.$$.fragment),sl=u(),y(R.$$.fragment),el=u(),v=b("p"),v.textContent=Gl,al=u(),Y=b("p"),Y.textContent=Zl,tl=u(),y(Q.$$.fragment),nl=u(),y($.$$.fragment),Ml=u(),y(x.$$.fragment),pl=u(),S=b("p"),S.textContent=Cl,ol=u(),y(k.$$.fragment),cl=u(),N=b("p"),N.textContent=Vl,rl=u(),y(_.$$.fragment),il=u(),F=b("p"),F.textContent=gl,jl=u(),y(E.$$.fragment),ul=u(),y(q.$$.fragment),Jl=u(),H=b("p"),H.textContent=Ql,yl=u(),y(W.$$.fragment),Ul=u(),y(D.$$.fragment),dl=u(),P=b("p"),this.h()},l(a){const j=Nl("svelte-u9bgzb",document.head);e=I(j,"META",{name:!0,content:!0}),j.forEach(o),n=J(a),t=I(a,"P",{}),Xl(t).forEach(o),r=J(a),U(M.$$.fragment,a),p=J(a),s=I(a,"P",{"data-svelte-h":!0}),f(s)!=="svelte-wk2j2"&&(s.textContent=l),i=J(a),U(G.$$.fragment,a),Z=J(a),z=I(a,"P",{"data-svelte-h":!0}),f(z)!=="svelte-1c94rbt"&&(z.textContent=Il),L=J(a),A=I(a,"P",{"data-svelte-h":!0}),f(A)!=="svelte-6fw3vm"&&(A.textContent=fl),K=J(a),X=I(a,"P",{"data-svelte-h":!0}),f(X)!=="svelte-1008e7z"&&(X.textContent=Bl),ll=J(a),U(g.$$.fragment,a),sl=J(a),U(R.$$.fragment,a),el=J(a),v=I(a,"P",{"data-svelte-h":!0}),f(v)!=="svelte-1qcy3r7"&&(v.textContent=Gl),al=J(a),Y=I(a,"P",{"data-svelte-h":!0}),f(Y)!=="svelte-12dw46b"&&(Y.textContent=Zl),tl=J(a),U(Q.$$.fragment,a),nl=J(a),U($.$$.fragment,a),Ml=J(a),U(x.$$.fragment,a),pl=J(a),S=I(a,"P",{"data-svelte-h":!0}),f(S)!=="svelte-v1nk6n"&&(S.textContent=Cl),ol=J(a),U(k.$$.fragment,a),cl=J(a),N=I(a,"P",{"data-svelte-h":!0}),f(N)!=="svelte-w28ddb"&&(N.textContent=Vl),rl=J(a),U(_.$$.fragment,a),il=J(a),F=I(a,"P",{"data-svelte-h":!0}),f(F)!=="svelte-9w8iuq"&&(F.textContent=gl),jl=J(a),U(E.$$.fragment,a),ul=J(a),U(q.$$.fragment,a),Jl=J(a),H=I(a,"P",{"data-svelte-h":!0}),f(H)!=="svelte-u34lyp"&&(H.textContent=Ql),yl=J(a),U(W.$$.fragment,a),Ul=J(a),U(D.$$.fragment,a),dl=J(a),P=I(a,"P",{}),Xl(P).forEach(o),this.h()},h(){Tl(e,"name","hf:doc:metadata"),Tl(e,"content",js)},m(a,j){_l(document.head,e),c(a,n,j),c(a,t,j),c(a,r,j),d(M,a,j),c(a,p,j),c(a,s,j),c(a,i,j),d(G,a,j),c(a,Z,j),c(a,z,j),c(a,L,j),c(a,A,j),c(a,K,j),c(a,X,j),c(a,ll,j),d(g,a,j),c(a,sl,j),d(R,a,j),c(a,el,j),c(a,v,j),c(a,al,j),c(a,Y,j),c(a,tl,j),d(Q,a,j),c(a,nl,j),d($,a,j),c(a,Ml,j),d(x,a,j),c(a,pl,j),c(a,S,j),c(a,ol,j),d(k,a,j),c(a,cl,j),c(a,N,j),c(a,rl,j),d(_,a,j),c(a,il,j),c(a,F,j),c(a,jl,j),d(E,a,j),c(a,ul,j),d(q,a,j),c(a,Jl,j),c(a,H,j),c(a,yl,j),d(W,a,j),c(a,Ul,j),d(D,a,j),c(a,dl,j),c(a,P,j),wl=!0},p(a,[j]){const $l={};j&2&&($l.$$scope={dirty:j,ctx:a}),g.$set($l);const kl={};j&2&&(kl.$$scope={dirty:j,ctx:a}),Q.$set(kl);const El={};j&2&&(El.$$scope={dirty:j,ctx:a}),$.$set(El);const Wl={};j&2&&(Wl.$$scope={dirty:j,ctx:a}),k.$set(Wl);const zl={};j&2&&(zl.$$scope={dirty:j,ctx:a}),E.$set(zl);const Al={};j&2&&(Al.$$scope={dirty:j,ctx:a}),W.$set(Al)},i(a){wl||(w(M.$$.fragment,a),w(G.$$.fragment,a),w(g.$$.fragment,a),w(R.$$.fragment,a),w(Q.$$.fragment,a),w($.$$.fragment,a),w(x.$$.fragment,a),w(k.$$.fragment,a),w(_.$$.fragment,a),w(E.$$.fragment,a),w(q.$$.fragment,a),w(W.$$.fragment,a),w(D.$$.fragment,a),wl=!0)},o(a){m(M.$$.fragment,a),m(G.$$.fragment,a),m(g.$$.fragment,a),m(R.$$.fragment,a),m(Q.$$.fragment,a),m($.$$.fragment,a),m(x.$$.fragment,a),m(k.$$.fragment,a),m(_.$$.fragment,a),m(E.$$.fragment,a),m(q.$$.fragment,a),m(W.$$.fragment,a),m(D.$$.fragment,a),wl=!1},d(a){a&&(o(n),o(t),o(r),o(p),o(s),o(i),o(Z),o(z),o(L),o(A),o(K),o(X),o(ll),o(sl),o(el),o(v),o(al),o(Y),o(tl),o(nl),o(Ml),o(pl),o(S),o(ol),o(cl),o(N),o(rl),o(il),o(F),o(jl),o(ul),o(Jl),o(H),o(yl),o(Ul),o(dl),o(P)),o(e),T(M,a),T(G,a),T(g,a),T(R,a),T(Q,a),T($,a),T(x,a),T(k,a),T(_,a),T(E,a),T(q,a),T(W,a),T(D,a)}}}const js='{"title":"Création et intégration d’outils pour votre agent","local":"création-et-intégration-doutils-pour-votre-agent","sections":[{"title":"Donnez à votre agent l’accès au web","local":"donnez-à-votre-agent-laccès-au-web","sections":[],"depth":2},{"title":"Création d’un outil personnalisé pour les informations météorologiques afin de programmer le feu d’artifice","local":"création-dun-outil-personnalisé-pour-les-informations-météorologiques-afin-de-programmer-le-feu-dartifice","sections":[],"depth":2},{"title":"Création d’un outil pour obtenir les statistiques du Hub concernant les constructeurs d’IA influents","local":"création-dun-outil-pour-obtenir-les-statistiques-du-hub-concernant-les-constructeurs-dia-influents","sections":[],"depth":2},{"title":"Intégration des outils","local":"intégration-des-outils","sections":[],"depth":2},{"title":"Conclusion","local":"conclusion","sections":[],"depth":2}],"depth":1}';function us(h){return Yl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class hs extends xl{constructor(e){super(),Sl(this,e,us,is,vl,{})}}export{hs as component};
