import{s as Al,o as Xl,n as V}from"../chunks/scheduler.37c15a92.js";import{S as Rl,i as vl,g as b,s as u,r as y,A as Yl,h as I,f as o,c as J,j as zl,u as U,x as B,k as ml,y as xl,a as c,v as d,d as w,t as m,w as T}from"../chunks/index.2bf4358c.js";import{C as f}from"../chunks/CodeBlock.4e987730.js";import{H as O}from"../chunks/Heading.8ada512a.js";import{H as Tl,a as C}from"../chunks/HfOption.02c8e375.js";import{E as Sl}from"../chunks/getInferenceSnippets.0aa3753f.js";function Nl(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function Fl(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function _l(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function ql(h){let n,p,a,i,M,t;return n=new C({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[Nl]},$$scope:{ctx:h}}}),a=new C({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[Fl]},$$scope:{ctx:h}}}),M=new C({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[_l]},$$scope:{ctx:h}}}),{c(){y(n.$$.fragment),p=u(),y(a.$$.fragment),i=u(),y(M.$$.fragment)},l(s){U(n.$$.fragment,s),p=J(s),U(a.$$.fragment,s),i=J(s),U(M.$$.fragment,s)},m(s,l){d(n,s,l),c(s,p,l),d(a,s,l),c(s,i,l),d(M,s,l),t=!0},p(s,l){const r={};l&2&&(r.$$scope={dirty:l,ctx:s}),n.$set(r);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),a.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){t||(w(n.$$.fragment,s),w(a.$$.fragment,s),w(M.$$.fragment,s),t=!0)},o(s){m(n.$$.fragment,s),m(a.$$.fragment,s),m(M.$$.fragment,s),t=!1},d(s){s&&(o(p),o(i)),T(n,s),T(a,s),T(M,s)}}}function Hl(h){let n,p;return n=new f({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBUb29sJTBBaW1wb3J0JTIwcmFuZG9tJTBBJTBBY2xhc3MlMjBXZWF0aGVySW5mb1Rvb2woVG9vbCklM0ElMEElMjAlMjAlMjAlMjBuYW1lJTIwJTNEJTIwJTIyd2VhdGhlcl9pbmZvJTIyJTBBJTIwJTIwJTIwJTIwZGVzY3JpcHRpb24lMjAlM0QlMjAlMjJSJUMzJUE5Y3VwJUMzJUE4cmUlMjBkZXMlMjBpbmZvcm1hdGlvbnMlMjBtJUMzJUE5dCVDMyVBOW9yb2xvZ2lxdWVzJTIwZmFjdG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AlMjAlMjAlMjAlMjAlN0IlMjJjb25kaXRpb24lMjIlM0ElMjAlMjJDbGFpciUyMiUyQyUyMCUyMnRlbXBfYyUyMiUzQSUyMDI1JTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIyY29uZGl0aW9uJTIyJTNBJTIwJTIyVmVudGV1eCUyMiUyQyUyMCUyMnRlbXBfYyUyMiUzQSUyMDIwJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwUyVDMyVBOWxlY3Rpb25uZXIlMjBhbCVDMyVBOWF0b2lyZW1lbnQlMjB1bmUlMjBjb25kaXRpb24lMjBtJUMzJUE5dCVDMyVBOW9yb2xvZ2lxdWUlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBkYXRhJTIwJTNEJTIwcmFuZG9tLmNob2ljZSh3ZWF0aGVyX2NvbmRpdGlvbnMpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwZiUyMk0lQzMlQTl0JUMzJUE5byUyMCVDMyVBMCUyMCU3QmxvY2F0aW9uJTdEJTNBJTIwJTdCZGF0YSU1Qidjb25kaXRpb24nJTVEJTdEJTJDJTIwJTdCZGF0YSU1Qid0ZW1wX2MnJTVEJTdEJUMyJUIwQyUyMiUwQSUwQSUyMyUyMEluaXRpYWxpc2VyJTIwbCdvdXRpbCUwQXdlYXRoZXJfaW5mb190b29sJTIwJTNEJTIwV2VhdGhlckluZm9Ub29sKCk=",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(n.$$.fragment)},l(a){U(n.$$.fragment,a)},m(a,i){d(n,a,i),p=!0},p:V,i(a){p||(w(n.$$.fragment,a),p=!0)},o(a){m(n.$$.fragment,a),p=!1},d(a){T(n,a)}}}function Dl(h){let n,p;return n=new f({props:{code:"aW1wb3J0JTIwcmFuZG9tJT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lvcm9sb2dpcXVlJTBBJTIwJTIwJTIwJTIwZGF0YSUyMCUzRCUyMHJhbmRvbS5jaG9pY2Uod2VhdGhlcl9jb25kaXRpb25zKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGYlMjJNJUMzJUE5dCVDMyVBOW8lMjAlQzMlQTAlMjAlN0Jsb2NhdGlvbiU3RCUzQSUyMCU3QmRhdGElNUInY29uZGl0aW9uJyU1RCU3RCUyQyUyMCU3QmRhdGElNUIndGVtcF9jJyU1RCU3RCVDMiVCMEMlMjIlMEElMEElMjMlMjBJbml0aWFsaXNlciUyMGwnb3V0aWwlMEF3ZWF0aGVyX2luZm9fdG9vbCUyMCUzRCUyMEZ1bmN0aW9uVG9vbC5mcm9tX2RlZmF1bHRzKGdldF93ZWF0aGVyX2luZm8p",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(n.$$.fragment)},l(a){U(n.$$.fragment,a)},m(a,i){d(n,a,i),p=!0},p:V,i(a){p||(w(n.$$.fragment,a),p=!0)},o(a){m(n.$$.fragment,a),p=!1},d(a){T(n,a)}}}function Ol(h){let n,p;return n=new f({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi50b29scyUyMGltcG9ydCUyMFRvb2wlMEFpbXBvcnQlMjByYW5kb20lMEElMEFkZWYlMjBnZXRfd2VhdGhlcl9pbmZvKGxvY2F0aW9uJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJSJUMzJUE5Y3VwJUMzJUE4cmUlMjBkZXMlMjBpbmZvcm1hdGlvbnMlMjBtJUMzJUE5dCVDMyVBOW9yb2xvZ2lxdWVzJTIwZmFjdGljZXMlMjBwb3VyJTIwdW4lMjBsaWV1JTIwZG9ubiVDMyVBOS4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjAlMjMlMjBEb25uJUMzJUE5ZXMlMjBtJUMzJUE5dCVDMyVBOW9yb2xvZ2lxdWVzJTIwZmFjdGljZXMlMEElMjAlMjAlMjAlMjB3ZWF0aGVyX2NvbmRpdGlvbnMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJjb25kaXRpb24lMjIlM0ElMjAlMjJQbHV2aWV1eCUyMiUyQyUyMCUyMnRlbXBfYyUyMiUzQSUyMDE1JTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJT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JTBBKQ==",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(n.$$.fragment)},l(a){U(n.$$.fragment,a)},m(a,i){d(n,a,i),p=!0},p:V,i(a){p||(w(n.$$.fragment,a),p=!0)},o(a){m(n.$$.fragment,a),p=!1},d(a){T(n,a)}}}function Ll(h){let n,p,a,i,M,t;return n=new C({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[Hl]},$$scope:{ctx:h}}}),a=new C({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[Dl]},$$scope:{ctx:h}}}),M=new C({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[Ol]},$$scope:{ctx:h}}}),{c(){y(n.$$.fragment),p=u(),y(a.$$.fragment),i=u(),y(M.$$.fragment)},l(s){U(n.$$.fragment,s),p=J(s),U(a.$$.fragment,s),i=J(s),U(M.$$.fragment,s)},m(s,l){d(n,s,l),c(s,p,l),d(a,s,l),c(s,i,l),d(M,s,l),t=!0},p(s,l){const r={};l&2&&(r.$$scope={dirty:l,ctx:s}),n.$set(r);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),a.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){t||(w(n.$$.fragment,s),w(a.$$.fragment,s),w(M.$$.fragment,s),t=!0)},o(s){m(n.$$.fragment,s),m(a.$$.fragment,s),m(M.$$.fragment,s),t=!1},d(s){s&&(o(p),o(i)),T(n,s),T(a,s),T(M,s)}}}function Kl(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBUb29sJTBBZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxpc3RfbW9kZWxzJTBBJTBBY2xhc3MlMjBIdWJTdGF0c1Rvb2woVG9vbCklM0ElMEElMjAlMjAlMjAlMjBuYW1lJTIwJTNEJTIwJTIyaHViX3N0YXRzJTIyJTBBJTIwJTIwJTIwJTIwZGVzY3JpcHRpb24lMjAlM0QlMjAlMjJSJUMzJUE5Y3VwJUMzJUE4cmUlMjBsZSUyMG1vZCVDMyVBOGxlJTIwbGUlMjBwbHVzJTIwdCVDMyVBOWwlQzMlQTljaGFyZyVDMyVBOSUyMGQndW4lMjBhdXRldX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lMjAlMjAlMjAlMjByZXR1cm4lMjBmJTIyRXJyZXVyJTIwbG9ycyUyMGRlJTIwbGElMjByJUMzJUE5Y3VwJUMzJUE5cmF0aW9uJTIwZGVzJTIwbW9kJUMzJUE4bGVzJTIwcG91ciUyMCU3QmF1dGhvciU3RCUzQSUyMCU3QnN0cihlKSU3RCUyMiUwQSUwQSUyMyUyMEluaXRpYWxpc2VyJTIwbCdvdXRpbCUwQWh1Yl9zdGF0c190b29sJTIwJTNEJTIwSHViU3RhdHNUb29sKCklMEElMEElMjMlMjBFeGVtcGxlJTIwZCd1c2FnZSUwQXByaW50KGh1Yl9zdGF0c190b29sKCUyMmZhY2Vib29rJTIyKSklMjAlMjMlMjBFeGVtcGxlJTIwJTNBJTIwT2J0ZW5pciUyMGxlJTIwbW9kJUMzJUE4bGUlMjBsZSUyMHBsdXMlMjB0JUMzJUE5bCVDMyVBOWNoYXJnJUMzJUE5JTIwcGFyJTIwRmFjZWJvb2s=",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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function Pl(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({props:{code:"aW1wb3J0JTIwcmFuZG9tJTBBZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUudG9vbHMlMjBpbXBvcnQlMjBGdW5jdGlvblRvb2wlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwbGlzdF9tb2RlbHMlMEElMEFkZWYlMjBnZXRfaHViX3N0YXRzKGF1dGhvciUzQSUyMHN0ciklMjAtJTNFJTIwc3RyJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyUiVDMyVBOWN1cCVDMyVBOHJlJTIwbGUlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHQlQzMlQTlsJUMzJUE5Y2hhcmclQzMlQTklMjBkJ3VuJTIwYXV0ZXVyJTIwc3AlQzMlQTljaWZpcXVlJTIwc3VyJTIwbGUlMjBIdWdnaW5nJTIwRmFjZSUyMEh1Yi4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjB0cnklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBMaXN0ZXIlMjBsZ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UyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMGYlMjJFcnJldXIlMjBsb3JzJTIwZGUlMjBsYSUyMHIlQzMlQTljdXAlQzMlQTlyYXRpb24lMjBkZXMlMjBtb2QlQzMlQThsZXMlMjBwb3VyJTIwJTdCYXV0aG9yJTdEJTNBJTIwJTdCc3RyKGUpJTdEJTIyJTBBJTBBJTIzJTIwSW5pdGlhbGlzZXIlMjBsJ291dGlsJTBBaHViX3N0YXRzX3Rvb2wlMjAlM0QlMjBGdW5jdGlvblRvb2wuZnJvbV9kZWZhdWx0cyhnZXRfaHViX3N0YXRzKSUwQSUwQSUyMyUyMEV4ZW1wbGUlMjBkJ3VzYWdlJTBBcHJpbnQoaHViX3N0YXRzX3Rvb2woJTIyZmFjZWJvb2slMjIpKSUyMCUyMyUyMEV4ZW1wbGUlMjAlM0ElMjBPYnRlbmlyJTIwbGUlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHQlQzMlQTlsJUMzJUE5Y2hhcmclQzMlQTklMjBwYXIlMjBGYWNlYm9vaw==",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">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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function ls(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi50b29scyUyMGltcG9ydCUyMFRvb2wlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwbGlzdF9tb2RlbHMlMEElMEFkZWYlMjBnZXRfaHViX3N0YXRzKGF1dGhvciUzQSUyMHN0ciklMjAtJTNFJTIwc3RyJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyUiVDMyVBOWN1cCVDMyVBOHJlJTIwbGUlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHQlQzMlQTlsJUMzJUE5Y2hhcmclQzMlQTklMjBkJ3VuJTIwYXV0ZXVyJTIwc3AlQzMlQTljaWZpcXVlJTIwc3VyJTIwbGUlMjBIdWdnaW5nJTIwRmFjZSUyMEh1Yi4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjB0cnklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBMaXN0ZXIlMjBsZXMlMjBtb2QlQzMlQThsZXMlMjBkZSUyMGwnYXV0ZXVyJTIwc3AlQzMlQTljaWZpJUMzJUE5JTJDJTIwdHJpJUMzJUE5cyUyMHBhciUyMHQlQzMlQTlsJUMzJUE5Y2hhcmdlbWVudHMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2RlbHMlMjAlM0QlMjBsaXN0KGxpc3RfbW9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wSW5pdGlhbGlzZXIlMjBsJ291dGlsJTBBaHViX3N0YXRzX3Rvb2wlMjAlM0QlMjBUb29sKCUwQSUyMCUyMCUyMCUyMG5hbWUlM0QlMjJnZXRfaHViX3N0YXRzJTIyJTJDJTBBJTIwJTIwJTIwJTIwZnVuYyUzRGdldF9odWJfc3RhdHMlMkMlMEElMjAlMjAlMjAlMjBkZXNjcmlwdGlvbiUzRCUyMlIlQzMlQTljdXAlQzMlQThyZSUyMGxlJTIwbW9kJUMzJUE4bGUlMjBsZSUyMHBsdXMlMjB0JUMzJUE5bCVDMyVBOWNoYXJnJUMzJUE5JTIwZCd1biUyMGF1dGV1ciUyMHNwJUMzJUE5Y2lmaXF1ZSUyMHN1ciUyMGxlJTIwSHVnZ2luZyUyMEZhY2UlMjBIdWIuJTIyJTBBKSUwQSUwQSUyMyUyMEV4ZW1wbGUlMjBkJ3VzYWdlJTBBcHJpbnQoaHViX3N0YXRzX3Rvb2wuaW52b2tlKCUyMmZhY2Vib29rJTIyKSklMjAlMjMlMjBFeGVtcGxlJTIwJTNBJTIwT2J0ZW5pciUyMGxlJTIwbW9kJUMzJUE4bGUlMjBsZSUyMHBsdXMlMjB0JUMzJUE5bCVDMyVBOWNoYXJnJUMzJUE5JTIwcGFyJTIwRmFjZWJvb2s=",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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function ss(h){let n,p,a,i,M,t;return n=new C({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[Kl]},$$scope:{ctx:h}}}),a=new C({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[Pl]},$$scope:{ctx:h}}}),M=new C({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[ls]},$$scope:{ctx:h}}}),{c(){y(n.$$.fragment),p=u(),y(a.$$.fragment),i=u(),y(M.$$.fragment)},l(s){U(n.$$.fragment,s),p=J(s),U(a.$$.fragment,s),i=J(s),U(M.$$.fragment,s)},m(s,l){d(n,s,l),c(s,p,l),d(a,s,l),c(s,i,l),d(M,s,l),t=!0},p(s,l){const r={};l&2&&(r.$$scope={dirty:l,ctx:s}),n.$set(r);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),a.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){t||(w(n.$$.fragment,s),w(a.$$.fragment,s),w(M.$$.fragment,s),t=!0)},o(s){m(n.$$.fragment,s),m(a.$$.fragment,s),m(M.$$.fragment,s),t=!1},d(s){s&&(o(p),o(i)),T(n,s),T(a,s),T(M,s)}}}function as(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function es(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function ns(h){let n,p,a,i="Sortie attendue :",M,t,s;return n=new f({props:{code:"ZnJvbSUyMHR5cGluZyUyMGltcG9ydCUyMFR5cGVkRGljdCUyQyUyMEFubm90YXRlZCUwQWZyb20lMjBsYW5nZ3JhcGguZ3JhcGgubWVzc2FnZSUyMGltcG9ydCUyMGFkZF9tZXNzYWdlcyUwQWZyb20lMjBsYW5nY2hhaW5fY29yZS5tZXNzYWdlcyUyMGltcG9ydCUyMEFueU1lc3NhZ2UlMkMlMjBIdW1hbk1lc3NhZ2UlMkMlMjBBSU1lc3NhZ2UlMEFmcm9tJTIwbGFuZ2dyYXBoLnByZWJ1aWx0JTIwaW1wb3J0JTIwVG9vbE5vZGUlMEFmcm9tJTIwbGFuZ2dyYXBoLmdyYXBoJTIwaW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OWNlc3NpdGUlMjB1biUyMG91dGlsJTJDJTIwcm91dGVyJTIwdmVycyUyMGxlcyUyMG91dGlscyUwQSUyMCUyMCUyMCUyMCUyMyUyMFNpbm9uJTJDJTIwZm91cm5pciUyMHVuZSUyMHIlQzMlQTlwb25zZSUyMGRpcmVjdGUlMEElMjAlMjAlMjAlMjB0b29sc19jb25kaXRpb24lMkMlMEEpJTBBYnVpbGRlci5hZGRfZWRnZSglMjJ0b29scyUyMiUyQyUyMCUyMmFzc2lzdGFudCUyMiklMEFhbGZyZWQlMjAlM0QlMjBidWlsZGVyLmNvbXBpbGUoKSUwQSUwQW1lc3NhZ2VzJTIwJTNEJTIwJTVCSHVtYW5NZXNzYWdlKGNvbnRlbnQlM0QlMjJRdWklMjBlc3QlMjBGYWNlYm9vayUyMGV0JTIwcXVlbCUyMGVzdCUyMGxldXIlMjBtb2QlQzMlQThsZSUyMGxlJTIwcGx1cyUyMHBvcHVsYWlyZSUyMCUzRiUyMiklNUQlMEFyZXNwb25zZSUyMCUzRCUyMGFsZnJlZC5pbnZva2UoJTdCJTIybWVzc2FnZXMlMjIlM0ElMjBtZXNzYWdlcyU3RCklMEElMEFwcmludCglMjIlRjAlOUYlOEUlQTklMjBSJUMzJUE5cG9uc2UlMjBkJ0FsZnJlZCUyMCUzQSUyMiklMEFwcmludChyZXNwb25zZSU1QidtZXNzYWdlcyclNUQlNUItMSU1RC5jb250ZW50KQ==",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}}),t=new f({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(n.$$.fragment),p=u(),a=b("p"),a.textContent=i,M=u(),y(t.$$.fragment)},l(l){U(n.$$.fragment,l),p=J(l),a=I(l,"P",{"data-svelte-h":!0}),B(a)!=="svelte-cs180i"&&(a.textContent=i),M=J(l),U(t.$$.fragment,l)},m(l,r){d(n,l,r),c(l,p,r),c(l,a,r),c(l,M,r),d(t,l,r),s=!0},p:V,i(l){s||(w(n.$$.fragment,l),w(t.$$.fragment,l),s=!0)},o(l){m(n.$$.fragment,l),m(t.$$.fragment,l),s=!1},d(l){l&&(o(p),o(a),o(M)),T(n,l),T(t,l)}}}function ts(h){let n,p,a,i,M,t;return n=new C({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[as]},$$scope:{ctx:h}}}),a=new C({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[es]},$$scope:{ctx:h}}}),M=new C({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[ns]},$$scope:{ctx:h}}}),{c(){y(n.$$.fragment),p=u(),y(a.$$.fragment),i=u(),y(M.$$.fragment)},l(s){U(n.$$.fragment,s),p=J(s),U(a.$$.fragment,s),i=J(s),U(M.$$.fragment,s)},m(s,l){d(n,s,l),c(s,p,l),d(a,s,l),c(s,i,l),d(M,s,l),t=!0},p(s,l){const r={};l&2&&(r.$$scope={dirty:l,ctx:s}),n.$set(r);const G={};l&2&&(G.$$scope={dirty:l,ctx:s}),a.$set(G);const Z={};l&2&&(Z.$$scope={dirty:l,ctx:s}),M.$set(Z)},i(s){t||(w(n.$$.fragment,s),w(a.$$.fragment,s),w(M.$$.fragment,s),t=!0)},o(s){m(n.$$.fragment,s),m(a.$$.fragment,s),m(M.$$.fragment,s),t=!1},d(s){s&&(o(p),o(i)),T(n,s),T(a,s),T(M,s)}}}function Ms(h){let n,p,a,i,M,t,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.`,r,G,Z,z,hl="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.",K,A,bl="Pour ce faire, nous devons nous assurer qu’Alfred a accès aux dernières nouvelles et informations sur le monde.",P,X,Il="Commençons par créer un outil de recherche web pour Alfred !",ll,g,sl,R,al,v,Bl="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.",el,Y,fl="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é.",nl,Q,Gl='<p>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 <a href="../../unit1/tutorial">l’Unité 1</a>.</p>',tl,$,Ml,x,pl,S,Zl="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,Cl="Avec l’outil de statistiques, Alfred peut maintenant impressionner les constructeurs d’IA influents en discutant de leurs modèles les plus populaires.",rl,F,jl,_,Vl="Maintenant que nous avons tous les outils, intégrons-les dans l’agent d’Alfred :",il,E,ul,q,Jl,H,gl="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,Ql="<p>Essayez d’implémenter un outil qui peut être utilisé pour obtenir les dernières nouvelles sur un sujet spécifique.</p> <p>Quand vous avez terminé, implémentez vos outils personnalisés dans le fichier <code>tools.py</code>.</p>",Ul,D,dl,L,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 Tl({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[ql]},$$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"}}),$=new Tl({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[Ll]},$$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 Tl({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[ss]},$$scope:{ctx:h}}}),F=new O({props:{title:"Intégration des outils",local:"intégration-des-outils",headingTag:"h2"}}),E=new Tl({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[ts]},$$scope:{ctx:h}}}),q=new O({props:{title:"Conclusion",local:"conclusion",headingTag:"h2"}}),D=new Sl({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/fr/unit3/agentic-rag/tools.mdx"}}),{c(){n=b("meta"),p=u(),a=b("p"),i=u(),y(M.$$.fragment),t=u(),s=b("p"),s.textContent=l,r=u(),y(G.$$.fragment),Z=u(),z=b("p"),z.textContent=hl,K=u(),A=b("p"),A.textContent=bl,P=u(),X=b("p"),X.textContent=Il,ll=u(),y(g.$$.fragment),sl=u(),y(R.$$.fragment),al=u(),v=b("p"),v.textContent=Bl,el=u(),Y=b("p"),Y.textContent=fl,nl=u(),Q=b("blockquote"),Q.innerHTML=Gl,tl=u(),y($.$$.fragment),Ml=u(),y(x.$$.fragment),pl=u(),S=b("p"),S.textContent=Zl,ol=u(),y(k.$$.fragment),cl=u(),N=b("p"),N.textContent=Cl,rl=u(),y(F.$$.fragment),jl=u(),_=b("p"),_.textContent=Vl,il=u(),y(E.$$.fragment),ul=u(),y(q.$$.fragment),Jl=u(),H=b("p"),H.textContent=gl,yl=u(),W=b("blockquote"),W.innerHTML=Ql,Ul=u(),y(D.$$.fragment),dl=u(),L=b("p"),this.h()},l(e){const j=Yl("svelte-u9bgzb",document.head);n=I(j,"META",{name:!0,content:!0}),j.forEach(o),p=J(e),a=I(e,"P",{}),zl(a).forEach(o),i=J(e),U(M.$$.fragment,e),t=J(e),s=I(e,"P",{"data-svelte-h":!0}),B(s)!=="svelte-wk2j2"&&(s.textContent=l),r=J(e),U(G.$$.fragment,e),Z=J(e),z=I(e,"P",{"data-svelte-h":!0}),B(z)!=="svelte-1c94rbt"&&(z.textContent=hl),K=J(e),A=I(e,"P",{"data-svelte-h":!0}),B(A)!=="svelte-6fw3vm"&&(A.textContent=bl),P=J(e),X=I(e,"P",{"data-svelte-h":!0}),B(X)!=="svelte-1008e7z"&&(X.textContent=Il),ll=J(e),U(g.$$.fragment,e),sl=J(e),U(R.$$.fragment,e),al=J(e),v=I(e,"P",{"data-svelte-h":!0}),B(v)!=="svelte-1qcy3r7"&&(v.textContent=Bl),el=J(e),Y=I(e,"P",{"data-svelte-h":!0}),B(Y)!=="svelte-12dw46b"&&(Y.textContent=fl),nl=J(e),Q=I(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),B(Q)!=="svelte-3is5nx"&&(Q.innerHTML=Gl),tl=J(e),U($.$$.fragment,e),Ml=J(e),U(x.$$.fragment,e),pl=J(e),S=I(e,"P",{"data-svelte-h":!0}),B(S)!=="svelte-v1nk6n"&&(S.textContent=Zl),ol=J(e),U(k.$$.fragment,e),cl=J(e),N=I(e,"P",{"data-svelte-h":!0}),B(N)!=="svelte-w28ddb"&&(N.textContent=Cl),rl=J(e),U(F.$$.fragment,e),jl=J(e),_=I(e,"P",{"data-svelte-h":!0}),B(_)!=="svelte-9w8iuq"&&(_.textContent=Vl),il=J(e),U(E.$$.fragment,e),ul=J(e),U(q.$$.fragment,e),Jl=J(e),H=I(e,"P",{"data-svelte-h":!0}),B(H)!=="svelte-u34lyp"&&(H.textContent=gl),yl=J(e),W=I(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),B(W)!=="svelte-1ckgxjw"&&(W.innerHTML=Ql),Ul=J(e),U(D.$$.fragment,e),dl=J(e),L=I(e,"P",{}),zl(L).forEach(o),this.h()},h(){ml(n,"name","hf:doc:metadata"),ml(n,"content",ps),ml(Q,"class","tip"),ml(W,"class","tip")},m(e,j){xl(document.head,n),c(e,p,j),c(e,a,j),c(e,i,j),d(M,e,j),c(e,t,j),c(e,s,j),c(e,r,j),d(G,e,j),c(e,Z,j),c(e,z,j),c(e,K,j),c(e,A,j),c(e,P,j),c(e,X,j),c(e,ll,j),d(g,e,j),c(e,sl,j),d(R,e,j),c(e,al,j),c(e,v,j),c(e,el,j),c(e,Y,j),c(e,nl,j),c(e,Q,j),c(e,tl,j),d($,e,j),c(e,Ml,j),d(x,e,j),c(e,pl,j),c(e,S,j),c(e,ol,j),d(k,e,j),c(e,cl,j),c(e,N,j),c(e,rl,j),d(F,e,j),c(e,jl,j),c(e,_,j),c(e,il,j),d(E,e,j),c(e,ul,j),d(q,e,j),c(e,Jl,j),c(e,H,j),c(e,yl,j),c(e,W,j),c(e,Ul,j),d(D,e,j),c(e,dl,j),c(e,L,j),wl=!0},p(e,[j]){const $l={};j&2&&($l.$$scope={dirty:j,ctx:e}),g.$set($l);const kl={};j&2&&(kl.$$scope={dirty:j,ctx:e}),$.$set(kl);const El={};j&2&&(El.$$scope={dirty:j,ctx:e}),k.$set(El);const Wl={};j&2&&(Wl.$$scope={dirty:j,ctx:e}),E.$set(Wl)},i(e){wl||(w(M.$$.fragment,e),w(G.$$.fragment,e),w(g.$$.fragment,e),w(R.$$.fragment,e),w($.$$.fragment,e),w(x.$$.fragment,e),w(k.$$.fragment,e),w(F.$$.fragment,e),w(E.$$.fragment,e),w(q.$$.fragment,e),w(D.$$.fragment,e),wl=!0)},o(e){m(M.$$.fragment,e),m(G.$$.fragment,e),m(g.$$.fragment,e),m(R.$$.fragment,e),m($.$$.fragment,e),m(x.$$.fragment,e),m(k.$$.fragment,e),m(F.$$.fragment,e),m(E.$$.fragment,e),m(q.$$.fragment,e),m(D.$$.fragment,e),wl=!1},d(e){e&&(o(p),o(a),o(i),o(t),o(s),o(r),o(Z),o(z),o(K),o(A),o(P),o(X),o(ll),o(sl),o(al),o(v),o(el),o(Y),o(nl),o(Q),o(tl),o(Ml),o(pl),o(S),o(ol),o(cl),o(N),o(rl),o(jl),o(_),o(il),o(ul),o(Jl),o(H),o(yl),o(W),o(Ul),o(dl),o(L)),o(n),T(M,e),T(G,e),T(g,e),T(R,e),T($,e),T(x,e),T(k,e),T(F,e),T(E,e),T(q,e),T(D,e)}}}const ps='{"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 os(h){return Xl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ys extends Rl{constructor(n){super(),vl(this,n,os,Ms,Al,{})}}export{ys as component};
