import{s as Ys,o as _s,n as g}from"../chunks/scheduler.37c15a92.js";import{S as Qs,i as Fs,g as b,s as h,r as J,A as Ss,h as I,f as p,c as w,j as Ns,u as m,x as f,k as Ts,y as xs,a as c,v as y,d,t as u,w as T,m as Us,n as bs}from"../chunks/index.2bf4358c.js";import{T as Vs}from"../chunks/Tip.363c041f.js";import{C as B}from"../chunks/CodeBlock.4e987730.js";import{H as K}from"../chunks/Heading.8ada512a.js";import{H as us,a as $}from"../chunks/HfOption.02c8e375.js";import{E as zs}from"../chunks/getInferenceSnippets.d4d07d1e.js";function Hs(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBEdWNrRHVja0dvU2VhcmNoVG9vbCUwQSUwQSUyMyUyMEluaXRpYWxpemUlMjB0aGUlMjBEdWNrRHVja0dvJTIwc2VhcmNoJTIwdG9vbCUwQXNlYXJjaF90b29sJTIwJTNEJTIwRHVja0R1Y2tHb1NlYXJjaFRvb2woKSUwQSUwQSUyMyUyMEV4YW1wbGUlMjB1c2FnZSUwQXJlc3VsdHMlMjAlM0QlMjBzZWFyY2hfdG9vbCglMjJXaG8ncyUyMHRoZSUyMGN1cnJlbnQlMjBQcmVzaWRlbnQlMjBvZiUyMEZyYW5jZSUzRiUyMiklMEFwcmludChyZXN1bHRzKQ==",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> DuckDuckGoSearchTool

<span class="hljs-comment"># Initialize the DuckDuckGo search tool</span>
search_tool = DuckDuckGoSearchTool()

<span class="hljs-comment"># Example usage</span>
results = search_tool(<span class="hljs-string">&quot;Who&#x27;s the current President of France?&quot;</span>)
<span class="hljs-built_in">print</span>(results)`,wrap:!1}}),M=new B({props:{code:"VGhlJTIwY3VycmVudCUyMFByZXNpZGVudCUyMG9mJTIwRnJhbmNlJTIwaW4lMjBFbW1hbnVlbCUyME1hY3Jvbi4=",highlighted:'The current President <span class="hljs-keyword">of</span> France in Emmanuel Macron.',wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-15t3xg7"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function qs(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LnRvb2xzLmR1Y2tkdWNrZ28lMjBpbXBvcnQlMjBEdWNrRHVja0dvU2VhcmNoVG9vbFNwZWMlMEFmcm9tJTIwbGxhbWFfaW5kZXguY29yZS50b29scyUyMGltcG9ydCUyMEZ1bmN0aW9uVG9vbCUwQSUwQSUyMyUyMEluaXRpYWxpemUlMjB0aGUlMjBEdWNrRHVja0dvJTIwc2VhcmNoJTIwdG9vbCUwQXRvb2xfc3BlYyUyMCUzRCUyMER1Y2tEdWNrR29TZWFyY2hUb29sU3BlYygpJTBBJTBBc2VhcmNoX3Rvb2wlMjAlM0QlMjBGdW5jdGlvblRvb2wuZnJvbV9kZWZhdWx0cyh0b29sX3NwZWMuZHVja2R1Y2tnb19mdWxsX3NlYXJjaCklMEElMjMlMjBFeGFtcGxlJTIwdXNhZ2UlMEFyZXNwb25zZSUyMCUzRCUyMHNlYXJjaF90b29sKCUyMldobydzJTIwdGhlJTIwY3VycmVudCUyMFByZXNpZGVudCUyMG9mJTIwRnJhbmNlJTNGJTIyKSUwQXByaW50KHJlc3BvbnNlLnJhd19vdXRwdXQlNUItMSU1RCU1Qidib2R5JyU1RCk=",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"># Initialize the DuckDuckGo search tool</span>
tool_spec = DuckDuckGoSearchToolSpec()

search_tool = FunctionTool.from_defaults(tool_spec.duckduckgo_full_search)
<span class="hljs-comment"># Example usage</span>
response = search_tool(<span class="hljs-string">&quot;Who&#x27;s the current President of 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}}),M=new B({props:{code:"VGhlJTIwUHJlc2lkZW50JTIwb2YlMjB0aGUlMjBGcmVuY2glMjBSZXB1YmxpYyUyMGlzJTIwdGhlJTIwaGVhZCUyMG9mJTIwc3RhdGUlMjBvZiUyMEZyYW5jZS4lMjBUaGUlMjBjdXJyZW50JTIwUHJlc2lkZW50JTIwaXMlMjBFbW1hbnVlbCUyME1hY3JvbiUyMHNpbmNlJTIwMTQlMjBNYXklMjAyMDE3JTIwZGVmZWF0aW5nJTIwTWFyaW5lJTIwTGUlMjBQZW4lMjBpbiUyMHRoZSUyMHNlY29uZCUyMHJvdW5kJTIwb2YlMjB0aGUlMjBwcmVzaWRlbnRpYWwlMjBlbGVjdGlvbiUyMG9uJTIwNyUyME1heSUyMDIwMTcuJTIwTGlzdCUyMG9mJTIwRnJlbmNoJTIwcHJlc2lkZW50cyUyMChGaWZ0aCUyMFJlcHVibGljKSUyME4lQzIlQjAlMjBQb3J0cmFpdCUyME5hbWUlMjAuLi4=",highlighted:'The President <span class="hljs-keyword">of</span> <span class="hljs-keyword">the</span> French Republic is <span class="hljs-keyword">the</span> head <span class="hljs-keyword">of</span> state <span class="hljs-keyword">of</span> France. The current President is Emmanuel Macron since <span class="hljs-number">14</span> May <span class="hljs-number">2017</span> defeating Marine Le Pen <span class="hljs-keyword">in</span> <span class="hljs-keyword">the</span> <span class="hljs-keyword">second</span> <span class="hljs-built_in">round</span> <span class="hljs-keyword">of</span> <span class="hljs-keyword">the</span> presidential election <span class="hljs-keyword">on</span> <span class="hljs-title">7</span> <span class="hljs-title">May</span> <span class="hljs-title">2017</span>. <span class="hljs-title">List</span> <span class="hljs-title">of</span> <span class="hljs-title">French</span> <span class="hljs-title">presidents</span> (<span class="hljs-title">Fifth</span> <span class="hljs-title">Republic</span>) <span class="hljs-title">N</span>° <span class="hljs-title">Portrait</span> <span class="hljs-title">Name</span> ...',wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-15t3xg7"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function Ds(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMGxhbmdjaGFpbl9jb21tdW5pdHkudG9vbHMlMjBpbXBvcnQlMjBEdWNrRHVja0dvU2VhcmNoUnVuJTBBJTBBc2VhcmNoX3Rvb2wlMjAlM0QlMjBEdWNrRHVja0dvU2VhcmNoUnVuKCklMEFyZXN1bHRzJTIwJTNEJTIwc2VhcmNoX3Rvb2wuaW52b2tlKCUyMldobydzJTIwdGhlJTIwY3VycmVudCUyMFByZXNpZGVudCUyMG9mJTIwRnJhbmNlJTNGJTIyKSUwQXByaW50KHJlc3VsdHMp",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;Who&#x27;s the current President of France?&quot;</span>)
<span class="hljs-built_in">print</span>(results)`,wrap:!1}}),M=new B({props:{code:"RW1tYW51ZWwlMjBNYWNyb24lMjAoYm9ybiUyMERlY2VtYmVyJTIwMjElMkMlMjAxOTc3JTJDJTIwQW1pZW5zJTJDJTIwRnJhbmNlKSUyMGlzJTIwYSUyMEZyZW5jaCUyMGJhbmtlciUyMGFuZCUyMHBvbGl0aWNpYW4lMjB3aG8lMjB3YXMlMjBlbGVjdGVkJTIwcHJlc2lkZW50JTIwb2YlMjBGcmFuY2UlMjBpbiUyMDIwMTcuLi4=",highlighted:'<span class="hljs-attribute">Emmanuel</span> Macron (born December <span class="hljs-number">21</span>, <span class="hljs-number">1977</span>, Amiens, France) is a French banker and politician who was elected president of France in <span class="hljs-number">2017</span>...',wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-15t3xg7"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function Ks(U){let a,e,n,j,o,M;return a=new $({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[Hs]},$$scope:{ctx:U}}}),n=new $({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[qs]},$$scope:{ctx:U}}}),o=new $({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[Ds]},$$scope:{ctx:U}}}),{c(){J(a.$$.fragment),e=h(),J(n.$$.fragment),j=h(),J(o.$$.fragment)},l(l){m(a.$$.fragment,l),e=w(l),m(n.$$.fragment,l),j=w(l),m(o.$$.fragment,l)},m(l,s){y(a,l,s),c(l,e,s),y(n,l,s),c(l,j,s),y(o,l,s),M=!0},p(l,s){const i={};s&2&&(i.$$scope={dirty:s,ctx:l}),a.$set(i);const G={};s&2&&(G.$$scope={dirty:s,ctx:l}),n.$set(G);const Z={};s&2&&(Z.$$scope={dirty:s,ctx:l}),o.$set(Z)},i(l){M||(d(a.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),M=!0)},o(l){u(a.$$.fragment,l),u(n.$$.fragment,l),u(o.$$.fragment,l),M=!1},d(l){l&&(p(e),p(j)),T(a,l),T(n,l),T(o,l)}}}function Ps(U){let a,e,n="Unit 1",j;return{c(){a=Us("For the sake of simplicity, we're using a dummy weather API for this example. If you want to use a real weather API, you could implement a weather tool that uses the OpenWeatherMap API, like in "),e=b("a"),e.textContent=n,j=Us("."),this.h()},l(o){a=bs(o,"For the sake of simplicity, we're using a dummy weather API for this example. If you want to use a real weather API, you could implement a weather tool that uses the OpenWeatherMap API, like in "),e=I(o,"A",{href:!0,"data-svelte-h":!0}),f(e)!=="svelte-qu572p"&&(e.textContent=n),j=bs(o,"."),this.h()},h(){Ts(e,"href","../../unit1/tutorial")},m(o,M){c(o,a,M),c(o,e,M),c(o,j,M)},p:g,d(o){o&&(p(a),p(e),p(j))}}}function Ls(U){let a,e;return a=new B({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBUb29sJTBBaW1wb3J0JTIwcmFuZG9tJTBBJTBBY2xhc3MlMjBXZWF0aGVySW5mb1Rvb2woVG9vbCklM0ElMEElMjAlMjAlMjAlMjBuYW1lJTIwJTNEJTIwJTIyd2VhdGhlcl9pbmZvJTIyJTBBJTIwJTIwJTIwJTIwZGVzY3JpcHRpb24lMjAlM0QlMjAlMjJGZXRjaGVzJTIwZHVtbXklMjB3ZWF0aGVyJTIwaW5mb3JtYXRpb24lMjBmb3IlMjBhJTIwZ2l2ZW4lMjBsb2NhdGlvbi4lMjIlMEElMjAlMjAlMjAlMjBpbnB1dHMlMjAlM0QlMjA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XRpb24lMjIlM0ElMjAlMjJXaW5keSUyMiUyQyUyMCUyMnRlbXBfYyUyMiUzQSUyMDIwJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwUmFuZG9tbHklMjBzZWxlY3QlMjBhJTIwd2VhdGhlciUyMGNvbmRpdGlvbiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGRhdGElMjAlM0QlMjByYW5kb20uY2hvaWNlKHdlYXRoZXJfY29uZGl0aW9ucyklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBmJTIyV2VhdGhlciUyMGluJTIwJTdCbG9jYXRpb24lN0QlM0ElMjAlN0JkYXRhJTVCJ2NvbmRpdGlvbiclNUQlN0QlMkMlMjAlN0JkYXRhJTVCJ3RlbXBfYyclNUQlN0QlQzIlQjBDJTIyJTBBJTBBJTIzJTIwSW5pdGlhbGl6ZSUyMHRoZSUyMHRvb2wlMEF3ZWF0aGVyX2luZm9fdG9vbCUyMCUzRCUyMFdlYXRoZXJJbmZvVG9vbCgp",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;Fetches dummy weather information for a given location.&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;The location to get weather information for.&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"># Dummy weather data</span>
        weather_conditions = [
            {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Rainy&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;Clear&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;Windy&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">20</span>}
        ]
        <span class="hljs-comment"># Randomly select a weather condition</span>
        data = random.choice(weather_conditions)
        <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Weather in <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"># Initialize the tool</span>
weather_info_tool = WeatherInfoTool()`,wrap:!1}}),{c(){J(a.$$.fragment)},l(n){m(a.$$.fragment,n)},m(n,j){y(a,n,j),e=!0},p:g,i(n){e||(d(a.$$.fragment,n),e=!0)},o(n){u(a.$$.fragment,n),e=!1},d(n){T(a,n)}}}function Os(U){let a,e;return a=new B({props:{code:"aW1wb3J0JTIwcmFuZG9tJTBBZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUudG9vbHMlMjBpbXBvcnQlMjBGdW5jdGlvblRvb2wlMEElMEFkZWYlMjBnZXRfd2VhdGhlcl9pbmZvKGxvY2F0aW9uJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJGZXRjaGVzJTIwZHVtbXklMjB3ZWF0aGVyJTIwaW5mb3JtYXRpb24lMjBmb3IlMjBhJTIwZ2l2ZW4lMjBsb2NhdGlvbi4lMjIlMj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_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;Fetches dummy weather information for a given location.&quot;&quot;&quot;</span>
    <span class="hljs-comment"># Dummy weather data</span>
    weather_conditions = [
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Rainy&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;Clear&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;Windy&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">20</span>}
    ]
    <span class="hljs-comment"># Randomly select a weather condition</span>
    data = random.choice(weather_conditions)
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Weather in <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"># Initialize the tool</span>
weather_info_tool = FunctionTool.from_defaults(get_weather_info)`,wrap:!1}}),{c(){J(a.$$.fragment)},l(n){m(a.$$.fragment,n)},m(n,j){y(a,n,j),e=!0},p:g,i(n){e||(d(a.$$.fragment,n),e=!0)},o(n){u(a.$$.fragment,n),e=!1},d(n){T(a,n)}}}function sl(U){let a,e;return a=new B({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi50b29scyUyMGltcG9ydCUyMFRvb2wlMEFpbXBvcnQlMjByYW5kb20lMEElMEFkZWYlMjBnZXRfd2VhdGhlcl9pbmZvKGxvY2F0aW9uJTNBJTIwc3R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yMHRoZSUyMHRvb2wlMEF3ZWF0aGVyX2luZm9fdG9vbCUyMCUzRCUyMFRvb2woJTBBJTIwJTIwJTIwJTIwbmFtZSUzRCUyMmdldF93ZWF0aGVyX2luZm8lMjIlMkMlMEElMjAlMjAlMjAlMjBmdW5jJTNEZ2V0X3dlYXRoZXJfaW5mbyUyQyUwQSUyMCUyMCUyMCUyMGRlc2NyaXB0aW9uJTNEJTIyRmV0Y2hlcyUyMGR1bW15JTIwd2VhdGhlciUyMGluZm9ybWF0aW9uJTIwZm9yJTIwYSUyMGdpdmVuJTIwbG9jYXRpb24uJTIyJTBBKQ==",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;Fetches dummy weather information for a given location.&quot;&quot;&quot;</span>
    <span class="hljs-comment"># Dummy weather data</span>
    weather_conditions = [
        {<span class="hljs-string">&quot;condition&quot;</span>: <span class="hljs-string">&quot;Rainy&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;Clear&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;Windy&quot;</span>, <span class="hljs-string">&quot;temp_c&quot;</span>: <span class="hljs-number">20</span>}
    ]
    <span class="hljs-comment"># Randomly select a weather condition</span>
    data = random.choice(weather_conditions)
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Weather in <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"># Initialize the tool</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;Fetches dummy weather information for a given location.&quot;</span>
)`,wrap:!1}}),{c(){J(a.$$.fragment)},l(n){m(a.$$.fragment,n)},m(n,j){y(a,n,j),e=!0},p:g,i(n){e||(d(a.$$.fragment,n),e=!0)},o(n){u(a.$$.fragment,n),e=!1},d(n){T(a,n)}}}function ll(U){let a,e,n,j,o,M;return a=new $({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[Ls]},$$scope:{ctx:U}}}),n=new $({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[Os]},$$scope:{ctx:U}}}),o=new $({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[sl]},$$scope:{ctx:U}}}),{c(){J(a.$$.fragment),e=h(),J(n.$$.fragment),j=h(),J(o.$$.fragment)},l(l){m(a.$$.fragment,l),e=w(l),m(n.$$.fragment,l),j=w(l),m(o.$$.fragment,l)},m(l,s){y(a,l,s),c(l,e,s),y(n,l,s),c(l,j,s),y(o,l,s),M=!0},p(l,s){const i={};s&2&&(i.$$scope={dirty:s,ctx:l}),a.$set(i);const G={};s&2&&(G.$$scope={dirty:s,ctx:l}),n.$set(G);const Z={};s&2&&(Z.$$scope={dirty:s,ctx:l}),o.$set(Z)},i(l){M||(d(a.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),M=!0)},o(l){u(a.$$.fragment,l),u(n.$$.fragment,l),u(o.$$.fragment,l),M=!1},d(l){l&&(p(e),p(j)),T(a,l),T(n,l),T(o,l)}}}function al(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBUb29sJTBBZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxpc3RfbW9kZWxzJTBBJ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TNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwZiUyMkVycm9yJTIwZmV0Y2hpbmclMjBtb2RlbHMlMjBmb3IlMjAlN0JhdXRob3IlN0QlM0ElMjAlN0JzdHIoZSklN0QlMjIlMEElMEElMjMlMjBJbml0aWFsaXplJTIwdGhlJTIwdG9vbCUwQWh1Yl9zdGF0c190b29sJTIwJTNEJTIwSHViU3RhdHNUb29sKCklMEElMEElMjMlMjBFeGFtcGxlJTIwdXNhZ2UlMEFwcmludChodWJfc3RhdHNfdG9vbCglMjJmYWNlYm9vayUyMikpJTIwJTIzJTIwRXhhbXBsZSUzQSUyMEdldCUyMHRoZSUyMG1vc3QlMjBkb3dubG9hZGVkJTIwbW9kZWwlMjBieSUyMEZhY2Vib29r",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;Fetches the most downloaded model from a specific author on the 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;The username of the model author/organization to find models from.&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"># List models from the specified author, sorted by downloads</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;The most downloaded model by <span class="hljs-subst">{author}</span> is <span class="hljs-subst">{model.<span class="hljs-built_in">id</span>}</span> with <span class="hljs-subst">{model.downloads:,}</span> downloads.&quot;</span>
            <span class="hljs-keyword">else</span>:
                <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;No models found for author <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;Error fetching models for <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"># Initialize the tool</span>
hub_stats_tool = HubStatsTool()

<span class="hljs-comment"># Example usage</span>
<span class="hljs-built_in">print</span>(hub_stats_tool(<span class="hljs-string">&quot;facebook&quot;</span>)) <span class="hljs-comment"># Example: Get the most downloaded model by Facebook</span>`,wrap:!1}}),M=new B({props:{code:"VGhlJTIwbW9zdCUyMGRvd25sb2FkZWQlMjBtb2RlbCUyMGJ5JTIwZmFjZWJvb2slMjBpcyUyMGZhY2Vib29rJTJGZXNtZm9sZF92MSUyMHdpdGglMjAxMiUyQzU0NCUyQzU1MCUyMGRvd25sb2Fkcy4=",highlighted:'<span class="hljs-attribute">The</span> most downloaded model by facebook is facebook/esmfold_v1 with <span class="hljs-number">12</span>,<span class="hljs-number">544</span>,<span class="hljs-number">550</span> downloads.',wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-15t3xg7"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,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JTIwJTIwJTIwJTIwbW9kZWwlMjAlM0QlMjBtb2RlbHMlNUIwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwZiUyMlRoZSUyMG1vc3QlMjBkb3dubG9hZGVkJTIwbW9kZWwlMjBieSUyMCU3QmF1dGhvciU3RCUyMGlzJTIwJTdCbW9kZWwuaWQlN0QlMjB3aXRoJTIwJTdCbW9kZWwuZG93bmxvYWRzJTNBJTJDJTdEJTIwZG93bmxvYWRzLiUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGVsc2UlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBmJTIyTm8lMjBtb2RlbHMlMjBmb3VuZCUyMGZvciUyMGF1dGhvciUyMCU3QmF1dGhvciU3RC4lMjIlMEElMjAlMjAlMjAlMjBleGNlcHQlMjBFeGNlcHRpb24lMjBhcyUyMGUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBmJTIyRXJyb3IlMjBmZXRjaGluZyUyMG1vZGVscyUyMGZvciUyMCU3QmF1dGhvciU3RCUzQSUyMCU3QnN0cihlKSU3RCUyMiUwQSUwQSUyMyUyMEluaXRpYWxpemUlMjB0aGUlMjB0b29sJTBBaHViX3N0YXRzX3Rvb2wlMjAlM0QlMjBGdW5jdGlvblRvb2wuZnJvbV9kZWZhdWx0cyhnZXRfaHViX3N0YXRzKSUwQSUwQSUyMyUyMEV4YW1wbGUlMjB1c2FnZSUwQXByaW50KGh1Yl9zdGF0c190b29sKCUyMmZhY2Vib29rJTIyKSklMjAlMjMlMjBFeGFtcGxlJTNBJTIwR2V0JTIwdGhlJTIwbW9zdCUyMGRvd25sb2FkZWQlMjBtb2RlbCUyMGJ5JTIwRmFjZWJvb2s=",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;Fetches the most downloaded model from a specific author on the Hugging Face Hub.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">try</span>:
        <span class="hljs-comment"># List models from the specified author, sorted by downloads</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;The most downloaded model by <span class="hljs-subst">{author}</span> is <span class="hljs-subst">{model.<span class="hljs-built_in">id</span>}</span> with <span class="hljs-subst">{model.downloads:,}</span> downloads.&quot;</span>
        <span class="hljs-keyword">else</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;No models found for author <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;Error fetching models for <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"># Initialize the tool</span>
hub_stats_tool = FunctionTool.from_defaults(get_hub_stats)

<span class="hljs-comment"># Example usage</span>
<span class="hljs-built_in">print</span>(hub_stats_tool(<span class="hljs-string">&quot;facebook&quot;</span>)) <span class="hljs-comment"># Example: Get the most downloaded model by Facebook</span>`,wrap:!1}}),M=new B({props:{code:"VGhlJTIwbW9zdCUyMGRvd25sb2FkZWQlMjBtb2RlbCUyMGJ5JTIwZmFjZWJvb2slMjBpcyUyMGZhY2Vib29rJTJGZXNtZm9sZF92MSUyMHdpdGglMjAxMiUyQzU0NCUyQzU1MCUyMGRvd25sb2Fkcy4=",highlighted:'<span class="hljs-attribute">The</span> most downloaded model by facebook is facebook/esmfold_v1 with <span class="hljs-number">12</span>,<span class="hljs-number">544</span>,<span class="hljs-number">550</span> downloads.',wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-15t3xg7"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function nl(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi50b29scyUyMGltcG9ydCUyMFRvb2wlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwbGlzdF9tb2RlbHMlMEElMEFkZWYlMjBnZXRfaHViX3N0YXRzKGF1dGhvciUzQSUyMHN0ciklMjAtJTNFJTIwc3RyJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyRmV0Y2hlcyUyMHRoZSUyMG1vc3QlMjBkb3dubG9hZGVkJTIwbW9kZWwlMjBmcm9tJTIwYSUyMHNwZWNpZmljJTIwYXV0aG9yJTIwb24lMjB0aGUlMjBIdWdnaW5nJTIwRmFjZSUyMEh1Yi4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjB0cnklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBMaXN0JTIwbW9kZWxzJTIwZnJvbSUyMHRoZSUyMHNwZWNpZmllZCUyMGF1dGhvciUy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X3Rvb2wlMjAlM0QlMjBUb29sKCUwQSUyMCUyMCUyMCUyMG5hbWUlM0QlMjJnZXRfaHViX3N0YXRzJTIyJTJDJTBBJTIwJTIwJTIwJTIwZnVuYyUzRGdldF9odWJfc3RhdHMlMkMlMEElMjAlMjAlMjAlMjBkZXNjcmlwdGlvbiUzRCUyMkZldGNoZXMlMjB0aGUlMjBtb3N0JTIwZG93bmxvYWRlZCUyMG1vZGVsJTIwZnJvbSUyMGElMjBzcGVjaWZpYyUyMGF1dGhvciUyMG9uJTIwdGhlJTIwSHVnZ2luZyUyMEZhY2UlMjBIdWIuJTIyJTBBKSUwQSUwQSUyMyUyMEV4YW1wbGUlMjB1c2FnZSUwQXByaW50KGh1Yl9zdGF0c190b29sLmludm9rZSglMjJmYWNlYm9vayUyMikpJTIwJTIzJTIwRXhhbXBsZSUzQSUyMEdldCUyMHRoZSUyMG1vc3QlMjBkb3dubG9hZGVkJTIwbW9kZWwlMjBieSUyMEZhY2Vib29r",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;Fetches the most downloaded model from a specific author on the Hugging Face Hub.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">try</span>:
        <span class="hljs-comment"># List models from the specified author, sorted by downloads</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;The most downloaded model by <span class="hljs-subst">{author}</span> is <span class="hljs-subst">{model.<span class="hljs-built_in">id</span>}</span> with <span class="hljs-subst">{model.downloads:,}</span> downloads.&quot;</span>
        <span class="hljs-keyword">else</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;No models found for author <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;Error fetching models for <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"># Initialize the tool</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;Fetches the most downloaded model from a specific author on the Hugging Face Hub.&quot;</span>
)

<span class="hljs-comment"># Example 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"># Example: Get the most downloaded model by Facebook</span>`,wrap:!1}}),M=new B({props:{code:"VGhlJTIwbW9zdCUyMGRvd25sb2FkZWQlMjBtb2RlbCUyMGJ5JTIwZmFjZWJvb2slMjBpcyUyMGZhY2Vib29rJTJGZXNtZm9sZF92MSUyMHdpdGglMjAxMyUyQzEwOSUyQzg2MSUyMGRvd25sb2Fkcy4=",highlighted:'<span class="hljs-attribute">The</span> most downloaded model by facebook is facebook/esmfold_v1 with <span class="hljs-number">13</span>,<span class="hljs-number">109</span>,<span class="hljs-number">861</span> downloads.',wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-15t3xg7"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function el(U){let a,e,n,j,o,M;return a=new $({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[al]},$$scope:{ctx:U}}}),n=new $({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[tl]},$$scope:{ctx:U}}}),o=new $({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[nl]},$$scope:{ctx:U}}}),{c(){J(a.$$.fragment),e=h(),J(n.$$.fragment),j=h(),J(o.$$.fragment)},l(l){m(a.$$.fragment,l),e=w(l),m(n.$$.fragment,l),j=w(l),m(o.$$.fragment,l)},m(l,s){y(a,l,s),c(l,e,s),y(n,l,s),c(l,j,s),y(o,l,s),M=!0},p(l,s){const i={};s&2&&(i.$$scope={dirty:s,ctx:l}),a.$set(i);const G={};s&2&&(G.$$scope={dirty:s,ctx:l}),n.$set(G);const Z={};s&2&&(Z.$$scope={dirty:s,ctx:l}),o.$set(Z)},i(l){M||(d(a.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),M=!0)},o(l){u(a.$$.fragment,l),u(n.$$.fragment,l),u(o.$$.fragment,l),M=!1},d(l){l&&(p(e),p(j)),T(a,l),T(n,l),T(o,l)}}}function ol(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemUlMjB0aGUlMjBIdWdnaW5nJTIwRmFjZSUyMG1vZGVsJTBBbW9kZWwlMjAlM0QlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCgpJTBBJTBBJTIzJTIwQ3JlYXRlJTIwQWxmcmVkJTIwd2l0aCUyMGFsbCUyMHRoZSUyMHRvb2xzJTBBYWxmcmVkJTIwJTNEJTIwQ29kZUFnZW50KCUwQSUyMCUyMCUyMCUyMHRvb2xzJTNEJTVCc2VhcmNoX3Rvb2wlMkMlMjB3ZWF0aGVyX2luZm9fdG9vbCUyQyUyMGh1Yl9zdGF0c190b29sJTVEJTJDJTIwJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUwQSklMEElMEElMjMlMjBFeGFtcGxlJTIwcXVlcnklMjBBbGZyZWQlMjBtaWdodCUyMHJlY2VpdmUlMjBkdXJpbmclMjB0aGUlMjBnYWxhJTBBcmVzcG9uc2UlMjAlM0QlMjBhbGZyZWQucnVuKCUyMldoYXQlMjBpcyUyMEZhY2Vib29rJTIwYW5kJTIwd2hhdCdzJTIwdGhlaXIlMjBtb3N0JTIwcG9wdWxhciUyMG1vZGVsJTNGJTIyKSUwQSUwQXByaW50KCUyMiVGMCU5RiU4RSVBOSUyMEFsZnJlZCdzJTIwUmVzcG9uc2UlM0ElMjIpJTBBcHJpbnQocmVzcG9uc2Up",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, InferenceClientModel

<span class="hljs-comment"># Initialize the Hugging Face model</span>
model = InferenceClientModel()

<span class="hljs-comment"># Create Alfred with all the tools</span>
alfred = CodeAgent(
    tools=[search_tool, weather_info_tool, hub_stats_tool], 
    model=model
)

<span class="hljs-comment"># Example query Alfred might receive during the gala</span>
response = alfred.run(<span class="hljs-string">&quot;What is Facebook and what&#x27;s their most popular model?&quot;</span>)

<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;🎩 Alfred&#x27;s Response:&quot;</span>)
<span class="hljs-built_in">print</span>(response)`,wrap:!1}}),M=new B({props:{code:"JUYwJTlGJThFJUE5JTIwQWxmcmVkJ3MlMjBSZXNwb25zZSUzQSUwQUZhY2Vib29rJTIwaXMlMjBhJTIwc29jaWFsJTIwbmV0d29ya2luZyUyMHdlYnNpdGUlMjB3aGVyZSUyMHVzZXJzJTIwY2FuJTIwY29ubmVjdCUyQyUyMHNoYXJlJTIwaW5mb3JtYXRpb24lMkMlMjBhbmQlMjBpbnRlcmFjdCUyMHdpdGglMjBvdGhlcnMuJTIwVGhlJTIwbW9zdCUyMGRvd25sb2FkZWQlMjBtb2RlbCUyMGJ5JTIwRmFjZWJvb2slMjBvbiUyMHRoZSUyMEh1Z2dpbmclMjBGYWNlJTIwSHViJTIwaXMlMjBFU01Gb2xkX3YxLg==",highlighted:`🎩 Alfred<span class="hljs-comment">&#x27;s Response:</span>
Facebook <span class="hljs-built_in">is</span> a social networking website <span class="hljs-keyword">where</span> users can connect, share information, <span class="hljs-built_in">and</span> interact <span class="hljs-keyword">with</span> others. The most downloaded model <span class="hljs-keyword">by</span> Facebook <span class="hljs-keyword">on</span> the Hugging Face Hub <span class="hljs-built_in">is</span> ESMFold_v1.`,wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-zgvuej"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function Ml(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMGxsYW1hX2luZGV4LmNvcmUuYWdlbnQud29ya2Zsb3clMjBpbXBvcnQlMjBBZ2VudFdvcmtmbG93JTBBZnJvbSUyMGxsYW1hX2luZGV4LmxsbXMuaHVnZ2luZ2ZhY2VfYXBpJTIwaW1wb3J0JTIwSHVnZ2luZ0ZhY2VJbmZlcmVuY2VBUEklMEElMEElMjMlMjBJbml0aWFsaXplJTIwdGhlJTIwSHVnZ2luZyUyMEZhY2UlMjBtb2RlbCUwQWxsbSUyMCUzRCUyMEh1Z2dpbmdGYWNlSW5mZXJlbmNlQVBJKG1vZGVsX25hbWUlM0QlMjJRd2VuJTJGUXdlbjIuNS1Db2Rlci0zMkItSW5zdHJ1Y3QlMjIpJTBBJTIzJTIwQ3JlYXRlJTIwQWxmcmVkJTIwd2l0aCUyMGFsbCUyMHRoZSUyMHRvb2xzJTBBYWxmcmVkJTIwJTNEJTIwQWdlbnRXb3JrZmxvdy5mcm9tX3Rvb2xzX29yX2Z1bmN0aW9ucyglMEElMjAlMjAlMjAlMjAlNUJzZWFyY2hfdG9vbCUyQyUyMHdlYXRoZXJfaW5mb190b29sJTJDJTIwaHViX3N0YXRzX3Rvb2wlNUQlMkMlMEElMjAlMjAlMjAlMjBsbG0lM0RsbG0lMEEpJTBBJTBBJTIzJTIwRXhhbXBsZSUyMHF1ZXJ5JTIwQWxmcmVkJTIwbWlnaHQlMjByZWNlaXZlJTIwZHVyaW5nJTIwdGhlJTIwZ2FsYSUwQXJlc3BvbnNlJTIwJTNEJTIwYXdhaXQlMjBhbGZyZWQucnVuKCUyMldoYXQlMjBpcyUyMEZhY2Vib29rJTIwYW5kJTIwd2hhdCdzJTIwdGhlaXIlMjBtb3N0JTIwcG9wdWxhciUyMG1vZGVsJTNGJTIyKSUwQSUwQXByaW50KCUyMiVGMCU5RiU4RSVBOSUyMEFsZnJlZCdzJTIwUmVzcG9uc2UlM0ElMjIpJTBBcHJpbnQocmVzcG9uc2Up",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"># Initialize the Hugging Face model</span>
llm = HuggingFaceInferenceAPI(model_name=<span class="hljs-string">&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</span>)
<span class="hljs-comment"># Create Alfred with all the tools</span>
alfred = AgentWorkflow.from_tools_or_functions(
    [search_tool, weather_info_tool, hub_stats_tool],
    llm=llm
)

<span class="hljs-comment"># Example query Alfred might receive during the gala</span>
response = <span class="hljs-keyword">await</span> alfred.run(<span class="hljs-string">&quot;What is Facebook and what&#x27;s their most popular model?&quot;</span>)

<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;🎩 Alfred&#x27;s Response:&quot;</span>)
<span class="hljs-built_in">print</span>(response)`,wrap:!1}}),M=new B({props:{code:"JUYwJTlGJThFJUE5JTIwQWxmcmVkJ3MlMjBSZXNwb25zZSUzQSUwQUZhY2Vib29rJTIwaXMlMjBhJTIwc29jaWFsJTIwbmV0d29ya2luZyUyMHNlcnZpY2UlMjBhbmQlMjB0ZWNobm9sb2d5JTIwY29tcGFueSUyMGJhc2VkJTIwaW4lMjBNZW5sbyUyMFBhcmslMkMlMjBDYWxpZm9ybmlhLiUyMEl0JTIwd2FzJTIwZm91bmRlZCUyMGJ5JTIwTWFyayUyMFp1Y2tlcmJlcmclMjBhbmQlMjBhbGxvd3MlMjBwZW9wbGUlMjB0byUyMGNyZWF0ZSUyMHByb2ZpbGVzJTJDJTIwY29ubmVjdCUyMHdpdGglMjBmcmllbmRzJTIwYW5kJTIwZmFtaWx5JTJDJTIwc2hhcmUlMjBwaG90b3MlMjBhbmQlMjB2aWRlb3MlMkMlMjBhbmQlMjBqb2luJTIwZ3JvdXBzJTIwYmFzZWQlMjBvbiUyMHNoYXJlZCUyMGludGVyZXN0cy4lMjBUaGUlMjBtb3N0JTIwcG9wdWxhciUyMG1vZGVsJTIwYnklMjBGYWNlYm9vayUyMG9uJTIwdGhlJTIwSHVnZ2luZyUyMEZhY2UlMjBIdWIlMjBpcyUyMCU2MGZhY2Vib29rJTJGZXNtZm9sZF92MSU2MCUyMHdpdGglMjAxMyUyQzEwOSUyQzg2MSUyMGRvd25sb2Fkcy4=",highlighted:'🎩 Alfred<span class="hljs-comment">&#x27;s Response:</span>\nFacebook <span class="hljs-built_in">is</span> a social networking service <span class="hljs-built_in">and</span> technology company based <span class="hljs-keyword">in</span> Menlo Park, California. It was founded <span class="hljs-keyword">by</span> Mark Zuckerberg <span class="hljs-built_in">and</span> allows people <span class="hljs-keyword">to</span> create profiles, connect <span class="hljs-keyword">with</span> friends <span class="hljs-built_in">and</span> family, share photos <span class="hljs-built_in">and</span> videos, <span class="hljs-built_in">and</span> <span class="hljs-keyword">join</span> groups based <span class="hljs-keyword">on</span> <span class="hljs-keyword">shared</span> interests. The most popular model <span class="hljs-keyword">by</span> Facebook <span class="hljs-keyword">on</span> the Hugging Face Hub <span class="hljs-built_in">is</span> `facebook/esmfold_v1` <span class="hljs-keyword">with</span> <span class="hljs-number">13</span>,<span class="hljs-number">109</span>,<span class="hljs-number">861</span> downloads.',wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-zgvuej"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function pl(U){let a,e,n,j="Expected output:",o,M,l;return a=new B({props:{code:"ZnJvbSUyMHR5cGluZyUyMGltcG9ydCUyMFR5cGVkRGljdCUyQyUyMEFubm90YXRlZCUwQWZyb20lMjBsYW5nZ3JhcGguZ3JhcGgubWVzc2FnZSUyMGltcG9ydCUyMGFkZF9tZXNzYWdlcyUwQWZyb20lMjBsYW5nY2hhaW5fY29yZS5tZXNzYWdlcyUyMGltcG9ydCUyMEFueU1lc3NhZ2UlMkMlMjBIdW1hbk1lc3NhZ2UlMkMlMjBBSU1lc3NhZ2UlMEFmcm9tJTIwbGFuZ2dyYXBoLnByZWJ1aWx0JTIwaW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2UlMkMlMjBwcm92aWRlJTIwYSUyMGRpcmVjdCUyMHJlc3BvbnNlJTBBJTIwJTIwJTIwJTIwdG9vbHNfY29uZGl0aW9uJTJDJTBBKSUwQWJ1aWxkZXIuYWRkX2VkZ2UoJTIydG9vbHMlMjIlMkMlMjAlMjJhc3Npc3RhbnQlMjIpJTBBYWxmcmVkJTIwJTNEJTIwYnVpbGRlci5jb21waWxlKCklMEElMEFtZXNzYWdlcyUyMCUzRCUyMCU1Qkh1bWFuTWVzc2FnZShjb250ZW50JTNEJTIyV2hvJTIwaXMlMjBGYWNlYm9vayUyMGFuZCUyMHdoYXQncyUyMHRoZWlyJTIwbW9zdCUyMHBvcHVsYXIlMjBtb2RlbCUzRiUyMiklNUQlMEFyZXNwb25zZSUyMCUzRCUyMGFsZnJlZC5pbnZva2UoJTdCJTIybWVzc2FnZXMlMjIlM0ElMjBtZXNzYWdlcyU3RCklMEElMEFwcmludCglMjIlRjAlOUYlOEUlQTklMjBBbGZyZWQncyUyMFJlc3BvbnNlJTNBJTIyKSUwQXByaW50KHJlc3BvbnNlJTVCJ21lc3NhZ2VzJyU1RCU1Qi0xJTVELmNvbnRlbnQp",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"># Generate the chat interface, including the tools</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"># Generate the AgentState and Agent graph</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">## The graph</span>
builder = StateGraph(AgentState)

<span class="hljs-comment"># Define nodes: these do the work</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"># Define edges: these determine how the control flow moves</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"># If the latest message requires a tool, route to tools</span>
    <span class="hljs-comment"># Otherwise, provide a direct response</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;Who is Facebook and what&#x27;s their most popular model?&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;🎩 Alfred&#x27;s Response:&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}}),M=new B({props:{code:"JUYwJTlGJThFJUE5JTIwQWxmcmVkJ3MlMjBSZXNwb25zZSUzQSUwQUZhY2Vib29rJTIwaXMlMjBhJTIwc29jaWFsJTIwbWVkaWElMjBjb21wYW55JTIwa25vd24lMjBmb3IlMjBpdHMlMjBzb2NpYWwlMjBuZXR3b3JraW5nJTIwc2l0ZSUyQyUyMEZhY2Vib29rJTJDJTIwYXMlMjB3ZWxsJTIwYXMlMjBvdGhlciUyMHNlcnZpY2VzJTIwbGlrZSUyMEluc3RhZ3JhbSUyMGFuZCUyMFdoYXRzQXBwLiUyMFRoZSUyMG1vc3QlMjBkb3dubG9hZGVkJTIwbW9kZWwlMjBieSUyMEZhY2Vib29rJTIwb24lMjB0aGUlMjBIdWdnaW5nJTIwRmFjZSUyMEh1YiUyMGlzJTIwZmFjZWJvb2slMkZlc21mb2xkX3YxJTIwd2l0aCUyMDEzJTJDMjAyJTJDMzIxJTIwZG93bmxvYWRzLg==",highlighted:`🎩 Alfred<span class="hljs-comment">&#x27;s Response:</span>
Facebook <span class="hljs-built_in">is</span> a social media company known <span class="hljs-keyword">for</span> its social networking site, Facebook, <span class="hljs-keyword">as</span> well <span class="hljs-keyword">as</span> other services <span class="hljs-built_in">like</span> Instagram <span class="hljs-built_in">and</span> WhatsApp. The most downloaded model <span class="hljs-keyword">by</span> Facebook <span class="hljs-keyword">on</span> the Hugging Face Hub <span class="hljs-built_in">is</span> facebook/esmfold_v1 <span class="hljs-keyword">with</span> <span class="hljs-number">13</span>,<span class="hljs-number">202</span>,<span class="hljs-number">321</span> downloads.`,wrap:!1}}),{c(){J(a.$$.fragment),e=h(),n=b("p"),n.textContent=j,o=h(),J(M.$$.fragment)},l(s){m(a.$$.fragment,s),e=w(s),n=I(s,"P",{"data-svelte-h":!0}),f(n)!=="svelte-15t3xg7"&&(n.textContent=j),o=w(s),m(M.$$.fragment,s)},m(s,i){y(a,s,i),c(s,e,i),c(s,n,i),c(s,o,i),y(M,s,i),l=!0},p:g,i(s){l||(d(a.$$.fragment,s),d(M.$$.fragment,s),l=!0)},o(s){u(a.$$.fragment,s),u(M.$$.fragment,s),l=!1},d(s){s&&(p(e),p(n),p(o)),T(a,s),T(M,s)}}}function cl(U){let a,e,n,j,o,M;return a=new $({props:{id:"agents-frameworks",option:"smolagents",$$slots:{default:[ol]},$$scope:{ctx:U}}}),n=new $({props:{id:"agents-frameworks",option:"llama-index",$$slots:{default:[Ml]},$$scope:{ctx:U}}}),o=new $({props:{id:"agents-frameworks",option:"langgraph",$$slots:{default:[pl]},$$scope:{ctx:U}}}),{c(){J(a.$$.fragment),e=h(),J(n.$$.fragment),j=h(),J(o.$$.fragment)},l(l){m(a.$$.fragment,l),e=w(l),m(n.$$.fragment,l),j=w(l),m(o.$$.fragment,l)},m(l,s){y(a,l,s),c(l,e,s),y(n,l,s),c(l,j,s),y(o,l,s),M=!0},p(l,s){const i={};s&2&&(i.$$scope={dirty:s,ctx:l}),a.$set(i);const G={};s&2&&(G.$$scope={dirty:s,ctx:l}),n.$set(G);const Z={};s&2&&(Z.$$scope={dirty:s,ctx:l}),o.$set(Z)},i(l){M||(d(a.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),M=!0)},o(l){u(a.$$.fragment,l),u(n.$$.fragment,l),u(o.$$.fragment,l),M=!1},d(l){l&&(p(e),p(j)),T(a,l),T(n,l),T(o,l)}}}function jl(U){let a,e,n="When you’re done, implement your custom tools in the <code>tools.py</code> file.";return{c(){a=Us(`Try implementing a tool that can be used to get the latest news about a specific topic.
`),e=b("p"),e.innerHTML=n},l(j){a=bs(j,`Try implementing a tool that can be used to get the latest news about a specific topic.
`),e=I(j,"P",{"data-svelte-h":!0}),f(e)!=="svelte-8szxag"&&(e.innerHTML=n)},m(j,o){c(j,a,o),c(j,e,o)},p:g,d(j){j&&(p(a),p(e))}}}function il(U){let a,e,n,j,o,M,l,s=`In this section, we’ll grant Alfred access to the web, enabling him to find the latest news and global updates.
Additionally, he’ll have access to weather data and Hugging Face hub model download statistics, so that he can make relevant conversation about fresh topics.`,i,G,Z,v,Is="Remember that we want Alfred to establish his presence as a true renaissance host, with a deep knowledge of the world.",L,X,fs="To do so, we need to make sure that Alfred has access to the latest news and information about the world.",O,N,Bs="Let’s start by creating a web search tool for Alfred!",ss,C,ls,V,as,Y,Gs="The perfect gala would have fireworks over a clear sky, we need to make sure the fireworks are not cancelled due to bad weather.",ts,_,Zs="Let’s create a custom tool that can be used to call an external weather API and get the weather information for a given location.",ns,k,es,W,os,Q,Ms,F,gs="In attendance at the gala are the who’s who of AI builders. Alfred wants to impress them by discussing their most popular models, datasets, and spaces. We’ll create a tool to fetch model statistics from the Hugging Face Hub based on a username.",ps,R,cs,S,$s="With the Hub Stats Tool, Alfred can now impress influential AI builders by discussing their most popular models.",js,x,is,z,Cs="Now that we have all the tools, let’s integrate them into Alfred’s agent:",rs,A,hs,H,ws,q,ks="By integrating these tools, Alfred is now equipped to handle a variety of tasks, from web searches to weather updates and model statistics. This ensures he remains the most informed and engaging host at the gala.",Js,E,ms,D,ys,P,ds;return o=new K({props:{title:"Building and Integrating Tools for Your Agent",local:"building-and-integrating-tools-for-your-agent",headingTag:"h1"}}),G=new K({props:{title:"Give Your Agent Access to the Web",local:"give-your-agent-access-to-the-web",headingTag:"h2"}}),C=new us({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[Ks]},$$scope:{ctx:U}}}),V=new K({props:{title:"Creating a Custom Tool for Weather Information to Schedule the Fireworks",local:"creating-a-custom-tool-for-weather-information-to-schedule-the-fireworks",headingTag:"h2"}}),k=new Vs({props:{$$slots:{default:[Ps]},$$scope:{ctx:U}}}),W=new us({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[ll]},$$scope:{ctx:U}}}),Q=new K({props:{title:"Creating a Hub Stats Tool for Influential AI Builders",local:"creating-a-hub-stats-tool-for-influential-ai-builders",headingTag:"h2"}}),R=new us({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[el]},$$scope:{ctx:U}}}),x=new K({props:{title:"Integrating Tools with Alfred",local:"integrating-tools-with-alfred",headingTag:"h2"}}),A=new us({props:{id:"agents-frameworks",options:["smolagents","llama-index","langgraph"],$$slots:{default:[cl]},$$scope:{ctx:U}}}),H=new K({props:{title:"Conclusion",local:"conclusion",headingTag:"h2"}}),E=new Vs({props:{$$slots:{default:[jl]},$$scope:{ctx:U}}}),D=new zs({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/en/unit3/agentic-rag/tools.mdx"}}),{c(){a=b("meta"),e=h(),n=b("p"),j=h(),J(o.$$.fragment),M=h(),l=b("p"),l.textContent=s,i=h(),J(G.$$.fragment),Z=h(),v=b("p"),v.textContent=Is,L=h(),X=b("p"),X.textContent=fs,O=h(),N=b("p"),N.textContent=Bs,ss=h(),J(C.$$.fragment),ls=h(),J(V.$$.fragment),as=h(),Y=b("p"),Y.textContent=Gs,ts=h(),_=b("p"),_.textContent=Zs,ns=h(),J(k.$$.fragment),es=h(),J(W.$$.fragment),os=h(),J(Q.$$.fragment),Ms=h(),F=b("p"),F.textContent=gs,ps=h(),J(R.$$.fragment),cs=h(),S=b("p"),S.textContent=$s,js=h(),J(x.$$.fragment),is=h(),z=b("p"),z.textContent=Cs,rs=h(),J(A.$$.fragment),hs=h(),J(H.$$.fragment),ws=h(),q=b("p"),q.textContent=ks,Js=h(),J(E.$$.fragment),ms=h(),J(D.$$.fragment),ys=h(),P=b("p"),this.h()},l(t){const r=Ss("svelte-u9bgzb",document.head);a=I(r,"META",{name:!0,content:!0}),r.forEach(p),e=w(t),n=I(t,"P",{}),Ns(n).forEach(p),j=w(t),m(o.$$.fragment,t),M=w(t),l=I(t,"P",{"data-svelte-h":!0}),f(l)!=="svelte-1321hri"&&(l.textContent=s),i=w(t),m(G.$$.fragment,t),Z=w(t),v=I(t,"P",{"data-svelte-h":!0}),f(v)!=="svelte-15rhug1"&&(v.textContent=Is),L=w(t),X=I(t,"P",{"data-svelte-h":!0}),f(X)!=="svelte-451rqo"&&(X.textContent=fs),O=w(t),N=I(t,"P",{"data-svelte-h":!0}),f(N)!=="svelte-hoxfy6"&&(N.textContent=Bs),ss=w(t),m(C.$$.fragment,t),ls=w(t),m(V.$$.fragment,t),as=w(t),Y=I(t,"P",{"data-svelte-h":!0}),f(Y)!=="svelte-1832d8g"&&(Y.textContent=Gs),ts=w(t),_=I(t,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1vieuj"&&(_.textContent=Zs),ns=w(t),m(k.$$.fragment,t),es=w(t),m(W.$$.fragment,t),os=w(t),m(Q.$$.fragment,t),Ms=w(t),F=I(t,"P",{"data-svelte-h":!0}),f(F)!=="svelte-1crb2we"&&(F.textContent=gs),ps=w(t),m(R.$$.fragment,t),cs=w(t),S=I(t,"P",{"data-svelte-h":!0}),f(S)!=="svelte-1k2iwrw"&&(S.textContent=$s),js=w(t),m(x.$$.fragment,t),is=w(t),z=I(t,"P",{"data-svelte-h":!0}),f(z)!=="svelte-qd7lv7"&&(z.textContent=Cs),rs=w(t),m(A.$$.fragment,t),hs=w(t),m(H.$$.fragment,t),ws=w(t),q=I(t,"P",{"data-svelte-h":!0}),f(q)!=="svelte-1wo13by"&&(q.textContent=ks),Js=w(t),m(E.$$.fragment,t),ms=w(t),m(D.$$.fragment,t),ys=w(t),P=I(t,"P",{}),Ns(P).forEach(p),this.h()},h(){Ts(a,"name","hf:doc:metadata"),Ts(a,"content",rl)},m(t,r){xs(document.head,a),c(t,e,r),c(t,n,r),c(t,j,r),y(o,t,r),c(t,M,r),c(t,l,r),c(t,i,r),y(G,t,r),c(t,Z,r),c(t,v,r),c(t,L,r),c(t,X,r),c(t,O,r),c(t,N,r),c(t,ss,r),y(C,t,r),c(t,ls,r),y(V,t,r),c(t,as,r),c(t,Y,r),c(t,ts,r),c(t,_,r),c(t,ns,r),y(k,t,r),c(t,es,r),y(W,t,r),c(t,os,r),y(Q,t,r),c(t,Ms,r),c(t,F,r),c(t,ps,r),y(R,t,r),c(t,cs,r),c(t,S,r),c(t,js,r),y(x,t,r),c(t,is,r),c(t,z,r),c(t,rs,r),y(A,t,r),c(t,hs,r),y(H,t,r),c(t,ws,r),c(t,q,r),c(t,Js,r),y(E,t,r),c(t,ms,r),y(D,t,r),c(t,ys,r),c(t,P,r),ds=!0},p(t,[r]){const Ws={};r&2&&(Ws.$$scope={dirty:r,ctx:t}),C.$set(Ws);const Rs={};r&2&&(Rs.$$scope={dirty:r,ctx:t}),k.$set(Rs);const As={};r&2&&(As.$$scope={dirty:r,ctx:t}),W.$set(As);const Es={};r&2&&(Es.$$scope={dirty:r,ctx:t}),R.$set(Es);const vs={};r&2&&(vs.$$scope={dirty:r,ctx:t}),A.$set(vs);const Xs={};r&2&&(Xs.$$scope={dirty:r,ctx:t}),E.$set(Xs)},i(t){ds||(d(o.$$.fragment,t),d(G.$$.fragment,t),d(C.$$.fragment,t),d(V.$$.fragment,t),d(k.$$.fragment,t),d(W.$$.fragment,t),d(Q.$$.fragment,t),d(R.$$.fragment,t),d(x.$$.fragment,t),d(A.$$.fragment,t),d(H.$$.fragment,t),d(E.$$.fragment,t),d(D.$$.fragment,t),ds=!0)},o(t){u(o.$$.fragment,t),u(G.$$.fragment,t),u(C.$$.fragment,t),u(V.$$.fragment,t),u(k.$$.fragment,t),u(W.$$.fragment,t),u(Q.$$.fragment,t),u(R.$$.fragment,t),u(x.$$.fragment,t),u(A.$$.fragment,t),u(H.$$.fragment,t),u(E.$$.fragment,t),u(D.$$.fragment,t),ds=!1},d(t){t&&(p(e),p(n),p(j),p(M),p(l),p(i),p(Z),p(v),p(L),p(X),p(O),p(N),p(ss),p(ls),p(as),p(Y),p(ts),p(_),p(ns),p(es),p(os),p(Ms),p(F),p(ps),p(cs),p(S),p(js),p(is),p(z),p(rs),p(hs),p(ws),p(q),p(Js),p(ms),p(ys),p(P)),p(a),T(o,t),T(G,t),T(C,t),T(V,t),T(k,t),T(W,t),T(Q,t),T(R,t),T(x,t),T(A,t),T(H,t),T(E,t),T(D,t)}}}const rl='{"title":"Building and Integrating Tools for Your Agent","local":"building-and-integrating-tools-for-your-agent","sections":[{"title":"Give Your Agent Access to the Web","local":"give-your-agent-access-to-the-web","sections":[],"depth":2},{"title":"Creating a Custom Tool for Weather Information to Schedule the Fireworks","local":"creating-a-custom-tool-for-weather-information-to-schedule-the-fireworks","sections":[],"depth":2},{"title":"Creating a Hub Stats Tool for Influential AI Builders","local":"creating-a-hub-stats-tool-for-influential-ai-builders","sections":[],"depth":2},{"title":"Integrating Tools with Alfred","local":"integrating-tools-with-alfred","sections":[],"depth":2},{"title":"Conclusion","local":"conclusion","sections":[],"depth":2}],"depth":1}';function hl(U){return _s(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ul extends Qs{constructor(a){super(),Fs(this,a,hl,il,Ys,{})}}export{Ul as component};
