import{s as Ci,f as Hs,o as Bi,n as j}from"../chunks/scheduler.9bc65507.js";import{S as xi,i as Hi,g as o,s as a,r as m,A as Ri,h as i,f as l,c as s,j as Wi,u as d,x as r,k as v,y as ki,a as n,v as h,d as u,t as M,w as y}from"../chunks/index.707bf1b6.js";import{T as $}from"../chunks/Tip.c2ecdbf4.js";import{C as c}from"../chunks/CodeBlock.54a9f38d.js";import{H as T}from"../chunks/Heading.342b1fa6.js";function Yi(g){let p,f=`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=o("p"),p.innerHTML=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-3d92zh"&&(p.innerHTML=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function _i(g){let p,f=`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=o("p"),p.textContent=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-1edi68n"&&(p.textContent=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function Ni(g){let p,f=`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=o("p"),p.innerHTML=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-g5vgrf"&&(p.innerHTML=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function Xi(g){let p,f=`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=o("p"),p.textContent=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-mlmd2c"&&(p.textContent=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function Qi(g){let p,f=`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=o("p"),p.innerHTML=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-1rh8x5r"&&(p.innerHTML=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function Vi(g){let p,f=`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=o("p"),p.innerHTML=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-35oor2"&&(p.innerHTML=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function Fi(g){let p,f="Using custom tools in your local runtime means that you’ll download code to run on your machine.",w,b,Z=`ALWAYS inspect the tool you’re downloading before loading it within your runtime, as you would do when
installing a package using pip/npm/apt.`;return{c(){p=o("p"),p.textContent=f,w=a(),b=o("p"),b.textContent=Z},l(J){p=i(J,"P",{"data-svelte-h":!0}),r(p)!=="svelte-swqlya"&&(p.textContent=f),w=s(J),b=i(J,"P",{"data-svelte-h":!0}),r(b)!=="svelte-8rv32t"&&(b.textContent=Z)},m(J,U){n(J,p,U),n(J,w,U),n(J,b,U)},p:j,d(J){J&&(l(p),l(w),l(b))}}}function Ei(g){let p,f=`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=o("p"),p.textContent=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-bxw4a"&&(p.textContent=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function Si(g){let p,f=`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=o("p"),p.textContent=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-56y5g1"&&(p.textContent=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function zi(g){let p,f=`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=o("p"),p.textContent=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-5sq1z0"&&(p.textContent=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function qi(g){let p,f=`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=o("p"),p.innerHTML=f},l(w){p=i(w,"P",{"data-svelte-h":!0}),r(p)!=="svelte-tx23fw"&&(p.innerHTML=f)},m(w,b){n(w,p,b)},p:j,d(w){w&&l(p)}}}function Li(g){let p,f,w,b,Z,J,U,Wl,G,Cl,_,Rs=`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:`,Bl,N,ks="<li>How to customize the prompt</li> <li>How to use custom tools</li> <li>How to create custom tools</li>",xl,X,Hl,Q,Ys=`As explained in <a href="transformers_agents">Transformers Agents</a> agents can run in <a href="/docs/transformers/v4.39.1/en/main_classes/agent#transformers.Agent.run">run()</a> and <a href="/docs/transformers/v4.39.1/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.`,Rl,V,kl,F,_s=`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.`,Yl,E,Ns='<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>',_l,S,Xs="To better understand each part, let’s look at a shortened version of how the <code>run</code> prompt can look like:",Nl,z,Xl,q,Qs=`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.`,Ql,L,Vs=`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:`,Vl,A,Fl,P,Fs="Let’s verify this quickly by loading the document_qa tool and printing out the name and description.",El,K,Sl,D,Es="which gives:",zl,O,ql,tt,Ss=`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.`,Ll,et,zs=`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.`,Al,I,Pl,lt,qs=`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.`,Kl,nt,Ls="Let’s have a look at one example:",Dl,at,Ol,st,As=`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.`,tn,ot,Ps=`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.`,en,it,Ks="The final part of the prompt corresponds to:",ln,rt,nn,pt,Ds=`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:`,an,mt,sn,dt,Os=`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.`,on,ht,to=`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>:`,rn,ut,pn,Mt,eo=`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.`,mn,yt,lo="Upon running <code>.chat</code>, the user’s input or <em>task</em> is cast into an unfinished example of the form:",dn,wt,hn,ct,no=`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.`,un,ft,ao="Great now that we know how the prompt is structured, let’s see how we can customize it!",Mn,bt,yn,gt,so=`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?`,wn,Jt,oo=`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.`,cn,Tt,fn,Ut,io="gives:",bn,$t,gn,jt,ro=`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.`,Jn,Zt,Tn,vt,Un,Gt,po="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.",$n,It,jn,Wt,mo="gives:",Zn,Ct,vn,Bt,ho=`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.`,Gn,xt,In,Ht,uo=`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.`,Wn,Rt,Mo=`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>`,Cn,kt,Bn,Yt,yo="returns",xn,_t,Hn,Nt,wo=`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.`,Rn,Xt,co=`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”:`,kn,Qt,Yn,Vt,fo="Now “modify” is a strong cue to use the new image processor which should help with the above prompt. Let’s run it again.",_n,Ft,Nn,Et,bo="Now we’re getting:",Xn,St,Qn,zt,go="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:",Vn,qt,Fn,Lt,En,W,Sn,At,zn,Pt,Jo=`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:`,qn,Kt,Ln,C,An,Dt,To="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:",Pn,Ot,Kn,te,Uo=`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.`,Dn,ee,On,B,ta,le,$o='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.',ea,ne,jo="To upload your custom prompt on a repo on the Hub and share it with the community just make sure:",la,ae,Zo="<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>",na,se,aa,x,sa,oe,vo="In this section, we’ll be leveraging two existing custom tools that are specific to image generation:",oa,ie,Go=`<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>`,ia,re,Io='We’ll start by loading the custom tools with the convenient <a href="/docs/transformers/v4.39.1/en/main_classes/agent#transformers.load_tool">load_tool()</a> function:',ra,pe,pa,me,Wo=`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>:`,ma,de,da,he,Co="gives",ha,ue,ua,Me,Bo=`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>:`,Ma,ye,ya,we,xo="This command should give you the following info:",wa,ce,ca,fe,Ho="The set of curated tools already has an <code>image_transformer</code> tool which is hereby replaced with our custom tool.",fa,H,ba,be,Ro=`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:`,ga,ge,Ja,Je,Ta,Te,ko="Note how <code>image_upscaler</code> is now part of the agents’ toolbox.",Ua,Ue,Yo='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>.',$a,$e,ja,je,_o,Za,Ze,No="Let’s transform the image into a beautiful winter landscape:",va,ve,Ga,Ge,Ia,Ie,Xo,Wa,We,Qo=`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.`,Ca,Ce,Ba,Be,xa,xe,Vo,Ha,He,Fo=`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.`,Ra,Re,Eo="Next, let’s have a look at how you can create a new custom tool.",ka,ke,Ya,Ye,So="In this section, we show how to create a new tool that can be added to the agent.",_a,_e,Na,Ne,zo=`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.`,Xa,Xe,qo="We can do that with the following code:",Qa,Qe,Va,Ve,Lo="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;google-t5/t5-base</code>.",Fa,Fe,Ao=`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:`,Ea,Ee,Sa,Se,Po="This class has a few needs:",za,ze,Ko=`<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>`,qa,qe,Do="Here’s what our class looks like now:",La,Le,Aa,Ae,Oo=`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:`,Pa,Pe,Ka,Ke,ti=`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:`,Da,De,Oa,Oe,ei="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.",ts,tl,es,el,li="We now have our tool that lives on the Hub which can be instantiated as such (change the user name for your tool):",ls,ll,ns,nl,ni="In order to use it in the agent, simply pass it in the <code>additional_tools</code> parameter of the agent initialization method:",as,al,ss,sl,ai="which outputs the following:",os,ol,is,il,si="and generates the following audio.",rs,rl,oi='<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>',ps,R,ms,pl,ds,ml,ii="Replacing existing tools can be done simply by assigning a new item to the agent’s toolbox. Here’s how one would do so:",hs,dl,us,k,Ms,hl,ys,ul,ri=`<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.`,ws,Ml,pi=`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.`,cs,yl,mi="We first import the tool from <code>gradio_tools</code> and instantiate it:",fs,wl,bs,cl,di="We pass that instance to the <code>Tool.from_gradio</code> method:",gs,fl,Js,bl,hi=`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>:`,Ts,gl,Us,Jl,ui="The model adequately leverages the tool:",$s,Tl,js,Ul,Mi="Before finally generating the image:",Zs,Gl,yi,vs,Y,Gs,$l,Is,jl,wi=`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.`,Ws,Zl,ci=`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.`,Cs,vl,fi=`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.`,Bs,Il,xs;return Z=new T({props:{title:"Custom Tools and Prompts",local:"custom-tools-and-prompts",headingTag:"h1"}}),U=new $({props:{$$slots:{default:[Yi]},$$scope:{ctx:g}}}),G=new $({props:{warning:!0,$$slots:{default:[_i]},$$scope:{ctx:g}}}),X=new T({props:{title:"Customizing the prompt",local:"customizing-the-prompt",headingTag:"h2"}}),V=new T({props:{title:"Structure of the prompt",local:"structure-of-the-prompt",headingTag:"h3"}}),z=new c({props:{code:"SSUyMHdpbGwlMjBhc2slMjB5b3UlMjB0byUyMHBlcmZvcm0lMjBhJTIwdGFzayUyQyUyMHlvdXIlMjBqb2IlMjBpcyUyMHRvJTIwY29tZSUyMHVwJTIwd2l0aCUyMGElMjBzZXJpZXMlMjBvZiUyMHNpbXBsZSUyMGNvbW1hbmRzJTIwaW4lMjBQeXRob24lMjB0aGF0JTIwd2lsbCUyMHBlcmZvcm0lMjB0aGUlMjB0YXNrLiUwQSU1Qi4uLiU1RCUwQVlvdSUyMGNhbiUyMHByaW50JTIwaW50ZXJtZWRpYXRlJTIwcmVzdWx0cyUyMGlmJTIwaXQlMjBtYWtlcy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JTIwdGhlJTIwJTYwZG9jdW1lbnQlNjAlMjBhbmQlMjBjcmVhdGUlMjBhbiUyMGltYWdlJTIwc2hvd2Nhc2luZyUyMHRoZSUyMHJlc3VsdCUyMGFzJTIwYSUyMGJhbm5lci4lMjIlMEElMEFJJTIwd2lsbCUyMHVzZSUyMHRoZSUyMGZvbGxvd2luZyUyMHRvb2xzJTNBJTIwJTYwZG9jdW1lbnRfcWElNjAlMjB0byUyMGZpbmQlMjB0aGUlMjBvbGRlc3QlMjBwZXJzb24lMjBpbiUyMHRoZSUyMGRvY3VtZW50JTJDJTIwdGhlbiUyMCU2MGltYWdlX2dlbmVyYXRvciU2MCUyMHRvJTIwZ2VuZXJhdGUlMjBhbiUyMGltYWdlJTIwYWNjb3JkaW5nJTIwdG8lMjB0aGUlMjBhbnN3ZXIuJTBBJTBBQW5zd2VyJTNBJTBBJTYwJTYwJTYwcHklMEFhbnN3ZXIlMjAlM0QlMjBkb2N1bWVudF9xYShkb2N1bWVudCUyQyUyMHF1ZXN0aW9uJTNEJTIyV2hhdCUyMGlzJTIwdGhlJTIwb2xkZXN0JTIwcGVyc29uJTNGJTIyKSUwQXByaW50KGYlMjJUaGUlMjBhbnN3ZXIlMjBpcyUyMCU3QmFuc3dlciU3RC4lMjIpJTBBaW1hZ2UlMjAlM0QlMjBpbWFnZV9nZW5lcmF0b3IoJTIyQSUyMGJhbm5lciUyMHNob3dpbmclMjAlMjIlMjAlMkIlMjBhbnN3ZXIpJTBBJTYwJTYwJTYwJTBBJTBBJTVCLi4uJTVEJTBBJTBBVGFzayUzQSUyMCUyMkRyYXclMjBtZSUyMGElMjBwaWN0dXJlJTIwb2YlMjByaXZlcnMlMjBhbmQlMjBsYWtlcyUyMiUwQSUwQUklMjB3aWxsJTIwdXNlJTIwdGhlJTIwZm9sbG93aW5n",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`,wrap:!1}}),A=new c({props:{code:"LSUyMCUzQ3Rvb2wubmFtZSUzRSUzQSUyMCUzQ3Rvb2wuZGVzY3JpcHRpb24lM0U=",highlighted:"- &lt;tool.name&gt;: &lt;tool.description&gt;",wrap:!1}}),K=new c({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>)`,wrap:!1}}),O=new c({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.",wrap:!1}}),I=new $({props:{$$slots:{default:[Ni]},$$scope:{ctx:g}}}),at=new c({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",wrap:!1}}),rt=new c({props:{code:"VGFzayUzQSUyMCUyMkRyYXclMjBtZSUyMGElMjBwaWN0dXJlJTIwb2YlMjByaXZlcnMlMjBhbmQlMjBsYWtlcyUyMiUwQSUwQUklMjB3aWxsJTIwdXNlJTIwdGhlJTIwZm9sbG93aW5n",highlighted:`Task: &quot;Draw me a picture of rivers and lakes&quot;

I will use the following`,wrap:!1}}),mt=new c({props:{code:"YWdlbnQucnVuKCUyMkRyYX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GZpcnN0LiUyMEklMjB3aWxsJTIwdXNlJTIwdGhlJTIwdG9vbCUyMCU2MHRyYW5zbGF0b3IlNjAlMjB0byUyMGRvJTIwdGhpcy4lMEElMEElNjAlNjAlNjBweSUwQXRyYW5zbGF0ZWRfcXVlc3Rpb24lMjAlM0QlMjB0cmFuc2xhdG9yKHF1ZXN0aW9uJTNEcXVlc3Rpb24lMkMlMjBzcmNfbGFuZyUzRCUyMkZyZW5jaCUyMiUyQyUyMHRndF9sYW5nJTNEJTIyRW5nbGlzaCUyMiklMEFwcmludChmJTIyVGhlJTIwdHJhbnNsYXRlZCUyMHF1ZXN0aW9uJTIwaXMlMjAlN0J0cmFuc2xhdGVkX3F1ZXN0aW9uJTdELiUyMiklMEFhbnN3ZXIlMjAlM0QlMjBpbWFnZV9xYSh0ZXh0JTNEdHJhbnNsYXRlZF9xdWVzdGlvbiUyQyUyMGltYWdlJTNEaW1hZ2UpJTBBcHJpbnQoZiUyMlRoZSUyMGFuc3dlciUyMGlzJTIwJTdCYW5zd2VyJTdEJTIyKSUwQSU2MCU2MCU2MCUwQSUwQSUzRCUzRCUzRCUzRCUzRCUwQSUwQSU1Qi4uLiU1RA==",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;)
\`\`\`

=====

[...]`,wrap:!1}}),wt=new c({props:{code:"SHVtYW4lM0ElMjAlM0N1c2VyLWlucHV0JTNFJTVDbiU1Q25Bc3Npc3RhbnQlM0E=",highlighted:"Human: &lt;user-input&gt;\\n\\nAssistant:",wrap:!1}}),bt=new T({props:{title:"Writing good user inputs",local:"writing-good-user-inputs",headingTag:"h3"}}),Tt=new c({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>)`,wrap:!1}}),$t=new c({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;)`,wrap:!1}}),Zt=new c({props:{code:"YWdlbnQudG9vbGJveCU1QiUyMmltYWdlX2dlbmVyYXRvciUyMiU1RC5kZXNjcmlwdGlvbg==",highlighted:'agent.toolbox[<span class="hljs-string">&quot;image_generator&quot;</span>].description',wrap:!1}}),vt=new c({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.",wrap:!1}}),It=new c({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>)',wrap:!1}}),Ct=new c({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;)`,wrap:!1}}),xt=new T({props:{title:"Customizing the tool descriptions",local:"customizing-the-tool-descriptions",headingTag:"h3"}}),kt=new c({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>)',wrap:!1}}),_t=new c({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;)`,wrap:!1}}),Qt=new c({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>
)`,wrap:!1}}),Ft=new c({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>)',wrap:!1}}),St=new c({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;)`,wrap:!1}}),qt=new c({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>)',wrap:!1}}),Lt=new c({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;)`,wrap:!1}}),W=new $({props:{warning:!0,$$slots:{default:[Xi]},$$scope:{ctx:g}}}),At=new T({props:{title:"Customizing the whole prompt",local:"customizing-the-whole-prompt",headingTag:"h3"}}),Kt=new c({props:{code:"dGVtcGxhdGUlMjAlM0QlMjAlMjIlMjIlMjIlMjAlNUIuLi4lNUQlMjAlMjIlMjIlMjIlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoeW91cl9lbmRwb2ludCUyQyUyMHJ1bl9wcm9tcHRfdGVtcGxhdGUlM0R0ZW1wbGF0ZSk=",highlighted:`template = <span class="hljs-string">&quot;&quot;&quot; [...] &quot;&quot;&quot;</span>

agent = HfAgent(your_endpoint, run_prompt_template=template)`,wrap:!1}}),C=new $({props:{warning:!0,$$slots:{default:[Qi]},$$scope:{ctx:g}}}),Ot=new c({props:{code:"SHVtYW4lM0ElMjAlM0MlM0N0YXNrJTNFJTNFJTBBJTBBQXNzaXN0YW50JTNB",highlighted:`Human: &lt;&lt;task&gt;&gt;

Assistant:`,wrap:!1}}),ee=new c({props:{code:"dGVtcGxhdGUlMjAlM0QlMjAlMjIlMjIlMjIlMjAlNUIuLi4lNUQlMjAlMjIlMjIlMjIlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQodXJsX2VuZHBvaW50JTNEeW91cl9lbmRwb2ludCUyQyUyMGNoYXRfcHJvbXB0X3RlbXBsYXRlJTNEdGVtcGxhdGUp",highlighted:`template = <span class="hljs-string">&quot;&quot;&quot; [...] &quot;&quot;&quot;</span>

agent = HfAgent(url_endpoint=your_endpoint, chat_prompt_template=template)`,wrap:!1}}),B=new $({props:{warning:!0,$$slots:{default:[Vi]},$$scope:{ctx:g}}}),se=new T({props:{title:"Using custom tools",local:"using-custom-tools",headingTag:"h2"}}),x=new $({props:{warning:!0,$$slots:{default:[Fi]},$$scope:{ctx:g}}}),pe=new c({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>)`,wrap:!1}}),de=new c({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>)`,wrap:!1}}),ue=new c({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;",wrap:!1}}),ye=new c({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)`,wrap:!1}}),ce=new c({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`",wrap:!1}}),H=new $({props:{$$slots:{default:[Ei]},$$scope:{ctx:g}}}),ge=new c({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()]))',wrap:!1}}),Je=new c({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`,wrap:!1}}),$e=new c({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>
)`,wrap:!1}}),ve=new c({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)',wrap:!1}}),Ge=new c({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;)`,wrap:!1}}),Ce=new c({props:{code:"aW1hZ2UlMjAlM0QlMjBhZ2VudC5ydW4oJTIyVXBzY2FsZSUyMHRoZSUyMGltYWdlJTIyJTJDJTIwaW1hZ2Up",highlighted:'image = agent.run(<span class="hljs-string">&quot;Upscale the image&quot;</span>, image)',wrap:!1}}),Be=new c({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)`,wrap:!1}}),ke=new T({props:{title:"Adding new tools",local:"adding-new-tools",headingTag:"h3"}}),_e=new T({props:{title:"Creating a new tool",local:"creating-a-new-tool",headingTag:"h4"}}),Qe=new c({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>)`,wrap:!1}}),Ee=new c({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>):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ZWYlMjBfX2NhbGxfXyhzZWxmJTJDJTIwdGFzayUzQSUyMHN0ciklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2RlbCUyMCUzRCUyMG5leHQoaXRlcihsaXN0X21vZGVscyhmaWx0ZXIlM0R0YXNrJTJDJTIwc29ydCUzRCUyMmRvd25sb2FkcyUyMiUyQyUyMGRpcmVjdGlvbiUzRC0xKSkpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwbW9kZWwuaWQ=",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>`,wrap:!1}}),Pe=new c({props:{code:"ZnJvbSUyMG1vZGVsX2Rvd25sb2FkcyUyMGltcG9ydCUyMEhGTW9kZWxEb3dubG9hZHNUb29sJTBBJTBBdG9vbCUyMCUzRCUyMEhGTW9kZWxEb3dubG9hZHNUb29sKCk=",highlighted:`<span class="hljs-keyword">from</span> model_downloads <span class="hljs-keyword">import</span> HFModelDownloadsTool

tool = HFModelDownloadsTool()`,wrap:!1}}),De=new c({props:{code:"dG9vbC5wdXNoX3RvX2h1YiglMjJoZi1tb2RlbC1kb3dubG9hZHMlMjIp",highlighted:'tool.push_to_hub(<span class="hljs-string">&quot;hf-model-downloads&quot;</span>)',wrap:!1}}),tl=new T({props:{title:"Having the agent use the tool",local:"having-the-agent-use-the-tool",headingTag:"h4"}}),ll=new c({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>)`,wrap:!1}}),al=new c({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>
)`,wrap:!1}}),ol=new c({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.`,wrap:!1}}),R=new $({props:{$$slots:{default:[Si]},$$scope:{ctx:g}}}),pl=new T({props:{title:"Replacing existing tools",local:"replacing-existing-tools",headingTag:"h3"}}),dl=new c({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>)`,wrap:!1}}),k=new $({props:{$$slots:{default:[zi]},$$scope:{ctx:g}}}),hl=new T({props:{title:"Leveraging gradio-tools",local:"leveraging-gradio-tools",headingTag:"h2"}}),wl=new c({props:{code:"ZnJvbSUyMGdyYWRpb190b29scyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblByb21wdEdlbmVyYXRvclRvb2wlMEElMEFncmFkaW9fdG9vbCUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblByb21wdEdlbmVyYXRvclRvb2woKQ==",highlighted:`<span class="hljs-keyword">from</span> gradio_tools <span class="hljs-keyword">import</span> StableDiffusionPromptGeneratorTool

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

tool = Tool.from_gradio(gradio_tool)`,wrap:!1}}),gl=new c({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>)`,wrap:!1}}),Tl=new c({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)`,wrap:!1}}),Y=new $({props:{warning:!0,$$slots:{default:[qi]},$$scope:{ctx:g}}}),$l=new T({props:{title:"Future compatibility with Langchain",local:"future-compatibility-with-langchain",headingTag:"h2"}}),{c(){p=o("meta"),f=a(),w=o("p"),b=a(),m(Z.$$.fragment),J=a(),m(U.$$.fragment),Wl=a(),m(G.$$.fragment),Cl=a(),_=o("p"),_.textContent=Rs,Bl=a(),N=o("ul"),N.innerHTML=ks,xl=a(),m(X.$$.fragment),Hl=a(),Q=o("p"),Q.innerHTML=Ys,Rl=a(),m(V.$$.fragment),kl=a(),F=o("p"),F.textContent=_s,Yl=a(),E=o("ul"),E.innerHTML=Ns,_l=a(),S=o("p"),S.innerHTML=Xs,Nl=a(),m(z.$$.fragment),Xl=a(),q=o("p"),q.innerHTML=Qs,Ql=a(),L=o("p"),L.innerHTML=Vs,Vl=a(),m(A.$$.fragment),Fl=a(),P=o("p"),P.textContent=Fs,El=a(),m(K.$$.fragment),Sl=a(),D=o("p"),D.textContent=Es,zl=a(),m(O.$$.fragment),ql=a(),tt=o("p"),tt.textContent=Ss,Ll=a(),et=o("p"),et.textContent=zs,Al=a(),m(I.$$.fragment),Pl=a(),lt=o("p"),lt.textContent=qs,Kl=a(),nt=o("p"),nt.textContent=Ls,Dl=a(),m(at.$$.fragment),Ol=a(),st=o("p"),st.textContent=As,tn=a(),ot=o("p"),ot.innerHTML=Ps,en=a(),it=o("p"),it.textContent=Ks,ln=a(),m(rt.$$.fragment),nn=a(),pt=o("p"),pt.textContent=Ds,an=a(),m(mt.$$.fragment),sn=a(),dt=o("p"),dt.innerHTML=Os,on=a(),ht=o("p"),ht.innerHTML=to,rn=a(),m(ut.$$.fragment),pn=a(),Mt=o("p"),Mt.innerHTML=eo,mn=a(),yt=o("p"),yt.innerHTML=lo,dn=a(),m(wt.$$.fragment),hn=a(),ct=o("p"),ct.innerHTML=no,un=a(),ft=o("p"),ft.textContent=ao,Mn=a(),m(bt.$$.fragment),yn=a(),gt=o("p"),gt.textContent=so,wn=a(),Jt=o("p"),Jt.textContent=oo,cn=a(),m(Tt.$$.fragment),fn=a(),Ut=o("p"),Ut.textContent=io,bn=a(),m($t.$$.fragment),gn=a(),jt=o("p"),jt.textContent=ro,Jn=a(),m(Zt.$$.fragment),Tn=a(),m(vt.$$.fragment),Un=a(),Gt=o("p"),Gt.textContent=po,$n=a(),m(It.$$.fragment),jn=a(),Wt=o("p"),Wt.textContent=mo,Zn=a(),m(Ct.$$.fragment),vn=a(),Bt=o("p"),Bt.textContent=ho,Gn=a(),m(xt.$$.fragment),In=a(),Ht=o("p"),Ht.innerHTML=uo,Wn=a(),Rt=o("p"),Rt.innerHTML=Mo,Cn=a(),m(kt.$$.fragment),Bn=a(),Yt=o("p"),Yt.textContent=yo,xn=a(),m(_t.$$.fragment),Hn=a(),Nt=o("p"),Nt.innerHTML=wo,Rn=a(),Xt=o("p"),Xt.innerHTML=co,kn=a(),m(Qt.$$.fragment),Yn=a(),Vt=o("p"),Vt.textContent=fo,_n=a(),m(Ft.$$.fragment),Nn=a(),Et=o("p"),Et.textContent=bo,Xn=a(),m(St.$$.fragment),Qn=a(),zt=o("p"),zt.textContent=go,Vn=a(),m(qt.$$.fragment),Fn=a(),m(Lt.$$.fragment),En=a(),m(W.$$.fragment),Sn=a(),m(At.$$.fragment),zn=a(),Pt=o("p"),Pt.innerHTML=Jo,qn=a(),m(Kt.$$.fragment),Ln=a(),m(C.$$.fragment),An=a(),Dt=o("p"),Dt.innerHTML=To,Pn=a(),m(Ot.$$.fragment),Kn=a(),te=o("p"),te.innerHTML=Uo,Dn=a(),m(ee.$$.fragment),On=a(),m(B.$$.fragment),ta=a(),le=o("p"),le.innerHTML=$o,ea=a(),ne=o("p"),ne.textContent=jo,la=a(),ae=o("ul"),ae.innerHTML=Zo,na=a(),m(se.$$.fragment),aa=a(),m(x.$$.fragment),sa=a(),oe=o("p"),oe.textContent=vo,oa=a(),ie=o("ul"),ie.innerHTML=Go,ia=a(),re=o("p"),re.innerHTML=Io,ra=a(),m(pe.$$.fragment),pa=a(),me=o("p"),me.innerHTML=Wo,ma=a(),m(de.$$.fragment),da=a(),he=o("p"),he.textContent=Co,ha=a(),m(ue.$$.fragment),ua=a(),Me=o("p"),Me.innerHTML=Bo,Ma=a(),m(ye.$$.fragment),ya=a(),we=o("p"),we.textContent=xo,wa=a(),m(ce.$$.fragment),ca=a(),fe=o("p"),fe.innerHTML=Ho,fa=a(),m(H.$$.fragment),ba=a(),be=o("p"),be.innerHTML=Ro,ga=a(),m(ge.$$.fragment),Ja=a(),m(Je.$$.fragment),Ta=a(),Te=o("p"),Te.innerHTML=ko,Ua=a(),Ue=o("p"),Ue.innerHTML=Yo,$a=a(),m($e.$$.fragment),ja=a(),je=o("img"),Za=a(),Ze=o("p"),Ze.textContent=No,va=a(),m(ve.$$.fragment),Ga=a(),m(Ge.$$.fragment),Ia=a(),Ie=o("img"),Wa=a(),We=o("p"),We.textContent=Qo,Ca=a(),m(Ce.$$.fragment),Ba=a(),m(Be.$$.fragment),xa=a(),xe=o("img"),Ha=a(),He=o("p"),He.textContent=Fo,Ra=a(),Re=o("p"),Re.textContent=Eo,ka=a(),m(ke.$$.fragment),Ya=a(),Ye=o("p"),Ye.textContent=So,_a=a(),m(_e.$$.fragment),Na=a(),Ne=o("p"),Ne.textContent=zo,Xa=a(),Xe=o("p"),Xe.textContent=qo,Qa=a(),m(Qe.$$.fragment),Va=a(),Ve=o("p"),Ve.innerHTML=Lo,Fa=a(),Fe=o("p"),Fe.innerHTML=Ao,Ea=a(),m(Ee.$$.fragment),Sa=a(),Se=o("p"),Se.textContent=Po,za=a(),ze=o("ul"),ze.innerHTML=Ko,qa=a(),qe=o("p"),qe.textContent=Do,La=a(),m(Le.$$.fragment),Aa=a(),Ae=o("p"),Ae.innerHTML=Oo,Pa=a(),m(Pe.$$.fragment),Ka=a(),Ke=o("p"),Ke.innerHTML=ti,Da=a(),m(De.$$.fragment),Oa=a(),Oe=o("p"),Oe.textContent=ei,ts=a(),m(tl.$$.fragment),es=a(),el=o("p"),el.textContent=li,ls=a(),m(ll.$$.fragment),ns=a(),nl=o("p"),nl.innerHTML=ni,as=a(),m(al.$$.fragment),ss=a(),sl=o("p"),sl.textContent=ai,os=a(),m(ol.$$.fragment),is=a(),il=o("p"),il.textContent=si,rs=a(),rl=o("table"),rl.innerHTML=oi,ps=a(),m(R.$$.fragment),ms=a(),m(pl.$$.fragment),ds=a(),ml=o("p"),ml.textContent=ii,hs=a(),m(dl.$$.fragment),us=a(),m(k.$$.fragment),Ms=a(),m(hl.$$.fragment),ys=a(),ul=o("p"),ul.innerHTML=ri,ws=a(),Ml=o("p"),Ml.innerHTML=pi,cs=a(),yl=o("p"),yl.innerHTML=mi,fs=a(),m(wl.$$.fragment),bs=a(),cl=o("p"),cl.innerHTML=di,gs=a(),m(fl.$$.fragment),Js=a(),bl=o("p"),bl.innerHTML=hi,Ts=a(),m(gl.$$.fragment),Us=a(),Jl=o("p"),Jl.textContent=ui,$s=a(),m(Tl.$$.fragment),js=a(),Ul=o("p"),Ul.textContent=Mi,Zs=a(),Gl=o("img"),vs=a(),m(Y.$$.fragment),Gs=a(),m($l.$$.fragment),Is=a(),jl=o("p"),jl.innerHTML=wi,Ws=a(),Zl=o("p"),Zl.textContent=ci,Cs=a(),vl=o("p"),vl.innerHTML=fi,Bs=a(),Il=o("p"),this.h()},l(t){const e=Ri("svelte-u9bgzb",document.head);p=i(e,"META",{name:!0,content:!0}),e.forEach(l),f=s(t),w=i(t,"P",{}),Wi(w).forEach(l),b=s(t),d(Z.$$.fragment,t),J=s(t),d(U.$$.fragment,t),Wl=s(t),d(G.$$.fragment,t),Cl=s(t),_=i(t,"P",{"data-svelte-h":!0}),r(_)!=="svelte-1qhojy7"&&(_.textContent=Rs),Bl=s(t),N=i(t,"UL",{"data-svelte-h":!0}),r(N)!=="svelte-1e2yd7f"&&(N.innerHTML=ks),xl=s(t),d(X.$$.fragment,t),Hl=s(t),Q=i(t,"P",{"data-svelte-h":!0}),r(Q)!=="svelte-12w5t2u"&&(Q.innerHTML=Ys),Rl=s(t),d(V.$$.fragment,t),kl=s(t),F=i(t,"P",{"data-svelte-h":!0}),r(F)!=="svelte-rii2rm"&&(F.textContent=_s),Yl=s(t),E=i(t,"UL",{"data-svelte-h":!0}),r(E)!=="svelte-1s06fus"&&(E.innerHTML=Ns),_l=s(t),S=i(t,"P",{"data-svelte-h":!0}),r(S)!=="svelte-1fvzc7b"&&(S.innerHTML=Xs),Nl=s(t),d(z.$$.fragment,t),Xl=s(t),q=i(t,"P",{"data-svelte-h":!0}),r(q)!=="svelte-1wu3o2u"&&(q.innerHTML=Qs),Ql=s(t),L=i(t,"P",{"data-svelte-h":!0}),r(L)!=="svelte-w2lme7"&&(L.innerHTML=Vs),Vl=s(t),d(A.$$.fragment,t),Fl=s(t),P=i(t,"P",{"data-svelte-h":!0}),r(P)!=="svelte-1aanlkj"&&(P.textContent=Fs),El=s(t),d(K.$$.fragment,t),Sl=s(t),D=i(t,"P",{"data-svelte-h":!0}),r(D)!=="svelte-1h8i6v1"&&(D.textContent=Es),zl=s(t),d(O.$$.fragment,t),ql=s(t),tt=i(t,"P",{"data-svelte-h":!0}),r(tt)!=="svelte-gnycp5"&&(tt.textContent=Ss),Ll=s(t),et=i(t,"P",{"data-svelte-h":!0}),r(et)!=="svelte-1l25cn1"&&(et.textContent=zs),Al=s(t),d(I.$$.fragment,t),Pl=s(t),lt=i(t,"P",{"data-svelte-h":!0}),r(lt)!=="svelte-pd6qvf"&&(lt.textContent=qs),Kl=s(t),nt=i(t,"P",{"data-svelte-h":!0}),r(nt)!=="svelte-19wuaq2"&&(nt.textContent=Ls),Dl=s(t),d(at.$$.fragment,t),Ol=s(t),st=i(t,"P",{"data-svelte-h":!0}),r(st)!=="svelte-137b6p5"&&(st.textContent=As),tn=s(t),ot=i(t,"P",{"data-svelte-h":!0}),r(ot)!=="svelte-15tb3lk"&&(ot.innerHTML=Ps),en=s(t),it=i(t,"P",{"data-svelte-h":!0}),r(it)!=="svelte-1wj8rg1"&&(it.textContent=Ks),ln=s(t),d(rt.$$.fragment,t),nn=s(t),pt=i(t,"P",{"data-svelte-h":!0}),r(pt)!=="svelte-1utp6i7"&&(pt.textContent=Ds),an=s(t),d(mt.$$.fragment,t),sn=s(t),dt=i(t,"P",{"data-svelte-h":!0}),r(dt)!=="svelte-1ff76an"&&(dt.innerHTML=Os),on=s(t),ht=i(t,"P",{"data-svelte-h":!0}),r(ht)!=="svelte-b48t6"&&(ht.innerHTML=to),rn=s(t),d(ut.$$.fragment,t),pn=s(t),Mt=i(t,"P",{"data-svelte-h":!0}),r(Mt)!=="svelte-1dwkh6"&&(Mt.innerHTML=eo),mn=s(t),yt=i(t,"P",{"data-svelte-h":!0}),r(yt)!=="svelte-reah3c"&&(yt.innerHTML=lo),dn=s(t),d(wt.$$.fragment,t),hn=s(t),ct=i(t,"P",{"data-svelte-h":!0}),r(ct)!=="svelte-e0mebg"&&(ct.innerHTML=no),un=s(t),ft=i(t,"P",{"data-svelte-h":!0}),r(ft)!=="svelte-3wcpkg"&&(ft.textContent=ao),Mn=s(t),d(bt.$$.fragment,t),yn=s(t),gt=i(t,"P",{"data-svelte-h":!0}),r(gt)!=="svelte-1dybovb"&&(gt.textContent=so),wn=s(t),Jt=i(t,"P",{"data-svelte-h":!0}),r(Jt)!=="svelte-z3kpmt"&&(Jt.textContent=oo),cn=s(t),d(Tt.$$.fragment,t),fn=s(t),Ut=i(t,"P",{"data-svelte-h":!0}),r(Ut)!=="svelte-1b883kw"&&(Ut.textContent=io),bn=s(t),d($t.$$.fragment,t),gn=s(t),jt=i(t,"P",{"data-svelte-h":!0}),r(jt)!=="svelte-1bazuf7"&&(jt.textContent=ro),Jn=s(t),d(Zt.$$.fragment,t),Tn=s(t),d(vt.$$.fragment,t),Un=s(t),Gt=i(t,"P",{"data-svelte-h":!0}),r(Gt)!=="svelte-b01ut5"&&(Gt.textContent=po),$n=s(t),d(It.$$.fragment,t),jn=s(t),Wt=i(t,"P",{"data-svelte-h":!0}),r(Wt)!=="svelte-1b883kw"&&(Wt.textContent=mo),Zn=s(t),d(Ct.$$.fragment,t),vn=s(t),Bt=i(t,"P",{"data-svelte-h":!0}),r(Bt)!=="svelte-4ez52l"&&(Bt.textContent=ho),Gn=s(t),d(xt.$$.fragment,t),In=s(t),Ht=i(t,"P",{"data-svelte-h":!0}),r(Ht)!=="svelte-8ifc9z"&&(Ht.innerHTML=uo),Wn=s(t),Rt=i(t,"P",{"data-svelte-h":!0}),r(Rt)!=="svelte-1oywuvq"&&(Rt.innerHTML=Mo),Cn=s(t),d(kt.$$.fragment,t),Bn=s(t),Yt=i(t,"P",{"data-svelte-h":!0}),r(Yt)!=="svelte-vjj76b"&&(Yt.textContent=yo),xn=s(t),d(_t.$$.fragment,t),Hn=s(t),Nt=i(t,"P",{"data-svelte-h":!0}),r(Nt)!=="svelte-bjnte8"&&(Nt.innerHTML=wo),Rn=s(t),Xt=i(t,"P",{"data-svelte-h":!0}),r(Xt)!=="svelte-btfpkp"&&(Xt.innerHTML=co),kn=s(t),d(Qt.$$.fragment,t),Yn=s(t),Vt=i(t,"P",{"data-svelte-h":!0}),r(Vt)!=="svelte-11yz1xk"&&(Vt.textContent=fo),_n=s(t),d(Ft.$$.fragment,t),Nn=s(t),Et=i(t,"P",{"data-svelte-h":!0}),r(Et)!=="svelte-10q5qmo"&&(Et.textContent=bo),Xn=s(t),d(St.$$.fragment,t),Qn=s(t),zt=i(t,"P",{"data-svelte-h":!0}),r(zt)!=="svelte-1xs09vd"&&(zt.textContent=go),Vn=s(t),d(qt.$$.fragment,t),Fn=s(t),d(Lt.$$.fragment,t),En=s(t),d(W.$$.fragment,t),Sn=s(t),d(At.$$.fragment,t),zn=s(t),Pt=i(t,"P",{"data-svelte-h":!0}),r(Pt)!=="svelte-knehpf"&&(Pt.innerHTML=Jo),qn=s(t),d(Kt.$$.fragment,t),Ln=s(t),d(C.$$.fragment,t),An=s(t),Dt=i(t,"P",{"data-svelte-h":!0}),r(Dt)!=="svelte-15jgvnr"&&(Dt.innerHTML=To),Pn=s(t),d(Ot.$$.fragment,t),Kn=s(t),te=i(t,"P",{"data-svelte-h":!0}),r(te)!=="svelte-kxexhm"&&(te.innerHTML=Uo),Dn=s(t),d(ee.$$.fragment,t),On=s(t),d(B.$$.fragment,t),ta=s(t),le=i(t,"P",{"data-svelte-h":!0}),r(le)!=="svelte-6yllxv"&&(le.innerHTML=$o),ea=s(t),ne=i(t,"P",{"data-svelte-h":!0}),r(ne)!=="svelte-1pz2hir"&&(ne.textContent=jo),la=s(t),ae=i(t,"UL",{"data-svelte-h":!0}),r(ae)!=="svelte-10jdtg2"&&(ae.innerHTML=Zo),na=s(t),d(se.$$.fragment,t),aa=s(t),d(x.$$.fragment,t),sa=s(t),oe=i(t,"P",{"data-svelte-h":!0}),r(oe)!=="svelte-1c5tlua"&&(oe.textContent=vo),oa=s(t),ie=i(t,"UL",{"data-svelte-h":!0}),r(ie)!=="svelte-3ndjxi"&&(ie.innerHTML=Go),ia=s(t),re=i(t,"P",{"data-svelte-h":!0}),r(re)!=="svelte-nsbtjg"&&(re.innerHTML=Io),ra=s(t),d(pe.$$.fragment,t),pa=s(t),me=i(t,"P",{"data-svelte-h":!0}),r(me)!=="svelte-p0dnmg"&&(me.innerHTML=Wo),ma=s(t),d(de.$$.fragment,t),da=s(t),he=i(t,"P",{"data-svelte-h":!0}),r(he)!=="svelte-1i27rne"&&(he.textContent=Co),ha=s(t),d(ue.$$.fragment,t),ua=s(t),Me=i(t,"P",{"data-svelte-h":!0}),r(Me)!=="svelte-6618iq"&&(Me.innerHTML=Bo),Ma=s(t),d(ye.$$.fragment,t),ya=s(t),we=i(t,"P",{"data-svelte-h":!0}),r(we)!=="svelte-gbcquo"&&(we.textContent=xo),wa=s(t),d(ce.$$.fragment,t),ca=s(t),fe=i(t,"P",{"data-svelte-h":!0}),r(fe)!=="svelte-gos6jv"&&(fe.innerHTML=Ho),fa=s(t),d(H.$$.fragment,t),ba=s(t),be=i(t,"P",{"data-svelte-h":!0}),r(be)!=="svelte-l1h4uq"&&(be.innerHTML=Ro),ga=s(t),d(ge.$$.fragment,t),Ja=s(t),d(Je.$$.fragment,t),Ta=s(t),Te=i(t,"P",{"data-svelte-h":!0}),r(Te)!=="svelte-1342gb7"&&(Te.innerHTML=ko),Ua=s(t),Ue=i(t,"P",{"data-svelte-h":!0}),r(Ue)!=="svelte-1ku572g"&&(Ue.innerHTML=Yo),$a=s(t),d($e.$$.fragment,t),ja=s(t),je=i(t,"IMG",{src:!0,width:!0}),Za=s(t),Ze=i(t,"P",{"data-svelte-h":!0}),r(Ze)!=="svelte-1ghiycr"&&(Ze.textContent=No),va=s(t),d(ve.$$.fragment,t),Ga=s(t),d(Ge.$$.fragment,t),Ia=s(t),Ie=i(t,"IMG",{src:!0,width:!0}),Wa=s(t),We=i(t,"P",{"data-svelte-h":!0}),r(We)!=="svelte-18tz5k9"&&(We.textContent=Qo),Ca=s(t),d(Ce.$$.fragment,t),Ba=s(t),d(Be.$$.fragment,t),xa=s(t),xe=i(t,"IMG",{src:!0,width:!0}),Ha=s(t),He=i(t,"P",{"data-svelte-h":!0}),r(He)!=="svelte-1tkj4wc"&&(He.textContent=Fo),Ra=s(t),Re=i(t,"P",{"data-svelte-h":!0}),r(Re)!=="svelte-dd7bew"&&(Re.textContent=Eo),ka=s(t),d(ke.$$.fragment,t),Ya=s(t),Ye=i(t,"P",{"data-svelte-h":!0}),r(Ye)!=="svelte-1otb4ya"&&(Ye.textContent=So),_a=s(t),d(_e.$$.fragment,t),Na=s(t),Ne=i(t,"P",{"data-svelte-h":!0}),r(Ne)!=="svelte-sol241"&&(Ne.textContent=zo),Xa=s(t),Xe=i(t,"P",{"data-svelte-h":!0}),r(Xe)!=="svelte-1t55phh"&&(Xe.textContent=qo),Qa=s(t),d(Qe.$$.fragment,t),Va=s(t),Ve=i(t,"P",{"data-svelte-h":!0}),r(Ve)!=="svelte-70xumj"&&(Ve.innerHTML=Lo),Fa=s(t),Fe=i(t,"P",{"data-svelte-h":!0}),r(Fe)!=="svelte-1gypcaq"&&(Fe.innerHTML=Ao),Ea=s(t),d(Ee.$$.fragment,t),Sa=s(t),Se=i(t,"P",{"data-svelte-h":!0}),r(Se)!=="svelte-113o02m"&&(Se.textContent=Po),za=s(t),ze=i(t,"UL",{"data-svelte-h":!0}),r(ze)!=="svelte-1yllho7"&&(ze.innerHTML=Ko),qa=s(t),qe=i(t,"P",{"data-svelte-h":!0}),r(qe)!=="svelte-1d2t961"&&(qe.textContent=Do),La=s(t),d(Le.$$.fragment,t),Aa=s(t),Ae=i(t,"P",{"data-svelte-h":!0}),r(Ae)!=="svelte-1pgmicw"&&(Ae.innerHTML=Oo),Pa=s(t),d(Pe.$$.fragment,t),Ka=s(t),Ke=i(t,"P",{"data-svelte-h":!0}),r(Ke)!=="svelte-sz7owm"&&(Ke.innerHTML=ti),Da=s(t),d(De.$$.fragment,t),Oa=s(t),Oe=i(t,"P",{"data-svelte-h":!0}),r(Oe)!=="svelte-1eaq3qx"&&(Oe.textContent=ei),ts=s(t),d(tl.$$.fragment,t),es=s(t),el=i(t,"P",{"data-svelte-h":!0}),r(el)!=="svelte-1g0yncs"&&(el.textContent=li),ls=s(t),d(ll.$$.fragment,t),ns=s(t),nl=i(t,"P",{"data-svelte-h":!0}),r(nl)!=="svelte-xkoq76"&&(nl.innerHTML=ni),as=s(t),d(al.$$.fragment,t),ss=s(t),sl=i(t,"P",{"data-svelte-h":!0}),r(sl)!=="svelte-pjyxhx"&&(sl.textContent=ai),os=s(t),d(ol.$$.fragment,t),is=s(t),il=i(t,"P",{"data-svelte-h":!0}),r(il)!=="svelte-406qkd"&&(il.textContent=si),rs=s(t),rl=i(t,"TABLE",{"data-svelte-h":!0}),r(rl)!=="svelte-1tqzmpy"&&(rl.innerHTML=oi),ps=s(t),d(R.$$.fragment,t),ms=s(t),d(pl.$$.fragment,t),ds=s(t),ml=i(t,"P",{"data-svelte-h":!0}),r(ml)!=="svelte-efrp9a"&&(ml.textContent=ii),hs=s(t),d(dl.$$.fragment,t),us=s(t),d(k.$$.fragment,t),Ms=s(t),d(hl.$$.fragment,t),ys=s(t),ul=i(t,"P",{"data-svelte-h":!0}),r(ul)!=="svelte-k79zul"&&(ul.innerHTML=ri),ws=s(t),Ml=i(t,"P",{"data-svelte-h":!0}),r(Ml)!=="svelte-1g50g90"&&(Ml.innerHTML=pi),cs=s(t),yl=i(t,"P",{"data-svelte-h":!0}),r(yl)!=="svelte-13sspw7"&&(yl.innerHTML=mi),fs=s(t),d(wl.$$.fragment,t),bs=s(t),cl=i(t,"P",{"data-svelte-h":!0}),r(cl)!=="svelte-fosp2q"&&(cl.innerHTML=di),gs=s(t),d(fl.$$.fragment,t),Js=s(t),bl=i(t,"P",{"data-svelte-h":!0}),r(bl)!=="svelte-upt5q1"&&(bl.innerHTML=hi),Ts=s(t),d(gl.$$.fragment,t),Us=s(t),Jl=i(t,"P",{"data-svelte-h":!0}),r(Jl)!=="svelte-1ss743w"&&(Jl.textContent=ui),$s=s(t),d(Tl.$$.fragment,t),js=s(t),Ul=i(t,"P",{"data-svelte-h":!0}),r(Ul)!=="svelte-euaib0"&&(Ul.textContent=Mi),Zs=s(t),Gl=i(t,"IMG",{src:!0}),vs=s(t),d(Y.$$.fragment,t),Gs=s(t),d($l.$$.fragment,t),Is=s(t),jl=i(t,"P",{"data-svelte-h":!0}),r(jl)!=="svelte-ez7x57"&&(jl.innerHTML=wi),Ws=s(t),Zl=i(t,"P",{"data-svelte-h":!0}),r(Zl)!=="svelte-1aa89ge"&&(Zl.textContent=ci),Cs=s(t),vl=i(t,"P",{"data-svelte-h":!0}),r(vl)!=="svelte-pg0m6x"&&(vl.innerHTML=fi),Bs=s(t),Il=i(t,"P",{}),Wi(Il).forEach(l),this.h()},h(){v(p,"name","hf:doc:metadata"),v(p,"content",Ai),Hs(je.src,_o="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes.png")||v(je,"src",_o),v(je,"width","200"),Hs(Ie.src,Xo="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes_winter.png")||v(Ie,"src",Xo),v(Ie,"width","200"),Hs(xe.src,Vo="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes_winter_upscale.png")||v(xe,"src",Vo),v(xe,"width","400"),Hs(Gl.src,yi="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png")||v(Gl,"src",yi)},m(t,e){ki(document.head,p),n(t,f,e),n(t,w,e),n(t,b,e),h(Z,t,e),n(t,J,e),h(U,t,e),n(t,Wl,e),h(G,t,e),n(t,Cl,e),n(t,_,e),n(t,Bl,e),n(t,N,e),n(t,xl,e),h(X,t,e),n(t,Hl,e),n(t,Q,e),n(t,Rl,e),h(V,t,e),n(t,kl,e),n(t,F,e),n(t,Yl,e),n(t,E,e),n(t,_l,e),n(t,S,e),n(t,Nl,e),h(z,t,e),n(t,Xl,e),n(t,q,e),n(t,Ql,e),n(t,L,e),n(t,Vl,e),h(A,t,e),n(t,Fl,e),n(t,P,e),n(t,El,e),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,e),n(t,Ae,e),n(t,Pa,e),h(Pe,t,e),n(t,Ka,e),n(t,Ke,e),n(t,Da,e),h(De,t,e),n(t,Oa,e),n(t,Oe,e),n(t,ts,e),h(tl,t,e),n(t,es,e),n(t,el,e),n(t,ls,e),h(ll,t,e),n(t,ns,e),n(t,nl,e),n(t,as,e),h(al,t,e),n(t,ss,e),n(t,sl,e),n(t,os,e),h(ol,t,e),n(t,is,e),n(t,il,e),n(t,rs,e),n(t,rl,e),n(t,ps,e),h(R,t,e),n(t,ms,e),h(pl,t,e),n(t,ds,e),n(t,ml,e),n(t,hs,e),h(dl,t,e),n(t,us,e),h(k,t,e),n(t,Ms,e),h(hl,t,e),n(t,ys,e),n(t,ul,e),n(t,ws,e),n(t,Ml,e),n(t,cs,e),n(t,yl,e),n(t,fs,e),h(wl,t,e),n(t,bs,e),n(t,cl,e),n(t,gs,e),h(fl,t,e),n(t,Js,e),n(t,bl,e),n(t,Ts,e),h(gl,t,e),n(t,Us,e),n(t,Jl,e),n(t,$s,e),h(Tl,t,e),n(t,js,e),n(t,Ul,e),n(t,Zs,e),n(t,Gl,e),n(t,vs,e),h(Y,t,e),n(t,Gs,e),h($l,t,e),n(t,Is,e),n(t,jl,e),n(t,Ws,e),n(t,Zl,e),n(t,Cs,e),n(t,vl,e),n(t,Bs,e),n(t,Il,e),xs=!0},p(t,[e]){const bi={};e&2&&(bi.$$scope={dirty:e,ctx:t}),U.$set(bi);const gi={};e&2&&(gi.$$scope={dirty:e,ctx:t}),G.$set(gi);const Ji={};e&2&&(Ji.$$scope={dirty:e,ctx:t}),I.$set(Ji);const Ti={};e&2&&(Ti.$$scope={dirty:e,ctx:t}),W.$set(Ti);const Ui={};e&2&&(Ui.$$scope={dirty:e,ctx:t}),C.$set(Ui);const $i={};e&2&&($i.$$scope={dirty:e,ctx:t}),B.$set($i);const ji={};e&2&&(ji.$$scope={dirty:e,ctx:t}),x.$set(ji);const Zi={};e&2&&(Zi.$$scope={dirty:e,ctx:t}),H.$set(Zi);const vi={};e&2&&(vi.$$scope={dirty:e,ctx:t}),R.$set(vi);const Gi={};e&2&&(Gi.$$scope={dirty:e,ctx:t}),k.$set(Gi);const Ii={};e&2&&(Ii.$$scope={dirty:e,ctx:t}),Y.$set(Ii)},i(t){xs||(u(Z.$$.fragment,t),u(U.$$.fragment,t),u(G.$$.fragment,t),u(X.$$.fragment,t),u(V.$$.fragment,t),u(z.$$.fragment,t),u(A.$$.fragment,t),u(K.$$.fragment,t),u(O.$$.fragment,t),u(I.$$.fragment,t),u(at.$$.fragment,t),u(rt.$$.fragment,t),u(mt.$$.fragment,t),u(ut.$$.fragment,t),u(wt.$$.fragment,t),u(bt.$$.fragment,t),u(Tt.$$.fragment,t),u($t.$$.fragment,t),u(Zt.$$.fragment,t),u(vt.$$.fragment,t),u(It.$$.fragment,t),u(Ct.$$.fragment,t),u(xt.$$.fragment,t),u(kt.$$.fragment,t),u(_t.$$.fragment,t),u(Qt.$$.fragment,t),u(Ft.$$.fragment,t),u(St.$$.fragment,t),u(qt.$$.fragment,t),u(Lt.$$.fragment,t),u(W.$$.fragment,t),u(At.$$.fragment,t),u(Kt.$$.fragment,t),u(C.$$.fragment,t),u(Ot.$$.fragment,t),u(ee.$$.fragment,t),u(B.$$.fragment,t),u(se.$$.fragment,t),u(x.$$.fragment,t),u(pe.$$.fragment,t),u(de.$$.fragment,t),u(ue.$$.fragment,t),u(ye.$$.fragment,t),u(ce.$$.fragment,t),u(H.$$.fragment,t),u(ge.$$.fragment,t),u(Je.$$.fragment,t),u($e.$$.fragment,t),u(ve.$$.fragment,t),u(Ge.$$.fragment,t),u(Ce.$$.fragment,t),u(Be.$$.fragment,t),u(ke.$$.fragment,t),u(_e.$$.fragment,t),u(Qe.$$.fragment,t),u(Ee.$$.fragment,t),u(Le.$$.fragment,t),u(Pe.$$.fragment,t),u(De.$$.fragment,t),u(tl.$$.fragment,t),u(ll.$$.fragment,t),u(al.$$.fragment,t),u(ol.$$.fragment,t),u(R.$$.fragment,t),u(pl.$$.fragment,t),u(dl.$$.fragment,t),u(k.$$.fragment,t),u(hl.$$.fragment,t),u(wl.$$.fragment,t),u(fl.$$.fragment,t),u(gl.$$.fragment,t),u(Tl.$$.fragment,t),u(Y.$$.fragment,t),u($l.$$.fragment,t),xs=!0)},o(t){M(Z.$$.fragment,t),M(U.$$.fragment,t),M(G.$$.fragment,t),M(X.$$.fragment,t),M(V.$$.fragment,t),M(z.$$.fragment,t),M(A.$$.fragment,t),M(K.$$.fragment,t),M(O.$$.fragment,t),M(I.$$.fragment,t),M(at.$$.fragment,t),M(rt.$$.fragment,t),M(mt.$$.fragment,t),M(ut.$$.fragment,t),M(wt.$$.fragment,t),M(bt.$$.fragment,t),M(Tt.$$.fragment,t),M($t.$$.fragment,t),M(Zt.$$.fragment,t),M(vt.$$.fragment,t),M(It.$$.fragment,t),M(Ct.$$.fragment,t),M(xt.$$.fragment,t),M(kt.$$.fragment,t),M(_t.$$.fragment,t),M(Qt.$$.fragment,t),M(Ft.$$.fragment,t),M(St.$$.fragment,t),M(qt.$$.fragment,t),M(Lt.$$.fragment,t),M(W.$$.fragment,t),M(At.$$.fragment,t),M(Kt.$$.fragment,t),M(C.$$.fragment,t),M(Ot.$$.fragment,t),M(ee.$$.fragment,t),M(B.$$.fragment,t),M(se.$$.fragment,t),M(x.$$.fragment,t),M(pe.$$.fragment,t),M(de.$$.fragment,t),M(ue.$$.fragment,t),M(ye.$$.fragment,t),M(ce.$$.fragment,t),M(H.$$.fragment,t),M(ge.$$.fragment,t),M(Je.$$.fragment,t),M($e.$$.fragment,t),M(ve.$$.fragment,t),M(Ge.$$.fragment,t),M(Ce.$$.fragment,t),M(Be.$$.fragment,t),M(ke.$$.fragment,t),M(_e.$$.fragment,t),M(Qe.$$.fragment,t),M(Ee.$$.fragment,t),M(Le.$$.fragment,t),M(Pe.$$.fragment,t),M(De.$$.fragment,t),M(tl.$$.fragment,t),M(ll.$$.fragment,t),M(al.$$.fragment,t),M(ol.$$.fragment,t),M(R.$$.fragment,t),M(pl.$$.fragment,t),M(dl.$$.fragment,t),M(k.$$.fragment,t),M(hl.$$.fragment,t),M(wl.$$.fragment,t),M(fl.$$.fragment,t),M(gl.$$.fragment,t),M(Tl.$$.fragment,t),M(Y.$$.fragment,t),M($l.$$.fragment,t),xs=!1},d(t){t&&(l(f),l(w),l(b),l(J),l(Wl),l(Cl),l(_),l(Bl),l(N),l(xl),l(Hl),l(Q),l(Rl),l(kl),l(F),l(Yl),l(E),l(_l),l(S),l(Nl),l(Xl),l(q),l(Ql),l(L),l(Vl),l(Fl),l(P),l(El),l(Sl),l(D),l(zl),l(ql),l(tt),l(Ll),l(et),l(Al),l(Pl),l(lt),l(Kl),l(nt),l(Dl),l(Ol),l(st),l(tn),l(ot),l(en),l(it),l(ln),l(nn),l(pt),l(an),l(sn),l(dt),l(on),l(ht),l(rn),l(pn),l(Mt),l(mn),l(yt),l(dn),l(hn),l(ct),l(un),l(ft),l(Mn),l(yn),l(gt),l(wn),l(Jt),l(cn),l(fn),l(Ut),l(bn),l(gn),l(jt),l(Jn),l(Tn),l(Un),l(Gt),l($n),l(jn),l(Wt),l(Zn),l(vn),l(Bt),l(Gn),l(In),l(Ht),l(Wn),l(Rt),l(Cn),l(Bn),l(Yt),l(xn),l(Hn),l(Nt),l(Rn),l(Xt),l(kn),l(Yn),l(Vt),l(_n),l(Nn),l(Et),l(Xn),l(Qn),l(zt),l(Vn),l(Fn),l(En),l(Sn),l(zn),l(Pt),l(qn),l(Ln),l(An),l(Dt),l(Pn),l(Kn),l(te),l(Dn),l(On),l(ta),l(le),l(ea),l(ne),l(la),l(ae),l(na),l(aa),l(sa),l(oe),l(oa),l(ie),l(ia),l(re),l(ra),l(pa),l(me),l(ma),l(da),l(he),l(ha),l(ua),l(Me),l(Ma),l(ya),l(we),l(wa),l(ca),l(fe),l(fa),l(ba),l(be),l(ga),l(Ja),l(Ta),l(Te),l(Ua),l(Ue),l($a),l(ja),l(je),l(Za),l(Ze),l(va),l(Ga),l(Ia),l(Ie),l(Wa),l(We),l(Ca),l(Ba),l(xa),l(xe),l(Ha),l(He),l(Ra),l(Re),l(ka),l(Ya),l(Ye),l(_a),l(Na),l(Ne),l(Xa),l(Xe),l(Qa),l(Va),l(Ve),l(Fa),l(Fe),l(Ea),l(Sa),l(Se),l(za),l(ze),l(qa),l(qe),l(La),l(Aa),l(Ae),l(Pa),l(Ka),l(Ke),l(Da),l(Oa),l(Oe),l(ts),l(es),l(el),l(ls),l(ns),l(nl),l(as),l(ss),l(sl),l(os),l(is),l(il),l(rs),l(rl),l(ps),l(ms),l(ds),l(ml),l(hs),l(us),l(Ms),l(ys),l(ul),l(ws),l(Ml),l(cs),l(yl),l(fs),l(bs),l(cl),l(gs),l(Js),l(bl),l(Ts),l(Us),l(Jl),l($s),l(js),l(Ul),l(Zs),l(Gl),l(vs),l(Gs),l(Is),l(jl),l(Ws),l(Zl),l(Cs),l(vl),l(Bs),l(Il)),l(p),y(Z,t),y(U,t),y(G,t),y(X,t),y(V,t),y(z,t),y(A,t),y(K,t),y(O,t),y(I,t),y(at,t),y(rt,t),y(mt,t),y(ut,t),y(wt,t),y(bt,t),y(Tt,t),y($t,t),y(Zt,t),y(vt,t),y(It,t),y(Ct,t),y(xt,t),y(kt,t),y(_t,t),y(Qt,t),y(Ft,t),y(St,t),y(qt,t),y(Lt,t),y(W,t),y(At,t),y(Kt,t),y(C,t),y(Ot,t),y(ee,t),y(B,t),y(se,t),y(x,t),y(pe,t),y(de,t),y(ue,t),y(ye,t),y(ce,t),y(H,t),y(ge,t),y(Je,t),y($e,t),y(ve,t),y(Ge,t),y(Ce,t),y(Be,t),y(ke,t),y(_e,t),y(Qe,t),y(Ee,t),y(Le,t),y(Pe,t),y(De,t),y(tl,t),y(ll,t),y(al,t),y(ol,t),y(R,t),y(pl,t),y(dl,t),y(k,t),y(hl,t),y(wl,t),y(fl,t),y(gl,t),y(Tl,t),y(Y,t),y($l,t)}}}const Ai='{"title":"Custom Tools and Prompts","local":"custom-tools-and-prompts","sections":[{"title":"Customizing the prompt","local":"customizing-the-prompt","sections":[{"title":"Structure of the prompt","local":"structure-of-the-prompt","sections":[],"depth":3},{"title":"Writing good user inputs","local":"writing-good-user-inputs","sections":[],"depth":3},{"title":"Customizing the tool descriptions","local":"customizing-the-tool-descriptions","sections":[],"depth":3},{"title":"Customizing the whole prompt","local":"customizing-the-whole-prompt","sections":[],"depth":3}],"depth":2},{"title":"Using custom tools","local":"using-custom-tools","sections":[{"title":"Adding new tools","local":"adding-new-tools","sections":[{"title":"Creating a new tool","local":"creating-a-new-tool","sections":[],"depth":4},{"title":"Having the agent use the tool","local":"having-the-agent-use-the-tool","sections":[],"depth":4}],"depth":3},{"title":"Replacing existing tools","local":"replacing-existing-tools","sections":[],"depth":3}],"depth":2},{"title":"Leveraging gradio-tools","local":"leveraging-gradio-tools","sections":[],"depth":2},{"title":"Future compatibility with Langchain","local":"future-compatibility-with-langchain","sections":[],"depth":2}],"depth":1}';function Pi(g){return Bi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class lr extends xi{constructor(p){super(),Hi(this,p,Pi,Li,Ci,{})}}export{lr as component};
