import{s as Gp,f as Ds,o as Cp,n as j}from"../chunks/scheduler.9bc65507.js";import{S as Ip,i as Wp,g as s,s as o,u as h,A as Bp,h as i,f as l,c as a,j as g,v as m,y as r,k as w,o as f,a as n,w as u,d,t as M,x as c}from"../chunks/index.78c82d43.js";import{T as $}from"../chunks/Tip.87d55b76.js";import{I as v}from"../chunks/IconCopyLink.bedaa44d.js";import{C as b}from"../chunks/CodeBlock.48618ec2.js";function xp(U){let p,J=`If you are not aware of what tools and agents are in the context of transformers, we recommend you read the
<a href="transformers_agents">Transformers Agents</a> page first.`;return{c(){p=s("p"),p.innerHTML=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-3d92zh"&&(p.innerHTML=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function kp(U){let p,J=`Transformers Agents is an experimental API that is subject to change at any time. Results returned by the agents
can vary as the APIs or underlying models are prone to change.`;return{c(){p=s("p"),p.textContent=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-1edi68n"&&(p.textContent=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Hp(U){let p,J=`Check the naming and description of the curated Transformers tools to better understand what name and
description a tool is expected to have. You can see all tools with the <code>Agent.toolbox</code> property.`;return{c(){p=s("p"),p.innerHTML=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-g5vgrf"&&(p.innerHTML=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function _p(U){let p,J=`Agents are still brittle for many use cases, especially when it comes to
slightly more complex use cases like generating an image of multiple objects.
Both the agent itself and the underlying prompt will be further improved in the coming
months making sure that agents become more robust to a variety of user inputs.`;return{c(){p=s("p"),p.textContent=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-mlmd2c"&&(p.textContent=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Rp(U){let p,J=`Please make sure to have the <code>&lt;&lt;all_tools&gt;&gt;</code> string and the <code>&lt;&lt;prompt&gt;&gt;</code> defined somewhere in the <code>template</code> so that the agent can be aware
of the tools, it has available to it as well as correctly insert the user’s prompt.`;return{c(){p=s("p"),p.innerHTML=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-1rh8x5r"&&(p.innerHTML=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Yp(U){let p,J=`Please make sure to have the <code>&lt;&lt;all_tools&gt;&gt;</code> string defined somewhere in the <code>template</code> so that the agent can be aware
of the tools, it has available to it.`;return{c(){p=s("p"),p.innerHTML=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-35oor2"&&(p.innerHTML=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Np(U){let p,J=`Overwriting existing tools can be beneficial if we want to use a custom tool exactly for the same task as an existing tool
because the agent is well-versed in using the specific task. Beware that the custom tool should follow the exact same API
as the overwritten tool in this case, or you should adapt the prompt template to make sure all examples using that
tool are updated.`;return{c(){p=s("p"),p.textContent=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-bxw4a"&&(p.textContent=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Ep(U){let p,J=`Depending on the LLM, some are quite brittle and require very exact prompts in order to work well. Having a well-defined
name and description of the tool is paramount to having it be leveraged by the agent.`;return{c(){p=s("p"),p.textContent=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-56y5g1"&&(p.textContent=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Xp(U){let p,J=`Beware when replacing tools with others! This will also adjust the agent’s prompt. This can be good if you have a better
prompt suited for the task, but it can also result in your tool being selected way more than others or for other
tools to be selected instead of the one you have defined.`;return{c(){p=s("p"),p.textContent=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-5sq1z0"&&(p.textContent=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Qp(U){let p,J=`gradio-tools requires <em>textual</em> inputs and outputs, even when working with different modalities. This implementation
works with image and audio objects. The two are currently incompatible, but will rapidly become compatible as we
work to improve the support.`;return{c(){p=s("p"),p.innerHTML=J},l(y){p=i(y,"P",{"data-svelte-h":!0}),r(p)!=="svelte-tx23fw"&&(p.innerHTML=J)},m(y,T){n(y,p,T)},p:j,d(y){y&&l(p)}}}function Vp(U){let p,J,y,T,Z,E,bn,pt,Os,on,ui="Custom Tools and Prompts",Nn,X,En,Q,Xn,ht,di=`Creating and using custom tools and prompts is paramount to empowering the agent and having it perform new tasks.
In this guide we’ll take a look at:`,Qn,mt,Mi="<li>How to customize the prompt</li> <li>How to use custom tools</li> <li>How to create custom tools</li>",Vn,G,V,gn,ut,ti,an,ci="Customizing the prompt",Sn,dt,yi=`As explained in <a href="transformers_agents">Transformers Agents</a> agents can run in <a href="/docs/transformers/v4.33.3/en/main_classes/agent#transformers.Agent.run">run()</a> and <a href="/docs/transformers/v4.33.3/en/main_classes/agent#transformers.Agent.chat">chat()</a> mode.
Both the <code>run</code> and <code>chat</code> modes underlie the same logic. The language model powering the agent is conditioned on a long
prompt and completes the prompt by generating the next tokens until the stop token is reached.
The only difference between the two modes is that during the <code>chat</code> mode the prompt is extended with
previous user inputs and model generations. This allows the agent to have access to past interactions,
seemingly giving the agent some kind of memory.`,Fn,C,S,Jn,Mt,ei,sn,wi="Structure of the prompt",zn,ct,fi=`Let’s take a closer look at how the prompt is structured to understand how it can be best customized.
The prompt is structured broadly into four parts.`,qn,yt,bi='<li><ol><li>Introduction: how the agent should behave, explanation of the concept of tools.</li></ol></li> <li><ol start="2"><li>Description of all the tools. This is defined by a <code>&lt;&lt;all_tools&gt;&gt;</code> token that is dynamically replaced at runtime with the tools defined/chosen by the user.</li></ol></li> <li><ol start="3"><li>A set of examples of tasks and their solution</li></ol></li> <li><ol start="4"><li>Current example, and request for solution.</li></ol></li>',An,wt,gi="To better understand each part, let’s look at a shortened version of how the <code>run</code> prompt can look like:",Ln,ft,Pn,bt,Ji=`The introduction (the text before <em>“Tools:”</em>) explains precisely how the model shall behave and what it should do.
This part most likely does not need to be customized as the agent shall always behave the same way.`,Kn,gt,Ti=`The second part (the bullet points below <em>“Tools”</em>) is dynamically added upon calling <code>run</code> or <code>chat</code>. There are
exactly as many bullet points as there are tools in <code>agent.toolbox</code> and each bullet point consists of the name
and description of the tool:`,Dn,Jt,On,Tt,Ui="Let’s verify this quickly by loading the document_qa tool and printing out the name and description.",to,Ut,eo,vt,vi="which gives:",lo,$t,no,jt,$i=`We can see that the tool name is short and precise. The description includes two parts, the first explaining
what the tool does and the second states what input arguments and return values are expected.`,oo,Zt,ji=`A good tool name and tool description are very important for the agent to correctly use it. Note that the only
information the agent has about the tool is its name and description, so one should make sure that both
are precisely written and match the style of the existing tools in the toolbox. In particular make sure the description
mentions all the arguments expected by name in code-style, along with the expected type and a description of what they
are.`,ao,F,so,Gt,Zi=`The third part includes a set of curated examples that show the agent exactly what code it should produce
for what kind of user request. The large language models empowering the agent are extremely good at
recognizing patterns in a prompt and repeating the pattern with new data. Therefore, it is very important
that the examples are written in a way that maximizes the likelihood of the agent to generating correct,
executable code in practice.`,io,Ct,Gi="Let’s have a look at one example:",ro,It,po,Wt,Ci=`The pattern the model is prompted to repeat has three parts: The task statement, the agent’s explanation of
what it intends to do, and finally the generated code. Every example that is part of the prompt has this exact
pattern, thus making sure that the agent will reproduce exactly the same pattern when generating new tokens.`,ho,Bt,Ii=`The prompt examples are curated by the Transformers team and rigorously evaluated on a set of
<a href="https://github.com/huggingface/transformers/blob/main/src/transformers/tools/evaluate_agent.py" rel="nofollow">problem statements</a>
to ensure that the agent’s prompt is as good as possible to solve real use cases of the agent.`,mo,xt,Wi="The final part of the prompt corresponds to:",uo,kt,Mo,Ht,Bi=`is a final and unfinished example that the agent is tasked to complete. The unfinished example
is dynamically created based on the actual user input. For the above example, the user ran:`,co,_t,yo,Rt,xi=`The user input - <em>a.k.a</em> the task: <em>“Draw me a picture of rivers and lakes”</em> is cast into the
prompt template: “Task: &lt;task&gt; \\n\\n I will use the following”. This sentence makes up the final lines of the
prompt the agent is conditioned on, therefore strongly influencing the agent to finish the example
exactly in the same way it was previously done in the examples.`,wo,Yt,ki=`Without going into too much detail, the chat template has the same prompt structure with the
examples having a slightly different style, <em>e.g.</em>:`,fo,Nt,bo,Et,Hi=`Contrary, to the examples of the <code>run</code> prompt, each <code>chat</code> prompt example has one or more exchanges between the
<em>Human</em> and the <em>Assistant</em>. Every exchange is structured similarly to the example of the <code>run</code> prompt.
The user’s input is appended to behind <em>Human:</em> and the agent is prompted to first generate what needs to be done
before generating code. An exchange can be based on previous exchanges, therefore allowing the user to refer
to past exchanges as is done <em>e.g.</em> above by the user’s input of “I tried <strong>this</strong> code” refers to the
previously generated code of the agent.`,go,Xt,_i="Upon running <code>.chat</code>, the user’s input or <em>task</em> is cast into an unfinished example of the form:",Jo,Qt,To,Vt,Ri=`which the agent completes. Contrary to the <code>run</code> command, the <code>chat</code> command then appends the completed example
to the prompt, thus giving the agent more context for the next <code>chat</code> turn.`,Uo,St,Yi="Great now that we know how the prompt is structured, let’s see how we can customize it!",vo,I,z,Tn,Ft,li,rn,Ni="Writing good user inputs",$o,zt,Ei=`While large language models are getting better and better at understanding users’ intentions, it helps
enormously to be as precise as possible to help the agent pick the correct task. What does it mean to be
as precise as possible?`,jo,qt,Xi=`The agent sees a list of tool names and their description in its prompt. The more tools are added the
more difficult it becomes for the agent to choose the correct tool and it’s even more difficult to choose
the correct sequences of tools to run. Let’s look at a common failure case, here we will only return
the code to analyze it.`,Zo,At,Go,Lt,Qi="gives:",Co,Pt,Io,Kt,Vi=`which is probably not what we wanted. Instead, it is more likely that we want an image of a tree to be generated.
To steer the agent more towards using a specific tool it can therefore be very helpful to use important keywords that
are present in the tool’s name and description. Let’s have a look.`,Wo,Dt,Bo,Ot,xo,te,Si="The name and description make use of the keywords “image”, “prompt”, “create” and “generate”. Using these words will most likely work better here. Let’s refine our prompt a bit.",ko,ee,Ho,le,Fi="gives:",_o,ne,Ro,oe,zi=`Much better! That looks more like what we want. In short, when you notice that the agent struggles to
correctly map your task to the correct tools, try looking up the most pertinent keywords of the tool’s name
and description and try refining your task request with it.`,Yo,W,q,Un,ae,ni,pn,qi="Customizing the tool descriptions",No,se,Ai=`As we’ve seen before the agent has access to each of the tools’ names and descriptions. The base tools
should have very precise names and descriptions, however, you might find that it could help to change the
the description or name of a tool for your specific use case. This might become especially important
when you’ve added multiple tools that are very similar or if you want to use your agent only for a certain
domain, <em>e.g.</em> image generation and transformations.`,Eo,ie,Li=`A common problem is that the agent confuses image generation with image transformation/modification when
used a lot for image generation tasks, <em>e.g.</em>`,Xo,re,Qo,pe,Pi="returns",Vo,he,So,me,Ki=`which is probably not exactly what we want here. It seems like the agent has a difficult time
to understand the difference between <code>image_generator</code> and <code>image_transformer</code> and often uses the two together.`,Fo,ue,Di=`We can help the agent here by changing the tool name and description of <code>image_transformer</code>. Let’s instead call it <code>modifier</code>
to disassociate it a bit from “image” and “prompt”:`,zo,de,qo,Me,Oi="Now “modify” is a strong cue to use the new image processor which should help with the above prompt. Let’s run it again.",Ao,ce,Lo,ye,tr="Now we’re getting:",Po,we,Ko,fe,er="which is definitely closer to what we had in mind! However, we want to have both the house and car in the same image. Steering the task more toward single image generation should help:",Do,be,Oo,ge,ta,A,ea,B,L,vn,Je,oi,hn,lr="Customizing the whole prompt",la,Te,nr=`To give the user maximum flexibility, the whole prompt template as explained in <a href="#structure-of-the-prompt">above</a>
can be overwritten by the user. In this case make sure that your custom prompt includes an introduction section,
a tool section, an example section, and an unfinished example section. If you want to overwrite the <code>run</code> prompt template,
you can do as follows:`,na,Ue,oa,P,aa,ve,or="Similarly, one can overwrite the <code>chat</code> prompt template. Note that the <code>chat</code> mode always uses the following format for the exchanges:",sa,$e,ia,je,ar=`Therefore it is important that the examples of the custom <code>chat</code> prompt template also make use of this format.
You can overwrite the <code>chat</code> template at instantiation as follows.`,ra,Ze,pa,K,ha,Ge,sr='In both cases, you can pass a repo ID instead of the prompt template if you would like to use a template hosted by someone in the community. The default prompts live in <a href="https://huggingface.co/datasets/huggingface-tools/default-prompts" rel="nofollow">this repo</a> as an example.',ma,Ce,ir="To upload your custom prompt on a repo on the Hub and share it with the community just make sure:",ua,Ie,rr="<li>to use a dataset repository</li> <li>to put the prompt template for the <code>run</code> command in a file named <code>run_prompt_template.txt</code></li> <li>to put the prompt template for the <code>chat</code> command in a file named <code>chat_prompt_template.txt</code></li>",da,x,D,$n,We,ai,mn,pr="Using custom tools",Ma,Be,hr="In this section, we’ll be leveraging two existing custom tools that are specific to image generation:",ca,xe,mr=`<li>We replace <a href="https://huggingface.co/spaces/huggingface-tools/image-transformation" rel="nofollow">huggingface-tools/image-transformation</a>,
with <a href="https://huggingface.co/spaces/diffusers/controlnet-canny-tool" rel="nofollow">diffusers/controlnet-canny-tool</a>
to allow for more image modifications.</li> <li>We add a new tool for image upscaling to the default toolbox:
<a href="https://huggingface.co/spaces/diffusers/latent-upscaler-tool" rel="nofollow">diffusers/latent-upscaler-tool</a> replace the existing image-transformation tool.</li>`,ya,ke,ur='We’ll start by loading the custom tools with the convenient <a href="/docs/transformers/v4.33.3/en/main_classes/agent#transformers.load_tool">load_tool()</a> function:',wa,He,fa,_e,dr=`Upon adding custom tools to an agent, the tools’ descriptions and names are automatically
included in the agents’ prompts. Thus, it is imperative that custom tools have
a well-written description and name in order for the agent to understand how to use them.
Let’s take a look at the description and name of <code>controlnet_transformer</code>:`,ba,Re,ga,Ye,Mr="gives",Ja,Ne,Ta,Ee,cr=`The name and description are accurate and fit the style of the <a href="./transformers_agents#a-curated-set-of-tools">curated set of tools</a>.
Next, let’s instantiate an agent with <code>controlnet_transformer</code> and <code>upscaler</code>:`,Ua,Xe,va,Qe,yr="This command should give you the following info:",$a,Ve,ja,Se,wr="The set of curated tools already has an <code>image_transformer</code> tool which is hereby replaced with our custom tool.",Za,O,Ga,Fe,fr=`The upscaler tool was given the name <code>image_upscaler</code> which is not yet present in the default toolbox and is therefore simply added to the list of tools.
You can always have a look at the toolbox that is currently available to the agent via the <code>agent.toolbox</code> attribute:`,Ca,ze,Ia,qe,Wa,Ae,br="Note how <code>image_upscaler</code> is now part of the agents’ toolbox.",Ba,Le,gr='Let’s now try out the new tools! We will re-use the image we generated in <a href="./transformers_agents#single-execution-run">Transformers Agents Quickstart</a>.',xa,Pe,ka,Ke,Jr,Ha,De,Tr="Let’s transform the image into a beautiful winter landscape:",_a,Oe,Ra,tl,Ya,el,Ur,Na,ll,vr=`The new image processing tool is based on ControlNet which can make very strong modifications to the image.
By default the image processing tool returns an image of size 512x512 pixels. Let’s see if we can upscale it.`,Ea,nl,Xa,ol,Qa,al,$r,Va,sl,jr=`The agent automatically mapped our prompt “Upscale the image” to the just added upscaler tool purely based on the description and name of the upscaler tool
and was able to correctly run it.`,Sa,il,Zr="Next, let’s have a look at how you can create a new custom tool.",Fa,k,tt,jn,rl,si,un,Gr="Adding new tools",za,pl,Cr="In this section, we show how to create a new tool that can be added to the agent.",qa,H,et,Zn,hl,ii,dn,Ir="Creating a new tool",Aa,ml,Wr=`We’ll first start by creating a tool. We’ll add the not-so-useful yet fun task of fetching the model on the Hugging Face
Hub with the most downloads for a given task.`,La,ul,Br="We can do that with the following code:",Pa,dl,Ka,Ml,xr="For the task <code>text-classification</code>, this returns <code>&#39;facebook/bart-large-mnli&#39;</code>, for <code>translation</code> it returns <code>&#39;t5-base</code>.",Da,cl,kr=`How do we convert this to a tool that the agent can leverage? All tools depend on the superclass <code>Tool</code> that holds the
main attributes necessary. We’ll create a class that inherits from it:`,Oa,yl,ts,wl,Hr="This class has a few needs:",es,fl,_r=`<li>An attribute <code>name</code>, which corresponds to the name of the tool itself. To be in tune with other tools which have a
performative name, we’ll name it <code>model_download_counter</code>.</li> <li>An attribute <code>description</code>, which will be used to populate the prompt of the agent.</li> <li><code>inputs</code> and <code>outputs</code> attributes. Defining this will help the python interpreter make educated choices about types,
and will allow for a gradio-demo to be spawned when we push our tool to the Hub. They’re both a list of expected
values, which can be <code>text</code>, <code>image</code>, or <code>audio</code>.</li> <li>A <code>__call__</code> method which contains the inference code. This is the code we’ve played with above!</li>`,ls,bl,Rr="Here’s what our class looks like now:",ns,gl,os,Jl,Yr=`We now have our tool handy. Save it in a file and import it from your main script. Let’s name this file
<code>model_downloads.py</code>, so the resulting import code looks like this:`,as,Tl,ss,Ul,Nr=`In order to let others benefit from it and for simpler initialization, we recommend pushing it to the Hub under your
namespace. To do so, just call <code>push_to_hub</code> on the <code>tool</code> variable:`,is,vl,rs,$l,Er="You now have your code on the Hub! Let’s take a look at the final step, which is to have the agent use it.",ps,_,lt,Gn,jl,ri,Mn,Xr="Having the agent use the tool",hs,Zl,Qr="We now have our tool that lives on the Hub which can be instantiated as such (change the user name for your tool):",ms,Gl,us,Cl,Vr="In order to use it in the agent, simply pass it in the <code>additional_tools</code> parameter of the agent initialization method:",ds,Il,Ms,Wl,Sr="which outputs the following:",cs,Bl,ys,xl,Fr="and generates the following audio.",ws,kl,zr='<thead><tr><th><strong>Audio</strong></th></tr></thead> <tbody><tr><td><audio controls=""><source src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/damo.wav" type="audio/wav"/></audio></td></tr></tbody>',fs,nt,bs,R,ot,Cn,Hl,pi,cn,qr="Replacing existing tools",gs,_l,Ar="Replacing existing tools can be done simply by assigning a new item to the agent’s toolbox. Here’s how one would do so:",Js,Rl,Ts,at,Us,Y,st,In,Yl,hi,yn,Lr="Leveraging gradio-tools",vs,Nl,Pr=`<a href="https://github.com/freddyaboulton/gradio-tools" rel="nofollow">gradio-tools</a> is a powerful library that allows using Hugging
Face Spaces as tools. It supports many existing Spaces as well as custom Spaces to be designed with it.`,$s,El,Kr=`We offer support for <code>gradio_tools</code> by using the <code>Tool.from_gradio</code> method. For example, we want to take
advantage of the <code>StableDiffusionPromptGeneratorTool</code> tool offered in the <code>gradio-tools</code> toolkit so as to
improve our prompts and generate better images.`,js,Xl,Dr="We first import the tool from <code>gradio_tools</code> and instantiate it:",Zs,Ql,Gs,Vl,Or="We pass that instance to the <code>Tool.from_gradio</code> method:",Cs,Sl,Is,Fl,tp=`Now we can manage it exactly as we would a usual custom tool. We leverage it to improve our prompt
<code>a rabbit wearing a space suit</code>:`,Ws,zl,Bs,ql,ep="The model adequately leverages the tool:",xs,Al,ks,Ll,lp="Before finally generating the image:",Hs,wn,np,_s,it,Rs,N,rt,Wn,Pl,mi,fn,op="Future compatibility with Langchain",Ys,Kl,ap=`We love Langchain and think it has a very compelling suite of tools. In order to handle these tools,
Langchain requires <em>textual</em> inputs and outputs, even when working with different modalities.
This is often the serialized version (i.e., saved to disk) of the objects.`,Ns,Dl,sp=`This difference means that multi-modality isn’t handled between transformers-agents and langchain.
We aim for this limitation to be resolved in future versions, and welcome any help from avid langchain
users to help us achieve this compatibility.`,Es,Ol,ip=`We would love to have better support. If you would like to help, please
<a href="https://github.com/huggingface/transformers/issues/new" rel="nofollow">open an issue</a> and share what you have in mind.`,Xs,Bn,Qs;return pt=new v({}),X=new $({props:{$$slots:{default:[xp]},$$scope:{ctx:U}}}),Q=new $({props:{warning:!0,$$slots:{default:[kp]},$$scope:{ctx:U}}}),ut=new v({}),Mt=new v({}),ft=new b({props:{code:"SSUyMHdpbGwlMjBhc2slMjB5b3UlMjB0byUyMHBlcmZvcm0lMjBhJTIwdGFzayUyQyUyMHlvdXIlMjBqb2IlMjBpcyUyMHRvJTIwY29tZSUyMHVwJTIwd2l0aCUyMGElMjBzZXJpZXMlMjBvZiUyMHNpbXBsZSUyMGNvbW1hbmRzJTIwaW4lMjBQeXRob24lMjB0aGF0JTIwd2lsbCUyMHBlcmZvcm0lMjB0aGUlMjB0YXNrLiUwQSU1Qi4uLiU1RCUwQVlvdSUyMGNhbiUyMHByaW50JTIwaW50ZXJtZWRpYXRlJTIwcmVzdWx0cyUyMGlmJTIwaXQlMjBtYWtlcyUyMHNlbnNlJTIwdG8lMjBkbyUyMHNvLiUwQSUwQVRvb2xzJTNBJTBBLSUyMGRvY3VtZW50X3FhJTNBJTIwVGhpcyUyMGlzJTIwYSUyMHRvb2wlMjB0aGF0JTIwYW5zd2VycyUyMGElMjBxdWVzdGlvbiUyMGFib3V0JTIwYSUyMGRvY3VtZW50JTIwKHBkZikuJTIwSXQlMjB0YWtlcyUyMGFuJTIwaW5wdXQlMjBuYW1lZCUyMCU2MGRvY3VtZW50JTYwJTIwd2hpY2glMjBzaG91bGQlMjBiZSUyMHRoZSUyMGRvY3VtZW50JTIwY29udGFpbmluZyUyMHRoZSUyMGluZm9ybWF0aW9uJTJDJTIwYXMlMjB3ZWxsJTIwYXMlMjBhJTIwJTYwcXVlc3Rpb24lNjAlMjB0aGF0JTIwaXMlMjB0aGUlMjBxdWVzdGlvbiUyMGFib3V0JTIwdGhlJTIwZG9jdW1lbnQuJTIwSXQlMjByZXR1cm5zJTIwYSUyMHRleHQlMjB0aGF0JTIwY29udGFpbnMlMjB0aGUlMjBhbnN3ZXIlMjB0byUyMHRoZSUyMHF1ZXN0aW9uLiUwQS0lMjBpbWFnZV9jYXB0aW9uZXIlM0ElMjBUaGlzJTIwaXMlMjBhJTIwdG9vbCUyMHRoYXQlMjBnZW5lcmF0ZXMlMjBhJTIwZGVzY3JpcHRpb24lMjBvZiUyMGFuJTIwaW1hZ2UuJTIwSXQlMjB0YWtlcyUyMGFuJTIwaW5wdXQlMjBuYW1lZCUyMCU2MGltYWdlJTYwJTIwd2hpY2glMjBzaG91bGQlMjBiZSUyMHRoZSUyMGltYWdlJTIwdG8lMjB0aGUlMjBjYXB0aW9uJTIwYW5kJTIwcmV0dXJucyUyMGElMjB0ZXh0JTIwdGhhdCUyMGNvbnRhaW5zJTIwdGhlJTIwZGVzY3JpcHRpb24lMjBpbiUyMEVuZ2xpc2guJTBBJTVCLi4uJTVEJTBBJTBBVGFzayUzQSUyMCUyMkFuc3dlciUyMHRoZSUyMHF1ZXN0aW9uJTIwaW4lMjB0aGUlMjB2YXJpYWJsZSUyMCU2MHF1ZXN0aW9uJTYwJTIwYWJvdXQlMjB0aGUlMjBpbWFnZSUyMHN0b3JlZCUyMGluJTIwdGhlJTIwdmFyaWFibGUlMjAlNjBpbWFnZSU2MC4lMjBUaGUlMjBxdWVzdGlvbiUyMGlzJTIwaW4lMjBGcmVuY2guJTIyJTBBJTBBSSUyMHdpbGwlMjB1c2UlMjB0aGUlMjBmb2xsb3dpbmclMjB0b29scyUzQSUyMCU2MHRyYW5zbGF0b3IlNjAlMjB0byUyMHRyYW5zbGF0ZSUyMHRoZSUyMHF1ZXN0aW9uJTIwaW50byUyMEVuZ2xpc2glMjBhbmQlMjB0aGVuJTIwJTYwaW1hZ2VfcWElNjAlMjB0byUyMGFuc3dlciUyMHRoZSUyMHF1ZXN0aW9uJTIwb24lMjB0aGUlMjBpbnB1dCUyMGltYWdlLiUwQSUwQUFuc3dlciUzQSUwQSU2MCU2MCU2MHB5JTBBdHJhbnNsYXRlZF9xdWVzdGlvbiUyMCUzRCUyMHRyYW5zbGF0b3IocXVlc3Rpb24lM0RxdWVzdGlvbiUyQyUyMHNyY19sYW5nJTNEJTIyRnJlbmNoJTIyJTJDJTIwdGd0X2xhbmclM0QlMjJFbmdsaXNoJTIyKSUwQXByaW50KGYlMjJUaGUlMjB0cmFuc2xhdGVkJTIwcXVlc3Rpb24lMjBpcyUyMCU3QnRyYW5zbGF0ZWRfcXVlc3Rpb24lN0QuJTIyKSUwQWFuc3dlciUyMCUzRCUyMGltYWdlX3FhKGltYWdlJTNEaW1hZ2UlMkMlMjBxdWVzdGlvbiUzRHRyYW5zbGF0ZWRfcXVlc3Rpb24pJTBBcHJpbnQoZiUyMlRoZSUyMGFuc3dlciUyMGlzJTIwJTdCYW5zd2VyJTdEJTIyKSUwQSU2MCU2MCU2MCUwQSUwQVRhc2slM0ElMjAlMjJJZGVudGlmeSUyMHRoZSUyMG9sZGVzdCUyMHBlcnNvbiUyMGluJTIwdGhlJTIwJTYwZG9jdW1lbnQlNjAlMjBhbmQlMjBjcmVhdGUlMjBhbiUyMGltYWdlJTIwc2hvd2Nhc2luZyUyMHRoZSUyMHJlc3VsdCUyMGFzJTIwYSUyMGJhbm5lci4lMjIlMEElMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2xzJTNBJTIwJTYwZG9jdW1lbnRfcWElNjAlMjB0byUyMGZpbmQlMjB0aGUlMjBvbGRlc3QlMjBwZXJzb24lMjBpbiUyMHRoZSUyMGRvY3VtZW50JTJDJTIwdGhlbiUyMCU2MGltYWdlX2dlbmVyYXRvciU2MCUyMHRvJTIwZ2VuZXJhdGUlMjBhbiUyMGltYWdlJTIwYWNjb3JkaW5nJTIwdG8lMjB0aGUlMjBhbnN3ZXIuJTBBJTBBQW5zd2VyJTNBJTBBJTYwJTYwJTYwcHklMEFhbnN3ZXIlMjAlM0QlMjBkb2N1bWVudF9xYShkb2N1bWVudCUyQyUyMHF1ZXN0aW9uJTNEJTIyV2hhdCUyMGlzJTIwdGhlJTIwb2xkZXN0JTIwcGVyc29uJTNGJTIyKSUwQXByaW50KGYlMjJUaGUlMjBhbnN3ZXIlMjBpcyUyMCU3QmFuc3dlciU3RC4lMjIpJTBBaW1hZ2UlMjAlM0QlMjBpbWFnZV9nZW5lcmF0b3IoJTIyQSUyMGJhbm5lciUyMHNob3dpbmclMjAlMjIlMjAlMkIlMjBhbnN3ZXIpJTBBJTYwJTYwJTYwJTBBJTBBJTVCLi4uJTVEJTBBJTBBVGFzayUzQSUyMCUyMkRyYXclMjBtZSUyMGElMjBwaWN0dXJlJTIwb2YlMjByaXZlcnMlMjBhbmQlMjBsYWtlcyUyMiUwQSUwQUklMjB3aWxsJTIwdXNlJTIwdGhlJTIwZm9sbG93aW5n",highlighted:`I will ask you to perform a task, your job is to come up with a series of simple commands in Python that will perform the task.
[...]
You can print intermediate results if it makes sense to do so.

Tools:
- document_qa: This is a tool that answers a question about a document (pdf). It takes an input named \`document\` which should be the document containing the information, as well as a \`question\` that is the question about the document. It returns a text that contains the answer to the question.
- image_captioner: This is a tool that generates a description of an image. It takes an input named \`image\` which should be the image to the caption and returns a text that contains the description in English.
[...]

Task: &quot;Answer the question in the variable \`question\` about the image stored in the variable \`image\`. The question is in French.&quot;

I will use the following tools: \`translator\` to translate the question into English and then \`image_qa\` to answer the question on the input image.

Answer:
\`\`\`py
translated_question = translator(question=question, src_lang=&quot;French&quot;, tgt_lang=&quot;English&quot;)
print(f&quot;The translated question is {translated_question}.&quot;)
answer = image_qa(image=image, question=translated_question)
print(f&quot;The answer is {answer}&quot;)
\`\`\`

Task: &quot;Identify the oldest person in the \`document\` and create an image showcasing the result as a banner.&quot;

I will use the following tools: \`document_qa\` to find the oldest person in the document, then \`image_generator\` to generate an image according to the answer.

Answer:
\`\`\`py
answer = document_qa(document, question=&quot;What is the oldest person?&quot;)
print(f&quot;The answer is {answer}.&quot;)
image = image_generator(&quot;A banner showing &quot; + answer)
\`\`\`

[...]

Task: &quot;Draw me a picture of rivers and lakes&quot;

I will use the following`}}),Jt=new b({props:{code:"LSUyMCUzQ3Rvb2wubmFtZSUzRSUzQSUyMCUzQ3Rvb2wuZGVzY3JpcHRpb24lM0U=",highlighted:"- &lt;tool.name&gt;: &lt;tool.description&gt;"}}),Ut=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGxvYWRfdG9vbCUwQSUwQWRvY3VtZW50X3FhJTIwJTNEJTIwbG9hZF90b29sKCUyMmRvY3VtZW50LXF1ZXN0aW9uLWFuc3dlcmluZyUyMiklMEFwcmludChmJTIyLSUyMCU3QmRvY3VtZW50X3FhLm5hbWUlN0QlM0ElMjAlN0Jkb2N1bWVudF9xYS5kZXNjcmlwdGlvbiU3RCUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> load_tool

document_qa = load_tool(<span class="hljs-string">&quot;document-question-answering&quot;</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;- <span class="hljs-subst">{document_qa.name}</span>: <span class="hljs-subst">{document_qa.description}</span>&quot;</span>)`}}),$t=new b({props:{code:"LSUyMGRvY3VtZW50X3FhJTNBJTIwVGhpcyUyMGlzJTIwYSUyMHRvb2wlMjB0aGF0JTIwYW5zd2VycyUyMGElMjBxdWVzdGlvbiUyMGFib3V0JTIwYSUyMGRvY3VtZW50JTIwKHBkZikuJTIwSXQlMjB0YWtlcyUyMGFuJTIwaW5wdXQlMjBuYW1lZCUyMCU2MGRvY3VtZW50JTYwJTIwd2hpY2glMjBzaG91bGQlMjBiZSUyMHRoZSUyMGRvY3VtZW50JTIwY29udGFpbmluZyUyMHRoZSUyMGluZm9ybWF0aW9uJTJDJTIwYXMlMjB3ZWxsJTIwYXMlMjBhJTIwJTYwcXVlc3Rpb24lNjAlMjB0aGF0JTIwaXMlMjB0aGUlMjBxdWVzdGlvbiUyMGFib3V0JTIwdGhlJTIwZG9jdW1lbnQuJTIwSXQlMjByZXR1cm5zJTIwYSUyMHRleHQlMjB0aGF0JTIwY29udGFpbnMlMjB0aGUlMjBhbnN3ZXIlMjB0byUyMHRoZSUyMHF1ZXN0aW9uLg==",highlighted:"- document_qa: This is a tool that answers a question about a document (pdf). It takes an input named `document` which should be the document containing the information, as well as a `question` that is the question about the document. It returns a text that contains the answer to the question."}}),F=new $({props:{$$slots:{default:[Hp]},$$scope:{ctx:U}}}),It=new b({props:{code:"VGFzayUzQSUyMCUyMklkZW50aWZ5JTIwdGhlJTIwb2xkZXN0JTIwcGVyc29uJTIwaW4lMjB0aGUlMjAlNjBkb2N1bWVudCU2MCUyMGFuZCUyMGNyZWF0ZSUyMGFuJTIwaW1hZ2UlMjBzaG93Y2FzaW5nJTIwdGhlJTIwcmVzdWx0JTIwYXMlMjBhJTIwYmFubmVyLiUyMiUwQSUwQUklMjB3aWxsJTIwdXNlJTIwdGhlJTIwZm9sbG93aW5nJTIwdG9vbHMlM0ElMjAlNjBkb2N1bWVudF9xYSU2MCUyMHRvJTIwZmluZCUyMHRoZSUyMG9sZGVzdCUyMHBlcnNvbiUyMGluJTIwdGhlJTIwZG9jdW1lbnQlMkMlMjB0aGVuJTIwJTYwaW1hZ2VfZ2VuZXJhdG9yJTYwJTIwdG8lMjBnZW5lcmF0ZSUyMGFuJTIwaW1hZ2UlMjBhY2NvcmRpbmclMjB0byUyMHRoZSUyMGFuc3dlci4lMEElMEFBbnN3ZXIlM0ElMEElNjAlNjAlNjBweSUwQWFuc3dlciUyMCUzRCUyMGRvY3VtZW50X3FhKGRvY3VtZW50JTJDJTIwcXVlc3Rpb24lM0QlMjJXaGF0JTIwaXMlMjB0aGUlMjBvbGRlc3QlMjBwZXJzb24lM0YlMjIpJTBBcHJpbnQoZiUyMlRoZSUyMGFuc3dlciUyMGlzJTIwJTdCYW5zd2VyJTdELiUyMiklMEFpbWFnZSUyMCUzRCUyMGltYWdlX2dlbmVyYXRvciglMjJBJTIwYmFubmVyJTIwc2hvd2luZyUyMCUyMiUyMCUyQiUyMGFuc3dlciklMEElNjAlNjAlNjAlMEE=",highlighted:"Task: &quot;Identify the oldest person in the `document` and create an image showcasing the result as a banner.&quot;\n\nI will use the following tools: `document_qa` to find the oldest person in the document, then `image_generator` to generate an image according to the answer.\n\nAnswer:\n```py\nanswer = document_qa(document, question=&quot;What is the oldest person?&quot;)\nprint(f&quot;The answer is {answer}.&quot;)\nimage = image_generator(&quot;A banner showing &quot; + answer)\n```\n"}}),kt=new b({props:{code:"VGFzayUzQSUyMCUyMkRyYXclMjBtZSUyMGElMjBwaWN0dXJlJTIwb2YlMjByaXZlcnMlMjBhbmQlMjBsYWtlcyUyMiUwQSUwQUklMjB3aWxsJTIwdXNlJTIwdGhlJTIwZm9sbG93aW5n",highlighted:`Task: &quot;Draw me a picture of rivers and lakes&quot;

I will use the following`}}),_t=new b({props:{code:"YWdlbnQucnVuKCUyMkRyYXclMjBtZSUyMGElMjBwaWN0dXJlJTIwb2YlMjByaXZlcnMlMjBhbmQlMjBsYWtlcyUyMik=",highlighted:'agent.run(<span class="hljs-string">&quot;Draw me a picture of rivers and lakes&quot;</span>)'}}),Nt=new b({props:{code:"JTVCLi4uJTVEJTBBJTBBJTNEJTNEJTNEJTNEJTNEJTBBJTBBSHVtYW4lM0ElMjBBbnN3ZXIlMjB0aGUlMjBxdWVzdGlvbiUyMGluJTIwdGhlJTIwdmFyaWFibGUlMjAlNjBxdWVzdGlvbiU2MCUyMGFib3V0JTIwdGhlJTIwaW1hZ2UlMjBzdG9yZWQlMjBpbiUyMHRoZSUyMHZhcmlhYmxlJTIwJTYwaW1hZ2UlNjAuJTBBJTBBQXNzaXN0YW50JTNBJTIwSSUyMHdpbGwlMjB1c2UlMjB0aGUlMjB0b29sJTIwJTYwaW1hZ2VfcWElNjAlMjB0byUyMGFuc3dlciUyMHRoZSUyMHF1ZXN0aW9uJTIwb24lMjB0aGUlMjBpbnB1dCUyMGltYWdlLiUwQSUwQSU2MCU2MCU2MHB5JTBBYW5zd2VyJTIwJTNEJTIwaW1hZ2VfcWEodGV4dCUzRHF1ZXN0aW9uJTJDJTIwaW1hZ2UlM0RpbWFnZSklMEFwcmludChmJTIyVGhlJTIwYW5zd2VyJTIwaXMlMjAlN0JhbnN3ZXIlN0QlMjIpJTBBJTYwJTYwJTYwJTBBJTBBSHVtYW4lM0ElMjBJJTIwdHJpZWQlMjB0aGlzJTIwY29kZSUyQyUyMGl0JTIwd29ya2VkJTIwYnV0JTIwZGlkbid0JTIwZ2l2ZSUyMG1lJTIwYSUyMGdvb2QlMjByZXN1bHQuJTIwVGhlJTIwcXVlc3Rpb24lMjBpcyUyMGluJTIwRnJlbmNoJTBBJTBBQXNzaXN0YW50JTNBJTIwSW4lMjB0aGlzJTIwY2FzZSUyQyUyMHRoZSUyMHF1ZXN0aW9uJTIwbmVlZHMlMjB0byUyMGJlJTIwdHJhbnNsYXRlZCUyMGZpcnN0LiUyMEklMjB3aWxsJTIwdXNlJTIwdGhlJTIwdG9vbCUyMCU2MHRyYW5zbGF0b3IlNjAlMjB0byUyMGRvJTIwdGhpcy4lMEElMEElNjAlNjAlNjBweSUwQXRyYW5zbGF0ZWRfcXVlc3Rpb24lMjAlM0QlMjB0cmFuc2xhdG9yKHF1ZXN0aW9uJTNEcXVlc3Rpb24lMkMlMjBzcmNfbGFuZyUzRCUyMkZyZW5jaCUyMiUyQyUyMHRndF9sYW5nJTNEJTIyRW5nbGlzaCUyMiklMEFwcmludChmJTIyVGhlJTIwdHJhbnNsYXRlZCUyMHF1ZXN0aW9uJTIwaXMlMjAlN0J0cmFuc2xhdGVkX3F1ZXN0aW9uJTdELiUyMiklMEFhbnN3ZXIlMjAlM0QlMjBpbWFnZV9xYSh0ZXh0JTNEdHJhbnNsYXRlZF9xdWVzdGlvbiUyQyUyMGltYWdlJTNEaW1hZ2UpJTBBcHJpbnQoZiUyMlRoZSUyMGFuc3dlciUyMGlzJTIwJTdCYW5zd2VyJTdEJTIyKSUwQSU2MCU2MCU2MCUwQSUwQSUzRCUzRCUzRCUzRCUzRCUwQSUwQSU1Qi4uLiU1RA==",highlighted:`[...]

=====

Human: Answer the question in the variable \`question\` about the image stored in the variable \`image\`.

Assistant: I will use the tool \`image_qa\` to answer the question on the input image.

\`\`\`py
answer = image_qa(text=question, image=image)
print(f&quot;The answer is {answer}&quot;)
\`\`\`

Human: I tried this code, it worked but didn&#x27;t give me a good result. The question is in French

Assistant: In this case, the question needs to be translated first. I will use the tool \`translator\` to do this.

\`\`\`py
translated_question = translator(question=question, src_lang=&quot;French&quot;, tgt_lang=&quot;English&quot;)
print(f&quot;The translated question is {translated_question}.&quot;)
answer = image_qa(text=translated_question, image=image)
print(f&quot;The answer is {answer}&quot;)
\`\`\`

=====

[...]`}}),Qt=new b({props:{code:"SHVtYW4lM0ElMjAlM0N1c2VyLWlucHV0JTNFJTVDbiU1Q25Bc3Npc3RhbnQlM0E=",highlighted:"Human: &lt;user-input&gt;\\n\\nAssistant:"}}),Ft=new v({}),At=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEhmQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiklMEElMEFhZ2VudC5ydW4oJTIyU2hvdyUyMG1lJTIwYSUyMHRyZWUlMjIlMkMlMjByZXR1cm5fY29kZSUzRFRydWUp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> HfAgent

agent = HfAgent(<span class="hljs-string">&quot;https://api-inference.huggingface.co/models/bigcode/starcoder&quot;</span>)

agent.run(<span class="hljs-string">&quot;Show me a tree&quot;</span>, return_code=<span class="hljs-literal">True</span>)`}}),Pt=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2wlM0ElMjAlNjBpbWFnZV9zZWdtZW50ZXIlNjAlMjB0byUyMGNyZWF0ZSUyMGElMjBzZWdtZW50YXRpb24lMjBtYXNrJTIwZm9yJTIwdGhlJTIwaW1hZ2UuJTBBJTBBJTBBJTNEJTNEQ29kZSUyMGdlbmVyYXRlZCUyMGJ5JTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFtYXNrJTIwJTNEJTIwaW1hZ2Vfc2VnbWVudGVyKGltYWdlJTJDJTIwcHJvbXB0JTNEJTIydHJlZSUyMik=",highlighted:`==Explanation from the agent==
I will use the following tool: \`image_segmenter\` to create a segmentation mask for the image.


==Code generated by the agent==
mask = image_segmenter(image, prompt=&quot;tree&quot;)`}}),Dt=new b({props:{code:"YWdlbnQudG9vbGJveCU1QiUyMmltYWdlX2dlbmVyYXRvciUyMiU1RC5kZXNjcmlwdGlvbg==",highlighted:'agent.toolbox[<span class="hljs-string">&quot;image_generator&quot;</span>].description'}}),Ot=new b({props:{code:"J1RoaXMlMjBpcyUyMGElMjB0b29sJTIwdGhhdCUyMGNyZWF0ZXMlMjBhbiUyMGltYWdlJTIwYWNjb3JkaW5nJTIwdG8lMjBhJTIwcHJvbXB0JTJDJTIwd2hpY2glMjBpcyUyMGElMjB0ZXh0JTIwZGVzY3JpcHRpb24uJTIwSXQlMjB0YWtlcyUyMGFuJTIwaW5wdXQlMjBuYW1lZCUyMCU2MHByb21wdCU2MCUyMHdoaWNoJTIwY29udGFpbnMlMjB0aGUlMjBpbWFnZSUyMGRlc2NyaXB0aW9uJTIwYW5kJTIwb3V0cHV0cyUyMGFuJTIwaW1hZ2Uu",highlighted:"&#x27;This is a tool that creates an image according to a prompt, which is a text description. It takes an input named `prompt` which contains the image description and outputs an image."}}),ee=new b({props:{code:"YWdlbnQucnVuKCUyMkNyZWF0ZSUyMGFuJTIwaW1hZ2UlMjBvZiUyMGElMjB0cmVlJTIyJTJDJTIwcmV0dXJuX2NvZGUlM0RUcnVlKQ==",highlighted:'agent.run(<span class="hljs-string">&quot;Create an image of a tree&quot;</span>, return_code=<span class="hljs-literal">True</span>)'}}),ne=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2wlMjAlNjBpbWFnZV9nZW5lcmF0b3IlNjAlMjB0byUyMGdlbmVyYXRlJTIwYW4lMjBpbWFnZSUyMG9mJTIwYSUyMHRyZWUuJTBBJTBBJTBBJTNEJTNEQ29kZSUyMGdlbmVyYXRlZCUyMGJ5JTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFpbWFnZSUyMCUzRCUyMGltYWdlX2dlbmVyYXRvcihwcm9tcHQlM0QlMjJ0cmVlJTIyKQ==",highlighted:`==Explanation from the agent==
I will use the following tool \`image_generator\` to generate an image of a tree.


==Code generated by the agent==
image = image_generator(prompt=&quot;tree&quot;)`}}),ae=new v({}),re=new b({props:{code:"YWdlbnQucnVuKCUyMk1ha2UlMjBhbiUyMGltYWdlJTIwb2YlMjBhJTIwaG91c2UlMjBhbmQlMjBhJTIwY2FyJTIyJTJDJTIwcmV0dXJuX2NvZGUlM0RUcnVlKQ==",highlighted:'agent.run(<span class="hljs-string">&quot;Make an image of a house and a car&quot;</span>, return_code=<span class="hljs-literal">True</span>)'}}),he=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMjAlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2xzJTIwJTYwaW1hZ2VfZ2VuZXJhdG9yJTYwJTIwdG8lMjBnZW5lcmF0ZSUyMGFuJTIwaW1hZ2UlMjBvZiUyMGElMjBob3VzZSUyMGFuZCUyMCU2MGltYWdlX3RyYW5zZm9ybWVyJTYwJTIwdG8lMjB0cmFuc2Zvcm0lMjB0aGUlMjBpbWFnZSUyMG9mJTIwYSUyMGNhciUyMGludG8lMjB0aGUlMjBpbWFnZSUyMG9mJTIwYSUyMGhvdXNlLiUwQSUwQSUzRCUzRENvZGUlMjBnZW5lcmF0ZWQlMjBieSUyMHRoZSUyMGFnZW50JTNEJTNEJTBBaG91c2VfaW1hZ2UlMjAlM0QlMjBpbWFnZV9nZW5lcmF0b3IocHJvbXB0JTNEJTIyQSUyMGhvdXNlJTIyKSUwQWNhcl9pbWFnZSUyMCUzRCUyMGltYWdlX2dlbmVyYXRvcihwcm9tcHQlM0QlMjJBJTIwY2FyJTIyKSUwQWhvdXNlX2Nhcl9pbWFnZSUyMCUzRCUyMGltYWdlX3RyYW5zZm9ybWVyKGltYWdlJTNEY2FyX2ltYWdlJTJDJTIwcHJvbXB0JTNEJTIyQSUyMGhvdXNlJTIyKQ==",highlighted:`==Explanation from the agent== 
I will use the following tools \`image_generator\` to generate an image of a house and \`image_transformer\` to transform the image of a car into the image of a house.

==Code generated by the agent==
house_image = image_generator(prompt=&quot;A house&quot;)
car_image = image_generator(prompt=&quot;A car&quot;)
house_car_image = image_transformer(image=car_image, prompt=&quot;A house&quot;)`}}),de=new b({props:{code:"YWdlbnQudG9vbGJveCU1QiUyMm1vZGlmaWVyJTIyJTVEJTIwJTNEJTIwYWdlbnQudG9vbGJveC5wb3AoJTIyaW1hZ2VfdHJhbnNmb3JtZXIlMjIpJTBBYWdlbnQudG9vbGJveCU1QiUyMm1vZGlmaWVyJTIyJTVELmRlc2NyaXB0aW9uJTIwJTNEJTIwYWdlbnQudG9vbGJveCU1QiUyMm1vZGlmaWVyJTIyJTVELmRlc2NyaXB0aW9uLnJlcGxhY2UoJTBBJTIwJTIwJTIwJTIwJTIydHJhbnNmb3JtcyUyMGFuJTIwaW1hZ2UlMjBhY2NvcmRpbmclMjB0byUyMGElMjBwcm9tcHQlMjIlMkMlMjAlMjJtb2RpZmllcyUyMGFuJTIwaW1hZ2UlMjIlMEEp",highlighted:`agent.toolbox[<span class="hljs-string">&quot;modifier&quot;</span>] = agent.toolbox.pop(<span class="hljs-string">&quot;image_transformer&quot;</span>)
agent.toolbox[<span class="hljs-string">&quot;modifier&quot;</span>].description = agent.toolbox[<span class="hljs-string">&quot;modifier&quot;</span>].description.replace(
    <span class="hljs-string">&quot;transforms an image according to a prompt&quot;</span>, <span class="hljs-string">&quot;modifies an image&quot;</span>
)`}}),ce=new b({props:{code:"YWdlbnQucnVuKCUyMk1ha2UlMjBhbiUyMGltYWdlJTIwb2YlMjBhJTIwaG91c2UlMjBhbmQlMjBhJTIwY2FyJTIyJTJDJTIwcmV0dXJuX2NvZGUlM0RUcnVlKQ==",highlighted:'agent.run(<span class="hljs-string">&quot;Make an image of a house and a car&quot;</span>, return_code=<span class="hljs-literal">True</span>)'}}),we=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2xzJTNBJTIwJTYwaW1hZ2VfZ2VuZXJhdG9yJTYwJTIwdG8lMjBnZW5lcmF0ZSUyMGFuJTIwaW1hZ2UlMjBvZiUyMGElMjBob3VzZSUyQyUyMHRoZW4lMjAlNjBpbWFnZV9nZW5lcmF0b3IlNjAlMjB0byUyMGdlbmVyYXRlJTIwYW4lMjBpbWFnZSUyMG9mJTIwYSUyMGNhci4lMEElMEElMEElM0QlM0RDb2RlJTIwZ2VuZXJhdGVkJTIwYnklMjB0aGUlMjBhZ2VudCUzRCUzRCUwQWhvdXNlX2ltYWdlJTIwJTNEJTIwaW1hZ2VfZ2VuZXJhdG9yKHByb21wdCUzRCUyMkElMjBob3VzZSUyMiklMEFjYXJfaW1hZ2UlMjAlM0QlMjBpbWFnZV9nZW5lcmF0b3IocHJvbXB0JTNEJTIyQSUyMGNhciUyMik=",highlighted:`==Explanation from the agent==
I will use the following tools: \`image_generator\` to generate an image of a house, then \`image_generator\` to generate an image of a car.


==Code generated by the agent==
house_image = image_generator(prompt=&quot;A house&quot;)
car_image = image_generator(prompt=&quot;A car&quot;)`}}),be=new b({props:{code:"YWdlbnQucnVuKCUyMkNyZWF0ZSUyMGltYWdlJTNBJTIwJ0ElMjBob3VzZSUyMGFuZCUyMGNhciclMjIlMkMlMjByZXR1cm5fY29kZSUzRFRydWUp",highlighted:'agent.run(<span class="hljs-string">&quot;Create image: &#x27;A house and car&#x27;&quot;</span>, return_code=<span class="hljs-literal">True</span>)'}}),ge=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2wlM0ElMjAlNjBpbWFnZV9nZW5lcmF0b3IlNjAlMjB0byUyMGdlbmVyYXRlJTIwYW4lMjBpbWFnZS4lMEElMEElMEElM0QlM0RDb2RlJTIwZ2VuZXJhdGVkJTIwYnklMjB0aGUlMjBhZ2VudCUzRCUzRCUwQWltYWdlJTIwJTNEJTIwaW1hZ2VfZ2VuZXJhdG9yKHByb21wdCUzRCUyMkElMjBob3VzZSUyMGFuZCUyMGNhciUyMik=",highlighted:`==Explanation from the agent==
I will use the following tool: \`image_generator\` to generate an image.


==Code generated by the agent==
image = image_generator(prompt=&quot;A house and car&quot;)`}}),A=new $({props:{warning:!0,$$slots:{default:[_p]},$$scope:{ctx:U}}}),Je=new v({}),Ue=new b({props:{code:"dGVtcGxhdGUlMjAlM0QlMjAlMjIlMjIlMjIlMjAlNUIuLi4lNUQlMjAlMjIlMjIlMjIlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoeW91cl9lbmRwb2ludCUyQyUyMHJ1bl9wcm9tcHRfdGVtcGxhdGUlM0R0ZW1wbGF0ZSk=",highlighted:`template = <span class="hljs-string">&quot;&quot;&quot; [...] &quot;&quot;&quot;</span>

agent = HfAgent(your_endpoint, run_prompt_template=template)`}}),P=new $({props:{warning:!0,$$slots:{default:[Rp]},$$scope:{ctx:U}}}),$e=new b({props:{code:"SHVtYW4lM0ElMjAlM0MlM0N0YXNrJTNFJTNFJTBBJTBBQXNzaXN0YW50JTNB",highlighted:`Human: &lt;&lt;task&gt;&gt;

Assistant:`}}),Ze=new b({props:{code:"dGVtcGxhdGUlMjAlM0QlMjAlMjIlMjIlMjIlMjAlNUIuLi4lNUQlMjAlMjIlMjIlMjIlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQodXJsX2VuZHBvaW50JTNEeW91cl9lbmRwb2ludCUyQyUyMGNoYXRfcHJvbXB0X3RlbXBsYXRlJTNEdGVtcGxhdGUp",highlighted:`<span class="hljs-attr">template</span> = <span class="hljs-string">&quot;&quot;&quot; [...] &quot;&quot;&quot;</span>

<span class="hljs-attr">agent</span> = HfAgent(url_endpoint=your_endpoint, chat_prompt_template=template)`}}),K=new $({props:{warning:!0,$$slots:{default:[Yp]},$$scope:{ctx:U}}}),We=new v({}),He=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGxvYWRfdG9vbCUwQSUwQWNvbnRyb2xuZXRfdHJhbnNmb3JtZXIlMjAlM0QlMjBsb2FkX3Rvb2woJTIyZGlmZnVzZXJzJTJGY29udHJvbG5ldC1jYW5ueS10b29sJTIyKSUwQXVwc2NhbGVyJTIwJTNEJTIwbG9hZF90b29sKCUyMmRpZmZ1c2VycyUyRmxhdGVudC11cHNjYWxlci10b29sJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> load_tool

controlnet_transformer = load_tool(<span class="hljs-string">&quot;diffusers/controlnet-canny-tool&quot;</span>)
upscaler = load_tool(<span class="hljs-string">&quot;diffusers/latent-upscaler-tool&quot;</span>)`}}),Re=new b({props:{code:"cHJpbnQoZiUyMkRlc2NyaXB0aW9uJTNBJTIwJyU3QmNvbnRyb2xuZXRfdHJhbnNmb3JtZXIuZGVzY3JpcHRpb24lN0QnJTIyKSUwQXByaW50KGYlMjJOYW1lJTNBJTIwJyU3QmNvbnRyb2xuZXRfdHJhbnNmb3JtZXIubmFtZSU3RCclMjIp",highlighted:`<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Description: &#x27;<span class="hljs-subst">{controlnet_transformer.description}</span>&#x27;&quot;</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Name: &#x27;<span class="hljs-subst">{controlnet_transformer.name}</span>&#x27;&quot;</span>)`}}),Ne=new b({props:{code:"RGVzY3JpcHRpb24lM0ElMjAnVGhpcyUyMGlzJTIwYSUyMHRvb2wlMjB0aGF0JTIwdHJhbnNmb3JtcyUyMGFuJTIwaW1hZ2UlMjB3aXRoJTIwQ29udHJvbE5ldCUyMGFjY29yZGluZyUyMHRvJTIwYSUyMHByb21wdC4lMjAlMEFJdCUyMHRha2VzJTIwdHdvJTIwaW5wdXRzJTNBJTIwJTYwaW1hZ2UlNjAlMkMlMjB3aGljaCUyMHNob3VsZCUyMGJlJTIwdGhlJTIwaW1hZ2UlMjB0byUyMHRyYW5zZm9ybSUyQyUyMGFuZCUyMCU2MHByb21wdCU2MCUyQyUyMHdoaWNoJTIwc2hvdWxkJTIwYmUlMjB0aGUlMjBwcm9tcHQlMjB0byUyMHVzZSUyMHRvJTIwY2hhbmdlJTIwaXQuJTIwSXQlMjByZXR1cm5zJTIwdGhlJTIwbW9kaWZpZWQlMjBpbWFnZS4nJTBBTmFtZSUzQSUyMCdpbWFnZV90cmFuc2Zvcm1lcic=",highlighted:"Description: &#x27;This is a tool that transforms an image with ControlNet according to a prompt. \nIt takes two inputs: `image`, which should be the image to transform, and `prompt`, which should be the prompt to use to change it. It returns the modified image.&#x27;\nName: &#x27;image_transformer&#x27;"}}),Xe=new b({props:{code:"dG9vbHMlMjAlM0QlMjAlNUJjb250cm9sbmV0X3RyYW5zZm9ybWVyJTJDJTIwdXBzY2FsZXIlNUQlMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiUyQyUyMGFkZGl0aW9uYWxfdG9vbHMlM0R0b29scyk=",highlighted:`tools = [controlnet_transformer, upscaler]
agent = HfAgent(<span class="hljs-string">&quot;https://api-inference.huggingface.co/models/bigcode/starcoder&quot;</span>, additional_tools=tools)`}}),Ve=new b({props:{code:"aW1hZ2VfdHJhbnNmb3JtZXIlMjBoYXMlMjBiZWVuJTIwcmVwbGFjZWQlMjBieSUyMCUzQ3RyYW5zZm9ybWVyc19tb2R1bGVzLmRpZmZ1c2Vycy5jb250cm9sbmV0LWNhbm55LXRvb2wuYmQ3NjE4MmM3Nzc3ZWJhOTYxMmZjMDNjMCUwQTg3MThhNjBjMGFhNjMxMi5pbWFnZV90cmFuc2Zvcm1hdGlvbi5Db250cm9sTmV0VHJhbnNmb3JtYXRpb25Ub29sJTIwb2JqZWN0JTIwYXQlMjAweDdmMWQzYmZhM2EwMCUzRSUyMGFzJTIwcHJvdmlkZWQlMjBpbiUyMCU2MGFkZGl0aW9uYWxfdG9vbHMlNjA=",highlighted:"image_transformer has been replaced by &lt;transformers_modules.diffusers.controlnet-canny-tool.bd76182c7777eba9612fc03c0\n8718a60c0aa6312.image_transformation.ControlNetTransformationTool object at 0x7f1d3bfa3a00&gt; as provided in `additional_tools`"}}),O=new $({props:{$$slots:{default:[Np]},$$scope:{ctx:U}}}),ze=new b({props:{code:"cHJpbnQoJTIyJTVDbiUyMi5qb2luKCU1QmYlMjItJTIwJTdCYSU3RCUyMiUyMGZvciUyMGElMjBpbiUyMGFnZW50LnRvb2xib3gua2V5cygpJTVEKSk=",highlighted:'<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;\\n&quot;</span>.join([<span class="hljs-string">f&quot;- <span class="hljs-subst">{a}</span>&quot;</span> <span class="hljs-keyword">for</span> a <span class="hljs-keyword">in</span> agent.toolbox.keys()]))'}}),qe=new b({props:{code:"LSUyMGRvY3VtZW50X3FhJTBBLSUyMGltYWdlX2NhcHRpb25lciUwQS0lMjBpbWFnZV9xYSUwQS0lMjBpbWFnZV9zZWdtZW50ZXIlMEEtJTIwdHJhbnNjcmliZXIlMEEtJTIwc3VtbWFyaXplciUwQS0lMjB0ZXh0X2NsYXNzaWZpZXIlMEEtJTIwdGV4dF9xYSUwQS0lMjB0ZXh0X3JlYWRlciUwQS0lMjB0cmFuc2xhdG9yJTBBLSUyMGltYWdlX3RyYW5zZm9ybWVyJTBBLSUyMHRleHRfZG93bmxvYWRlciUwQS0lMjBpbWFnZV9nZW5lcmF0b3IlMEEtJTIwdmlkZW9fZ2VuZXJhdG9yJTBBLSUyMGltYWdlX3Vwc2NhbGVy",highlighted:`- document_qa
- image_captioner
- image_qa
- image_segmenter
- transcriber
- summarizer
- text_classifier
- text_qa
- text_reader
- translator
- image_transformer
- text_downloader
- image_generator
- video_generator
- image_upscaler`}}),Pe=new b({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEFpbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGdHJhbnNmb3JtZXJzJTJGcml2ZXJzX2FuZF9sYWtlcy5wbmclMjIlMEEp",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

image = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes.png&quot;</span>
)`}}),Oe=new b({props:{code:"aW1hZ2UlMjAlM0QlMjBhZ2VudC5ydW4oJTIyVHJhbnNmb3JtJTIwdGhlJTIwaW1hZ2UlM0ElMjAnQSUyMGZyb3plbiUyMGxha2UlMjBhbmQlMjBzbm93eSUyMGZvcmVzdCclMjIlMkMlMjBpbWFnZSUzRGltYWdlKQ==",highlighted:'image = agent.run(<span class="hljs-string">&quot;Transform the image: &#x27;A frozen lake and snowy forest&#x27;&quot;</span>, image=image)'}}),tl=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2wlM0ElMjAlNjBpbWFnZV90cmFuc2Zvcm1lciU2MCUyMHRvJTIwdHJhbnNmb3JtJTIwdGhlJTIwaW1hZ2UuJTBBJTBBJTBBJTNEJTNEQ29kZSUyMGdlbmVyYXRlZCUyMGJ5JTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFpbWFnZSUyMCUzRCUyMGltYWdlX3RyYW5zZm9ybWVyKGltYWdlJTJDJTIwcHJvbXB0JTNEJTIyQSUyMGZyb3plbiUyMGxha2UlMjBhbmQlMjBzbm93eSUyMGZvcmVzdCUyMik=",highlighted:`==Explanation from the agent==
I will use the following tool: \`image_transformer\` to transform the image.


==Code generated by the agent==
image = image_transformer(image, prompt=&quot;A frozen lake and snowy forest&quot;)`}}),nl=new b({props:{code:"aW1hZ2UlMjAlM0QlMjBhZ2VudC5ydW4oJTIyVXBzY2FsZSUyMHRoZSUyMGltYWdlJTIyJTJDJTIwaW1hZ2Up",highlighted:'image = agent.run(<span class="hljs-string">&quot;Upscale the image&quot;</span>, image)'}}),ol=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2wlM0ElMjAlNjBpbWFnZV91cHNjYWxlciU2MCUyMHRvJTIwdXBzY2FsZSUyMHRoZSUyMGltYWdlLiUwQSUwQSUwQSUzRCUzRENvZGUlMjBnZW5lcmF0ZWQlMjBieSUyMHRoZSUyMGFnZW50JTNEJTNEJTBBdXBzY2FsZWRfaW1hZ2UlMjAlM0QlMjBpbWFnZV91cHNjYWxlcihpbWFnZSk=",highlighted:`==Explanation from the agent==
I will use the following tool: \`image_upscaler\` to upscale the image.


==Code generated by the agent==
upscaled_image = image_upscaler(image)`}}),rl=new v({}),hl=new v({}),dl=new b({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxpc3RfbW9kZWxzJTBBJTBBdGFzayUyMCUzRCUyMCUyMnRleHQtY2xhc3NpZmljYXRpb24lMjIlMEElMEFtb2RlbCUyMCUzRCUyMG5leHQoaXRlcihsaXN0X21vZGVscyhmaWx0ZXIlM0R0YXNrJTJDJTIwc29ydCUzRCUyMmRvd25sb2FkcyUyMiUyQyUyMGRpcmVjdGlvbiUzRC0xKSkpJTBBcHJpbnQobW9kZWwuaWQp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> list_models

task = <span class="hljs-string">&quot;text-classification&quot;</span>

model = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(list_models(<span class="hljs-built_in">filter</span>=task, sort=<span class="hljs-string">&quot;downloads&quot;</span>, direction=-<span class="hljs-number">1</span>)))
<span class="hljs-built_in">print</span>(model.<span class="hljs-built_in">id</span>)`}}),yl=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2wlMEElMEElMEFjbGFzcyUyMEhGTW9kZWxEb3dubG9hZHNUb29sKFRvb2wpJTNBJTBBJTIwJTIwJTIwJTIwcGFzcw==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Tool


<span class="hljs-keyword">class</span> <span class="hljs-title class_">HFModelDownloadsTool</span>(<span class="hljs-title class_ inherited__">Tool</span>):
    <span class="hljs-keyword">pass</span>`}}),gl=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2wlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwbGlzdF9tb2RlbHMlMEElMEElMEFjbGFzcyUyMEhGTW9kZWxEb3dubG9hZHNUb29sKFRvb2wpJTNBJTBBJTIwJTIwJTIwJTIwbmFtZSUyMCUzRCUyMCUyMm1vZGVsX2Rvd25sb2FkX2NvdW50ZXIlMjIlMEElMjAlMjAlMjAlMjBkZXNjcmlwdGlvbiUyMCUzRCUyMCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJUaGlzJTIwaXMlMjBhJTIwdG9vbCUyMHRoYXQlMjByZXR1cm5zJTIwdGhlJTIwbW9zdCUyMGRvd25sb2FkZWQlMjBtb2RlbCUyMG9mJTIwYSUyMGdpdmVuJTIwdGFzayUyMG9uJTIwdGhlJTIwSHVnZ2luZyUyMEZhY2UlMjBIdWIuJTIwJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIySXQlMjB0YWtlcyUyMHRoZSUyMG5hbWUlMjBvZiUyMHRoZSUyMGNhdGVnb3J5JTIwKHN1Y2glMjBhcyUyMHRleHQtY2xhc3NpZmljYXRpb24lMkMlMjBkZXB0aC1lc3RpbWF0aW9uJTJDJTIwZXRjKSUyQyUyMGFuZCUyMCUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJldHVybnMlMjB0aGUlMjBuYW1lJTIwb2YlMjB0aGUlMjBjaGVja3BvaW50LiUyMiUwQSUyMCUyMCUyMCUyMCklMEElMEElMjAlMjAlMjAlMjBpbnB1dHMlMjAlM0QlMjAlNUIlMjJ0ZXh0JTIyJTVEJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMCU1QiUyMnRleHQlMjIlNUQlMEElMEElMjAlMjAlMjAlMjBkZWYlMjBfX2NhbGxfXyhzZWxmJTJDJTIwdGFzayUzQSUyMHN0ciklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2RlbCUyMCUzRCUyMG5leHQoaXRlcihsaXN0X21vZGVscyhmaWx0ZXIlM0R0YXNrJTJDJTIwc29ydCUzRCUyMmRvd25sb2FkcyUyMiUyQyUyMGRpcmVjdGlvbiUzRC0xKSkpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwbW9kZWwuaWQ=",highlighted:`<span class="hljs-keyword">from</span> transformers <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_">HFModelDownloadsTool</span>(<span class="hljs-title class_ inherited__">Tool</span>):
    name = <span class="hljs-string">&quot;model_download_counter&quot;</span>
    description = (
        <span class="hljs-string">&quot;This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. &quot;</span>
        <span class="hljs-string">&quot;It takes the name of the category (such as text-classification, depth-estimation, etc), and &quot;</span>
        <span class="hljs-string">&quot;returns the name of the checkpoint.&quot;</span>
    )

    inputs = [<span class="hljs-string">&quot;text&quot;</span>]
    outputs = [<span class="hljs-string">&quot;text&quot;</span>]

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, task: <span class="hljs-built_in">str</span></span>):
        model = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(list_models(<span class="hljs-built_in">filter</span>=task, sort=<span class="hljs-string">&quot;downloads&quot;</span>, direction=-<span class="hljs-number">1</span>)))
        <span class="hljs-keyword">return</span> model.<span class="hljs-built_in">id</span>`}}),Tl=new b({props:{code:"ZnJvbSUyMG1vZGVsX2Rvd25sb2FkcyUyMGltcG9ydCUyMEhGTW9kZWxEb3dubG9hZHNUb29sJTBBJTBBdG9vbCUyMCUzRCUyMEhGTW9kZWxEb3dubG9hZHNUb29sKCk=",highlighted:`<span class="hljs-keyword">from</span> model_downloads <span class="hljs-keyword">import</span> HFModelDownloadsTool

tool = HFModelDownloadsTool()`}}),vl=new b({props:{code:"dG9vbC5wdXNoX3RvX2h1YiglMjJoZi1tb2RlbC1kb3dubG9hZHMlMjIp",highlighted:'tool.push_to_hub(<span class="hljs-string">&quot;hf-model-downloads&quot;</span>)'}}),jl=new v({}),Gl=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGxvYWRfdG9vbCUwQSUwQXRvb2wlMjAlM0QlMjBsb2FkX3Rvb2woJTIybHlzYW5kcmUlMkZoZi1tb2RlbC1kb3dubG9hZHMlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> load_tool

tool = load_tool(<span class="hljs-string">&quot;lysandre/hf-model-downloads&quot;</span>)`}}),Il=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEhmQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiUyQyUyMGFkZGl0aW9uYWxfdG9vbHMlM0QlNUJ0b29sJTVEKSUwQSUwQWFnZW50LnJ1biglMEElMjAlMjAlMjAlMjAlMjJDYW4lMjB5b3UlMjByZWFkJTIwb3V0JTIwbG91ZCUyMHRoZSUyMG5hbWUlMjBvZiUyMHRoZSUyMG1vZGVsJTIwdGhhdCUyMGhhcyUyMHRoZSUyMG1vc3QlMjBkb3dubG9hZHMlMjBpbiUyMHRoZSUyMCd0ZXh0LXRvLXZpZGVvJyUyMHRhc2slMjBvbiUyMHRoZSUyMEh1Z2dpbmclMjBGYWNlJTIwSHViJTNGJTIyJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> HfAgent

agent = HfAgent(<span class="hljs-string">&quot;https://api-inference.huggingface.co/models/bigcode/starcoder&quot;</span>, additional_tools=[tool])

agent.run(
    <span class="hljs-string">&quot;Can you read out loud the name of the model that has the most downloads in the &#x27;text-to-video&#x27; task on the Hugging Face Hub?&quot;</span>
)`}}),Bl=new b({props:{code:"JTNEJTNEQ29kZSUyMGdlbmVyYXRlZCUyMGJ5JTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFtb2RlbCUyMCUzRCUyMG1vZGVsX2Rvd25sb2FkX2NvdW50ZXIodGFzayUzRCUyMnRleHQtdG8tdmlkZW8lMjIpJTBBcHJpbnQoZiUyMlRoZSUyMG1vZGVsJTIwd2l0aCUyMHRoZSUyMG1vc3QlMjBkb3dubG9hZHMlMjBpcyUyMCU3Qm1vZGVsJTdELiUyMiklMEFhdWRpb19tb2RlbCUyMCUzRCUyMHRleHRfcmVhZGVyKG1vZGVsKSUwQSUwQSUwQSUzRCUzRFJlc3VsdCUzRCUzRCUwQVRoZSUyMG1vZGVsJTIwd2l0aCUyMHRoZSUyMG1vc3QlMjBkb3dubG9hZHMlMjBpcyUyMGRhbW8tdmlsYWIlMkZ0ZXh0LXRvLXZpZGVvLW1zLTEuN2Iu",highlighted:`==Code generated by the agent==
model = model_download_counter(task=&quot;text-to-video&quot;)
print(f&quot;The model with the most downloads is {model}.&quot;)
audio_model = text_reader(model)


==Result==
The model with the most downloads is damo-vilab/text-to-video-ms-1.7b.`}}),nt=new $({props:{$$slots:{default:[Ep]},$$scope:{ctx:U}}}),Hl=new v({}),Rl=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEhmQWdlbnQlMkMlMjBsb2FkX3Rvb2wlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiklMEFhZ2VudC50b29sYm94JTVCJTIyaW1hZ2UtdHJhbnNmb3JtYXRpb24lMjIlNUQlMjAlM0QlMjBsb2FkX3Rvb2woJTIyZGlmZnVzZXJzJTJGY29udHJvbG5ldC1jYW5ueS10b29sJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> HfAgent, load_tool

agent = HfAgent(<span class="hljs-string">&quot;https://api-inference.huggingface.co/models/bigcode/starcoder&quot;</span>)
agent.toolbox[<span class="hljs-string">&quot;image-transformation&quot;</span>] = load_tool(<span class="hljs-string">&quot;diffusers/controlnet-canny-tool&quot;</span>)`}}),at=new $({props:{$$slots:{default:[Xp]},$$scope:{ctx:U}}}),Yl=new v({}),Ql=new b({props:{code:"ZnJvbSUyMGdyYWRpb190b29scyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblByb21wdEdlbmVyYXRvclRvb2wlMEElMEFncmFkaW9fdG9vbCUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblByb21wdEdlbmVyYXRvclRvb2woKQ==",highlighted:`<span class="hljs-keyword">from</span> gradio_tools <span class="hljs-keyword">import</span> StableDiffusionPromptGeneratorTool

gradio_tool = StableDiffusionPromptGeneratorTool()`}}),Sl=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2wlMEElMEF0b29sJTIwJTNEJTIwVG9vbC5mcm9tX2dyYWRpbyhncmFkaW9fdG9vbCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Tool

tool = Tool.from_gradio(gradio_tool)`}}),zl=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEhmQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiUyQyUyMGFkZGl0aW9uYWxfdG9vbHMlM0QlNUJ0b29sJTVEKSUwQSUwQWFnZW50LnJ1biglMjJHZW5lcmF0ZSUyMGFuJTIwaW1hZ2UlMjBvZiUyMHRoZSUyMCU2MHByb21wdCU2MCUyMGFmdGVyJTIwaW1wcm92aW5nJTIwaXQuJTIyJTJDJTIwcHJvbXB0JTNEJTIyQSUyMHJhYmJpdCUyMHdlYXJpbmclMjBhJTIwc3BhY2UlMjBzdWl0JTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> HfAgent

agent = HfAgent(<span class="hljs-string">&quot;https://api-inference.huggingface.co/models/bigcode/starcoder&quot;</span>, additional_tools=[tool])

agent.run(<span class="hljs-string">&quot;Generate an image of the \`prompt\` after improving it.&quot;</span>, prompt=<span class="hljs-string">&quot;A rabbit wearing a space suit&quot;</span>)`}}),Al=new b({props:{code:"JTNEJTNERXhwbGFuYXRpb24lMjBmcm9tJTIwdGhlJTIwYWdlbnQlM0QlM0QlMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMCUyMHRvb2xzJTNBJTIwJTYwU3RhYmxlRGlmZnVzaW9uUHJvbXB0R2VuZXJhdG9yJTYwJTIwdG8lMjBpbXByb3ZlJTIwdGhlJTIwcHJvbXB0JTJDJTIwdGhlbiUyMCU2MGltYWdlX2dlbmVyYXRvciU2MCUyMHRvJTIwZ2VuZXJhdGUlMjBhbiUyMGltYWdlJTIwYWNjb3JkaW5nJTIwdG8lMjB0aGUlMjBpbXByb3ZlZCUyMHByb21wdC4lMEElMEElMEElM0QlM0RDb2RlJTIwZ2VuZXJhdGVkJTIwYnklMjB0aGUlMjBhZ2VudCUzRCUzRCUwQWltcHJvdmVkX3Byb21wdCUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblByb21wdEdlbmVyYXRvcihwcm9tcHQpJTBBcHJpbnQoZiUyMlRoZSUyMGltcHJvdmVkJTIwcHJvbXB0JTIwaXMlMjAlN0JpbXByb3ZlZF9wcm9tcHQlN0QuJTIyKSUwQWltYWdlJTIwJTNEJTIwaW1hZ2VfZ2VuZXJhdG9yKGltcHJvdmVkX3Byb21wdCk=",highlighted:`==Explanation from the agent==
I will use the following  tools: \`StableDiffusionPromptGenerator\` to improve the prompt, then \`image_generator\` to generate an image according to the improved prompt.


==Code generated by the agent==
improved_prompt = StableDiffusionPromptGenerator(prompt)
print(f&quot;The improved prompt is {improved_prompt}.&quot;)
image = image_generator(improved_prompt)`}}),it=new $({props:{warning:!0,$$slots:{default:[Qp]},$$scope:{ctx:U}}}),Pl=new v({}),{c(){p=s("meta"),J=o(),y=s("p"),T=o(),Z=s("h1"),E=s("a"),bn=s("span"),h(pt.$$.fragment),Os=o(),on=s("span"),on.textContent=ui,Nn=o(),h(X.$$.fragment),En=o(),h(Q.$$.fragment),Xn=o(),ht=s("p"),ht.textContent=di,Qn=o(),mt=s("ul"),mt.innerHTML=Mi,Vn=o(),G=s("h2"),V=s("a"),gn=s("span"),h(ut.$$.fragment),ti=o(),an=s("span"),an.textContent=ci,Sn=o(),dt=s("p"),dt.innerHTML=yi,Fn=o(),C=s("h3"),S=s("a"),Jn=s("span"),h(Mt.$$.fragment),ei=o(),sn=s("span"),sn.textContent=wi,zn=o(),ct=s("p"),ct.textContent=fi,qn=o(),yt=s("ul"),yt.innerHTML=bi,An=o(),wt=s("p"),wt.innerHTML=gi,Ln=o(),h(ft.$$.fragment),Pn=o(),bt=s("p"),bt.innerHTML=Ji,Kn=o(),gt=s("p"),gt.innerHTML=Ti,Dn=o(),h(Jt.$$.fragment),On=o(),Tt=s("p"),Tt.textContent=Ui,to=o(),h(Ut.$$.fragment),eo=o(),vt=s("p"),vt.textContent=vi,lo=o(),h($t.$$.fragment),no=o(),jt=s("p"),jt.textContent=$i,oo=o(),Zt=s("p"),Zt.textContent=ji,ao=o(),h(F.$$.fragment),so=o(),Gt=s("p"),Gt.textContent=Zi,io=o(),Ct=s("p"),Ct.textContent=Gi,ro=o(),h(It.$$.fragment),po=o(),Wt=s("p"),Wt.textContent=Ci,ho=o(),Bt=s("p"),Bt.innerHTML=Ii,mo=o(),xt=s("p"),xt.textContent=Wi,uo=o(),h(kt.$$.fragment),Mo=o(),Ht=s("p"),Ht.textContent=Bi,co=o(),h(_t.$$.fragment),yo=o(),Rt=s("p"),Rt.innerHTML=xi,wo=o(),Yt=s("p"),Yt.innerHTML=ki,fo=o(),h(Nt.$$.fragment),bo=o(),Et=s("p"),Et.innerHTML=Hi,go=o(),Xt=s("p"),Xt.innerHTML=_i,Jo=o(),h(Qt.$$.fragment),To=o(),Vt=s("p"),Vt.innerHTML=Ri,Uo=o(),St=s("p"),St.textContent=Yi,vo=o(),I=s("h3"),z=s("a"),Tn=s("span"),h(Ft.$$.fragment),li=o(),rn=s("span"),rn.textContent=Ni,$o=o(),zt=s("p"),zt.textContent=Ei,jo=o(),qt=s("p"),qt.textContent=Xi,Zo=o(),h(At.$$.fragment),Go=o(),Lt=s("p"),Lt.textContent=Qi,Co=o(),h(Pt.$$.fragment),Io=o(),Kt=s("p"),Kt.textContent=Vi,Wo=o(),h(Dt.$$.fragment),Bo=o(),h(Ot.$$.fragment),xo=o(),te=s("p"),te.textContent=Si,ko=o(),h(ee.$$.fragment),Ho=o(),le=s("p"),le.textContent=Fi,_o=o(),h(ne.$$.fragment),Ro=o(),oe=s("p"),oe.textContent=zi,Yo=o(),W=s("h3"),q=s("a"),Un=s("span"),h(ae.$$.fragment),ni=o(),pn=s("span"),pn.textContent=qi,No=o(),se=s("p"),se.innerHTML=Ai,Eo=o(),ie=s("p"),ie.innerHTML=Li,Xo=o(),h(re.$$.fragment),Qo=o(),pe=s("p"),pe.textContent=Pi,Vo=o(),h(he.$$.fragment),So=o(),me=s("p"),me.innerHTML=Ki,Fo=o(),ue=s("p"),ue.innerHTML=Di,zo=o(),h(de.$$.fragment),qo=o(),Me=s("p"),Me.textContent=Oi,Ao=o(),h(ce.$$.fragment),Lo=o(),ye=s("p"),ye.textContent=tr,Po=o(),h(we.$$.fragment),Ko=o(),fe=s("p"),fe.textContent=er,Do=o(),h(be.$$.fragment),Oo=o(),h(ge.$$.fragment),ta=o(),h(A.$$.fragment),ea=o(),B=s("h3"),L=s("a"),vn=s("span"),h(Je.$$.fragment),oi=o(),hn=s("span"),hn.textContent=lr,la=o(),Te=s("p"),Te.innerHTML=nr,na=o(),h(Ue.$$.fragment),oa=o(),h(P.$$.fragment),aa=o(),ve=s("p"),ve.innerHTML=or,sa=o(),h($e.$$.fragment),ia=o(),je=s("p"),je.innerHTML=ar,ra=o(),h(Ze.$$.fragment),pa=o(),h(K.$$.fragment),ha=o(),Ge=s("p"),Ge.innerHTML=sr,ma=o(),Ce=s("p"),Ce.textContent=ir,ua=o(),Ie=s("ul"),Ie.innerHTML=rr,da=o(),x=s("h2"),D=s("a"),$n=s("span"),h(We.$$.fragment),ai=o(),mn=s("span"),mn.textContent=pr,Ma=o(),Be=s("p"),Be.textContent=hr,ca=o(),xe=s("ul"),xe.innerHTML=mr,ya=o(),ke=s("p"),ke.innerHTML=ur,wa=o(),h(He.$$.fragment),fa=o(),_e=s("p"),_e.innerHTML=dr,ba=o(),h(Re.$$.fragment),ga=o(),Ye=s("p"),Ye.textContent=Mr,Ja=o(),h(Ne.$$.fragment),Ta=o(),Ee=s("p"),Ee.innerHTML=cr,Ua=o(),h(Xe.$$.fragment),va=o(),Qe=s("p"),Qe.textContent=yr,$a=o(),h(Ve.$$.fragment),ja=o(),Se=s("p"),Se.innerHTML=wr,Za=o(),h(O.$$.fragment),Ga=o(),Fe=s("p"),Fe.innerHTML=fr,Ca=o(),h(ze.$$.fragment),Ia=o(),h(qe.$$.fragment),Wa=o(),Ae=s("p"),Ae.innerHTML=br,Ba=o(),Le=s("p"),Le.innerHTML=gr,xa=o(),h(Pe.$$.fragment),ka=o(),Ke=s("img"),Ha=o(),De=s("p"),De.textContent=Tr,_a=o(),h(Oe.$$.fragment),Ra=o(),h(tl.$$.fragment),Ya=o(),el=s("img"),Na=o(),ll=s("p"),ll.textContent=vr,Ea=o(),h(nl.$$.fragment),Xa=o(),h(ol.$$.fragment),Qa=o(),al=s("img"),Va=o(),sl=s("p"),sl.textContent=jr,Sa=o(),il=s("p"),il.textContent=Zr,Fa=o(),k=s("h3"),tt=s("a"),jn=s("span"),h(rl.$$.fragment),si=o(),un=s("span"),un.textContent=Gr,za=o(),pl=s("p"),pl.textContent=Cr,qa=o(),H=s("h4"),et=s("a"),Zn=s("span"),h(hl.$$.fragment),ii=o(),dn=s("span"),dn.textContent=Ir,Aa=o(),ml=s("p"),ml.textContent=Wr,La=o(),ul=s("p"),ul.textContent=Br,Pa=o(),h(dl.$$.fragment),Ka=o(),Ml=s("p"),Ml.innerHTML=xr,Da=o(),cl=s("p"),cl.innerHTML=kr,Oa=o(),h(yl.$$.fragment),ts=o(),wl=s("p"),wl.textContent=Hr,es=o(),fl=s("ul"),fl.innerHTML=_r,ls=o(),bl=s("p"),bl.textContent=Rr,ns=o(),h(gl.$$.fragment),os=o(),Jl=s("p"),Jl.innerHTML=Yr,as=o(),h(Tl.$$.fragment),ss=o(),Ul=s("p"),Ul.innerHTML=Nr,is=o(),h(vl.$$.fragment),rs=o(),$l=s("p"),$l.textContent=Er,ps=o(),_=s("h4"),lt=s("a"),Gn=s("span"),h(jl.$$.fragment),ri=o(),Mn=s("span"),Mn.textContent=Xr,hs=o(),Zl=s("p"),Zl.textContent=Qr,ms=o(),h(Gl.$$.fragment),us=o(),Cl=s("p"),Cl.innerHTML=Vr,ds=o(),h(Il.$$.fragment),Ms=o(),Wl=s("p"),Wl.textContent=Sr,cs=o(),h(Bl.$$.fragment),ys=o(),xl=s("p"),xl.textContent=Fr,ws=o(),kl=s("table"),kl.innerHTML=zr,fs=o(),h(nt.$$.fragment),bs=o(),R=s("h3"),ot=s("a"),Cn=s("span"),h(Hl.$$.fragment),pi=o(),cn=s("span"),cn.textContent=qr,gs=o(),_l=s("p"),_l.textContent=Ar,Js=o(),h(Rl.$$.fragment),Ts=o(),h(at.$$.fragment),Us=o(),Y=s("h2"),st=s("a"),In=s("span"),h(Yl.$$.fragment),hi=o(),yn=s("span"),yn.textContent=Lr,vs=o(),Nl=s("p"),Nl.innerHTML=Pr,$s=o(),El=s("p"),El.innerHTML=Kr,js=o(),Xl=s("p"),Xl.innerHTML=Dr,Zs=o(),h(Ql.$$.fragment),Gs=o(),Vl=s("p"),Vl.innerHTML=Or,Cs=o(),h(Sl.$$.fragment),Is=o(),Fl=s("p"),Fl.innerHTML=tp,Ws=o(),h(zl.$$.fragment),Bs=o(),ql=s("p"),ql.textContent=ep,xs=o(),h(Al.$$.fragment),ks=o(),Ll=s("p"),Ll.textContent=lp,Hs=o(),wn=s("img"),_s=o(),h(it.$$.fragment),Rs=o(),N=s("h2"),rt=s("a"),Wn=s("span"),h(Pl.$$.fragment),mi=o(),fn=s("span"),fn.textContent=op,Ys=o(),Kl=s("p"),Kl.innerHTML=ap,Ns=o(),Dl=s("p"),Dl.textContent=sp,Es=o(),Ol=s("p"),Ol.innerHTML=ip,Xs=o(),Bn=s("p"),this.h()},l(t){const e=Bp("svelte-1phssyn",document.head);p=i(e,"META",{name:!0,content:!0}),e.forEach(l),J=a(t),y=i(t,"P",{}),g(y).forEach(l),T=a(t),Z=i(t,"H1",{class:!0});var tn=g(Z);E=i(tn,"A",{id:!0,class:!0,href:!0});var xn=g(E);bn=i(xn,"SPAN",{});var kn=g(bn);m(pt.$$.fragment,kn),kn.forEach(l),xn.forEach(l),Os=a(tn),on=i(tn,"SPAN",{"data-svelte-h":!0}),r(on)!=="svelte-1n8s9i7"&&(on.textContent=ui),tn.forEach(l),Nn=a(t),m(X.$$.fragment,t),En=a(t),m(Q.$$.fragment,t),Xn=a(t),ht=i(t,"P",{"data-svelte-h":!0}),r(ht)!=="svelte-1qhojy7"&&(ht.textContent=di),Qn=a(t),mt=i(t,"UL",{"data-svelte-h":!0}),r(mt)!=="svelte-1e2yd7f"&&(mt.innerHTML=Mi),Vn=a(t),G=i(t,"H2",{class:!0});var en=g(G);V=i(en,"A",{id:!0,class:!0,href:!0});var Hn=g(V);gn=i(Hn,"SPAN",{});var _n=g(gn);m(ut.$$.fragment,_n),_n.forEach(l),Hn.forEach(l),ti=a(en),an=i(en,"SPAN",{"data-svelte-h":!0}),r(an)!=="svelte-1r8yyh0"&&(an.textContent=ci),en.forEach(l),Sn=a(t),dt=i(t,"P",{"data-svelte-h":!0}),r(dt)!=="svelte-kvp0za"&&(dt.innerHTML=yi),Fn=a(t),C=i(t,"H3",{class:!0});var ln=g(C);S=i(ln,"A",{id:!0,class:!0,href:!0});var Rn=g(S);Jn=i(Rn,"SPAN",{});var Yn=g(Jn);m(Mt.$$.fragment,Yn),Yn.forEach(l),Rn.forEach(l),ei=a(ln),sn=i(ln,"SPAN",{"data-svelte-h":!0}),r(sn)!=="svelte-1266kbm"&&(sn.textContent=wi),ln.forEach(l),zn=a(t),ct=i(t,"P",{"data-svelte-h":!0}),r(ct)!=="svelte-rii2rm"&&(ct.textContent=fi),qn=a(t),yt=i(t,"UL",{"data-svelte-h":!0}),r(yt)!=="svelte-1s06fus"&&(yt.innerHTML=bi),An=a(t),wt=i(t,"P",{"data-svelte-h":!0}),r(wt)!=="svelte-1fvzc7b"&&(wt.innerHTML=gi),Ln=a(t),m(ft.$$.fragment,t),Pn=a(t),bt=i(t,"P",{"data-svelte-h":!0}),r(bt)!=="svelte-1wu3o2u"&&(bt.innerHTML=Ji),Kn=a(t),gt=i(t,"P",{"data-svelte-h":!0}),r(gt)!=="svelte-w2lme7"&&(gt.innerHTML=Ti),Dn=a(t),m(Jt.$$.fragment,t),On=a(t),Tt=i(t,"P",{"data-svelte-h":!0}),r(Tt)!=="svelte-1aanlkj"&&(Tt.textContent=Ui),to=a(t),m(Ut.$$.fragment,t),eo=a(t),vt=i(t,"P",{"data-svelte-h":!0}),r(vt)!=="svelte-1h8i6v1"&&(vt.textContent=vi),lo=a(t),m($t.$$.fragment,t),no=a(t),jt=i(t,"P",{"data-svelte-h":!0}),r(jt)!=="svelte-gnycp5"&&(jt.textContent=$i),oo=a(t),Zt=i(t,"P",{"data-svelte-h":!0}),r(Zt)!=="svelte-1l25cn1"&&(Zt.textContent=ji),ao=a(t),m(F.$$.fragment,t),so=a(t),Gt=i(t,"P",{"data-svelte-h":!0}),r(Gt)!=="svelte-pd6qvf"&&(Gt.textContent=Zi),io=a(t),Ct=i(t,"P",{"data-svelte-h":!0}),r(Ct)!=="svelte-19wuaq2"&&(Ct.textContent=Gi),ro=a(t),m(It.$$.fragment,t),po=a(t),Wt=i(t,"P",{"data-svelte-h":!0}),r(Wt)!=="svelte-137b6p5"&&(Wt.textContent=Ci),ho=a(t),Bt=i(t,"P",{"data-svelte-h":!0}),r(Bt)!=="svelte-15tb3lk"&&(Bt.innerHTML=Ii),mo=a(t),xt=i(t,"P",{"data-svelte-h":!0}),r(xt)!=="svelte-1wj8rg1"&&(xt.textContent=Wi),uo=a(t),m(kt.$$.fragment,t),Mo=a(t),Ht=i(t,"P",{"data-svelte-h":!0}),r(Ht)!=="svelte-1utp6i7"&&(Ht.textContent=Bi),co=a(t),m(_t.$$.fragment,t),yo=a(t),Rt=i(t,"P",{"data-svelte-h":!0}),r(Rt)!=="svelte-1ff76an"&&(Rt.innerHTML=xi),wo=a(t),Yt=i(t,"P",{"data-svelte-h":!0}),r(Yt)!=="svelte-b48t6"&&(Yt.innerHTML=ki),fo=a(t),m(Nt.$$.fragment,t),bo=a(t),Et=i(t,"P",{"data-svelte-h":!0}),r(Et)!=="svelte-1dwkh6"&&(Et.innerHTML=Hi),go=a(t),Xt=i(t,"P",{"data-svelte-h":!0}),r(Xt)!=="svelte-reah3c"&&(Xt.innerHTML=_i),Jo=a(t),m(Qt.$$.fragment,t),To=a(t),Vt=i(t,"P",{"data-svelte-h":!0}),r(Vt)!=="svelte-e0mebg"&&(Vt.innerHTML=Ri),Uo=a(t),St=i(t,"P",{"data-svelte-h":!0}),r(St)!=="svelte-3wcpkg"&&(St.textContent=Yi),vo=a(t),I=i(t,"H3",{class:!0});var nn=g(I);z=i(nn,"A",{id:!0,class:!0,href:!0});var rp=g(z);Tn=i(rp,"SPAN",{});var pp=g(Tn);m(Ft.$$.fragment,pp),pp.forEach(l),rp.forEach(l),li=a(nn),rn=i(nn,"SPAN",{"data-svelte-h":!0}),r(rn)!=="svelte-9pmzje"&&(rn.textContent=Ni),nn.forEach(l),$o=a(t),zt=i(t,"P",{"data-svelte-h":!0}),r(zt)!=="svelte-1dybovb"&&(zt.textContent=Ei),jo=a(t),qt=i(t,"P",{"data-svelte-h":!0}),r(qt)!=="svelte-z3kpmt"&&(qt.textContent=Xi),Zo=a(t),m(At.$$.fragment,t),Go=a(t),Lt=i(t,"P",{"data-svelte-h":!0}),r(Lt)!=="svelte-1b883kw"&&(Lt.textContent=Qi),Co=a(t),m(Pt.$$.fragment,t),Io=a(t),Kt=i(t,"P",{"data-svelte-h":!0}),r(Kt)!=="svelte-1bazuf7"&&(Kt.textContent=Vi),Wo=a(t),m(Dt.$$.fragment,t),Bo=a(t),m(Ot.$$.fragment,t),xo=a(t),te=i(t,"P",{"data-svelte-h":!0}),r(te)!=="svelte-b01ut5"&&(te.textContent=Si),ko=a(t),m(ee.$$.fragment,t),Ho=a(t),le=i(t,"P",{"data-svelte-h":!0}),r(le)!=="svelte-1b883kw"&&(le.textContent=Fi),_o=a(t),m(ne.$$.fragment,t),Ro=a(t),oe=i(t,"P",{"data-svelte-h":!0}),r(oe)!=="svelte-4ez52l"&&(oe.textContent=zi),Yo=a(t),W=i(t,"H3",{class:!0});var Vs=g(W);q=i(Vs,"A",{id:!0,class:!0,href:!0});var hp=g(q);Un=i(hp,"SPAN",{});var mp=g(Un);m(ae.$$.fragment,mp),mp.forEach(l),hp.forEach(l),ni=a(Vs),pn=i(Vs,"SPAN",{"data-svelte-h":!0}),r(pn)!=="svelte-19bm8dh"&&(pn.textContent=qi),Vs.forEach(l),No=a(t),se=i(t,"P",{"data-svelte-h":!0}),r(se)!=="svelte-8ifc9z"&&(se.innerHTML=Ai),Eo=a(t),ie=i(t,"P",{"data-svelte-h":!0}),r(ie)!=="svelte-1oywuvq"&&(ie.innerHTML=Li),Xo=a(t),m(re.$$.fragment,t),Qo=a(t),pe=i(t,"P",{"data-svelte-h":!0}),r(pe)!=="svelte-vjj76b"&&(pe.textContent=Pi),Vo=a(t),m(he.$$.fragment,t),So=a(t),me=i(t,"P",{"data-svelte-h":!0}),r(me)!=="svelte-bjnte8"&&(me.innerHTML=Ki),Fo=a(t),ue=i(t,"P",{"data-svelte-h":!0}),r(ue)!=="svelte-btfpkp"&&(ue.innerHTML=Di),zo=a(t),m(de.$$.fragment,t),qo=a(t),Me=i(t,"P",{"data-svelte-h":!0}),r(Me)!=="svelte-11yz1xk"&&(Me.textContent=Oi),Ao=a(t),m(ce.$$.fragment,t),Lo=a(t),ye=i(t,"P",{"data-svelte-h":!0}),r(ye)!=="svelte-10q5qmo"&&(ye.textContent=tr),Po=a(t),m(we.$$.fragment,t),Ko=a(t),fe=i(t,"P",{"data-svelte-h":!0}),r(fe)!=="svelte-1xs09vd"&&(fe.textContent=er),Do=a(t),m(be.$$.fragment,t),Oo=a(t),m(ge.$$.fragment,t),ta=a(t),m(A.$$.fragment,t),ea=a(t),B=i(t,"H3",{class:!0});var Ss=g(B);L=i(Ss,"A",{id:!0,class:!0,href:!0});var up=g(L);vn=i(up,"SPAN",{});var dp=g(vn);m(Je.$$.fragment,dp),dp.forEach(l),up.forEach(l),oi=a(Ss),hn=i(Ss,"SPAN",{"data-svelte-h":!0}),r(hn)!=="svelte-108o9n3"&&(hn.textContent=lr),Ss.forEach(l),la=a(t),Te=i(t,"P",{"data-svelte-h":!0}),r(Te)!=="svelte-knehpf"&&(Te.innerHTML=nr),na=a(t),m(Ue.$$.fragment,t),oa=a(t),m(P.$$.fragment,t),aa=a(t),ve=i(t,"P",{"data-svelte-h":!0}),r(ve)!=="svelte-15jgvnr"&&(ve.innerHTML=or),sa=a(t),m($e.$$.fragment,t),ia=a(t),je=i(t,"P",{"data-svelte-h":!0}),r(je)!=="svelte-kxexhm"&&(je.innerHTML=ar),ra=a(t),m(Ze.$$.fragment,t),pa=a(t),m(K.$$.fragment,t),ha=a(t),Ge=i(t,"P",{"data-svelte-h":!0}),r(Ge)!=="svelte-6yllxv"&&(Ge.innerHTML=sr),ma=a(t),Ce=i(t,"P",{"data-svelte-h":!0}),r(Ce)!=="svelte-1pz2hir"&&(Ce.textContent=ir),ua=a(t),Ie=i(t,"UL",{"data-svelte-h":!0}),r(Ie)!=="svelte-10jdtg2"&&(Ie.innerHTML=rr),da=a(t),x=i(t,"H2",{class:!0});var Fs=g(x);D=i(Fs,"A",{id:!0,class:!0,href:!0});var Mp=g(D);$n=i(Mp,"SPAN",{});var cp=g($n);m(We.$$.fragment,cp),cp.forEach(l),Mp.forEach(l),ai=a(Fs),mn=i(Fs,"SPAN",{"data-svelte-h":!0}),r(mn)!=="svelte-lgnu39"&&(mn.textContent=pr),Fs.forEach(l),Ma=a(t),Be=i(t,"P",{"data-svelte-h":!0}),r(Be)!=="svelte-1c5tlua"&&(Be.textContent=hr),ca=a(t),xe=i(t,"UL",{"data-svelte-h":!0}),r(xe)!=="svelte-3ndjxi"&&(xe.innerHTML=mr),ya=a(t),ke=i(t,"P",{"data-svelte-h":!0}),r(ke)!=="svelte-1ea7dmc"&&(ke.innerHTML=ur),wa=a(t),m(He.$$.fragment,t),fa=a(t),_e=i(t,"P",{"data-svelte-h":!0}),r(_e)!=="svelte-p0dnmg"&&(_e.innerHTML=dr),ba=a(t),m(Re.$$.fragment,t),ga=a(t),Ye=i(t,"P",{"data-svelte-h":!0}),r(Ye)!=="svelte-1i27rne"&&(Ye.textContent=Mr),Ja=a(t),m(Ne.$$.fragment,t),Ta=a(t),Ee=i(t,"P",{"data-svelte-h":!0}),r(Ee)!=="svelte-6618iq"&&(Ee.innerHTML=cr),Ua=a(t),m(Xe.$$.fragment,t),va=a(t),Qe=i(t,"P",{"data-svelte-h":!0}),r(Qe)!=="svelte-gbcquo"&&(Qe.textContent=yr),$a=a(t),m(Ve.$$.fragment,t),ja=a(t),Se=i(t,"P",{"data-svelte-h":!0}),r(Se)!=="svelte-gos6jv"&&(Se.innerHTML=wr),Za=a(t),m(O.$$.fragment,t),Ga=a(t),Fe=i(t,"P",{"data-svelte-h":!0}),r(Fe)!=="svelte-l1h4uq"&&(Fe.innerHTML=fr),Ca=a(t),m(ze.$$.fragment,t),Ia=a(t),m(qe.$$.fragment,t),Wa=a(t),Ae=i(t,"P",{"data-svelte-h":!0}),r(Ae)!=="svelte-1342gb7"&&(Ae.innerHTML=br),Ba=a(t),Le=i(t,"P",{"data-svelte-h":!0}),r(Le)!=="svelte-1ku572g"&&(Le.innerHTML=gr),xa=a(t),m(Pe.$$.fragment,t),ka=a(t),Ke=i(t,"IMG",{src:!0,width:!0}),Ha=a(t),De=i(t,"P",{"data-svelte-h":!0}),r(De)!=="svelte-1ghiycr"&&(De.textContent=Tr),_a=a(t),m(Oe.$$.fragment,t),Ra=a(t),m(tl.$$.fragment,t),Ya=a(t),el=i(t,"IMG",{src:!0,width:!0}),Na=a(t),ll=i(t,"P",{"data-svelte-h":!0}),r(ll)!=="svelte-18tz5k9"&&(ll.textContent=vr),Ea=a(t),m(nl.$$.fragment,t),Xa=a(t),m(ol.$$.fragment,t),Qa=a(t),al=i(t,"IMG",{src:!0,width:!0}),Va=a(t),sl=i(t,"P",{"data-svelte-h":!0}),r(sl)!=="svelte-1tkj4wc"&&(sl.textContent=jr),Sa=a(t),il=i(t,"P",{"data-svelte-h":!0}),r(il)!=="svelte-dd7bew"&&(il.textContent=Zr),Fa=a(t),k=i(t,"H3",{class:!0});var zs=g(k);tt=i(zs,"A",{id:!0,class:!0,href:!0});var yp=g(tt);jn=i(yp,"SPAN",{});var wp=g(jn);m(rl.$$.fragment,wp),wp.forEach(l),yp.forEach(l),si=a(zs),un=i(zs,"SPAN",{"data-svelte-h":!0}),r(un)!=="svelte-j4uvs1"&&(un.textContent=Gr),zs.forEach(l),za=a(t),pl=i(t,"P",{"data-svelte-h":!0}),r(pl)!=="svelte-1otb4ya"&&(pl.textContent=Cr),qa=a(t),H=i(t,"H4",{class:!0});var qs=g(H);et=i(qs,"A",{id:!0,class:!0,href:!0});var fp=g(et);Zn=i(fp,"SPAN",{});var bp=g(Zn);m(hl.$$.fragment,bp),bp.forEach(l),fp.forEach(l),ii=a(qs),dn=i(qs,"SPAN",{"data-svelte-h":!0}),r(dn)!=="svelte-o43op3"&&(dn.textContent=Ir),qs.forEach(l),Aa=a(t),ml=i(t,"P",{"data-svelte-h":!0}),r(ml)!=="svelte-sol241"&&(ml.textContent=Wr),La=a(t),ul=i(t,"P",{"data-svelte-h":!0}),r(ul)!=="svelte-1t55phh"&&(ul.textContent=Br),Pa=a(t),m(dl.$$.fragment,t),Ka=a(t),Ml=i(t,"P",{"data-svelte-h":!0}),r(Ml)!=="svelte-ktokvd"&&(Ml.innerHTML=xr),Da=a(t),cl=i(t,"P",{"data-svelte-h":!0}),r(cl)!=="svelte-1gypcaq"&&(cl.innerHTML=kr),Oa=a(t),m(yl.$$.fragment,t),ts=a(t),wl=i(t,"P",{"data-svelte-h":!0}),r(wl)!=="svelte-113o02m"&&(wl.textContent=Hr),es=a(t),fl=i(t,"UL",{"data-svelte-h":!0}),r(fl)!=="svelte-1yllho7"&&(fl.innerHTML=_r),ls=a(t),bl=i(t,"P",{"data-svelte-h":!0}),r(bl)!=="svelte-1d2t961"&&(bl.textContent=Rr),ns=a(t),m(gl.$$.fragment,t),os=a(t),Jl=i(t,"P",{"data-svelte-h":!0}),r(Jl)!=="svelte-1pgmicw"&&(Jl.innerHTML=Yr),as=a(t),m(Tl.$$.fragment,t),ss=a(t),Ul=i(t,"P",{"data-svelte-h":!0}),r(Ul)!=="svelte-sz7owm"&&(Ul.innerHTML=Nr),is=a(t),m(vl.$$.fragment,t),rs=a(t),$l=i(t,"P",{"data-svelte-h":!0}),r($l)!=="svelte-1eaq3qx"&&($l.textContent=Er),ps=a(t),_=i(t,"H4",{class:!0});var As=g(_);lt=i(As,"A",{id:!0,class:!0,href:!0});var gp=g(lt);Gn=i(gp,"SPAN",{});var Jp=g(Gn);m(jl.$$.fragment,Jp),Jp.forEach(l),gp.forEach(l),ri=a(As),Mn=i(As,"SPAN",{"data-svelte-h":!0}),r(Mn)!=="svelte-1ay9b24"&&(Mn.textContent=Xr),As.forEach(l),hs=a(t),Zl=i(t,"P",{"data-svelte-h":!0}),r(Zl)!=="svelte-1g0yncs"&&(Zl.textContent=Qr),ms=a(t),m(Gl.$$.fragment,t),us=a(t),Cl=i(t,"P",{"data-svelte-h":!0}),r(Cl)!=="svelte-xkoq76"&&(Cl.innerHTML=Vr),ds=a(t),m(Il.$$.fragment,t),Ms=a(t),Wl=i(t,"P",{"data-svelte-h":!0}),r(Wl)!=="svelte-pjyxhx"&&(Wl.textContent=Sr),cs=a(t),m(Bl.$$.fragment,t),ys=a(t),xl=i(t,"P",{"data-svelte-h":!0}),r(xl)!=="svelte-406qkd"&&(xl.textContent=Fr),ws=a(t),kl=i(t,"TABLE",{"data-svelte-h":!0}),r(kl)!=="svelte-1tqzmpy"&&(kl.innerHTML=zr),fs=a(t),m(nt.$$.fragment,t),bs=a(t),R=i(t,"H3",{class:!0});var Ls=g(R);ot=i(Ls,"A",{id:!0,class:!0,href:!0});var Tp=g(ot);Cn=i(Tp,"SPAN",{});var Up=g(Cn);m(Hl.$$.fragment,Up),Up.forEach(l),Tp.forEach(l),pi=a(Ls),cn=i(Ls,"SPAN",{"data-svelte-h":!0}),r(cn)!=="svelte-1a3wa6s"&&(cn.textContent=qr),Ls.forEach(l),gs=a(t),_l=i(t,"P",{"data-svelte-h":!0}),r(_l)!=="svelte-efrp9a"&&(_l.textContent=Ar),Js=a(t),m(Rl.$$.fragment,t),Ts=a(t),m(at.$$.fragment,t),Us=a(t),Y=i(t,"H2",{class:!0});var Ps=g(Y);st=i(Ps,"A",{id:!0,class:!0,href:!0});var vp=g(st);In=i(vp,"SPAN",{});var $p=g(In);m(Yl.$$.fragment,$p),$p.forEach(l),vp.forEach(l),hi=a(Ps),yn=i(Ps,"SPAN",{"data-svelte-h":!0}),r(yn)!=="svelte-jj73yl"&&(yn.textContent=Lr),Ps.forEach(l),vs=a(t),Nl=i(t,"P",{"data-svelte-h":!0}),r(Nl)!=="svelte-k79zul"&&(Nl.innerHTML=Pr),$s=a(t),El=i(t,"P",{"data-svelte-h":!0}),r(El)!=="svelte-1g50g90"&&(El.innerHTML=Kr),js=a(t),Xl=i(t,"P",{"data-svelte-h":!0}),r(Xl)!=="svelte-13sspw7"&&(Xl.innerHTML=Dr),Zs=a(t),m(Ql.$$.fragment,t),Gs=a(t),Vl=i(t,"P",{"data-svelte-h":!0}),r(Vl)!=="svelte-fosp2q"&&(Vl.innerHTML=Or),Cs=a(t),m(Sl.$$.fragment,t),Is=a(t),Fl=i(t,"P",{"data-svelte-h":!0}),r(Fl)!=="svelte-upt5q1"&&(Fl.innerHTML=tp),Ws=a(t),m(zl.$$.fragment,t),Bs=a(t),ql=i(t,"P",{"data-svelte-h":!0}),r(ql)!=="svelte-1ss743w"&&(ql.textContent=ep),xs=a(t),m(Al.$$.fragment,t),ks=a(t),Ll=i(t,"P",{"data-svelte-h":!0}),r(Ll)!=="svelte-euaib0"&&(Ll.textContent=lp),Hs=a(t),wn=i(t,"IMG",{src:!0}),_s=a(t),m(it.$$.fragment,t),Rs=a(t),N=i(t,"H2",{class:!0});var Ks=g(N);rt=i(Ks,"A",{id:!0,class:!0,href:!0});var jp=g(rt);Wn=i(jp,"SPAN",{});var Zp=g(Wn);m(Pl.$$.fragment,Zp),Zp.forEach(l),jp.forEach(l),mi=a(Ks),fn=i(Ks,"SPAN",{"data-svelte-h":!0}),r(fn)!=="svelte-1966tnv"&&(fn.textContent=op),Ks.forEach(l),Ys=a(t),Kl=i(t,"P",{"data-svelte-h":!0}),r(Kl)!=="svelte-ez7x57"&&(Kl.innerHTML=ap),Ns=a(t),Dl=i(t,"P",{"data-svelte-h":!0}),r(Dl)!=="svelte-1aa89ge"&&(Dl.textContent=sp),Es=a(t),Ol=i(t,"P",{"data-svelte-h":!0}),r(Ol)!=="svelte-pg0m6x"&&(Ol.innerHTML=ip),Xs=a(t),Bn=i(t,"P",{}),g(Bn).forEach(l),this.h()},h(){w(p,"name","hf:doc:metadata"),w(p,"content",JSON.stringify(Sp)),w(E,"id","custom-tools-and-prompts"),w(E,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(E,"href","#custom-tools-and-prompts"),w(Z,"class","relative group"),w(V,"id","customizing-the-prompt"),w(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(V,"href","#customizing-the-prompt"),w(G,"class","relative group"),w(S,"id","structure-of-the-prompt"),w(S,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(S,"href","#structure-of-the-prompt"),w(C,"class","relative group"),w(z,"id","writing-good-user-inputs"),w(z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(z,"href","#writing-good-user-inputs"),w(I,"class","relative group"),w(q,"id","customizing-the-tool-descriptions"),w(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(q,"href","#customizing-the-tool-descriptions"),w(W,"class","relative group"),w(L,"id","customizing-the-whole-prompt"),w(L,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(L,"href","#customizing-the-whole-prompt"),w(B,"class","relative group"),w(D,"id","using-custom-tools"),w(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(D,"href","#using-custom-tools"),w(x,"class","relative group"),Ds(Ke.src,Jr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes.png")||w(Ke,"src",Jr),w(Ke,"width","200"),Ds(el.src,Ur="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes_winter.png")||w(el,"src",Ur),w(el,"width","200"),Ds(al.src,$r="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes_winter_upscale.png")||w(al,"src",$r),w(al,"width","400"),w(tt,"id","adding-new-tools"),w(tt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(tt,"href","#adding-new-tools"),w(k,"class","relative group"),w(et,"id","creating-a-new-tool"),w(et,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(et,"href","#creating-a-new-tool"),w(H,"class","relative group"),w(lt,"id","having-the-agent-use-the-tool"),w(lt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(lt,"href","#having-the-agent-use-the-tool"),w(_,"class","relative group"),w(ot,"id","replacing-existing-tools"),w(ot,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(ot,"href","#replacing-existing-tools"),w(R,"class","relative group"),w(st,"id","leveraging-gradiotools"),w(st,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(st,"href","#leveraging-gradiotools"),w(Y,"class","relative group"),Ds(wn.src,np="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png")||w(wn,"src",np),w(rt,"id","future-compatibility-with-langchain"),w(rt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),w(rt,"href","#future-compatibility-with-langchain"),w(N,"class","relative group")},m(t,e){f(document.head,p),n(t,J,e),n(t,y,e),n(t,T,e),n(t,Z,e),f(Z,E),f(E,bn),u(pt,bn,null),f(Z,Os),f(Z,on),n(t,Nn,e),u(X,t,e),n(t,En,e),u(Q,t,e),n(t,Xn,e),n(t,ht,e),n(t,Qn,e),n(t,mt,e),n(t,Vn,e),n(t,G,e),f(G,V),f(V,gn),u(ut,gn,null),f(G,ti),f(G,an),n(t,Sn,e),n(t,dt,e),n(t,Fn,e),n(t,C,e),f(C,S),f(S,Jn),u(Mt,Jn,null),f(C,ei),f(C,sn),n(t,zn,e),n(t,ct,e),n(t,qn,e),n(t,yt,e),n(t,An,e),n(t,wt,e),n(t,Ln,e),u(ft,t,e),n(t,Pn,e),n(t,bt,e),n(t,Kn,e),n(t,gt,e),n(t,Dn,e),u(Jt,t,e),n(t,On,e),n(t,Tt,e),n(t,to,e),u(Ut,t,e),n(t,eo,e),n(t,vt,e),n(t,lo,e),u($t,t,e),n(t,no,e),n(t,jt,e),n(t,oo,e),n(t,Zt,e),n(t,ao,e),u(F,t,e),n(t,so,e),n(t,Gt,e),n(t,io,e),n(t,Ct,e),n(t,ro,e),u(It,t,e),n(t,po,e),n(t,Wt,e),n(t,ho,e),n(t,Bt,e),n(t,mo,e),n(t,xt,e),n(t,uo,e),u(kt,t,e),n(t,Mo,e),n(t,Ht,e),n(t,co,e),u(_t,t,e),n(t,yo,e),n(t,Rt,e),n(t,wo,e),n(t,Yt,e),n(t,fo,e),u(Nt,t,e),n(t,bo,e),n(t,Et,e),n(t,go,e),n(t,Xt,e),n(t,Jo,e),u(Qt,t,e),n(t,To,e),n(t,Vt,e),n(t,Uo,e),n(t,St,e),n(t,vo,e),n(t,I,e),f(I,z),f(z,Tn),u(Ft,Tn,null),f(I,li),f(I,rn),n(t,$o,e),n(t,zt,e),n(t,jo,e),n(t,qt,e),n(t,Zo,e),u(At,t,e),n(t,Go,e),n(t,Lt,e),n(t,Co,e),u(Pt,t,e),n(t,Io,e),n(t,Kt,e),n(t,Wo,e),u(Dt,t,e),n(t,Bo,e),u(Ot,t,e),n(t,xo,e),n(t,te,e),n(t,ko,e),u(ee,t,e),n(t,Ho,e),n(t,le,e),n(t,_o,e),u(ne,t,e),n(t,Ro,e),n(t,oe,e),n(t,Yo,e),n(t,W,e),f(W,q),f(q,Un),u(ae,Un,null),f(W,ni),f(W,pn),n(t,No,e),n(t,se,e),n(t,Eo,e),n(t,ie,e),n(t,Xo,e),u(re,t,e),n(t,Qo,e),n(t,pe,e),n(t,Vo,e),u(he,t,e),n(t,So,e),n(t,me,e),n(t,Fo,e),n(t,ue,e),n(t,zo,e),u(de,t,e),n(t,qo,e),n(t,Me,e),n(t,Ao,e),u(ce,t,e),n(t,Lo,e),n(t,ye,e),n(t,Po,e),u(we,t,e),n(t,Ko,e),n(t,fe,e),n(t,Do,e),u(be,t,e),n(t,Oo,e),u(ge,t,e),n(t,ta,e),u(A,t,e),n(t,ea,e),n(t,B,e),f(B,L),f(L,vn),u(Je,vn,null),f(B,oi),f(B,hn),n(t,la,e),n(t,Te,e),n(t,na,e),u(Ue,t,e),n(t,oa,e),u(P,t,e),n(t,aa,e),n(t,ve,e),n(t,sa,e),u($e,t,e),n(t,ia,e),n(t,je,e),n(t,ra,e),u(Ze,t,e),n(t,pa,e),u(K,t,e),n(t,ha,e),n(t,Ge,e),n(t,ma,e),n(t,Ce,e),n(t,ua,e),n(t,Ie,e),n(t,da,e),n(t,x,e),f(x,D),f(D,$n),u(We,$n,null),f(x,ai),f(x,mn),n(t,Ma,e),n(t,Be,e),n(t,ca,e),n(t,xe,e),n(t,ya,e),n(t,ke,e),n(t,wa,e),u(He,t,e),n(t,fa,e),n(t,_e,e),n(t,ba,e),u(Re,t,e),n(t,ga,e),n(t,Ye,e),n(t,Ja,e),u(Ne,t,e),n(t,Ta,e),n(t,Ee,e),n(t,Ua,e),u(Xe,t,e),n(t,va,e),n(t,Qe,e),n(t,$a,e),u(Ve,t,e),n(t,ja,e),n(t,Se,e),n(t,Za,e),u(O,t,e),n(t,Ga,e),n(t,Fe,e),n(t,Ca,e),u(ze,t,e),n(t,Ia,e),u(qe,t,e),n(t,Wa,e),n(t,Ae,e),n(t,Ba,e),n(t,Le,e),n(t,xa,e),u(Pe,t,e),n(t,ka,e),n(t,Ke,e),n(t,Ha,e),n(t,De,e),n(t,_a,e),u(Oe,t,e),n(t,Ra,e),u(tl,t,e),n(t,Ya,e),n(t,el,e),n(t,Na,e),n(t,ll,e),n(t,Ea,e),u(nl,t,e),n(t,Xa,e),u(ol,t,e),n(t,Qa,e),n(t,al,e),n(t,Va,e),n(t,sl,e),n(t,Sa,e),n(t,il,e),n(t,Fa,e),n(t,k,e),f(k,tt),f(tt,jn),u(rl,jn,null),f(k,si),f(k,un),n(t,za,e),n(t,pl,e),n(t,qa,e),n(t,H,e),f(H,et),f(et,Zn),u(hl,Zn,null),f(H,ii),f(H,dn),n(t,Aa,e),n(t,ml,e),n(t,La,e),n(t,ul,e),n(t,Pa,e),u(dl,t,e),n(t,Ka,e),n(t,Ml,e),n(t,Da,e),n(t,cl,e),n(t,Oa,e),u(yl,t,e),n(t,ts,e),n(t,wl,e),n(t,es,e),n(t,fl,e),n(t,ls,e),n(t,bl,e),n(t,ns,e),u(gl,t,e),n(t,os,e),n(t,Jl,e),n(t,as,e),u(Tl,t,e),n(t,ss,e),n(t,Ul,e),n(t,is,e),u(vl,t,e),n(t,rs,e),n(t,$l,e),n(t,ps,e),n(t,_,e),f(_,lt),f(lt,Gn),u(jl,Gn,null),f(_,ri),f(_,Mn),n(t,hs,e),n(t,Zl,e),n(t,ms,e),u(Gl,t,e),n(t,us,e),n(t,Cl,e),n(t,ds,e),u(Il,t,e),n(t,Ms,e),n(t,Wl,e),n(t,cs,e),u(Bl,t,e),n(t,ys,e),n(t,xl,e),n(t,ws,e),n(t,kl,e),n(t,fs,e),u(nt,t,e),n(t,bs,e),n(t,R,e),f(R,ot),f(ot,Cn),u(Hl,Cn,null),f(R,pi),f(R,cn),n(t,gs,e),n(t,_l,e),n(t,Js,e),u(Rl,t,e),n(t,Ts,e),u(at,t,e),n(t,Us,e),n(t,Y,e),f(Y,st),f(st,In),u(Yl,In,null),f(Y,hi),f(Y,yn),n(t,vs,e),n(t,Nl,e),n(t,$s,e),n(t,El,e),n(t,js,e),n(t,Xl,e),n(t,Zs,e),u(Ql,t,e),n(t,Gs,e),n(t,Vl,e),n(t,Cs,e),u(Sl,t,e),n(t,Is,e),n(t,Fl,e),n(t,Ws,e),u(zl,t,e),n(t,Bs,e),n(t,ql,e),n(t,xs,e),u(Al,t,e),n(t,ks,e),n(t,Ll,e),n(t,Hs,e),n(t,wn,e),n(t,_s,e),u(it,t,e),n(t,Rs,e),n(t,N,e),f(N,rt),f(rt,Wn),u(Pl,Wn,null),f(N,mi),f(N,fn),n(t,Ys,e),n(t,Kl,e),n(t,Ns,e),n(t,Dl,e),n(t,Es,e),n(t,Ol,e),n(t,Xs,e),n(t,Bn,e),Qs=!0},p(t,[e]){const tn={};e&2&&(tn.$$scope={dirty:e,ctx:t}),X.$set(tn);const xn={};e&2&&(xn.$$scope={dirty:e,ctx:t}),Q.$set(xn);const kn={};e&2&&(kn.$$scope={dirty:e,ctx:t}),F.$set(kn);const en={};e&2&&(en.$$scope={dirty:e,ctx:t}),A.$set(en);const Hn={};e&2&&(Hn.$$scope={dirty:e,ctx:t}),P.$set(Hn);const _n={};e&2&&(_n.$$scope={dirty:e,ctx:t}),K.$set(_n);const ln={};e&2&&(ln.$$scope={dirty:e,ctx:t}),O.$set(ln);const Rn={};e&2&&(Rn.$$scope={dirty:e,ctx:t}),nt.$set(Rn);const Yn={};e&2&&(Yn.$$scope={dirty:e,ctx:t}),at.$set(Yn);const nn={};e&2&&(nn.$$scope={dirty:e,ctx:t}),it.$set(nn)},i(t){Qs||(d(pt.$$.fragment,t),d(X.$$.fragment,t),d(Q.$$.fragment,t),d(ut.$$.fragment,t),d(Mt.$$.fragment,t),d(ft.$$.fragment,t),d(Jt.$$.fragment,t),d(Ut.$$.fragment,t),d($t.$$.fragment,t),d(F.$$.fragment,t),d(It.$$.fragment,t),d(kt.$$.fragment,t),d(_t.$$.fragment,t),d(Nt.$$.fragment,t),d(Qt.$$.fragment,t),d(Ft.$$.fragment,t),d(At.$$.fragment,t),d(Pt.$$.fragment,t),d(Dt.$$.fragment,t),d(Ot.$$.fragment,t),d(ee.$$.fragment,t),d(ne.$$.fragment,t),d(ae.$$.fragment,t),d(re.$$.fragment,t),d(he.$$.fragment,t),d(de.$$.fragment,t),d(ce.$$.fragment,t),d(we.$$.fragment,t),d(be.$$.fragment,t),d(ge.$$.fragment,t),d(A.$$.fragment,t),d(Je.$$.fragment,t),d(Ue.$$.fragment,t),d(P.$$.fragment,t),d($e.$$.fragment,t),d(Ze.$$.fragment,t),d(K.$$.fragment,t),d(We.$$.fragment,t),d(He.$$.fragment,t),d(Re.$$.fragment,t),d(Ne.$$.fragment,t),d(Xe.$$.fragment,t),d(Ve.$$.fragment,t),d(O.$$.fragment,t),d(ze.$$.fragment,t),d(qe.$$.fragment,t),d(Pe.$$.fragment,t),d(Oe.$$.fragment,t),d(tl.$$.fragment,t),d(nl.$$.fragment,t),d(ol.$$.fragment,t),d(rl.$$.fragment,t),d(hl.$$.fragment,t),d(dl.$$.fragment,t),d(yl.$$.fragment,t),d(gl.$$.fragment,t),d(Tl.$$.fragment,t),d(vl.$$.fragment,t),d(jl.$$.fragment,t),d(Gl.$$.fragment,t),d(Il.$$.fragment,t),d(Bl.$$.fragment,t),d(nt.$$.fragment,t),d(Hl.$$.fragment,t),d(Rl.$$.fragment,t),d(at.$$.fragment,t),d(Yl.$$.fragment,t),d(Ql.$$.fragment,t),d(Sl.$$.fragment,t),d(zl.$$.fragment,t),d(Al.$$.fragment,t),d(it.$$.fragment,t),d(Pl.$$.fragment,t),Qs=!0)},o(t){M(pt.$$.fragment,t),M(X.$$.fragment,t),M(Q.$$.fragment,t),M(ut.$$.fragment,t),M(Mt.$$.fragment,t),M(ft.$$.fragment,t),M(Jt.$$.fragment,t),M(Ut.$$.fragment,t),M($t.$$.fragment,t),M(F.$$.fragment,t),M(It.$$.fragment,t),M(kt.$$.fragment,t),M(_t.$$.fragment,t),M(Nt.$$.fragment,t),M(Qt.$$.fragment,t),M(Ft.$$.fragment,t),M(At.$$.fragment,t),M(Pt.$$.fragment,t),M(Dt.$$.fragment,t),M(Ot.$$.fragment,t),M(ee.$$.fragment,t),M(ne.$$.fragment,t),M(ae.$$.fragment,t),M(re.$$.fragment,t),M(he.$$.fragment,t),M(de.$$.fragment,t),M(ce.$$.fragment,t),M(we.$$.fragment,t),M(be.$$.fragment,t),M(ge.$$.fragment,t),M(A.$$.fragment,t),M(Je.$$.fragment,t),M(Ue.$$.fragment,t),M(P.$$.fragment,t),M($e.$$.fragment,t),M(Ze.$$.fragment,t),M(K.$$.fragment,t),M(We.$$.fragment,t),M(He.$$.fragment,t),M(Re.$$.fragment,t),M(Ne.$$.fragment,t),M(Xe.$$.fragment,t),M(Ve.$$.fragment,t),M(O.$$.fragment,t),M(ze.$$.fragment,t),M(qe.$$.fragment,t),M(Pe.$$.fragment,t),M(Oe.$$.fragment,t),M(tl.$$.fragment,t),M(nl.$$.fragment,t),M(ol.$$.fragment,t),M(rl.$$.fragment,t),M(hl.$$.fragment,t),M(dl.$$.fragment,t),M(yl.$$.fragment,t),M(gl.$$.fragment,t),M(Tl.$$.fragment,t),M(vl.$$.fragment,t),M(jl.$$.fragment,t),M(Gl.$$.fragment,t),M(Il.$$.fragment,t),M(Bl.$$.fragment,t),M(nt.$$.fragment,t),M(Hl.$$.fragment,t),M(Rl.$$.fragment,t),M(at.$$.fragment,t),M(Yl.$$.fragment,t),M(Ql.$$.fragment,t),M(Sl.$$.fragment,t),M(zl.$$.fragment,t),M(Al.$$.fragment,t),M(it.$$.fragment,t),M(Pl.$$.fragment,t),Qs=!1},d(t){t&&(l(J),l(y),l(T),l(Z),l(Nn),l(En),l(Xn),l(ht),l(Qn),l(mt),l(Vn),l(G),l(Sn),l(dt),l(Fn),l(C),l(zn),l(ct),l(qn),l(yt),l(An),l(wt),l(Ln),l(Pn),l(bt),l(Kn),l(gt),l(Dn),l(On),l(Tt),l(to),l(eo),l(vt),l(lo),l(no),l(jt),l(oo),l(Zt),l(ao),l(so),l(Gt),l(io),l(Ct),l(ro),l(po),l(Wt),l(ho),l(Bt),l(mo),l(xt),l(uo),l(Mo),l(Ht),l(co),l(yo),l(Rt),l(wo),l(Yt),l(fo),l(bo),l(Et),l(go),l(Xt),l(Jo),l(To),l(Vt),l(Uo),l(St),l(vo),l(I),l($o),l(zt),l(jo),l(qt),l(Zo),l(Go),l(Lt),l(Co),l(Io),l(Kt),l(Wo),l(Bo),l(xo),l(te),l(ko),l(Ho),l(le),l(_o),l(Ro),l(oe),l(Yo),l(W),l(No),l(se),l(Eo),l(ie),l(Xo),l(Qo),l(pe),l(Vo),l(So),l(me),l(Fo),l(ue),l(zo),l(qo),l(Me),l(Ao),l(Lo),l(ye),l(Po),l(Ko),l(fe),l(Do),l(Oo),l(ta),l(ea),l(B),l(la),l(Te),l(na),l(oa),l(aa),l(ve),l(sa),l(ia),l(je),l(ra),l(pa),l(ha),l(Ge),l(ma),l(Ce),l(ua),l(Ie),l(da),l(x),l(Ma),l(Be),l(ca),l(xe),l(ya),l(ke),l(wa),l(fa),l(_e),l(ba),l(ga),l(Ye),l(Ja),l(Ta),l(Ee),l(Ua),l(va),l(Qe),l($a),l(ja),l(Se),l(Za),l(Ga),l(Fe),l(Ca),l(Ia),l(Wa),l(Ae),l(Ba),l(Le),l(xa),l(ka),l(Ke),l(Ha),l(De),l(_a),l(Ra),l(Ya),l(el),l(Na),l(ll),l(Ea),l(Xa),l(Qa),l(al),l(Va),l(sl),l(Sa),l(il),l(Fa),l(k),l(za),l(pl),l(qa),l(H),l(Aa),l(ml),l(La),l(ul),l(Pa),l(Ka),l(Ml),l(Da),l(cl),l(Oa),l(ts),l(wl),l(es),l(fl),l(ls),l(bl),l(ns),l(os),l(Jl),l(as),l(ss),l(Ul),l(is),l(rs),l($l),l(ps),l(_),l(hs),l(Zl),l(ms),l(us),l(Cl),l(ds),l(Ms),l(Wl),l(cs),l(ys),l(xl),l(ws),l(kl),l(fs),l(bs),l(R),l(gs),l(_l),l(Js),l(Ts),l(Us),l(Y),l(vs),l(Nl),l($s),l(El),l(js),l(Xl),l(Zs),l(Gs),l(Vl),l(Cs),l(Is),l(Fl),l(Ws),l(Bs),l(ql),l(xs),l(ks),l(Ll),l(Hs),l(wn),l(_s),l(Rs),l(N),l(Ys),l(Kl),l(Ns),l(Dl),l(Es),l(Ol),l(Xs),l(Bn)),l(p),c(pt),c(X,t),c(Q,t),c(ut),c(Mt),c(ft,t),c(Jt,t),c(Ut,t),c($t,t),c(F,t),c(It,t),c(kt,t),c(_t,t),c(Nt,t),c(Qt,t),c(Ft),c(At,t),c(Pt,t),c(Dt,t),c(Ot,t),c(ee,t),c(ne,t),c(ae),c(re,t),c(he,t),c(de,t),c(ce,t),c(we,t),c(be,t),c(ge,t),c(A,t),c(Je),c(Ue,t),c(P,t),c($e,t),c(Ze,t),c(K,t),c(We),c(He,t),c(Re,t),c(Ne,t),c(Xe,t),c(Ve,t),c(O,t),c(ze,t),c(qe,t),c(Pe,t),c(Oe,t),c(tl,t),c(nl,t),c(ol,t),c(rl),c(hl),c(dl,t),c(yl,t),c(gl,t),c(Tl,t),c(vl,t),c(jl),c(Gl,t),c(Il,t),c(Bl,t),c(nt,t),c(Hl),c(Rl,t),c(at,t),c(Yl),c(Ql,t),c(Sl,t),c(zl,t),c(Al,t),c(it,t),c(Pl)}}}const Sp={local:"custom-tools-and-prompts",sections:[{local:"customizing-the-prompt",sections:[{local:"structure-of-the-prompt",title:"Structure of the prompt"},{local:"writing-good-user-inputs",title:"Writing good user inputs"},{local:"customizing-the-tool-descriptions",title:"Customizing the tool descriptions"},{local:"customizing-the-whole-prompt",title:"Customizing the whole prompt"}],title:"Customizing the prompt"},{local:"using-custom-tools",sections:[{local:"adding-new-tools",sections:[{local:"creating-a-new-tool",title:"Creating a new tool"},{local:"having-the-agent-use-the-tool",title:"Having the agent use the tool"}],title:"Adding new tools"},{local:"replacing-existing-tools",title:"Replacing existing tools"}],title:"Using custom tools"},{local:"leveraging-gradiotools",title:"Leveraging gradio-tools"},{local:"future-compatibility-with-langchain",title:"Future compatibility with Langchain"}],title:"Custom Tools and Prompts"};function Fp(U){return Cp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kp extends Ip{constructor(p){super(),Wp(this,p,Fp,Vp,Gp,{})}}export{Kp as component};
