import{S as rm,i as am,s as nm,e as r,k as i,w as g,t as s,M as sm,c as a,d as t,m as d,a as n,x as v,h as l,b as c,G as e,g as f,y as _,q as $,o as b,B as w,v as lm,L as en}from"../../chunks/vendor-hf-doc-builder.js";import{T as om}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as tn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as K}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Za}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function im(N){let h,T;return{c(){h=r("p"),T=s(`Transformers Agent is an experimental API which is subject to change at any time. Results returned by the agents
can vary as the APIs or underlying models are prone to change.`)},l(y){h=a(y,"P",{});var u=n(h);T=l(u,`Transformers Agent is an experimental API which is subject to change at any time. Results returned by the agents
can vary as the APIs or underlying models are prone to change.`),u.forEach(t)},m(y,u){f(y,h,u),e(h,T)},d(y){y&&t(h)}}}function dm(N){let h,T,y,u,A;return u=new tn({props:{code:`from transformers import HfAgent

agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
agent.run("Is the following \`text\` (in Spanish) positive or negative?", text="\xA1Este es un API muy agradable!")`,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;Is the following \`text\` (in Spanish) positive or negative?&quot;</span>, text=<span class="hljs-string">&quot;\xA1Este es un API muy agradable!&quot;</span>)`}}),{c(){h=r("p"),T=s("Example:"),y=i(),g(u.$$.fragment)},l(m){h=a(m,"P",{});var E=n(h);T=l(E,"Example:"),E.forEach(t),y=d(m),v(u.$$.fragment,m)},m(m,E){f(m,h,E),e(h,T),f(m,y,E),_(u,m,E),A=!0},p:en,i(m){A||($(u.$$.fragment,m),A=!0)},o(m){b(u.$$.fragment,m),A=!1},d(m){m&&t(h),m&&t(y),w(u,m)}}}function cm(N){let h,T,y,u,A,m,E,oe;return{c(){h=r("p"),T=s("The openAI models are used in generation mode, so even for the "),y=r("code"),u=s("chat()"),A=s(` API, it\u2019s better to use models like
`),m=r("code"),E=s('"text-davinci-003"'),oe=s(" over the chat-GPT variant. Proper support for chat-GPT models will come in a next version.")},l(re){h=a(re,"P",{});var S=n(h);T=l(S,"The openAI models are used in generation mode, so even for the "),y=a(S,"CODE",{});var G=n(y);u=l(G,"chat()"),G.forEach(t),A=l(S,` API, it\u2019s better to use models like
`),m=a(S,"CODE",{});var nt=n(m);E=l(nt,'"text-davinci-003"'),nt.forEach(t),oe=l(S," over the chat-GPT variant. Proper support for chat-GPT models will come in a next version."),S.forEach(t)},m(re,S){f(re,h,S),e(h,T),e(h,y),e(y,u),e(h,A),e(h,m),e(m,E),e(h,oe)},d(re){re&&t(h)}}}function mm(N){let h,T,y,u,A;return u=new tn({props:{code:`from transformers import OpenAiAgent

agent = OpenAiAgent(model="text-davinci-003", api_key=xxx)
agent.run("Is the following \`text\` (in Spanish) positive or negative?", text="\xA1Este es un API muy agradable!")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OpenAiAgent

agent = OpenAiAgent(model=<span class="hljs-string">&quot;text-davinci-003&quot;</span>, api_key=xxx)
agent.run(<span class="hljs-string">&quot;Is the following \`text\` (in Spanish) positive or negative?&quot;</span>, text=<span class="hljs-string">&quot;\xA1Este es un API muy agradable!&quot;</span>)`}}),{c(){h=r("p"),T=s("Example:"),y=i(),g(u.$$.fragment)},l(m){h=a(m,"P",{});var E=n(h);T=l(E,"Example:"),E.forEach(t),y=d(m),v(u.$$.fragment,m)},m(m,E){f(m,h,E),e(h,T),f(m,y,E),_(u,m,E),A=!0},p:en,i(m){A||($(u.$$.fragment,m),A=!0)},o(m){b(u.$$.fragment,m),A=!1},d(m){m&&t(h),m&&t(y),w(u,m)}}}function pm(N){let h,T,y,u,A;return u=new tn({props:{code:`from transformers import HfAgent

agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
agent.chat("Draw me a picture of rivers and lakes")

agent.chat("Transform the picture so that there is a rock in there")`,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.chat(<span class="hljs-string">&quot;Draw me a picture of rivers and lakes&quot;</span>)

agent.chat(<span class="hljs-string">&quot;Transform the picture so that there is a rock in there&quot;</span>)`}}),{c(){h=r("p"),T=s("Example:"),y=i(),g(u.$$.fragment)},l(m){h=a(m,"P",{});var E=n(h);T=l(E,"Example:"),E.forEach(t),y=d(m),v(u.$$.fragment,m)},m(m,E){f(m,h,E),e(h,T),f(m,y,E),_(u,m,E),A=!0},p:en,i(m){A||($(u.$$.fragment,m),A=!0)},o(m){b(u.$$.fragment,m),A=!1},d(m){m&&t(h),m&&t(y),w(u,m)}}}function hm(N){let h,T,y,u,A;return u=new tn({props:{code:`from transformers import HfAgent

agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
agent.run("Draw me a picture of rivers and lakes")`,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;Draw me a picture of rivers and lakes&quot;</span>)`}}),{c(){h=r("p"),T=s("Example:"),y=i(),g(u.$$.fragment)},l(m){h=a(m,"P",{});var E=n(h);T=l(E,"Example:"),E.forEach(t),y=d(m),v(u.$$.fragment,m)},m(m,E){f(m,h,E),e(h,T),f(m,y,E),_(u,m,E),A=!0},p:en,i(m){A||($(u.$$.fragment,m),A=!0)},o(m){b(u.$$.fragment,m),A=!1},d(m){m&&t(h),m&&t(y),w(u,m)}}}function fm(N){let h,T,y,u,A,m,E,oe,re,S,G,nt,Te,on,Zt,rn,an,Xr,ae,ke,To,st,nn,ko,sn,Zr,Q,ln,eo,dn,cn,to,mn,pn,ea,ne,xe,xo,lt,hn,Po,fn,ta,z,it,un,Io,gn,vn,Pe,oa,se,Ie,Do,dt,_n,Oo,$n,ra,C,ct,bn,qo,wn,yn,De,En,Oe,aa,le,qe,No,mt,An,Ho,Tn,na,q,pt,kn,So,xn,Pn,X,ht,In,Co,Dn,On,Ne,qn,Z,ft,Nn,Lo,Hn,Sn,He,Cn,Se,ut,Ln,gt,Rn,oo,jn,Vn,sa,ie,Ce,Ro,vt,Fn,jo,Un,la,de,Le,Vo,_t,Wn,Fo,Mn,ia,ce,$t,Gn,Uo,zn,da,me,Re,Wo,bt,Yn,Mo,Bn,ca,k,wt,Jn,yt,Kn,Go,Qn,Xn,Zn,Y,V,zo,es,ts,Yo,os,rs,Bo,as,ns,Jo,ss,ls,is,F,Ko,ds,cs,Qo,ms,ps,Xo,hs,fs,Zo,us,gs,vs,D,er,_s,$s,tr,bs,ws,or,ys,Es,rr,As,Ts,ar,ks,xs,nr,Ps,Is,Ds,O,sr,Os,qs,lr,Ns,Hs,ir,Ss,Cs,dr,Ls,Rs,cr,js,Vs,mr,Fs,Us,Ws,pe,Ms,ro,Gs,zs,ao,Ys,Bs,Js,je,Et,Ks,At,Qs,no,Xs,Zs,el,Ve,Tt,tl,pr,ol,rl,Fe,kt,al,hr,nl,sl,U,xt,ll,Pt,il,fr,dl,cl,ml,he,so,pl,ur,hl,fl,It,ul,gr,gl,vl,_l,Dt,$l,vr,bl,wl,yl,Ot,El,_r,Al,Tl,kl,Ue,qt,xl,$r,Pl,ma,fe,We,br,Nt,Il,wr,Dl,pa,P,Ht,Ol,ue,ql,lo,Nl,Hl,io,Sl,Cl,Ll,B,Me,yr,Rl,jl,Er,Vl,Fl,Ul,Ge,Ar,Wl,Ml,Tr,Gl,zl,Yl,W,kr,Bl,Jl,xr,Kl,Ql,Pr,Xl,Zl,co,ei,ti,oi,M,Ir,ri,ai,Dr,ni,si,Or,li,ii,mo,di,ci,mi,ze,St,pi,Ct,hi,qr,fi,ui,gi,Ye,Lt,vi,ge,_i,Nr,$i,bi,Hr,wi,yi,Ei,Be,Rt,Ai,jt,Ti,Sr,ki,xi,Pi,Je,Vt,Ii,J,Di,Cr,Oi,qi,Lr,Ni,Hi,Rr,Si,Ci,ha,ve,Ke,jr,Ft,Li,Vr,Ri,fa,L,Ut,ji,Wt,Vi,po,Fi,Ui,Wi,Qe,Mt,Mi,Gt,Gi,ho,zi,Yi,Bi,ee,zt,Ji,Yt,Ki,Fr,Qi,Xi,Zi,Bt,ed,fo,td,od,ua,_e,Xe,Ur,Jt,rd,Wr,ad,ga,$e,Kt,nd,be,sd,Mr,ld,id,Gr,dd,cd,va;return m=new K({}),G=new om({props:{warning:!0,$$slots:{default:[im]},$$scope:{ctx:N}}}),st=new K({}),lt=new K({}),it=new x({props:{name:"class transformers.HfAgent",anchor:"transformers.HfAgent",parameters:[{name:"url_endpoint",val:""},{name:"token",val:" = None"},{name:"chat_prompt_template",val:" = None"},{name:"run_prompt_template",val:" = None"},{name:"additional_tools",val:" = None"}],parametersDescription:[{anchor:"transformers.HfAgent.url_endpoint",description:`<strong>url_endpoint</strong> (<code>str</code>) &#x2014;
The name of the url endpoint to use.`,name:"url_endpoint"},{anchor:"transformers.HfAgent.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If unset, will use the token generated when
running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.HfAgent.chat_prompt_template",description:`<strong>chat_prompt_template</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Pass along your own prompt if you want to override the default template for the <code>chat</code> method.`,name:"chat_prompt_template"},{anchor:"transformers.HfAgent.run_prompt_template",description:`<strong>run_prompt_template</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Pass along your own prompt if you want to override the default template for the <code>run</code> method.`,name:"run_prompt_template"},{anchor:"transformers.HfAgent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool">Tool</a>, list of tools or dictionary with tool values, <em>optional</em>) &#x2014;
Any additional tools to include on top of the default ones. If you pass along a tool with the same name as
one of the default tools, that default tool will be overridden.`,name:"additional_tools"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/agents.py#L431"}}),Pe=new Za({props:{anchor:"transformers.HfAgent.example",$$slots:{default:[dm]},$$scope:{ctx:N}}}),dt=new K({}),ct=new x({props:{name:"class transformers.OpenAiAgent",anchor:"transformers.OpenAiAgent",parameters:[{name:"model",val:" = 'text-davinci-003'"},{name:"api_key",val:" = None"},{name:"chat_prompt_template",val:" = None"},{name:"run_prompt_template",val:" = None"},{name:"additional_tools",val:" = None"}],parametersDescription:[{anchor:"transformers.OpenAiAgent.model",description:`<strong>model</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;text-davinci-003&quot;</code>) &#x2014;
The name of the OpenAI model to use.`,name:"model"},{anchor:"transformers.OpenAiAgent.api_key",description:`<strong>api_key</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The API key to use. If unset, will look for the environment variable <code>&quot;OPENAI_API_KEY&quot;</code>.`,name:"api_key"},{anchor:"transformers.OpenAiAgent.chat_prompt_template",description:`<strong>chat_prompt_template</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Pass along your own prompt if you want to override the default template for the <code>chat</code> method.`,name:"chat_prompt_template"},{anchor:"transformers.OpenAiAgent.run_prompt_template",description:`<strong>run_prompt_template</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Pass along your own prompt if you want to override the default template for the <code>run</code> method.`,name:"run_prompt_template"},{anchor:"transformers.OpenAiAgent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool">Tool</a>, list of tools or dictionary with tool values, <em>optional</em>) &#x2014;
Any additional tools to include on top of the default ones. If you pass along a tool with the same name as
one of the default tools, that default tool will be overridden.`,name:"additional_tools"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/agents.py#L337"}}),De=new om({props:{warning:!0,$$slots:{default:[cm]},$$scope:{ctx:N}}}),Oe=new Za({props:{anchor:"transformers.OpenAiAgent.example",$$slots:{default:[mm]},$$scope:{ctx:N}}}),mt=new K({}),pt=new x({props:{name:"class transformers.Agent",anchor:"transformers.Agent",parameters:[{name:"chat_prompt_template",val:" = None"},{name:"run_prompt_template",val:" = None"},{name:"additional_tools",val:" = None"}],parametersDescription:[{anchor:"transformers.Agent.chat_prompt_template",description:`<strong>chat_prompt_template</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Pass along your own prompt if you want to override the default template for the <code>chat</code> method.`,name:"chat_prompt_template"},{anchor:"transformers.Agent.run_prompt_template",description:`<strong>run_prompt_template</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Pass along your own prompt if you want to override the default template for the <code>run</code> method.`,name:"run_prompt_template"},{anchor:"transformers.Agent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool">Tool</a>, list of tools or dictionary with tool values, <em>optional</em>) &#x2014;
Any additional tools to include on top of the default ones. If you pass along a tool with the same name as
one of the default tools, that default tool will be overridden.`,name:"additional_tools"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/agents.py#L184"}}),ht=new x({props:{name:"chat",anchor:"transformers.Agent.chat",parameters:[{name:"task",val:""},{name:"return_code",val:" = False"},{name:"remote",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Agent.chat.task",description:"<strong>task</strong> (<code>str</code>) &#x2014; The task to perform",name:"task"},{anchor:"transformers.Agent.chat.return_code",description:`<strong>return_code</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to just return code and not evaluate it.`,name:"return_code"},{anchor:"transformers.Agent.chat.remote",description:`<strong>remote</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use remote tools (inference endpoints) instead of local ones.
kwargs &#x2014;
Any keyword argument to send to the agent when evaluating the code.`,name:"remote"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/agents.py#L241"}}),Ne=new Za({props:{anchor:"transformers.Agent.chat.example",$$slots:{default:[pm]},$$scope:{ctx:N}}}),ft=new x({props:{name:"run",anchor:"transformers.Agent.run",parameters:[{name:"task",val:""},{name:"return_code",val:" = False"},{name:"remote",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Agent.run.task",description:"<strong>task</strong> (<code>str</code>) &#x2014; The task to perform",name:"task"},{anchor:"transformers.Agent.run.return_code",description:`<strong>return_code</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to just return code and not evaluate it.`,name:"return_code"},{anchor:"transformers.Agent.run.remote",description:`<strong>remote</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use remote tools (inference endpoints) instead of local ones.
kwargs &#x2014;
Any keyword argument to send to the agent when evaluating the code.`,name:"remote"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/agents.py#L291"}}),He=new Za({props:{anchor:"transformers.Agent.run.example",$$slots:{default:[hm]},$$scope:{ctx:N}}}),ut=new x({props:{name:"prepare_for_new_chat",anchor:"transformers.Agent.prepare_for_new_chat",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/agents.py#L283"}}),vt=new K({}),_t=new K({}),$t=new x({props:{name:"transformers.load_tool",anchor:"transformers.load_tool",parameters:[{name:"task_or_repo_id",val:""},{name:"model_repo_id",val:" = None"},{name:"remote",val:" = False"},{name:"token",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.load_tool.task_or_repo_id",description:`<strong>task_or_repo_id</strong> (<code>str</code>) &#x2014;
The task for which to load the tool or a repo ID of a tool on the Hub. Tasks implemented in Transformers
are:</p>
<ul>
<li><code>&quot;document-question-answering&quot;</code></li>
<li><code>&quot;image-captioning&quot;</code></li>
<li><code>&quot;image-question-answering&quot;</code></li>
<li><code>&quot;image-segmentation&quot;</code></li>
<li><code>&quot;speech-to-text&quot;</code></li>
<li><code>&quot;summarization&quot;</code></li>
<li><code>&quot;text-classification&quot;</code></li>
<li><code>&quot;text-question-answering&quot;</code></li>
<li><code>&quot;text-to-speech&quot;</code></li>
<li><code>&quot;translation&quot;</code></li>
</ul>`,name:"task_or_repo_id"},{anchor:"transformers.load_tool.model_repo_id",description:`<strong>model_repo_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Use this argument to use a different model than the default one for the tool you selected.`,name:"model_repo_id"},{anchor:"transformers.load_tool.remote",description:`<strong>remote</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use your tool by downloading the model or (if it is available) with an inference endpoint.`,name:"remote"},{anchor:"transformers.load_tool.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to identify you on hf.co. If unset, will use the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).
kwargs &#x2014;
Additional keyword arguments that will be split in two: all arguments relevant to the Hub (such as
<code>cache_dir</code>, <code>revision</code>, <code>subfolder</code>) will be used when downloading the files for your tool, and the others
will be passed along to its init.`,name:"token"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L607"}}),bt=new K({}),wt=new x({props:{name:"class transformers.Tool",anchor:"transformers.Tool",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L80"}}),Et=new x({props:{name:"from_gradio",anchor:"transformers.Tool.from_gradio",parameters:[{name:"gradio_tool",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L309"}}),Tt=new x({props:{name:"from_hub",anchor:"transformers.Tool.from_hub",parameters:[{name:"repo_id",val:""},{name:"model_repo_id",val:" = None"},{name:"token",val:" = None"},{name:"remote",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Tool.from_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repo on the Hub where your tool is defined.`,name:"repo_id"},{anchor:"transformers.Tool.from_hub.model_repo_id",description:`<strong>model_repo_id</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If your tool uses a model and you want to use a different model than the default, you can pass a second
repo ID or an endpoint url to this argument.`,name:"model_repo_id"},{anchor:"transformers.Tool.from_hub.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to identify you on hf.co. If unset, will use the token generated when running
<code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.Tool.from_hub.remote",description:`<strong>remote</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use your tool by downloading the model or (if it is available) with an inference endpoint.
kwargs &#x2014;
Additional keyword arguments that will be split in two: all arguments relevant to the Hub (such as
<code>cache_dir</code>, <code>revision</code>, <code>subfolder</code>) will be used when downloading the files for your tool, and the
others will be passed along to its init.`,name:"remote"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L175"}}),kt=new x({props:{name:"push_to_hub",anchor:"transformers.Tool.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"commit_message",val:": str = 'Upload tool'"},{name:"private",val:": typing.Optional[bool] = None"},{name:"token",val:": typing.Union[str, bool, NoneType] = None"},{name:"create_pr",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Tool.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your tool to. It should contain your organization name when
pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.Tool.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;Upload tool&quot;</code>) &#x2014;
Message to commit while pushing.`,name:"commit_message"},{anchor:"transformers.Tool.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.Tool.push_to_hub.token",description:`<strong>token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If unset, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.Tool.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L260"}}),xt=new x({props:{name:"save",anchor:"transformers.Tool.save",parameters:[{name:"output_dir",val:""}],parametersDescription:[{anchor:"transformers.Tool.save.output_dir",description:"<strong>output_dir</strong> (<code>str</code>) &#x2014; The folder in which you want to save your tool.",name:"output_dir"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L121"}}),qt=new x({props:{name:"setup",anchor:"transformers.Tool.setup",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L114"}}),Nt=new K({}),Ht=new x({props:{name:"class transformers.PipelineTool",anchor:"transformers.PipelineTool",parameters:[{name:"model",val:" = None"},{name:"pre_processor",val:" = None"},{name:"post_processor",val:" = None"},{name:"device",val:" = None"},{name:"device_map",val:" = None"},{name:"model_kwargs",val:" = None"},{name:"token",val:" = None"},{name:"**hub_kwargs",val:""}],parametersDescription:[{anchor:"transformers.PipelineTool.model",description:`<strong>model</strong> (<code>str</code> or <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>, <em>optional</em>) &#x2014;
The name of the checkpoint to use for the model, or the instantiated model. If unset, will default to the
value of the class attribute <code>default_checkpoint</code>.`,name:"model"},{anchor:"transformers.PipelineTool.pre_processor",description:`<strong>pre_processor</strong> (<code>str</code> or <code>Any</code>, <em>optional</em>) &#x2014;
The name of the checkpoint to use for the pre-processor, or the instantiated pre-processor (can be a
tokenizer, an image processor, a feature extractor or a processor). Will default to the value of <code>model</code> if
unset.`,name:"pre_processor"},{anchor:"transformers.PipelineTool.post_processor",description:`<strong>post_processor</strong> (<code>str</code> or <code>Any</code>, <em>optional</em>) &#x2014;
The name of the checkpoint to use for the post-processor, or the instantiated pre-processor (can be a
tokenizer, an image processor, a feature extractor or a processor). Will default to the <code>pre_processor</code> if
unset.`,name:"post_processor"},{anchor:"transformers.PipelineTool.device",description:`<strong>device</strong> (<code>int</code>, <code>str</code> or <code>torch.device</code>, <em>optional</em>) &#x2014;
The device on which to execute the model. Will default to any accelerator available (GPU, MPS etc&#x2026;), the
CPU otherwise.`,name:"device"},{anchor:"transformers.PipelineTool.device_map",description:`<strong>device_map</strong> (<code>str</code> or <code>dict</code>, <em>optional</em>) &#x2014;
If passed along, will be used to instantiate the model.`,name:"device_map"},{anchor:"transformers.PipelineTool.model_kwargs",description:`<strong>model_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Any keyword argument to send to the model instantiation.`,name:"model_kwargs"},{anchor:"transformers.PipelineTool.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If unset, will use the token generated when
running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).
hub_kwargs &#x2014;
Any additional keyword argument to send to the methods that will load the data from the Hub.`,name:"token"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L407"}}),St=new x({props:{name:"decode",anchor:"transformers.PipelineTool.decode",parameters:[{name:"outputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L524"}}),Lt=new x({props:{name:"encode",anchor:"transformers.PipelineTool.encode",parameters:[{name:"raw_inputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L511"}}),Rt=new x({props:{name:"forward",anchor:"transformers.PipelineTool.forward",parameters:[{name:"inputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L517"}}),Vt=new x({props:{name:"setup",anchor:"transformers.PipelineTool.setup",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L487"}}),Ft=new K({}),Ut=new x({props:{name:"class transformers.RemoteTool",anchor:"transformers.RemoteTool",parameters:[{name:"endpoint_url",val:" = None"},{name:"token",val:" = None"},{name:"tool_class",val:" = None"}],parametersDescription:[{anchor:"transformers.RemoteTool.endpoint_url",description:`<strong>endpoint_url</strong> (<code>str</code>) &#x2014;
The url of the endpoint to use.`,name:"endpoint_url"},{anchor:"transformers.RemoteTool.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If unset, will use the token generated when
running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"token"},{anchor:"transformers.RemoteTool.tool_class",description:`<strong>tool_class</strong> (<code>type</code>, <em>optional</em>) &#x2014;
The corresponding <code>tool_class</code> if this is a remote version of an existing tool. Will help determine when
the output should be converted to another type (like images).`,name:"tool_class"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L325"}}),Mt=new x({props:{name:"extract_outputs",anchor:"transformers.RemoteTool.extract_outputs",parameters:[{name:"outputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L388"}}),zt=new x({props:{name:"prepare_inputs",anchor:"transformers.RemoteTool.prepare_inputs",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L345"}}),Jt=new K({}),Kt=new x({props:{name:"transformers.launch_gradio_demo",anchor:"transformers.launch_gradio_demo",parameters:[{name:"tool_class",val:": Tool"}],parametersDescription:[{anchor:"transformers.launch_gradio_demo.tool_class",description:"<strong>tool_class</strong> (<code>type</code>) &#x2014; The class of the tool for which to launch the demo.",name:"tool_class"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tools/base.py#L541"}}),{c(){h=r("meta"),T=i(),y=r("h1"),u=r("a"),A=r("span"),g(m.$$.fragment),E=i(),oe=r("span"),re=s("Agents & Tools"),S=i(),g(G.$$.fragment),nt=i(),Te=r("p"),on=s("To learn more about agents and tools make sure to read the "),Zt=r("a"),rn=s("introductory guide"),an=s(`. This page
contains the API docs for the underlying classes.`),Xr=i(),ae=r("h2"),ke=r("a"),To=r("span"),g(st.$$.fragment),nn=i(),ko=r("span"),sn=s("Agents"),Zr=i(),Q=r("p"),ln=s("We provide two types of agents: "),eo=r("a"),dn=s("HfAgent"),cn=s(" uses inference endpoints for opensource models and "),to=r("a"),mn=s("OpenAiAgent"),pn=s(" uses OpenAI closed models."),ea=i(),ne=r("h3"),xe=r("a"),xo=r("span"),g(lt.$$.fragment),hn=i(),Po=r("span"),fn=s("HfAgent"),ta=i(),z=r("div"),g(it.$$.fragment),un=i(),Io=r("p"),gn=s("Agent that uses and inference endpoint to generate code."),vn=i(),g(Pe.$$.fragment),oa=i(),se=r("h3"),Ie=r("a"),Do=r("span"),g(dt.$$.fragment),_n=i(),Oo=r("span"),$n=s("OpenAiAgent"),ra=i(),C=r("div"),g(ct.$$.fragment),bn=i(),qo=r("p"),wn=s("Agent that uses the openai API to generate code."),yn=i(),g(De.$$.fragment),En=i(),g(Oe.$$.fragment),aa=i(),le=r("h3"),qe=r("a"),No=r("span"),g(mt.$$.fragment),An=i(),Ho=r("span"),Tn=s("Agent"),na=i(),q=r("div"),g(pt.$$.fragment),kn=i(),So=r("p"),xn=s("Base class for all agents which contains the main API methods."),Pn=i(),X=r("div"),g(ht.$$.fragment),In=i(),Co=r("p"),Dn=s("Sends a new request to the agent in a chat. Will use the previous ones in its history."),On=i(),g(Ne.$$.fragment),qn=i(),Z=r("div"),g(ft.$$.fragment),Nn=i(),Lo=r("p"),Hn=s("Sends a request to the agent."),Sn=i(),g(He.$$.fragment),Cn=i(),Se=r("div"),g(ut.$$.fragment),Ln=i(),gt=r("p"),Rn=s("Clears the history of prior calls to "),oo=r("a"),jn=s("chat()"),Vn=s("."),sa=i(),ie=r("h2"),Ce=r("a"),Ro=r("span"),g(vt.$$.fragment),Fn=i(),jo=r("span"),Un=s("Tools"),la=i(),de=r("h3"),Le=r("a"),Vo=r("span"),g(_t.$$.fragment),Wn=i(),Fo=r("span"),Mn=s("load_tool"),ia=i(),ce=r("div"),g($t.$$.fragment),Gn=i(),Uo=r("p"),zn=s("Main function to quickly load a tool, be it on the Hub or in the Transformers library."),da=i(),me=r("h3"),Re=r("a"),Wo=r("span"),g(bt.$$.fragment),Yn=i(),Mo=r("span"),Bn=s("Tool"),ca=i(),k=r("div"),g(wt.$$.fragment),Jn=i(),yt=r("p"),Kn=s("A base class for the functions used by the agent. Subclass this and implement the "),Go=r("code"),Qn=s("__call__"),Xn=s(` method as well as the
following class attributes:`),Zn=i(),Y=r("ul"),V=r("li"),zo=r("strong"),es=s("description"),ts=s(" ("),Yo=r("code"),os=s("str"),rs=s(`) \u2014 A short description of what your tool does, the inputs it expects and the output(s) it
will return. For instance \u2018This is a tool that downloads a file from a `),Bo=r("code"),as=s("url"),ns=s(". It takes the "),Jo=r("code"),ss=s("url"),ls=s(` as input, and
returns the text contained in the file\u2019.`),is=i(),F=r("li"),Ko=r("strong"),ds=s("name"),cs=s(" ("),Qo=r("code"),ms=s("str"),ps=s(`) \u2014 A performative name that will be used for your tool in the prompt to the agent. For instance
`),Xo=r("code"),hs=s('"text-classifier"'),fs=s(" or "),Zo=r("code"),us=s('"image_generator"'),gs=s("."),vs=i(),D=r("li"),er=r("strong"),_s=s("inputs"),$s=s(" ("),tr=r("code"),bs=s("List[str]"),ws=s(`) \u2014 The list of modalities expected for the inputs (in the same order as in the call).
Modalitiies should be `),or=r("code"),ys=s('"text"'),Es=s(", "),rr=r("code"),As=s('"image"'),Ts=s(" or "),ar=r("code"),ks=s('"audio"'),xs=s(". This is only used by "),nr=r("code"),Ps=s("launch_gradio_demo"),Is=s(` or to make a
nice space from your tool.`),Ds=i(),O=r("li"),sr=r("strong"),Os=s("outputs"),qs=s(" ("),lr=r("code"),Ns=s("List[str]"),Hs=s(`) \u2014 The list of modalities returned but the tool (in the same order as the return of the
call method). Modalitiies should be `),ir=r("code"),Ss=s('"text"'),Cs=s(", "),dr=r("code"),Ls=s('"image"'),Rs=s(" or "),cr=r("code"),js=s('"audio"'),Vs=s(". This is only used by "),mr=r("code"),Fs=s("launch_gradio_demo"),Us=s(`
or to make a nice space from your tool.`),Ws=i(),pe=r("p"),Ms=s("You can also override the method "),ro=r("a"),Gs=s("setup()"),zs=s(` if your tool as an expensive operation to perform before being
usable (such as loading a model). `),ao=r("a"),Ys=s("setup()"),Bs=s(` will be called the first time you use your tool, but not at
instantiation.`),Js=i(),je=r("div"),g(Et.$$.fragment),Ks=i(),At=r("p"),Qs=s("Creates a "),no=r("a"),Xs=s("Tool"),Zs=s(" from a gradio tool."),el=i(),Ve=r("div"),g(Tt.$$.fragment),tl=i(),pr=r("p"),ol=s("Loads a tool defined on the Hub."),rl=i(),Fe=r("div"),g(kt.$$.fragment),al=i(),hr=r("p"),nl=s("Upload the tool to the Hub."),sl=i(),U=r("div"),g(xt.$$.fragment),ll=i(),Pt=r("p"),il=s(`Saves the relevant code files for your tool so it can be pushed to the Hub. This will copy the code of your
tool in `),fr=r("code"),dl=s("output_dir"),cl=s(" as well as autogenerate:"),ml=i(),he=r("ul"),so=r("li"),pl=s("a config file named "),ur=r("code"),hl=s("tool_config.json"),fl=i(),It=r("li"),ul=s("an "),gr=r("code"),gl=s("app.py"),vl=s(" file so that your tool can be converted to a space"),_l=i(),Dt=r("li"),$l=s("a "),vr=r("code"),bl=s("requirements.txt"),wl=s(` containing the names of the module used by your tool (as detected when inspecting its
code)`),yl=i(),Ot=r("p"),El=s("You should only use this method to save tools that are defined in a separate module (not "),_r=r("code"),Al=s("__main__"),Tl=s(")."),kl=i(),Ue=r("div"),g(qt.$$.fragment),xl=i(),$r=r("p"),Pl=s(`Overwrite this method here for any operation that is expensive and needs to be executed before you start using
your tool. Such as loading a big model.`),ma=i(),fe=r("h3"),We=r("a"),br=r("span"),g(Nt.$$.fragment),Il=i(),wr=r("span"),Dl=s("PipelineTool"),pa=i(),P=r("div"),g(Ht.$$.fragment),Ol=i(),ue=r("p"),ql=s("A "),lo=r("a"),Nl=s("Tool"),Hl=s(" tailored towards Transformer models. On top of the class attributes of the base class "),io=r("a"),Sl=s("Tool"),Cl=s(`, you will
need to specify:`),Ll=i(),B=r("ul"),Me=r("li"),yr=r("strong"),Rl=s("model_class"),jl=s(" ("),Er=r("code"),Vl=s("type"),Fl=s(") \u2014 The class to use to load the model in this tool."),Ul=i(),Ge=r("li"),Ar=r("strong"),Wl=s("default_checkpoint"),Ml=s(" ("),Tr=r("code"),Gl=s("str"),zl=s(") \u2014 The default checkpoint that should be used when the user doesn\u2019t specify one."),Yl=i(),W=r("li"),kr=r("strong"),Bl=s("pre_processor_class"),Jl=s(" ("),xr=r("code"),Kl=s("type"),Ql=s(", "),Pr=r("em"),Xl=s("optional"),Zl=s(", defaults to "),co=r("a"),ei=s("AutoProcessor"),ti=s(`) \u2014 The class to use to load the
pre-processor`),oi=i(),M=r("li"),Ir=r("strong"),ri=s("post_processor_class"),ai=s(" ("),Dr=r("code"),ni=s("type"),si=s(", "),Or=r("em"),li=s("optional"),ii=s(", defaults to "),mo=r("a"),di=s("AutoProcessor"),ci=s(`) \u2014 The class to use to load the
post-processor (when different from the pre-processor).`),mi=i(),ze=r("div"),g(St.$$.fragment),pi=i(),Ct=r("p"),hi=s("Uses the "),qr=r("code"),fi=s("post_processor"),ui=s(" to decode the model output."),gi=i(),Ye=r("div"),g(Lt.$$.fragment),vi=i(),ge=r("p"),_i=s("Uses the "),Nr=r("code"),$i=s("pre_processor"),bi=s(" to prepare the inputs for the "),Hr=r("code"),wi=s("model"),yi=s("."),Ei=i(),Be=r("div"),g(Rt.$$.fragment),Ai=i(),jt=r("p"),Ti=s("Sends the inputs through the "),Sr=r("code"),ki=s("model"),xi=s("."),Pi=i(),Je=r("div"),g(Vt.$$.fragment),Ii=i(),J=r("p"),Di=s("Instantiates the "),Cr=r("code"),Oi=s("pre_processor"),qi=s(", "),Lr=r("code"),Ni=s("model"),Hi=s(" and "),Rr=r("code"),Si=s("post_processor"),Ci=s(" if necessary."),ha=i(),ve=r("h3"),Ke=r("a"),jr=r("span"),g(Ft.$$.fragment),Li=i(),Vr=r("span"),Ri=s("RemoteTool"),fa=i(),L=r("div"),g(Ut.$$.fragment),ji=i(),Wt=r("p"),Vi=s("A "),po=r("a"),Fi=s("Tool"),Ui=s(" that will make requests to an inference endpoint."),Wi=i(),Qe=r("div"),g(Mt.$$.fragment),Mi=i(),Gt=r("p"),Gi=s("You can override this method in your custom class of "),ho=r("a"),zi=s("RemoteTool"),Yi=s(` to apply some custom post-processing of the
outputs of the endpoint.`),Bi=i(),ee=r("div"),g(zt.$$.fragment),Ji=i(),Yt=r("p"),Ki=s(`Prepare the inputs received for the HTTP client sending data to the endpoint. Positional arguments will be
matched with the signature of the `),Fr=r("code"),Qi=s("tool_class"),Xi=s(` if it was provided at instantation. Images will be encoded into
bytes.`),Zi=i(),Bt=r("p"),ed=s("You can override this method in your custom class of "),fo=r("a"),td=s("RemoteTool"),od=s("."),ua=i(),_e=r("h3"),Xe=r("a"),Ur=r("span"),g(Jt.$$.fragment),rd=i(),Wr=r("span"),ad=s("launch_gradio_demo"),ga=i(),$e=r("div"),g(Kt.$$.fragment),nd=i(),be=r("p"),sd=s(`Launches a gradio demo for a tool. The corresponding tool class needs to properly implement the class attributes
`),Mr=r("code"),ld=s("inputs"),id=s(" and "),Gr=r("code"),dd=s("outputs"),cd=s("."),this.h()},l(o){const p=sm('[data-svelte="svelte-1phssyn"]',document.head);h=a(p,"META",{name:!0,content:!0}),p.forEach(t),T=d(o),y=a(o,"H1",{class:!0});var Qt=n(y);u=a(Qt,"A",{id:!0,class:!0,href:!0});var zr=n(u);A=a(zr,"SPAN",{});var Yr=n(A);v(m.$$.fragment,Yr),Yr.forEach(t),zr.forEach(t),E=d(Qt),oe=a(Qt,"SPAN",{});var Br=n(oe);re=l(Br,"Agents & Tools"),Br.forEach(t),Qt.forEach(t),S=d(o),v(G.$$.fragment,o),nt=d(o),Te=a(o,"P",{});var Xt=n(Te);on=l(Xt,"To learn more about agents and tools make sure to read the "),Zt=a(Xt,"A",{href:!0});var Jr=n(Zt);rn=l(Jr,"introductory guide"),Jr.forEach(t),an=l(Xt,`. This page
contains the API docs for the underlying classes.`),Xt.forEach(t),Xr=d(o),ae=a(o,"H2",{class:!0});var _a=n(ae);ke=a(_a,"A",{id:!0,class:!0,href:!0});var pd=n(ke);To=a(pd,"SPAN",{});var hd=n(To);v(st.$$.fragment,hd),hd.forEach(t),pd.forEach(t),nn=d(_a),ko=a(_a,"SPAN",{});var fd=n(ko);sn=l(fd,"Agents"),fd.forEach(t),_a.forEach(t),Zr=d(o),Q=a(o,"P",{});var uo=n(Q);ln=l(uo,"We provide two types of agents: "),eo=a(uo,"A",{href:!0});var ud=n(eo);dn=l(ud,"HfAgent"),ud.forEach(t),cn=l(uo," uses inference endpoints for opensource models and "),to=a(uo,"A",{href:!0});var gd=n(to);mn=l(gd,"OpenAiAgent"),gd.forEach(t),pn=l(uo," uses OpenAI closed models."),uo.forEach(t),ea=d(o),ne=a(o,"H3",{class:!0});var $a=n(ne);xe=a($a,"A",{id:!0,class:!0,href:!0});var vd=n(xe);xo=a(vd,"SPAN",{});var _d=n(xo);v(lt.$$.fragment,_d),_d.forEach(t),vd.forEach(t),hn=d($a),Po=a($a,"SPAN",{});var $d=n(Po);fn=l($d,"HfAgent"),$d.forEach(t),$a.forEach(t),ta=d(o),z=a(o,"DIV",{class:!0});var go=n(z);v(it.$$.fragment,go),un=d(go),Io=a(go,"P",{});var bd=n(Io);gn=l(bd,"Agent that uses and inference endpoint to generate code."),bd.forEach(t),vn=d(go),v(Pe.$$.fragment,go),go.forEach(t),oa=d(o),se=a(o,"H3",{class:!0});var ba=n(se);Ie=a(ba,"A",{id:!0,class:!0,href:!0});var wd=n(Ie);Do=a(wd,"SPAN",{});var yd=n(Do);v(dt.$$.fragment,yd),yd.forEach(t),wd.forEach(t),_n=d(ba),Oo=a(ba,"SPAN",{});var Ed=n(Oo);$n=l(Ed,"OpenAiAgent"),Ed.forEach(t),ba.forEach(t),ra=d(o),C=a(o,"DIV",{class:!0});var Ze=n(C);v(ct.$$.fragment,Ze),bn=d(Ze),qo=a(Ze,"P",{});var Ad=n(qo);wn=l(Ad,"Agent that uses the openai API to generate code."),Ad.forEach(t),yn=d(Ze),v(De.$$.fragment,Ze),En=d(Ze),v(Oe.$$.fragment,Ze),Ze.forEach(t),aa=d(o),le=a(o,"H3",{class:!0});var wa=n(le);qe=a(wa,"A",{id:!0,class:!0,href:!0});var Td=n(qe);No=a(Td,"SPAN",{});var kd=n(No);v(mt.$$.fragment,kd),kd.forEach(t),Td.forEach(t),An=d(wa),Ho=a(wa,"SPAN",{});var xd=n(Ho);Tn=l(xd,"Agent"),xd.forEach(t),wa.forEach(t),na=d(o),q=a(o,"DIV",{class:!0});var te=n(q);v(pt.$$.fragment,te),kn=d(te),So=a(te,"P",{});var Pd=n(So);xn=l(Pd,"Base class for all agents which contains the main API methods."),Pd.forEach(t),Pn=d(te),X=a(te,"DIV",{class:!0});var vo=n(X);v(ht.$$.fragment,vo),In=d(vo),Co=a(vo,"P",{});var Id=n(Co);Dn=l(Id,"Sends a new request to the agent in a chat. Will use the previous ones in its history."),Id.forEach(t),On=d(vo),v(Ne.$$.fragment,vo),vo.forEach(t),qn=d(te),Z=a(te,"DIV",{class:!0});var _o=n(Z);v(ft.$$.fragment,_o),Nn=d(_o),Lo=a(_o,"P",{});var Dd=n(Lo);Hn=l(Dd,"Sends a request to the agent."),Dd.forEach(t),Sn=d(_o),v(He.$$.fragment,_o),_o.forEach(t),Cn=d(te),Se=a(te,"DIV",{class:!0});var ya=n(Se);v(ut.$$.fragment,ya),Ln=d(ya),gt=a(ya,"P",{});var Ea=n(gt);Rn=l(Ea,"Clears the history of prior calls to "),oo=a(Ea,"A",{href:!0});var Od=n(oo);jn=l(Od,"chat()"),Od.forEach(t),Vn=l(Ea,"."),Ea.forEach(t),ya.forEach(t),te.forEach(t),sa=d(o),ie=a(o,"H2",{class:!0});var Aa=n(ie);Ce=a(Aa,"A",{id:!0,class:!0,href:!0});var qd=n(Ce);Ro=a(qd,"SPAN",{});var Nd=n(Ro);v(vt.$$.fragment,Nd),Nd.forEach(t),qd.forEach(t),Fn=d(Aa),jo=a(Aa,"SPAN",{});var Hd=n(jo);Un=l(Hd,"Tools"),Hd.forEach(t),Aa.forEach(t),la=d(o),de=a(o,"H3",{class:!0});var Ta=n(de);Le=a(Ta,"A",{id:!0,class:!0,href:!0});var Sd=n(Le);Vo=a(Sd,"SPAN",{});var Cd=n(Vo);v(_t.$$.fragment,Cd),Cd.forEach(t),Sd.forEach(t),Wn=d(Ta),Fo=a(Ta,"SPAN",{});var Ld=n(Fo);Mn=l(Ld,"load_tool"),Ld.forEach(t),Ta.forEach(t),ia=d(o),ce=a(o,"DIV",{class:!0});var ka=n(ce);v($t.$$.fragment,ka),Gn=d(ka),Uo=a(ka,"P",{});var Rd=n(Uo);zn=l(Rd,"Main function to quickly load a tool, be it on the Hub or in the Transformers library."),Rd.forEach(t),ka.forEach(t),da=d(o),me=a(o,"H3",{class:!0});var xa=n(me);Re=a(xa,"A",{id:!0,class:!0,href:!0});var jd=n(Re);Wo=a(jd,"SPAN",{});var Vd=n(Wo);v(bt.$$.fragment,Vd),Vd.forEach(t),jd.forEach(t),Yn=d(xa),Mo=a(xa,"SPAN",{});var Fd=n(Mo);Bn=l(Fd,"Tool"),Fd.forEach(t),xa.forEach(t),ca=d(o),k=a(o,"DIV",{class:!0});var I=n(k);v(wt.$$.fragment,I),Jn=d(I),yt=a(I,"P",{});var Pa=n(yt);Kn=l(Pa,"A base class for the functions used by the agent. Subclass this and implement the "),Go=a(Pa,"CODE",{});var Ud=n(Go);Qn=l(Ud,"__call__"),Ud.forEach(t),Xn=l(Pa,` method as well as the
following class attributes:`),Pa.forEach(t),Zn=d(I),Y=a(I,"UL",{});var et=n(Y);V=a(et,"LI",{});var we=n(V);zo=a(we,"STRONG",{});var Wd=n(zo);es=l(Wd,"description"),Wd.forEach(t),ts=l(we," ("),Yo=a(we,"CODE",{});var Md=n(Yo);os=l(Md,"str"),Md.forEach(t),rs=l(we,`) \u2014 A short description of what your tool does, the inputs it expects and the output(s) it
will return. For instance \u2018This is a tool that downloads a file from a `),Bo=a(we,"CODE",{});var Gd=n(Bo);as=l(Gd,"url"),Gd.forEach(t),ns=l(we,". It takes the "),Jo=a(we,"CODE",{});var zd=n(Jo);ss=l(zd,"url"),zd.forEach(t),ls=l(we,` as input, and
returns the text contained in the file\u2019.`),we.forEach(t),is=d(et),F=a(et,"LI",{});var ye=n(F);Ko=a(ye,"STRONG",{});var Yd=n(Ko);ds=l(Yd,"name"),Yd.forEach(t),cs=l(ye," ("),Qo=a(ye,"CODE",{});var Bd=n(Qo);ms=l(Bd,"str"),Bd.forEach(t),ps=l(ye,`) \u2014 A performative name that will be used for your tool in the prompt to the agent. For instance
`),Xo=a(ye,"CODE",{});var Jd=n(Xo);hs=l(Jd,'"text-classifier"'),Jd.forEach(t),fs=l(ye," or "),Zo=a(ye,"CODE",{});var Kd=n(Zo);us=l(Kd,'"image_generator"'),Kd.forEach(t),gs=l(ye,"."),ye.forEach(t),vs=d(et),D=a(et,"LI",{});var R=n(D);er=a(R,"STRONG",{});var Qd=n(er);_s=l(Qd,"inputs"),Qd.forEach(t),$s=l(R," ("),tr=a(R,"CODE",{});var Xd=n(tr);bs=l(Xd,"List[str]"),Xd.forEach(t),ws=l(R,`) \u2014 The list of modalities expected for the inputs (in the same order as in the call).
Modalitiies should be `),or=a(R,"CODE",{});var Zd=n(or);ys=l(Zd,'"text"'),Zd.forEach(t),Es=l(R,", "),rr=a(R,"CODE",{});var ec=n(rr);As=l(ec,'"image"'),ec.forEach(t),Ts=l(R," or "),ar=a(R,"CODE",{});var tc=n(ar);ks=l(tc,'"audio"'),tc.forEach(t),xs=l(R,". This is only used by "),nr=a(R,"CODE",{});var oc=n(nr);Ps=l(oc,"launch_gradio_demo"),oc.forEach(t),Is=l(R,` or to make a
nice space from your tool.`),R.forEach(t),Ds=d(et),O=a(et,"LI",{});var j=n(O);sr=a(j,"STRONG",{});var rc=n(sr);Os=l(rc,"outputs"),rc.forEach(t),qs=l(j," ("),lr=a(j,"CODE",{});var ac=n(lr);Ns=l(ac,"List[str]"),ac.forEach(t),Hs=l(j,`) \u2014 The list of modalities returned but the tool (in the same order as the return of the
call method). Modalitiies should be `),ir=a(j,"CODE",{});var nc=n(ir);Ss=l(nc,'"text"'),nc.forEach(t),Cs=l(j,", "),dr=a(j,"CODE",{});var sc=n(dr);Ls=l(sc,'"image"'),sc.forEach(t),Rs=l(j," or "),cr=a(j,"CODE",{});var lc=n(cr);js=l(lc,'"audio"'),lc.forEach(t),Vs=l(j,". This is only used by "),mr=a(j,"CODE",{});var ic=n(mr);Fs=l(ic,"launch_gradio_demo"),ic.forEach(t),Us=l(j,`
or to make a nice space from your tool.`),j.forEach(t),et.forEach(t),Ws=d(I),pe=a(I,"P",{});var $o=n(pe);Ms=l($o,"You can also override the method "),ro=a($o,"A",{href:!0});var dc=n(ro);Gs=l(dc,"setup()"),dc.forEach(t),zs=l($o,` if your tool as an expensive operation to perform before being
usable (such as loading a model). `),ao=a($o,"A",{href:!0});var cc=n(ao);Ys=l(cc,"setup()"),cc.forEach(t),Bs=l($o,` will be called the first time you use your tool, but not at
instantiation.`),$o.forEach(t),Js=d(I),je=a(I,"DIV",{class:!0});var Ia=n(je);v(Et.$$.fragment,Ia),Ks=d(Ia),At=a(Ia,"P",{});var Da=n(At);Qs=l(Da,"Creates a "),no=a(Da,"A",{href:!0});var mc=n(no);Xs=l(mc,"Tool"),mc.forEach(t),Zs=l(Da," from a gradio tool."),Da.forEach(t),Ia.forEach(t),el=d(I),Ve=a(I,"DIV",{class:!0});var Oa=n(Ve);v(Tt.$$.fragment,Oa),tl=d(Oa),pr=a(Oa,"P",{});var pc=n(pr);ol=l(pc,"Loads a tool defined on the Hub."),pc.forEach(t),Oa.forEach(t),rl=d(I),Fe=a(I,"DIV",{class:!0});var qa=n(Fe);v(kt.$$.fragment,qa),al=d(qa),hr=a(qa,"P",{});var hc=n(hr);nl=l(hc,"Upload the tool to the Hub."),hc.forEach(t),qa.forEach(t),sl=d(I),U=a(I,"DIV",{class:!0});var tt=n(U);v(xt.$$.fragment,tt),ll=d(tt),Pt=a(tt,"P",{});var Na=n(Pt);il=l(Na,`Saves the relevant code files for your tool so it can be pushed to the Hub. This will copy the code of your
tool in `),fr=a(Na,"CODE",{});var fc=n(fr);dl=l(fc,"output_dir"),fc.forEach(t),cl=l(Na," as well as autogenerate:"),Na.forEach(t),ml=d(tt),he=a(tt,"UL",{});var bo=n(he);so=a(bo,"LI",{});var md=n(so);pl=l(md,"a config file named "),ur=a(md,"CODE",{});var uc=n(ur);hl=l(uc,"tool_config.json"),uc.forEach(t),md.forEach(t),fl=d(bo),It=a(bo,"LI",{});var Ha=n(It);ul=l(Ha,"an "),gr=a(Ha,"CODE",{});var gc=n(gr);gl=l(gc,"app.py"),gc.forEach(t),vl=l(Ha," file so that your tool can be converted to a space"),Ha.forEach(t),_l=d(bo),Dt=a(bo,"LI",{});var Sa=n(Dt);$l=l(Sa,"a "),vr=a(Sa,"CODE",{});var vc=n(vr);bl=l(vc,"requirements.txt"),vc.forEach(t),wl=l(Sa,` containing the names of the module used by your tool (as detected when inspecting its
code)`),Sa.forEach(t),bo.forEach(t),yl=d(tt),Ot=a(tt,"P",{});var Ca=n(Ot);El=l(Ca,"You should only use this method to save tools that are defined in a separate module (not "),_r=a(Ca,"CODE",{});var _c=n(_r);Al=l(_c,"__main__"),_c.forEach(t),Tl=l(Ca,")."),Ca.forEach(t),tt.forEach(t),kl=d(I),Ue=a(I,"DIV",{class:!0});var La=n(Ue);v(qt.$$.fragment,La),xl=d(La),$r=a(La,"P",{});var $c=n($r);Pl=l($c,`Overwrite this method here for any operation that is expensive and needs to be executed before you start using
your tool. Such as loading a big model.`),$c.forEach(t),La.forEach(t),I.forEach(t),ma=d(o),fe=a(o,"H3",{class:!0});var Ra=n(fe);We=a(Ra,"A",{id:!0,class:!0,href:!0});var bc=n(We);br=a(bc,"SPAN",{});var wc=n(br);v(Nt.$$.fragment,wc),wc.forEach(t),bc.forEach(t),Il=d(Ra),wr=a(Ra,"SPAN",{});var yc=n(wr);Dl=l(yc,"PipelineTool"),yc.forEach(t),Ra.forEach(t),pa=d(o),P=a(o,"DIV",{class:!0});var H=n(P);v(Ht.$$.fragment,H),Ol=d(H),ue=a(H,"P",{});var wo=n(ue);ql=l(wo,"A "),lo=a(wo,"A",{href:!0});var Ec=n(lo);Nl=l(Ec,"Tool"),Ec.forEach(t),Hl=l(wo," tailored towards Transformer models. On top of the class attributes of the base class "),io=a(wo,"A",{href:!0});var Ac=n(io);Sl=l(Ac,"Tool"),Ac.forEach(t),Cl=l(wo,`, you will
need to specify:`),wo.forEach(t),Ll=d(H),B=a(H,"UL",{});var ot=n(B);Me=a(ot,"LI",{});var Kr=n(Me);yr=a(Kr,"STRONG",{});var Tc=n(yr);Rl=l(Tc,"model_class"),Tc.forEach(t),jl=l(Kr," ("),Er=a(Kr,"CODE",{});var kc=n(Er);Vl=l(kc,"type"),kc.forEach(t),Fl=l(Kr,") \u2014 The class to use to load the model in this tool."),Kr.forEach(t),Ul=d(ot),Ge=a(ot,"LI",{});var Qr=n(Ge);Ar=a(Qr,"STRONG",{});var xc=n(Ar);Wl=l(xc,"default_checkpoint"),xc.forEach(t),Ml=l(Qr," ("),Tr=a(Qr,"CODE",{});var Pc=n(Tr);Gl=l(Pc,"str"),Pc.forEach(t),zl=l(Qr,") \u2014 The default checkpoint that should be used when the user doesn\u2019t specify one."),Qr.forEach(t),Yl=d(ot),W=a(ot,"LI",{});var Ee=n(W);kr=a(Ee,"STRONG",{});var Ic=n(kr);Bl=l(Ic,"pre_processor_class"),Ic.forEach(t),Jl=l(Ee," ("),xr=a(Ee,"CODE",{});var Dc=n(xr);Kl=l(Dc,"type"),Dc.forEach(t),Ql=l(Ee,", "),Pr=a(Ee,"EM",{});var Oc=n(Pr);Xl=l(Oc,"optional"),Oc.forEach(t),Zl=l(Ee,", defaults to "),co=a(Ee,"A",{href:!0});var qc=n(co);ei=l(qc,"AutoProcessor"),qc.forEach(t),ti=l(Ee,`) \u2014 The class to use to load the
pre-processor`),Ee.forEach(t),oi=d(ot),M=a(ot,"LI",{});var Ae=n(M);Ir=a(Ae,"STRONG",{});var Nc=n(Ir);ri=l(Nc,"post_processor_class"),Nc.forEach(t),ai=l(Ae," ("),Dr=a(Ae,"CODE",{});var Hc=n(Dr);ni=l(Hc,"type"),Hc.forEach(t),si=l(Ae,", "),Or=a(Ae,"EM",{});var Sc=n(Or);li=l(Sc,"optional"),Sc.forEach(t),ii=l(Ae,", defaults to "),mo=a(Ae,"A",{href:!0});var Cc=n(mo);di=l(Cc,"AutoProcessor"),Cc.forEach(t),ci=l(Ae,`) \u2014 The class to use to load the
post-processor (when different from the pre-processor).`),Ae.forEach(t),ot.forEach(t),mi=d(H),ze=a(H,"DIV",{class:!0});var ja=n(ze);v(St.$$.fragment,ja),pi=d(ja),Ct=a(ja,"P",{});var Va=n(Ct);hi=l(Va,"Uses the "),qr=a(Va,"CODE",{});var Lc=n(qr);fi=l(Lc,"post_processor"),Lc.forEach(t),ui=l(Va," to decode the model output."),Va.forEach(t),ja.forEach(t),gi=d(H),Ye=a(H,"DIV",{class:!0});var Fa=n(Ye);v(Lt.$$.fragment,Fa),vi=d(Fa),ge=a(Fa,"P",{});var yo=n(ge);_i=l(yo,"Uses the "),Nr=a(yo,"CODE",{});var Rc=n(Nr);$i=l(Rc,"pre_processor"),Rc.forEach(t),bi=l(yo," to prepare the inputs for the "),Hr=a(yo,"CODE",{});var jc=n(Hr);wi=l(jc,"model"),jc.forEach(t),yi=l(yo,"."),yo.forEach(t),Fa.forEach(t),Ei=d(H),Be=a(H,"DIV",{class:!0});var Ua=n(Be);v(Rt.$$.fragment,Ua),Ai=d(Ua),jt=a(Ua,"P",{});var Wa=n(jt);Ti=l(Wa,"Sends the inputs through the "),Sr=a(Wa,"CODE",{});var Vc=n(Sr);ki=l(Vc,"model"),Vc.forEach(t),xi=l(Wa,"."),Wa.forEach(t),Ua.forEach(t),Pi=d(H),Je=a(H,"DIV",{class:!0});var Ma=n(Je);v(Vt.$$.fragment,Ma),Ii=d(Ma),J=a(Ma,"P",{});var rt=n(J);Di=l(rt,"Instantiates the "),Cr=a(rt,"CODE",{});var Fc=n(Cr);Oi=l(Fc,"pre_processor"),Fc.forEach(t),qi=l(rt,", "),Lr=a(rt,"CODE",{});var Uc=n(Lr);Ni=l(Uc,"model"),Uc.forEach(t),Hi=l(rt," and "),Rr=a(rt,"CODE",{});var Wc=n(Rr);Si=l(Wc,"post_processor"),Wc.forEach(t),Ci=l(rt," if necessary."),rt.forEach(t),Ma.forEach(t),H.forEach(t),ha=d(o),ve=a(o,"H3",{class:!0});var Ga=n(ve);Ke=a(Ga,"A",{id:!0,class:!0,href:!0});var Mc=n(Ke);jr=a(Mc,"SPAN",{});var Gc=n(jr);v(Ft.$$.fragment,Gc),Gc.forEach(t),Mc.forEach(t),Li=d(Ga),Vr=a(Ga,"SPAN",{});var zc=n(Vr);Ri=l(zc,"RemoteTool"),zc.forEach(t),Ga.forEach(t),fa=d(o),L=a(o,"DIV",{class:!0});var at=n(L);v(Ut.$$.fragment,at),ji=d(at),Wt=a(at,"P",{});var za=n(Wt);Vi=l(za,"A "),po=a(za,"A",{href:!0});var Yc=n(po);Fi=l(Yc,"Tool"),Yc.forEach(t),Ui=l(za," that will make requests to an inference endpoint."),za.forEach(t),Wi=d(at),Qe=a(at,"DIV",{class:!0});var Ya=n(Qe);v(Mt.$$.fragment,Ya),Mi=d(Ya),Gt=a(Ya,"P",{});var Ba=n(Gt);Gi=l(Ba,"You can override this method in your custom class of "),ho=a(Ba,"A",{href:!0});var Bc=n(ho);zi=l(Bc,"RemoteTool"),Bc.forEach(t),Yi=l(Ba,` to apply some custom post-processing of the
outputs of the endpoint.`),Ba.forEach(t),Ya.forEach(t),Bi=d(at),ee=a(at,"DIV",{class:!0});var Eo=n(ee);v(zt.$$.fragment,Eo),Ji=d(Eo),Yt=a(Eo,"P",{});var Ja=n(Yt);Ki=l(Ja,`Prepare the inputs received for the HTTP client sending data to the endpoint. Positional arguments will be
matched with the signature of the `),Fr=a(Ja,"CODE",{});var Jc=n(Fr);Qi=l(Jc,"tool_class"),Jc.forEach(t),Xi=l(Ja,` if it was provided at instantation. Images will be encoded into
bytes.`),Ja.forEach(t),Zi=d(Eo),Bt=a(Eo,"P",{});var Ka=n(Bt);ed=l(Ka,"You can override this method in your custom class of "),fo=a(Ka,"A",{href:!0});var Kc=n(fo);td=l(Kc,"RemoteTool"),Kc.forEach(t),od=l(Ka,"."),Ka.forEach(t),Eo.forEach(t),at.forEach(t),ua=d(o),_e=a(o,"H3",{class:!0});var Qa=n(_e);Xe=a(Qa,"A",{id:!0,class:!0,href:!0});var Qc=n(Xe);Ur=a(Qc,"SPAN",{});var Xc=n(Ur);v(Jt.$$.fragment,Xc),Xc.forEach(t),Qc.forEach(t),rd=d(Qa),Wr=a(Qa,"SPAN",{});var Zc=n(Wr);ad=l(Zc,"launch_gradio_demo"),Zc.forEach(t),Qa.forEach(t),ga=d(o),$e=a(o,"DIV",{class:!0});var Xa=n($e);v(Kt.$$.fragment,Xa),nd=d(Xa),be=a(Xa,"P",{});var Ao=n(be);sd=l(Ao,`Launches a gradio demo for a tool. The corresponding tool class needs to properly implement the class attributes
`),Mr=a(Ao,"CODE",{});var em=n(Mr);ld=l(em,"inputs"),em.forEach(t),id=l(Ao," and "),Gr=a(Ao,"CODE",{});var tm=n(Gr);dd=l(tm,"outputs"),tm.forEach(t),cd=l(Ao,"."),Ao.forEach(t),Xa.forEach(t),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(um)),c(u,"id","agents-tools"),c(u,"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"),c(u,"href","#agents-tools"),c(y,"class","relative group"),c(Zt,"href","../transformers_agents"),c(ke,"id","agents"),c(ke,"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"),c(ke,"href","#agents"),c(ae,"class","relative group"),c(eo,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.HfAgent"),c(to,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.OpenAiAgent"),c(xe,"id","transformers.HfAgent"),c(xe,"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"),c(xe,"href","#transformers.HfAgent"),c(ne,"class","relative group"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ie,"id","transformers.OpenAiAgent"),c(Ie,"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"),c(Ie,"href","#transformers.OpenAiAgent"),c(se,"class","relative group"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(qe,"id","transformers.Agent"),c(qe,"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"),c(qe,"href","#transformers.Agent"),c(le,"class","relative group"),c(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(oo,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Agent.chat"),c(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ce,"id","tools"),c(Ce,"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"),c(Ce,"href","#tools"),c(ie,"class","relative group"),c(Le,"id","transformers.load_tool"),c(Le,"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"),c(Le,"href","#transformers.load_tool"),c(de,"class","relative group"),c(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Re,"id","transformers.Tool"),c(Re,"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"),c(Re,"href","#transformers.Tool"),c(me,"class","relative group"),c(ro,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool.setup"),c(ao,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool.setup"),c(no,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool"),c(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(We,"id","transformers.PipelineTool"),c(We,"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"),c(We,"href","#transformers.PipelineTool"),c(fe,"class","relative group"),c(lo,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool"),c(io,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool"),c(co,"href","/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoProcessor"),c(mo,"href","/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoProcessor"),c(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ke,"id","transformers.RemoteTool"),c(Ke,"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"),c(Ke,"href","#transformers.RemoteTool"),c(ve,"class","relative group"),c(po,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.Tool"),c(ho,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.RemoteTool"),c(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(fo,"href","/docs/transformers/v4.29.0/en/main_classes/agent#transformers.RemoteTool"),c(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Xe,"id","transformers.launch_gradio_demo"),c(Xe,"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"),c(Xe,"href","#transformers.launch_gradio_demo"),c(_e,"class","relative group"),c($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,p){e(document.head,h),f(o,T,p),f(o,y,p),e(y,u),e(u,A),_(m,A,null),e(y,E),e(y,oe),e(oe,re),f(o,S,p),_(G,o,p),f(o,nt,p),f(o,Te,p),e(Te,on),e(Te,Zt),e(Zt,rn),e(Te,an),f(o,Xr,p),f(o,ae,p),e(ae,ke),e(ke,To),_(st,To,null),e(ae,nn),e(ae,ko),e(ko,sn),f(o,Zr,p),f(o,Q,p),e(Q,ln),e(Q,eo),e(eo,dn),e(Q,cn),e(Q,to),e(to,mn),e(Q,pn),f(o,ea,p),f(o,ne,p),e(ne,xe),e(xe,xo),_(lt,xo,null),e(ne,hn),e(ne,Po),e(Po,fn),f(o,ta,p),f(o,z,p),_(it,z,null),e(z,un),e(z,Io),e(Io,gn),e(z,vn),_(Pe,z,null),f(o,oa,p),f(o,se,p),e(se,Ie),e(Ie,Do),_(dt,Do,null),e(se,_n),e(se,Oo),e(Oo,$n),f(o,ra,p),f(o,C,p),_(ct,C,null),e(C,bn),e(C,qo),e(qo,wn),e(C,yn),_(De,C,null),e(C,En),_(Oe,C,null),f(o,aa,p),f(o,le,p),e(le,qe),e(qe,No),_(mt,No,null),e(le,An),e(le,Ho),e(Ho,Tn),f(o,na,p),f(o,q,p),_(pt,q,null),e(q,kn),e(q,So),e(So,xn),e(q,Pn),e(q,X),_(ht,X,null),e(X,In),e(X,Co),e(Co,Dn),e(X,On),_(Ne,X,null),e(q,qn),e(q,Z),_(ft,Z,null),e(Z,Nn),e(Z,Lo),e(Lo,Hn),e(Z,Sn),_(He,Z,null),e(q,Cn),e(q,Se),_(ut,Se,null),e(Se,Ln),e(Se,gt),e(gt,Rn),e(gt,oo),e(oo,jn),e(gt,Vn),f(o,sa,p),f(o,ie,p),e(ie,Ce),e(Ce,Ro),_(vt,Ro,null),e(ie,Fn),e(ie,jo),e(jo,Un),f(o,la,p),f(o,de,p),e(de,Le),e(Le,Vo),_(_t,Vo,null),e(de,Wn),e(de,Fo),e(Fo,Mn),f(o,ia,p),f(o,ce,p),_($t,ce,null),e(ce,Gn),e(ce,Uo),e(Uo,zn),f(o,da,p),f(o,me,p),e(me,Re),e(Re,Wo),_(bt,Wo,null),e(me,Yn),e(me,Mo),e(Mo,Bn),f(o,ca,p),f(o,k,p),_(wt,k,null),e(k,Jn),e(k,yt),e(yt,Kn),e(yt,Go),e(Go,Qn),e(yt,Xn),e(k,Zn),e(k,Y),e(Y,V),e(V,zo),e(zo,es),e(V,ts),e(V,Yo),e(Yo,os),e(V,rs),e(V,Bo),e(Bo,as),e(V,ns),e(V,Jo),e(Jo,ss),e(V,ls),e(Y,is),e(Y,F),e(F,Ko),e(Ko,ds),e(F,cs),e(F,Qo),e(Qo,ms),e(F,ps),e(F,Xo),e(Xo,hs),e(F,fs),e(F,Zo),e(Zo,us),e(F,gs),e(Y,vs),e(Y,D),e(D,er),e(er,_s),e(D,$s),e(D,tr),e(tr,bs),e(D,ws),e(D,or),e(or,ys),e(D,Es),e(D,rr),e(rr,As),e(D,Ts),e(D,ar),e(ar,ks),e(D,xs),e(D,nr),e(nr,Ps),e(D,Is),e(Y,Ds),e(Y,O),e(O,sr),e(sr,Os),e(O,qs),e(O,lr),e(lr,Ns),e(O,Hs),e(O,ir),e(ir,Ss),e(O,Cs),e(O,dr),e(dr,Ls),e(O,Rs),e(O,cr),e(cr,js),e(O,Vs),e(O,mr),e(mr,Fs),e(O,Us),e(k,Ws),e(k,pe),e(pe,Ms),e(pe,ro),e(ro,Gs),e(pe,zs),e(pe,ao),e(ao,Ys),e(pe,Bs),e(k,Js),e(k,je),_(Et,je,null),e(je,Ks),e(je,At),e(At,Qs),e(At,no),e(no,Xs),e(At,Zs),e(k,el),e(k,Ve),_(Tt,Ve,null),e(Ve,tl),e(Ve,pr),e(pr,ol),e(k,rl),e(k,Fe),_(kt,Fe,null),e(Fe,al),e(Fe,hr),e(hr,nl),e(k,sl),e(k,U),_(xt,U,null),e(U,ll),e(U,Pt),e(Pt,il),e(Pt,fr),e(fr,dl),e(Pt,cl),e(U,ml),e(U,he),e(he,so),e(so,pl),e(so,ur),e(ur,hl),e(he,fl),e(he,It),e(It,ul),e(It,gr),e(gr,gl),e(It,vl),e(he,_l),e(he,Dt),e(Dt,$l),e(Dt,vr),e(vr,bl),e(Dt,wl),e(U,yl),e(U,Ot),e(Ot,El),e(Ot,_r),e(_r,Al),e(Ot,Tl),e(k,kl),e(k,Ue),_(qt,Ue,null),e(Ue,xl),e(Ue,$r),e($r,Pl),f(o,ma,p),f(o,fe,p),e(fe,We),e(We,br),_(Nt,br,null),e(fe,Il),e(fe,wr),e(wr,Dl),f(o,pa,p),f(o,P,p),_(Ht,P,null),e(P,Ol),e(P,ue),e(ue,ql),e(ue,lo),e(lo,Nl),e(ue,Hl),e(ue,io),e(io,Sl),e(ue,Cl),e(P,Ll),e(P,B),e(B,Me),e(Me,yr),e(yr,Rl),e(Me,jl),e(Me,Er),e(Er,Vl),e(Me,Fl),e(B,Ul),e(B,Ge),e(Ge,Ar),e(Ar,Wl),e(Ge,Ml),e(Ge,Tr),e(Tr,Gl),e(Ge,zl),e(B,Yl),e(B,W),e(W,kr),e(kr,Bl),e(W,Jl),e(W,xr),e(xr,Kl),e(W,Ql),e(W,Pr),e(Pr,Xl),e(W,Zl),e(W,co),e(co,ei),e(W,ti),e(B,oi),e(B,M),e(M,Ir),e(Ir,ri),e(M,ai),e(M,Dr),e(Dr,ni),e(M,si),e(M,Or),e(Or,li),e(M,ii),e(M,mo),e(mo,di),e(M,ci),e(P,mi),e(P,ze),_(St,ze,null),e(ze,pi),e(ze,Ct),e(Ct,hi),e(Ct,qr),e(qr,fi),e(Ct,ui),e(P,gi),e(P,Ye),_(Lt,Ye,null),e(Ye,vi),e(Ye,ge),e(ge,_i),e(ge,Nr),e(Nr,$i),e(ge,bi),e(ge,Hr),e(Hr,wi),e(ge,yi),e(P,Ei),e(P,Be),_(Rt,Be,null),e(Be,Ai),e(Be,jt),e(jt,Ti),e(jt,Sr),e(Sr,ki),e(jt,xi),e(P,Pi),e(P,Je),_(Vt,Je,null),e(Je,Ii),e(Je,J),e(J,Di),e(J,Cr),e(Cr,Oi),e(J,qi),e(J,Lr),e(Lr,Ni),e(J,Hi),e(J,Rr),e(Rr,Si),e(J,Ci),f(o,ha,p),f(o,ve,p),e(ve,Ke),e(Ke,jr),_(Ft,jr,null),e(ve,Li),e(ve,Vr),e(Vr,Ri),f(o,fa,p),f(o,L,p),_(Ut,L,null),e(L,ji),e(L,Wt),e(Wt,Vi),e(Wt,po),e(po,Fi),e(Wt,Ui),e(L,Wi),e(L,Qe),_(Mt,Qe,null),e(Qe,Mi),e(Qe,Gt),e(Gt,Gi),e(Gt,ho),e(ho,zi),e(Gt,Yi),e(L,Bi),e(L,ee),_(zt,ee,null),e(ee,Ji),e(ee,Yt),e(Yt,Ki),e(Yt,Fr),e(Fr,Qi),e(Yt,Xi),e(ee,Zi),e(ee,Bt),e(Bt,ed),e(Bt,fo),e(fo,td),e(Bt,od),f(o,ua,p),f(o,_e,p),e(_e,Xe),e(Xe,Ur),_(Jt,Ur,null),e(_e,rd),e(_e,Wr),e(Wr,ad),f(o,ga,p),f(o,$e,p),_(Kt,$e,null),e($e,nd),e($e,be),e(be,sd),e(be,Mr),e(Mr,ld),e(be,id),e(be,Gr),e(Gr,dd),e(be,cd),va=!0},p(o,[p]){const Qt={};p&2&&(Qt.$$scope={dirty:p,ctx:o}),G.$set(Qt);const zr={};p&2&&(zr.$$scope={dirty:p,ctx:o}),Pe.$set(zr);const Yr={};p&2&&(Yr.$$scope={dirty:p,ctx:o}),De.$set(Yr);const Br={};p&2&&(Br.$$scope={dirty:p,ctx:o}),Oe.$set(Br);const Xt={};p&2&&(Xt.$$scope={dirty:p,ctx:o}),Ne.$set(Xt);const Jr={};p&2&&(Jr.$$scope={dirty:p,ctx:o}),He.$set(Jr)},i(o){va||($(m.$$.fragment,o),$(G.$$.fragment,o),$(st.$$.fragment,o),$(lt.$$.fragment,o),$(it.$$.fragment,o),$(Pe.$$.fragment,o),$(dt.$$.fragment,o),$(ct.$$.fragment,o),$(De.$$.fragment,o),$(Oe.$$.fragment,o),$(mt.$$.fragment,o),$(pt.$$.fragment,o),$(ht.$$.fragment,o),$(Ne.$$.fragment,o),$(ft.$$.fragment,o),$(He.$$.fragment,o),$(ut.$$.fragment,o),$(vt.$$.fragment,o),$(_t.$$.fragment,o),$($t.$$.fragment,o),$(bt.$$.fragment,o),$(wt.$$.fragment,o),$(Et.$$.fragment,o),$(Tt.$$.fragment,o),$(kt.$$.fragment,o),$(xt.$$.fragment,o),$(qt.$$.fragment,o),$(Nt.$$.fragment,o),$(Ht.$$.fragment,o),$(St.$$.fragment,o),$(Lt.$$.fragment,o),$(Rt.$$.fragment,o),$(Vt.$$.fragment,o),$(Ft.$$.fragment,o),$(Ut.$$.fragment,o),$(Mt.$$.fragment,o),$(zt.$$.fragment,o),$(Jt.$$.fragment,o),$(Kt.$$.fragment,o),va=!0)},o(o){b(m.$$.fragment,o),b(G.$$.fragment,o),b(st.$$.fragment,o),b(lt.$$.fragment,o),b(it.$$.fragment,o),b(Pe.$$.fragment,o),b(dt.$$.fragment,o),b(ct.$$.fragment,o),b(De.$$.fragment,o),b(Oe.$$.fragment,o),b(mt.$$.fragment,o),b(pt.$$.fragment,o),b(ht.$$.fragment,o),b(Ne.$$.fragment,o),b(ft.$$.fragment,o),b(He.$$.fragment,o),b(ut.$$.fragment,o),b(vt.$$.fragment,o),b(_t.$$.fragment,o),b($t.$$.fragment,o),b(bt.$$.fragment,o),b(wt.$$.fragment,o),b(Et.$$.fragment,o),b(Tt.$$.fragment,o),b(kt.$$.fragment,o),b(xt.$$.fragment,o),b(qt.$$.fragment,o),b(Nt.$$.fragment,o),b(Ht.$$.fragment,o),b(St.$$.fragment,o),b(Lt.$$.fragment,o),b(Rt.$$.fragment,o),b(Vt.$$.fragment,o),b(Ft.$$.fragment,o),b(Ut.$$.fragment,o),b(Mt.$$.fragment,o),b(zt.$$.fragment,o),b(Jt.$$.fragment,o),b(Kt.$$.fragment,o),va=!1},d(o){t(h),o&&t(T),o&&t(y),w(m),o&&t(S),w(G,o),o&&t(nt),o&&t(Te),o&&t(Xr),o&&t(ae),w(st),o&&t(Zr),o&&t(Q),o&&t(ea),o&&t(ne),w(lt),o&&t(ta),o&&t(z),w(it),w(Pe),o&&t(oa),o&&t(se),w(dt),o&&t(ra),o&&t(C),w(ct),w(De),w(Oe),o&&t(aa),o&&t(le),w(mt),o&&t(na),o&&t(q),w(pt),w(ht),w(Ne),w(ft),w(He),w(ut),o&&t(sa),o&&t(ie),w(vt),o&&t(la),o&&t(de),w(_t),o&&t(ia),o&&t(ce),w($t),o&&t(da),o&&t(me),w(bt),o&&t(ca),o&&t(k),w(wt),w(Et),w(Tt),w(kt),w(xt),w(qt),o&&t(ma),o&&t(fe),w(Nt),o&&t(pa),o&&t(P),w(Ht),w(St),w(Lt),w(Rt),w(Vt),o&&t(ha),o&&t(ve),w(Ft),o&&t(fa),o&&t(L),w(Ut),w(Mt),w(zt),o&&t(ua),o&&t(_e),w(Jt),o&&t(ga),o&&t($e),w(Kt)}}}const um={local:"agents-tools",sections:[{local:"agents",sections:[{local:"transformers.HfAgent",title:"HfAgent"},{local:"transformers.OpenAiAgent",title:"OpenAiAgent"},{local:"transformers.Agent",title:"Agent"}],title:"Agents"},{local:"tools",sections:[{local:"transformers.load_tool",title:"load_tool"},{local:"transformers.Tool",title:"Tool"},{local:"transformers.PipelineTool",title:"PipelineTool"},{local:"transformers.RemoteTool",title:"RemoteTool"},{local:"transformers.launch_gradio_demo",title:"launch_gradio_demo"}],title:"Tools"}],title:"Agents & Tools"};function gm(N){return lm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Em extends rm{constructor(h){super();am(this,h,gm,fm,nm,{})}}export{Em as default,um as metadata};
