import{S as su,i as lu,s as iu,e as r,k as i,w as g,t as s,M as du,c as a,d as o,m as d,a as n,x as v,h as l,b as p,G as e,g as h,y as _,q as b,o as $,B as y,v as cu,L as rr}from"../../chunks/vendor-hf-doc-builder.js";import{T as Hm}from"../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ar}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as J}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as or}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function pu(I){let f,T;return{c(){f=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(w){f=a(w,"P",{});var u=n(f);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(o)},m(w,u){h(w,f,u),e(f,T)},d(w){w&&o(f)}}}function mu(I){let f,T,w,u,E;return u=new ar({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEhmQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiklMEFhZ2VudC5ydW4oJTIySXMlMjB0aGUlMjBmb2xsb3dpbmclMjAlNjB0ZXh0JTYwJTIwKGluJTIwU3BhbmlzaCklMjBwb3NpdGl2ZSUyMG9yJTIwbmVnYXRpdmUlM0YlMjIlMkMlMjB0ZXh0JTNEJTIyJUMyJUExRXN0ZSUyMGVzJTIwdW4lMjBBUEklMjBtdXklMjBhZ3JhZGFibGUhJTIyKQ==",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(){f=r("p"),T=s("Example:"),w=i(),g(u.$$.fragment)},l(c){f=a(c,"P",{});var A=n(f);T=l(A,"Example:"),A.forEach(o),w=d(c),v(u.$$.fragment,c)},m(c,A){h(c,f,A),e(f,T),h(c,w,A),_(u,c,A),E=!0},p:rr,i(c){E||(b(u.$$.fragment,c),E=!0)},o(c){$(u.$$.fragment,c),E=!1},d(c){c&&o(f),c&&o(w),y(u,c)}}}function hu(I){let f,T,w,u,E;return u=new ar({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTJDJTIwTG9jYWxBZ2VudCUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJiaWdjb2RlJTJGc3RhcmNvZGVyJTIyJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCUyQyUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KSUwQSUwQWFnZW50JTIwJTNEJTIwTG9jYWxBZ2VudChtb2RlbCUyQyUyMHRva2VuaXplciklMEFhZ2VudC5ydW4oJTIyRHJhdyUyMG1lJTIwYSUyMHBpY3R1cmUlMjBvZiUyMHJpdmVycyUyMGFuZCUyMGxha2VzLiUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, LocalAgent

checkpoint = <span class="hljs-string">&quot;bigcode/starcoder&quot;</span>
model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map=<span class="hljs-string">&quot;auto&quot;</span>, torch_dtype=torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

agent = LocalAgent(model, tokenizer)
agent.run(<span class="hljs-string">&quot;Draw me a picture of rivers and lakes.&quot;</span>)`}}),{c(){f=r("p"),T=s("Example:"),w=i(),g(u.$$.fragment)},l(c){f=a(c,"P",{});var A=n(f);T=l(A,"Example:"),A.forEach(o),w=d(c),v(u.$$.fragment,c)},m(c,A){h(c,f,A),e(f,T),h(c,w,A),_(u,c,A),E=!0},p:rr,i(c){E||(b(u.$$.fragment,c),E=!0)},o(c){$(u.$$.fragment,c),E=!1},d(c){c&&o(f),c&&o(w),y(u,c)}}}function fu(I){let f,T,w,u,E;return u=new ar({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwTG9jYWxBZ2VudCUwQSUwQWFnZW50JTIwJTNEJTIwTG9jYWxBZ2VudC5mcm9tX3ByZXRyYWluZWQoJTIyYmlnY29kZSUyRnN0YXJjb2RlciUyMiUyQyUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiklMEFhZ2VudC5ydW4oJTIyRHJhdyUyMG1lJTIwYSUyMHBpY3R1cmUlMjBvZiUyMHJpdmVycyUyMGFuZCUyMGxha2VzLiUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LocalAgent

agent = LocalAgent.from_pretrained(<span class="hljs-string">&quot;bigcode/starcoder&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, torch_dtype=torch.bfloat16)
agent.run(<span class="hljs-string">&quot;Draw me a picture of rivers and lakes.&quot;</span>)`}}),{c(){f=r("p"),T=s("Example:"),w=i(),g(u.$$.fragment)},l(c){f=a(c,"P",{});var A=n(f);T=l(A,"Example:"),A.forEach(o),w=d(c),v(u.$$.fragment,c)},m(c,A){h(c,f,A),e(f,T),h(c,w,A),_(u,c,A),E=!0},p:rr,i(c){E||(b(u.$$.fragment,c),E=!0)},o(c){$(u.$$.fragment,c),E=!1},d(c){c&&o(f),c&&o(w),y(u,c)}}}function uu(I){let f,T,w,u,E,c,A,R;return{c(){f=r("p"),T=s("The openAI models are used in generation mode, so even for the "),w=r("code"),u=s("chat()"),E=s(` API, it\u2019s better to use models like
`),c=r("code"),A=s('"text-davinci-003"'),R=s(" over the chat-GPT variant. Proper support for chat-GPT models will come in a next version.")},l(H){f=a(H,"P",{});var M=n(f);T=l(M,"The openAI models are used in generation mode, so even for the "),w=a(M,"CODE",{});var N=n(w);u=l(N,"chat()"),N.forEach(o),E=l(M,` API, it\u2019s better to use models like
`),c=a(M,"CODE",{});var ae=n(c);A=l(ae,'"text-davinci-003"'),ae.forEach(o),R=l(M," over the chat-GPT variant. Proper support for chat-GPT models will come in a next version."),M.forEach(o)},m(H,M){h(H,f,M),e(f,T),e(f,w),e(w,u),e(f,E),e(f,c),e(c,A),e(f,R)},d(H){H&&o(f)}}}function gu(I){let f,T,w,u,E;return u=new ar({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME9wZW5BaUFnZW50JTBBJTBBYWdlbnQlMjAlM0QlMjBPcGVuQWlBZ2VudChtb2RlbCUzRCUyMnRleHQtZGF2aW5jaS0wMDMlMjIlMkMlMjBhcGlfa2V5JTNEeHh4KSUwQWFnZW50LnJ1biglMjJJcyUyMHRoZSUyMGZvbGxvd2luZyUyMCU2MHRleHQlNjAlMjAoaW4lMjBTcGFuaXNoKSUyMHBvc2l0aXZlJTIwb3IlMjBuZWdhdGl2ZSUzRiUyMiUyQyUyMHRleHQlM0QlMjIlQzIlQTFFc3RlJTIwZXMlMjB1biUyMEFQSSUyMG11eSUyMGFncmFkYWJsZSElMjIp",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(){f=r("p"),T=s("Example:"),w=i(),g(u.$$.fragment)},l(c){f=a(c,"P",{});var A=n(f);T=l(A,"Example:"),A.forEach(o),w=d(c),v(u.$$.fragment,c)},m(c,A){h(c,f,A),e(f,T),h(c,w,A),_(u,c,A),E=!0},p:rr,i(c){E||(b(u.$$.fragment,c),E=!0)},o(c){$(u.$$.fragment,c),E=!1},d(c){c&&o(f),c&&o(w),y(u,c)}}}function vu(I){let f,T,w,u,E,c,A,R;return{c(){f=r("p"),T=s("The openAI models are used in generation mode, so even for the "),w=r("code"),u=s("chat()"),E=s(` API, it\u2019s better to use models like
`),c=r("code"),A=s('"text-davinci-003"'),R=s(" over the chat-GPT variant. Proper support for chat-GPT models will come in a next version.")},l(H){f=a(H,"P",{});var M=n(f);T=l(M,"The openAI models are used in generation mode, so even for the "),w=a(M,"CODE",{});var N=n(w);u=l(N,"chat()"),N.forEach(o),E=l(M,` API, it\u2019s better to use models like
`),c=a(M,"CODE",{});var ae=n(c);A=l(ae,'"text-davinci-003"'),ae.forEach(o),R=l(M," over the chat-GPT variant. Proper support for chat-GPT models will come in a next version."),M.forEach(o)},m(H,M){h(H,f,M),e(f,T),e(f,w),e(w,u),e(f,E),e(f,c),e(c,A),e(f,R)},d(H){H&&o(f)}}}function _u(I){let f,T,w,u,E;return u=new ar({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF6dXJlT3BlbkFpQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMEF6dXJlQWlBZ2VudChkZXBsb3ltZW50X2lkJTNEJTIyRGF2aW5jaS0wMDMlMjIlMkMlMjBhcGlfa2V5JTNEeHh4JTJDJTIwcmVzb3VyY2VfbmFtZSUzRHl5eSklMEFhZ2VudC5ydW4oJTIySXMlMjB0aGUlMjBmb2xsb3dpbmclMjAlNjB0ZXh0JTYwJTIwKGluJTIwU3BhbmlzaCklMjBwb3NpdGl2ZSUyMG9yJTIwbmVnYXRpdmUlM0YlMjIlMkMlMjB0ZXh0JTNEJTIyJUMyJUExRXN0ZSUyMGVzJTIwdW4lMjBBUEklMjBtdXklMjBhZ3JhZGFibGUhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AzureOpenAiAgent

agent = AzureAiAgent(deployment_id=<span class="hljs-string">&quot;Davinci-003&quot;</span>, api_key=xxx, resource_name=yyy)
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(){f=r("p"),T=s("Example:"),w=i(),g(u.$$.fragment)},l(c){f=a(c,"P",{});var A=n(f);T=l(A,"Example:"),A.forEach(o),w=d(c),v(u.$$.fragment,c)},m(c,A){h(c,f,A),e(f,T),h(c,w,A),_(u,c,A),E=!0},p:rr,i(c){E||(b(u.$$.fragment,c),E=!0)},o(c){$(u.$$.fragment,c),E=!1},d(c){c&&o(f),c&&o(w),y(u,c)}}}function bu(I){let f,T,w,u,E;return u=new ar({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEhmQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiklMEFhZ2VudC5jaGF0KCUyMkRyYXclMjBtZSUyMGElMjBwaWN0dXJlJTIwb2YlMjByaXZlcnMlMjBhbmQlMjBsYWtlcyUyMiklMEElMEFhZ2VudC5jaGF0KCUyMlRyYW5zZm9ybSUyMHRoZSUyMHBpY3R1cmUlMjBzbyUyMHRoYXQlMjB0aGVyZSUyMGlzJTIwYSUyMHJvY2slMjBpbiUyMHRoZXJlJTIyKQ==",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(){f=r("p"),T=s("Example:"),w=i(),g(u.$$.fragment)},l(c){f=a(c,"P",{});var A=n(f);T=l(A,"Example:"),A.forEach(o),w=d(c),v(u.$$.fragment,c)},m(c,A){h(c,f,A),e(f,T),h(c,w,A),_(u,c,A),E=!0},p:rr,i(c){E||(b(u.$$.fragment,c),E=!0)},o(c){$(u.$$.fragment,c),E=!1},d(c){c&&o(f),c&&o(w),y(u,c)}}}function $u(I){let f,T,w,u,E;return u=new ar({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEhmQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMEhmQWdlbnQoJTIyaHR0cHMlM0ElMkYlMkZhcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvJTJGbW9kZWxzJTJGYmlnY29kZSUyRnN0YXJjb2RlciUyMiklMEFhZ2VudC5ydW4oJTIyRHJhdyUyMG1lJTIwYSUyMHBpY3R1cmUlMjBvZiUyMHJpdmVycyUyMGFuZCUyMGxha2VzJTIyKQ==",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(){f=r("p"),T=s("Example:"),w=i(),g(u.$$.fragment)},l(c){f=a(c,"P",{});var A=n(f);T=l(A,"Example:"),A.forEach(o),w=d(c),v(u.$$.fragment,c)},m(c,A){h(c,f,A),e(f,T),h(c,w,A),_(u,c,A),E=!0},p:rr,i(c){E||(b(u.$$.fragment,c),E=!0)},o(c){$(u.$$.fragment,c),E=!1},d(c){c&&o(f),c&&o(w),y(u,c)}}}function yu(I){let f,T,w,u,E,c,A,R,H,M,N,ae,Ze,ul,nr,gl,vl,On,pe,Le,Hr,Zt,_l,Cr,bl,Rn,B,$l,sr,yl,wl,lr,Al,El,ir,Tl,kl,Zn,me,Se,Nr,Lt,xl,Or,Il,Ln,ee,St,Ml,Rr,Pl,jl,We,Sn,he,Ge,Zr,Wt,Jl,Lr,Ul,Wn,Z,Gt,Dl,Sr,Hl,Cl,qe,Nl,ne,qt,Ol,zt,Rl,Wr,Zl,Ll,Sl,ze,Gn,fe,Ve,Gr,Vt,Wl,qr,Gl,qn,L,Bt,ql,zr,zl,Vl,Be,Bl,Ye,zn,ue,Fe,Vr,Yt,Yl,Br,Fl,Vn,S,Ft,Ql,Qt,Xl,Xt,Kl,ei,ti,Qe,oi,Xe,Bn,ge,Ke,Yr,Kt,ri,Fr,ai,Yn,C,eo,ni,Qr,si,li,se,to,ii,Xr,di,ci,et,pi,le,oo,mi,Kr,hi,fi,tt,ui,ot,ro,gi,ao,vi,dr,_i,bi,Fn,ve,rt,ea,no,$i,ta,yi,Qn,_e,at,oa,so,wi,ra,Ai,Xn,be,lo,Ei,aa,Ti,Kn,$e,nt,na,io,ki,sa,xi,es,x,co,Ii,po,Mi,la,Pi,ji,Ji,te,Y,ia,Ui,Di,da,Hi,Ci,ca,Ni,Oi,pa,Ri,Zi,Li,F,ma,Si,Wi,ha,Gi,qi,fa,zi,Vi,ua,Bi,Yi,Fi,U,ga,Qi,Xi,va,Ki,ed,_a,td,od,ba,rd,ad,$a,nd,sd,ya,ld,id,dd,D,wa,cd,pd,Aa,md,hd,Ea,fd,ud,Ta,gd,vd,ka,_d,bd,xa,$d,yd,wd,ye,Ad,cr,Ed,Td,pr,kd,xd,Id,st,mo,Md,ho,Pd,mr,jd,Jd,Ud,lt,fo,Dd,Ia,Hd,Cd,it,uo,Nd,Ma,Od,Rd,Q,go,Zd,vo,Ld,Pa,Sd,Wd,Gd,we,hr,qd,ja,zd,Vd,_o,Bd,Ja,Yd,Fd,Qd,bo,Xd,Ua,Kd,ec,tc,$o,oc,Da,rc,ac,nc,dt,yo,sc,Ha,lc,ts,Ae,ct,Ca,wo,ic,Na,dc,os,P,Ao,cc,Ee,pc,fr,mc,hc,ur,fc,uc,gc,oe,pt,Oa,vc,_c,Ra,bc,$c,yc,mt,Za,wc,Ac,La,Ec,Tc,kc,X,Sa,xc,Ic,Wa,Mc,Pc,Ga,jc,Jc,gr,Uc,Dc,Hc,K,qa,Cc,Nc,za,Oc,Rc,Va,Zc,Lc,vr,Sc,Wc,Gc,ht,Eo,qc,To,zc,Ba,Vc,Bc,Yc,ft,ko,Fc,Te,Qc,Ya,Xc,Kc,Fa,ep,tp,op,ut,xo,rp,Io,ap,Qa,np,sp,lp,gt,Mo,ip,re,dp,Xa,cp,pp,Ka,mp,hp,en,fp,up,rs,ke,vt,tn,Po,gp,on,vp,as,W,jo,_p,Jo,bp,_r,$p,yp,wp,_t,Uo,Ap,Do,Ep,br,Tp,kp,xp,ie,Ho,Ip,Co,Mp,rn,Pp,jp,Jp,No,Up,$r,Dp,Hp,ns,xe,bt,an,Oo,Cp,nn,Np,ss,Ie,Ro,Op,Me,Rp,sn,Zp,Lp,ln,Sp,Wp,ls,Pe,$t,dn,Zo,Gp,cn,qp,is,yr,zp,ds,yt,Vp,pn,Bp,Yp,cs,wr,Fp,ps,de,Lo,Qp,mn,Xp,Kp,em,je,tm,hn,om,rm,fn,am,nm,sm,un,lm,ms,Je,wt,gn,So,im,vn,dm,hs,Ue,Wo,cm,_n,pm,fs,De,At,bn,Go,mm,$n,hm,us,G,qo,fm,yn,um,gm,Et,zo,vm,wn,_m,bm,Tt,Vo,$m,An,ym,gs,He,kt,En,Bo,wm,Tn,Am,vs,q,Yo,Em,kn,Tm,km,xt,Fo,xm,Qo,Im,xn,Mm,Pm,jm,It,Xo,Jm,In,Um,_s;return c=new J({}),N=new Hm({props:{warning:!0,$$slots:{default:[pu]},$$scope:{ctx:I}}}),Zt=new J({}),Lt=new J({}),St=new k({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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>chat_prompt_template.txt</code> in this repo in this case.`,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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>run_prompt_template.txt</code> in this repo in this case.`,name:"run_prompt_template"},{anchor:"transformers.HfAgent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.32.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.32.0/src/transformers/tools/agents.py#L588"}}),We=new or({props:{anchor:"transformers.HfAgent.example",$$slots:{default:[mu]},$$scope:{ctx:I}}}),Wt=new J({}),Gt=new k({props:{name:"class transformers.LocalAgent",anchor:"transformers.LocalAgent",parameters:[{name:"model",val:""},{name:"tokenizer",val:""},{name:"chat_prompt_template",val:" = None"},{name:"run_prompt_template",val:" = None"},{name:"additional_tools",val:" = None"}],parametersDescription:[{anchor:"transformers.LocalAgent.model",description:`<strong>model</strong> (<a href="/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>) &#x2014;
The model to use for the agent.`,name:"model"},{anchor:"transformers.LocalAgent.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.32.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>) &#x2014;
The tokenizer to use for the agent.`,name:"tokenizer"},{anchor:"transformers.LocalAgent.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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>chat_prompt_template.txt</code> in this repo in this case.`,name:"chat_prompt_template"},{anchor:"transformers.LocalAgent.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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>run_prompt_template.txt</code> in this repo in this case.`,name:"run_prompt_template"},{anchor:"transformers.LocalAgent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.32.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.32.0/src/transformers/tools/agents.py#L659"}}),qe=new or({props:{anchor:"transformers.LocalAgent.example",$$slots:{default:[hu]},$$scope:{ctx:I}}}),qt=new k({props:{name:"from_pretrained",anchor:"transformers.LocalAgent.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LocalAgent.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
The name of a repo on the Hub or a local path to a folder containing both model and tokenizer.`,name:"pretrained_model_name_or_path"},{anchor:"transformers.LocalAgent.from_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Keyword arguments passed along to <a href="/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a>.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agents.py#L704"}}),ze=new or({props:{anchor:"transformers.LocalAgent.from_pretrained.example",$$slots:{default:[fu]},$$scope:{ctx:I}}}),Vt=new J({}),Bt=new k({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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>chat_prompt_template.txt</code> in this repo in this case.`,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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>run_prompt_template.txt</code> in this repo in this case.`,name:"run_prompt_template"},{anchor:"transformers.OpenAiAgent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.32.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.32.0/src/transformers/tools/agents.py#L364"}}),Be=new Hm({props:{warning:!0,$$slots:{default:[uu]},$$scope:{ctx:I}}}),Ye=new or({props:{anchor:"transformers.OpenAiAgent.example",$$slots:{default:[gu]},$$scope:{ctx:I}}}),Yt=new J({}),Ft=new k({props:{name:"class transformers.AzureOpenAiAgent",anchor:"transformers.AzureOpenAiAgent",parameters:[{name:"deployment_id",val:""},{name:"api_key",val:" = None"},{name:"resource_name",val:" = None"},{name:"api_version",val:" = '2022-12-01'"},{name:"is_chat_model",val:" = None"},{name:"chat_prompt_template",val:" = None"},{name:"run_prompt_template",val:" = None"},{name:"additional_tools",val:" = None"}],parametersDescription:[{anchor:"transformers.AzureOpenAiAgent.deployment_id",description:`<strong>deployment_id</strong> (<code>str</code>) &#x2014;
The name of the deployed Azure openAI model to use.`,name:"deployment_id"},{anchor:"transformers.AzureOpenAiAgent.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;AZURE_OPENAI_API_KEY&quot;</code>.`,name:"api_key"},{anchor:"transformers.AzureOpenAiAgent.resource_name",description:`<strong>resource_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The name of your Azure OpenAI Resource. If unset, will look for the environment variable
<code>&quot;AZURE_OPENAI_RESOURCE_NAME&quot;</code>.`,name:"resource_name"},{anchor:"transformers.AzureOpenAiAgent.api_version",description:`<strong>api_version</strong> (<code>str</code>, <em>optional</em>, default to <code>&quot;2022-12-01&quot;</code>) &#x2014;
The API version to use for this agent.`,name:"api_version"},{anchor:"transformers.AzureOpenAiAgent.is_chat_mode",description:`<strong>is_chat_mode</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether you are using a completion model or a chat model (see note above, chat models won&#x2019;t be as
efficient). Will default to <code>gpt</code> being in the <code>deployment_id</code> or not.`,name:"is_chat_mode"},{anchor:"transformers.AzureOpenAiAgent.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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>chat_prompt_template.txt</code> in this repo in this case.`,name:"chat_prompt_template"},{anchor:"transformers.AzureOpenAiAgent.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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>run_prompt_template.txt</code> in this repo in this case.`,name:"run_prompt_template"},{anchor:"transformers.AzureOpenAiAgent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.32.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.32.0/src/transformers/tools/agents.py#L462"}}),Qe=new Hm({props:{warning:!0,$$slots:{default:[vu]},$$scope:{ctx:I}}}),Xe=new or({props:{anchor:"transformers.AzureOpenAiAgent.example",$$slots:{default:[_u]},$$scope:{ctx:I}}}),Kt=new J({}),eo=new k({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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>chat_prompt_template.txt</code> in this repo in this case.`,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. Can be the
actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
<code>run_prompt_template.txt</code> in this repo in this case.`,name:"run_prompt_template"},{anchor:"transformers.Agent.additional_tools",description:`<strong>additional_tools</strong> (<a href="/docs/transformers/v4.32.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.32.0/src/transformers/tools/agents.py#L196"}}),to=new k({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.`,name:"remote"},{anchor:"transformers.Agent.chat.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#x2014;
Any keyword argument to send to the agent when evaluating the code.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agents.py#L268"}}),et=new or({props:{anchor:"transformers.Agent.chat.example",$$slots:{default:[bu]},$$scope:{ctx:I}}}),oo=new k({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.`,name:"remote"},{anchor:"transformers.Agent.run.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#x2014;
Any keyword argument to send to the agent when evaluating the code.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agents.py#L318"}}),tt=new or({props:{anchor:"transformers.Agent.run.example",$$slots:{default:[$u]},$$scope:{ctx:I}}}),ro=new k({props:{name:"prepare_for_new_chat",anchor:"transformers.Agent.prepare_for_new_chat",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agents.py#L310"}}),no=new J({}),so=new J({}),lo=new k({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>).`,name:"token"},{anchor:"transformers.load_tool.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#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:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L639"}}),io=new J({}),co=new k({props:{name:"class transformers.Tool",anchor:"transformers.Tool",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L81"}}),mo=new k({props:{name:"from_gradio",anchor:"transformers.Tool.from_gradio",parameters:[{name:"gradio_tool",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L330"}}),fo=new k({props:{name:"from_hub",anchor:"transformers.Tool.from_hub",parameters:[{name:"repo_id",val:": str"},{name:"model_repo_id",val:": typing.Optional[str] = None"},{name:"token",val:": typing.Optional[str] = None"},{name:"remote",val:": bool = 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.`,name:"remote"},{anchor:"transformers.Tool.from_hub.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#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:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L176"}}),uo=new k({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[bool, str, 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.32.0/src/transformers/tools/base.py#L286"}}),go=new k({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.32.0/src/transformers/tools/base.py#L122"}}),yo=new k({props:{name:"setup",anchor:"transformers.Tool.setup",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L115"}}),wo=new J({}),Ao=new k({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.32.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>).`,name:"token"},{anchor:"transformers.PipelineTool.hub_kwargs",description:`<strong>hub_kwargs</strong> (additional keyword arguments, <em>optional</em>) &#x2014;
Any additional keyword argument to send to the methods that will load the data from the Hub.`,name:"hub_kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L433"}}),Eo=new k({props:{name:"decode",anchor:"transformers.PipelineTool.decode",parameters:[{name:"outputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L552"}}),ko=new k({props:{name:"encode",anchor:"transformers.PipelineTool.encode",parameters:[{name:"raw_inputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L539"}}),xo=new k({props:{name:"forward",anchor:"transformers.PipelineTool.forward",parameters:[{name:"inputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L545"}}),Mo=new k({props:{name:"setup",anchor:"transformers.PipelineTool.setup",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L513"}}),Po=new J({}),jo=new k({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.32.0/src/transformers/tools/base.py#L346"}}),Uo=new k({props:{name:"extract_outputs",anchor:"transformers.RemoteTool.extract_outputs",parameters:[{name:"outputs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L409"}}),Ho=new k({props:{name:"prepare_inputs",anchor:"transformers.RemoteTool.prepare_inputs",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/base.py#L366"}}),Oo=new J({}),Ro=new k({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.32.0/src/transformers/tools/base.py#L573"}}),Zo=new J({}),So=new J({}),Wo=new k({props:{name:"class transformers.tools.agent_types.AgentText",anchor:"transformers.tools.agent_types.AgentText",parameters:[{name:"value",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agent_types.py#L71"}}),Go=new J({}),qo=new k({props:{name:"class transformers.tools.agent_types.AgentImage",anchor:"transformers.tools.agent_types.AgentImage",parameters:[{name:"value",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agent_types.py#L83"}}),zo=new k({props:{name:"to_raw",anchor:"transformers.tools.agent_types.AgentImage.to_raw",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agent_types.py#L115"}}),Vo=new k({props:{name:"to_string",anchor:"transformers.tools.agent_types.AgentImage.to_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agent_types.py#L126"}}),Bo=new J({}),Yo=new k({props:{name:"class transformers.tools.agent_types.AgentAudio",anchor:"transformers.tools.agent_types.AgentAudio",parameters:[{name:"value",val:""},{name:"samplerate",val:" = 16000"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agent_types.py#L155"}}),Fo=new k({props:{name:"to_raw",anchor:"transformers.tools.agent_types.AgentAudio.to_raw",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agent_types.py#L186"}}),Xo=new k({props:{name:"to_string",anchor:"transformers.tools.agent_types.AgentAudio.to_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/tools/agent_types.py#L198"}}),{c(){f=r("meta"),T=i(),w=r("h1"),u=r("a"),E=r("span"),g(c.$$.fragment),A=i(),R=r("span"),H=s("Agents & Tools"),M=i(),g(N.$$.fragment),ae=i(),Ze=r("p"),ul=s("To learn more about agents and tools make sure to read the "),nr=r("a"),gl=s("introductory guide"),vl=s(`. This page
contains the API docs for the underlying classes.`),On=i(),pe=r("h2"),Le=r("a"),Hr=r("span"),g(Zt.$$.fragment),_l=i(),Cr=r("span"),bl=s("Agents"),Rn=i(),B=r("p"),$l=s("We provide three types of agents: "),sr=r("a"),yl=s("HfAgent"),wl=s(" uses inference endpoints for opensource models, "),lr=r("a"),Al=s("LocalAgent"),El=s(" uses a model of your choice locally and "),ir=r("a"),Tl=s("OpenAiAgent"),kl=s(" uses OpenAI closed models."),Zn=i(),me=r("h3"),Se=r("a"),Nr=r("span"),g(Lt.$$.fragment),xl=i(),Or=r("span"),Il=s("HfAgent"),Ln=i(),ee=r("div"),g(St.$$.fragment),Ml=i(),Rr=r("p"),Pl=s("Agent that uses an inference endpoint to generate code."),jl=i(),g(We.$$.fragment),Sn=i(),he=r("h3"),Ge=r("a"),Zr=r("span"),g(Wt.$$.fragment),Jl=i(),Lr=r("span"),Ul=s("LocalAgent"),Wn=i(),Z=r("div"),g(Gt.$$.fragment),Dl=i(),Sr=r("p"),Hl=s("Agent that uses a local model and tokenizer to generate code."),Cl=i(),g(qe.$$.fragment),Nl=i(),ne=r("div"),g(qt.$$.fragment),Ol=i(),zt=r("p"),Rl=s("Convenience method to build a "),Wr=r("code"),Zl=s("LocalAgent"),Ll=s(" from a pretrained checkpoint."),Sl=i(),g(ze.$$.fragment),Gn=i(),fe=r("h3"),Ve=r("a"),Gr=r("span"),g(Vt.$$.fragment),Wl=i(),qr=r("span"),Gl=s("OpenAiAgent"),qn=i(),L=r("div"),g(Bt.$$.fragment),ql=i(),zr=r("p"),zl=s("Agent that uses the openai API to generate code."),Vl=i(),g(Be.$$.fragment),Bl=i(),g(Ye.$$.fragment),zn=i(),ue=r("h3"),Fe=r("a"),Vr=r("span"),g(Yt.$$.fragment),Yl=i(),Br=r("span"),Fl=s("AzureOpenAiAgent"),Vn=i(),S=r("div"),g(Ft.$$.fragment),Ql=i(),Qt=r("p"),Xl=s("Agent that uses Azure OpenAI to generate code. See the "),Xt=r("a"),Kl=s(`official
documentation`),ei=s(` to learn how to deploy an openAI
model on Azure`),ti=i(),g(Qe.$$.fragment),oi=i(),g(Xe.$$.fragment),Bn=i(),ge=r("h3"),Ke=r("a"),Yr=r("span"),g(Kt.$$.fragment),ri=i(),Fr=r("span"),ai=s("Agent"),Yn=i(),C=r("div"),g(eo.$$.fragment),ni=i(),Qr=r("p"),si=s("Base class for all agents which contains the main API methods."),li=i(),se=r("div"),g(to.$$.fragment),ii=i(),Xr=r("p"),di=s("Sends a new request to the agent in a chat. Will use the previous ones in its history."),ci=i(),g(et.$$.fragment),pi=i(),le=r("div"),g(oo.$$.fragment),mi=i(),Kr=r("p"),hi=s("Sends a request to the agent."),fi=i(),g(tt.$$.fragment),ui=i(),ot=r("div"),g(ro.$$.fragment),gi=i(),ao=r("p"),vi=s("Clears the history of prior calls to "),dr=r("a"),_i=s("chat()"),bi=s("."),Fn=i(),ve=r("h2"),rt=r("a"),ea=r("span"),g(no.$$.fragment),$i=i(),ta=r("span"),yi=s("Tools"),Qn=i(),_e=r("h3"),at=r("a"),oa=r("span"),g(so.$$.fragment),wi=i(),ra=r("span"),Ai=s("load_tool"),Xn=i(),be=r("div"),g(lo.$$.fragment),Ei=i(),aa=r("p"),Ti=s("Main function to quickly load a tool, be it on the Hub or in the Transformers library."),Kn=i(),$e=r("h3"),nt=r("a"),na=r("span"),g(io.$$.fragment),ki=i(),sa=r("span"),xi=s("Tool"),es=i(),x=r("div"),g(co.$$.fragment),Ii=i(),po=r("p"),Mi=s("A base class for the functions used by the agent. Subclass this and implement the "),la=r("code"),Pi=s("__call__"),ji=s(` method as well as the
following class attributes:`),Ji=i(),te=r("ul"),Y=r("li"),ia=r("strong"),Ui=s("description"),Di=s(" ("),da=r("code"),Hi=s("str"),Ci=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 `),ca=r("code"),Ni=s("url"),Oi=s(". It takes the "),pa=r("code"),Ri=s("url"),Zi=s(` as input, and
returns the text contained in the file\u2019.`),Li=i(),F=r("li"),ma=r("strong"),Si=s("name"),Wi=s(" ("),ha=r("code"),Gi=s("str"),qi=s(`) \u2014 A performative name that will be used for your tool in the prompt to the agent. For instance
`),fa=r("code"),zi=s('"text-classifier"'),Vi=s(" or "),ua=r("code"),Bi=s('"image_generator"'),Yi=s("."),Fi=i(),U=r("li"),ga=r("strong"),Qi=s("inputs"),Xi=s(" ("),va=r("code"),Ki=s("List[str]"),ed=s(`) \u2014 The list of modalities expected for the inputs (in the same order as in the call).
Modalitiies should be `),_a=r("code"),td=s('"text"'),od=s(", "),ba=r("code"),rd=s('"image"'),ad=s(" or "),$a=r("code"),nd=s('"audio"'),sd=s(". This is only used by "),ya=r("code"),ld=s("launch_gradio_demo"),id=s(` or to make a
nice space from your tool.`),dd=i(),D=r("li"),wa=r("strong"),cd=s("outputs"),pd=s(" ("),Aa=r("code"),md=s("List[str]"),hd=s(`) \u2014 The list of modalities returned but the tool (in the same order as the return of the
call method). Modalitiies should be `),Ea=r("code"),fd=s('"text"'),ud=s(", "),Ta=r("code"),gd=s('"image"'),vd=s(" or "),ka=r("code"),_d=s('"audio"'),bd=s(". This is only used by "),xa=r("code"),$d=s("launch_gradio_demo"),yd=s(`
or to make a nice space from your tool.`),wd=i(),ye=r("p"),Ad=s("You can also override the method "),cr=r("a"),Ed=s("setup()"),Td=s(` if your tool as an expensive operation to perform before being
usable (such as loading a model). `),pr=r("a"),kd=s("setup()"),xd=s(` will be called the first time you use your tool, but not at
instantiation.`),Id=i(),st=r("div"),g(mo.$$.fragment),Md=i(),ho=r("p"),Pd=s("Creates a "),mr=r("a"),jd=s("Tool"),Jd=s(" from a gradio tool."),Ud=i(),lt=r("div"),g(fo.$$.fragment),Dd=i(),Ia=r("p"),Hd=s("Loads a tool defined on the Hub."),Cd=i(),it=r("div"),g(uo.$$.fragment),Nd=i(),Ma=r("p"),Od=s("Upload the tool to the Hub."),Rd=i(),Q=r("div"),g(go.$$.fragment),Zd=i(),vo=r("p"),Ld=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 `),Pa=r("code"),Sd=s("output_dir"),Wd=s(" as well as autogenerate:"),Gd=i(),we=r("ul"),hr=r("li"),qd=s("a config file named "),ja=r("code"),zd=s("tool_config.json"),Vd=i(),_o=r("li"),Bd=s("an "),Ja=r("code"),Yd=s("app.py"),Fd=s(" file so that your tool can be converted to a space"),Qd=i(),bo=r("li"),Xd=s("a "),Ua=r("code"),Kd=s("requirements.txt"),ec=s(` containing the names of the module used by your tool (as detected when inspecting its
code)`),tc=i(),$o=r("p"),oc=s("You should only use this method to save tools that are defined in a separate module (not "),Da=r("code"),rc=s("__main__"),ac=s(")."),nc=i(),dt=r("div"),g(yo.$$.fragment),sc=i(),Ha=r("p"),lc=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.`),ts=i(),Ae=r("h3"),ct=r("a"),Ca=r("span"),g(wo.$$.fragment),ic=i(),Na=r("span"),dc=s("PipelineTool"),os=i(),P=r("div"),g(Ao.$$.fragment),cc=i(),Ee=r("p"),pc=s("A "),fr=r("a"),mc=s("Tool"),hc=s(" tailored towards Transformer models. On top of the class attributes of the base class "),ur=r("a"),fc=s("Tool"),uc=s(`, you will
need to specify:`),gc=i(),oe=r("ul"),pt=r("li"),Oa=r("strong"),vc=s("model_class"),_c=s(" ("),Ra=r("code"),bc=s("type"),$c=s(") \u2014 The class to use to load the model in this tool."),yc=i(),mt=r("li"),Za=r("strong"),wc=s("default_checkpoint"),Ac=s(" ("),La=r("code"),Ec=s("str"),Tc=s(") \u2014 The default checkpoint that should be used when the user doesn\u2019t specify one."),kc=i(),X=r("li"),Sa=r("strong"),xc=s("pre_processor_class"),Ic=s(" ("),Wa=r("code"),Mc=s("type"),Pc=s(", "),Ga=r("em"),jc=s("optional"),Jc=s(", defaults to "),gr=r("a"),Uc=s("AutoProcessor"),Dc=s(`) \u2014 The class to use to load the
pre-processor`),Hc=i(),K=r("li"),qa=r("strong"),Cc=s("post_processor_class"),Nc=s(" ("),za=r("code"),Oc=s("type"),Rc=s(", "),Va=r("em"),Zc=s("optional"),Lc=s(", defaults to "),vr=r("a"),Sc=s("AutoProcessor"),Wc=s(`) \u2014 The class to use to load the
post-processor (when different from the pre-processor).`),Gc=i(),ht=r("div"),g(Eo.$$.fragment),qc=i(),To=r("p"),zc=s("Uses the "),Ba=r("code"),Vc=s("post_processor"),Bc=s(" to decode the model output."),Yc=i(),ft=r("div"),g(ko.$$.fragment),Fc=i(),Te=r("p"),Qc=s("Uses the "),Ya=r("code"),Xc=s("pre_processor"),Kc=s(" to prepare the inputs for the "),Fa=r("code"),ep=s("model"),tp=s("."),op=i(),ut=r("div"),g(xo.$$.fragment),rp=i(),Io=r("p"),ap=s("Sends the inputs through the "),Qa=r("code"),np=s("model"),sp=s("."),lp=i(),gt=r("div"),g(Mo.$$.fragment),ip=i(),re=r("p"),dp=s("Instantiates the "),Xa=r("code"),cp=s("pre_processor"),pp=s(", "),Ka=r("code"),mp=s("model"),hp=s(" and "),en=r("code"),fp=s("post_processor"),up=s(" if necessary."),rs=i(),ke=r("h3"),vt=r("a"),tn=r("span"),g(Po.$$.fragment),gp=i(),on=r("span"),vp=s("RemoteTool"),as=i(),W=r("div"),g(jo.$$.fragment),_p=i(),Jo=r("p"),bp=s("A "),_r=r("a"),$p=s("Tool"),yp=s(" that will make requests to an inference endpoint."),wp=i(),_t=r("div"),g(Uo.$$.fragment),Ap=i(),Do=r("p"),Ep=s("You can override this method in your custom class of "),br=r("a"),Tp=s("RemoteTool"),kp=s(` to apply some custom post-processing of the
outputs of the endpoint.`),xp=i(),ie=r("div"),g(Ho.$$.fragment),Ip=i(),Co=r("p"),Mp=s(`Prepare the inputs received for the HTTP client sending data to the endpoint. Positional arguments will be
matched with the signature of the `),rn=r("code"),Pp=s("tool_class"),jp=s(` if it was provided at instantation. Images will be encoded into
bytes.`),Jp=i(),No=r("p"),Up=s("You can override this method in your custom class of "),$r=r("a"),Dp=s("RemoteTool"),Hp=s("."),ns=i(),xe=r("h3"),bt=r("a"),an=r("span"),g(Oo.$$.fragment),Cp=i(),nn=r("span"),Np=s("launch_gradio_demo"),ss=i(),Ie=r("div"),g(Ro.$$.fragment),Op=i(),Me=r("p"),Rp=s(`Launches a gradio demo for a tool. The corresponding tool class needs to properly implement the class attributes
`),sn=r("code"),Zp=s("inputs"),Lp=s(" and "),ln=r("code"),Sp=s("outputs"),Wp=s("."),ls=i(),Pe=r("h2"),$t=r("a"),dn=r("span"),g(Zo.$$.fragment),Gp=i(),cn=r("span"),qp=s("Agent Types"),is=i(),yr=r("p"),zp=s(`Agents can handle any type of object in-between tools; tools, being completely multimodal, can accept and return
text, image, audio, video, among other types. In order to increase compatibility between tools, as well as to
correctly render these returns in ipython (jupyter, colab, ipython notebooks, \u2026), we implement wrapper classes
around these types.`),ds=i(),yt=r("p"),Vp=s(`The wrapped objects should continue behaving as initially; a text object should still behave as a string, an image
object should still behave as a `),pn=r("code"),Bp=s("PIL.Image"),Yp=s("."),cs=i(),wr=r("p"),Fp=s("These types have three specific purposes:"),ps=i(),de=r("ul"),Lo=r("li"),Qp=s("Calling "),mn=r("code"),Xp=s("to_raw"),Kp=s(" on the type should return the underlying object"),em=i(),je=r("li"),tm=s("Calling "),hn=r("code"),om=s("to_string"),rm=s(" on the type should return the object as a string: that can be the string in case of an "),fn=r("code"),am=s("AgentText"),nm=s(`
but will be the path of the serialized version of the object in other instances`),sm=i(),un=r("li"),lm=s("Displaying it in an ipython kernel should display the object correctly"),ms=i(),Je=r("h3"),wt=r("a"),gn=r("span"),g(So.$$.fragment),im=i(),vn=r("span"),dm=s("AgentText"),hs=i(),Ue=r("div"),g(Wo.$$.fragment),cm=i(),_n=r("p"),pm=s("Text type returned by the agent. Behaves as a string."),fs=i(),De=r("h3"),At=r("a"),bn=r("span"),g(Go.$$.fragment),mm=i(),$n=r("span"),hm=s("AgentImage"),us=i(),G=r("div"),g(qo.$$.fragment),fm=i(),yn=r("p"),um=s("Image type returned by the agent. Behaves as a PIL.Image."),gm=i(),Et=r("div"),g(zo.$$.fragment),vm=i(),wn=r("p"),_m=s("Returns the \u201Craw\u201D version of that object. In the case of an AgentImage, it is a PIL.Image."),bm=i(),Tt=r("div"),g(Vo.$$.fragment),$m=i(),An=r("p"),ym=s(`Returns the stringified version of that object. In the case of an AgentImage, it is a path to the serialized
version of the image.`),gs=i(),He=r("h3"),kt=r("a"),En=r("span"),g(Bo.$$.fragment),wm=i(),Tn=r("span"),Am=s("AgentAudio"),vs=i(),q=r("div"),g(Yo.$$.fragment),Em=i(),kn=r("p"),Tm=s("Audio type returned by the agent."),km=i(),xt=r("div"),g(Fo.$$.fragment),xm=i(),Qo=r("p"),Im=s("Returns the \u201Craw\u201D version of that object. It is a "),xn=r("code"),Mm=s("torch.Tensor"),Pm=s(" object."),jm=i(),It=r("div"),g(Xo.$$.fragment),Jm=i(),In=r("p"),Um=s(`Returns the stringified version of that object. In the case of an AgentAudio, it is a path to the serialized
version of the audio.`),this.h()},l(t){const m=du('[data-svelte="svelte-1phssyn"]',document.head);f=a(m,"META",{name:!0,content:!0}),m.forEach(o),T=d(t),w=a(t,"H1",{class:!0});var Ko=n(w);u=a(Ko,"A",{id:!0,class:!0,href:!0});var Mn=n(u);E=a(Mn,"SPAN",{});var Pn=n(E);v(c.$$.fragment,Pn),Pn.forEach(o),Mn.forEach(o),A=d(Ko),R=a(Ko,"SPAN",{});var jn=n(R);H=l(jn,"Agents & Tools"),jn.forEach(o),Ko.forEach(o),M=d(t),v(N.$$.fragment,t),ae=d(t),Ze=a(t,"P",{});var er=n(Ze);ul=l(er,"To learn more about agents and tools make sure to read the "),nr=a(er,"A",{href:!0});var Jn=n(nr);gl=l(Jn,"introductory guide"),Jn.forEach(o),vl=l(er,`. This page
contains the API docs for the underlying classes.`),er.forEach(o),On=d(t),pe=a(t,"H2",{class:!0});var tr=n(pe);Le=a(tr,"A",{id:!0,class:!0,href:!0});var Un=n(Le);Hr=a(Un,"SPAN",{});var Dn=n(Hr);v(Zt.$$.fragment,Dn),Dn.forEach(o),Un.forEach(o),_l=d(tr),Cr=a(tr,"SPAN",{});var Hn=n(Cr);bl=l(Hn,"Agents"),Hn.forEach(o),tr.forEach(o),Rn=d(t),B=a(t,"P",{});var Mt=n(B);$l=l(Mt,"We provide three types of agents: "),sr=a(Mt,"A",{href:!0});var Cm=n(sr);yl=l(Cm,"HfAgent"),Cm.forEach(o),wl=l(Mt," uses inference endpoints for opensource models, "),lr=a(Mt,"A",{href:!0});var Nm=n(lr);Al=l(Nm,"LocalAgent"),Nm.forEach(o),El=l(Mt," uses a model of your choice locally and "),ir=a(Mt,"A",{href:!0});var Om=n(ir);Tl=l(Om,"OpenAiAgent"),Om.forEach(o),kl=l(Mt," uses OpenAI closed models."),Mt.forEach(o),Zn=d(t),me=a(t,"H3",{class:!0});var bs=n(me);Se=a(bs,"A",{id:!0,class:!0,href:!0});var Rm=n(Se);Nr=a(Rm,"SPAN",{});var Zm=n(Nr);v(Lt.$$.fragment,Zm),Zm.forEach(o),Rm.forEach(o),xl=d(bs),Or=a(bs,"SPAN",{});var Lm=n(Or);Il=l(Lm,"HfAgent"),Lm.forEach(o),bs.forEach(o),Ln=d(t),ee=a(t,"DIV",{class:!0});var Ar=n(ee);v(St.$$.fragment,Ar),Ml=d(Ar),Rr=a(Ar,"P",{});var Sm=n(Rr);Pl=l(Sm,"Agent that uses an inference endpoint to generate code."),Sm.forEach(o),jl=d(Ar),v(We.$$.fragment,Ar),Ar.forEach(o),Sn=d(t),he=a(t,"H3",{class:!0});var $s=n(he);Ge=a($s,"A",{id:!0,class:!0,href:!0});var Wm=n(Ge);Zr=a(Wm,"SPAN",{});var Gm=n(Zr);v(Wt.$$.fragment,Gm),Gm.forEach(o),Wm.forEach(o),Jl=d($s),Lr=a($s,"SPAN",{});var qm=n(Lr);Ul=l(qm,"LocalAgent"),qm.forEach(o),$s.forEach(o),Wn=d(t),Z=a(t,"DIV",{class:!0});var Pt=n(Z);v(Gt.$$.fragment,Pt),Dl=d(Pt),Sr=a(Pt,"P",{});var zm=n(Sr);Hl=l(zm,"Agent that uses a local model and tokenizer to generate code."),zm.forEach(o),Cl=d(Pt),v(qe.$$.fragment,Pt),Nl=d(Pt),ne=a(Pt,"DIV",{class:!0});var Er=n(ne);v(qt.$$.fragment,Er),Ol=d(Er),zt=a(Er,"P",{});var ys=n(zt);Rl=l(ys,"Convenience method to build a "),Wr=a(ys,"CODE",{});var Vm=n(Wr);Zl=l(Vm,"LocalAgent"),Vm.forEach(o),Ll=l(ys," from a pretrained checkpoint."),ys.forEach(o),Sl=d(Er),v(ze.$$.fragment,Er),Er.forEach(o),Pt.forEach(o),Gn=d(t),fe=a(t,"H3",{class:!0});var ws=n(fe);Ve=a(ws,"A",{id:!0,class:!0,href:!0});var Bm=n(Ve);Gr=a(Bm,"SPAN",{});var Ym=n(Gr);v(Vt.$$.fragment,Ym),Ym.forEach(o),Bm.forEach(o),Wl=d(ws),qr=a(ws,"SPAN",{});var Fm=n(qr);Gl=l(Fm,"OpenAiAgent"),Fm.forEach(o),ws.forEach(o),qn=d(t),L=a(t,"DIV",{class:!0});var jt=n(L);v(Bt.$$.fragment,jt),ql=d(jt),zr=a(jt,"P",{});var Qm=n(zr);zl=l(Qm,"Agent that uses the openai API to generate code."),Qm.forEach(o),Vl=d(jt),v(Be.$$.fragment,jt),Bl=d(jt),v(Ye.$$.fragment,jt),jt.forEach(o),zn=d(t),ue=a(t,"H3",{class:!0});var As=n(ue);Fe=a(As,"A",{id:!0,class:!0,href:!0});var Xm=n(Fe);Vr=a(Xm,"SPAN",{});var Km=n(Vr);v(Yt.$$.fragment,Km),Km.forEach(o),Xm.forEach(o),Yl=d(As),Br=a(As,"SPAN",{});var eh=n(Br);Fl=l(eh,"AzureOpenAiAgent"),eh.forEach(o),As.forEach(o),Vn=d(t),S=a(t,"DIV",{class:!0});var Jt=n(S);v(Ft.$$.fragment,Jt),Ql=d(Jt),Qt=a(Jt,"P",{});var Es=n(Qt);Xl=l(Es,"Agent that uses Azure OpenAI to generate code. See the "),Xt=a(Es,"A",{href:!0,rel:!0});var th=n(Xt);Kl=l(th,`official
documentation`),th.forEach(o),ei=l(Es,` to learn how to deploy an openAI
model on Azure`),Es.forEach(o),ti=d(Jt),v(Qe.$$.fragment,Jt),oi=d(Jt),v(Xe.$$.fragment,Jt),Jt.forEach(o),Bn=d(t),ge=a(t,"H3",{class:!0});var Ts=n(ge);Ke=a(Ts,"A",{id:!0,class:!0,href:!0});var oh=n(Ke);Yr=a(oh,"SPAN",{});var rh=n(Yr);v(Kt.$$.fragment,rh),rh.forEach(o),oh.forEach(o),ri=d(Ts),Fr=a(Ts,"SPAN",{});var ah=n(Fr);ai=l(ah,"Agent"),ah.forEach(o),Ts.forEach(o),Yn=d(t),C=a(t,"DIV",{class:!0});var ce=n(C);v(eo.$$.fragment,ce),ni=d(ce),Qr=a(ce,"P",{});var nh=n(Qr);si=l(nh,"Base class for all agents which contains the main API methods."),nh.forEach(o),li=d(ce),se=a(ce,"DIV",{class:!0});var Tr=n(se);v(to.$$.fragment,Tr),ii=d(Tr),Xr=a(Tr,"P",{});var sh=n(Xr);di=l(sh,"Sends a new request to the agent in a chat. Will use the previous ones in its history."),sh.forEach(o),ci=d(Tr),v(et.$$.fragment,Tr),Tr.forEach(o),pi=d(ce),le=a(ce,"DIV",{class:!0});var kr=n(le);v(oo.$$.fragment,kr),mi=d(kr),Kr=a(kr,"P",{});var lh=n(Kr);hi=l(lh,"Sends a request to the agent."),lh.forEach(o),fi=d(kr),v(tt.$$.fragment,kr),kr.forEach(o),ui=d(ce),ot=a(ce,"DIV",{class:!0});var ks=n(ot);v(ro.$$.fragment,ks),gi=d(ks),ao=a(ks,"P",{});var xs=n(ao);vi=l(xs,"Clears the history of prior calls to "),dr=a(xs,"A",{href:!0});var ih=n(dr);_i=l(ih,"chat()"),ih.forEach(o),bi=l(xs,"."),xs.forEach(o),ks.forEach(o),ce.forEach(o),Fn=d(t),ve=a(t,"H2",{class:!0});var Is=n(ve);rt=a(Is,"A",{id:!0,class:!0,href:!0});var dh=n(rt);ea=a(dh,"SPAN",{});var ch=n(ea);v(no.$$.fragment,ch),ch.forEach(o),dh.forEach(o),$i=d(Is),ta=a(Is,"SPAN",{});var ph=n(ta);yi=l(ph,"Tools"),ph.forEach(o),Is.forEach(o),Qn=d(t),_e=a(t,"H3",{class:!0});var Ms=n(_e);at=a(Ms,"A",{id:!0,class:!0,href:!0});var mh=n(at);oa=a(mh,"SPAN",{});var hh=n(oa);v(so.$$.fragment,hh),hh.forEach(o),mh.forEach(o),wi=d(Ms),ra=a(Ms,"SPAN",{});var fh=n(ra);Ai=l(fh,"load_tool"),fh.forEach(o),Ms.forEach(o),Xn=d(t),be=a(t,"DIV",{class:!0});var Ps=n(be);v(lo.$$.fragment,Ps),Ei=d(Ps),aa=a(Ps,"P",{});var uh=n(aa);Ti=l(uh,"Main function to quickly load a tool, be it on the Hub or in the Transformers library."),uh.forEach(o),Ps.forEach(o),Kn=d(t),$e=a(t,"H3",{class:!0});var js=n($e);nt=a(js,"A",{id:!0,class:!0,href:!0});var gh=n(nt);na=a(gh,"SPAN",{});var vh=n(na);v(io.$$.fragment,vh),vh.forEach(o),gh.forEach(o),ki=d(js),sa=a(js,"SPAN",{});var _h=n(sa);xi=l(_h,"Tool"),_h.forEach(o),js.forEach(o),es=d(t),x=a(t,"DIV",{class:!0});var j=n(x);v(co.$$.fragment,j),Ii=d(j),po=a(j,"P",{});var Js=n(po);Mi=l(Js,"A base class for the functions used by the agent. Subclass this and implement the "),la=a(Js,"CODE",{});var bh=n(la);Pi=l(bh,"__call__"),bh.forEach(o),ji=l(Js,` method as well as the
following class attributes:`),Js.forEach(o),Ji=d(j),te=a(j,"UL",{});var Ut=n(te);Y=a(Ut,"LI",{});var Ce=n(Y);ia=a(Ce,"STRONG",{});var $h=n(ia);Ui=l($h,"description"),$h.forEach(o),Di=l(Ce," ("),da=a(Ce,"CODE",{});var yh=n(da);Hi=l(yh,"str"),yh.forEach(o),Ci=l(Ce,`) \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 `),ca=a(Ce,"CODE",{});var wh=n(ca);Ni=l(wh,"url"),wh.forEach(o),Oi=l(Ce,". It takes the "),pa=a(Ce,"CODE",{});var Ah=n(pa);Ri=l(Ah,"url"),Ah.forEach(o),Zi=l(Ce,` as input, and
returns the text contained in the file\u2019.`),Ce.forEach(o),Li=d(Ut),F=a(Ut,"LI",{});var Ne=n(F);ma=a(Ne,"STRONG",{});var Eh=n(ma);Si=l(Eh,"name"),Eh.forEach(o),Wi=l(Ne," ("),ha=a(Ne,"CODE",{});var Th=n(ha);Gi=l(Th,"str"),Th.forEach(o),qi=l(Ne,`) \u2014 A performative name that will be used for your tool in the prompt to the agent. For instance
`),fa=a(Ne,"CODE",{});var kh=n(fa);zi=l(kh,'"text-classifier"'),kh.forEach(o),Vi=l(Ne," or "),ua=a(Ne,"CODE",{});var xh=n(ua);Bi=l(xh,'"image_generator"'),xh.forEach(o),Yi=l(Ne,"."),Ne.forEach(o),Fi=d(Ut),U=a(Ut,"LI",{});var z=n(U);ga=a(z,"STRONG",{});var Ih=n(ga);Qi=l(Ih,"inputs"),Ih.forEach(o),Xi=l(z," ("),va=a(z,"CODE",{});var Mh=n(va);Ki=l(Mh,"List[str]"),Mh.forEach(o),ed=l(z,`) \u2014 The list of modalities expected for the inputs (in the same order as in the call).
Modalitiies should be `),_a=a(z,"CODE",{});var Ph=n(_a);td=l(Ph,'"text"'),Ph.forEach(o),od=l(z,", "),ba=a(z,"CODE",{});var jh=n(ba);rd=l(jh,'"image"'),jh.forEach(o),ad=l(z," or "),$a=a(z,"CODE",{});var Jh=n($a);nd=l(Jh,'"audio"'),Jh.forEach(o),sd=l(z,". This is only used by "),ya=a(z,"CODE",{});var Uh=n(ya);ld=l(Uh,"launch_gradio_demo"),Uh.forEach(o),id=l(z,` or to make a
nice space from your tool.`),z.forEach(o),dd=d(Ut),D=a(Ut,"LI",{});var V=n(D);wa=a(V,"STRONG",{});var Dh=n(wa);cd=l(Dh,"outputs"),Dh.forEach(o),pd=l(V," ("),Aa=a(V,"CODE",{});var Hh=n(Aa);md=l(Hh,"List[str]"),Hh.forEach(o),hd=l(V,`) \u2014 The list of modalities returned but the tool (in the same order as the return of the
call method). Modalitiies should be `),Ea=a(V,"CODE",{});var Ch=n(Ea);fd=l(Ch,'"text"'),Ch.forEach(o),ud=l(V,", "),Ta=a(V,"CODE",{});var Nh=n(Ta);gd=l(Nh,'"image"'),Nh.forEach(o),vd=l(V," or "),ka=a(V,"CODE",{});var Oh=n(ka);_d=l(Oh,'"audio"'),Oh.forEach(o),bd=l(V,". This is only used by "),xa=a(V,"CODE",{});var Rh=n(xa);$d=l(Rh,"launch_gradio_demo"),Rh.forEach(o),yd=l(V,`
or to make a nice space from your tool.`),V.forEach(o),Ut.forEach(o),wd=d(j),ye=a(j,"P",{});var xr=n(ye);Ad=l(xr,"You can also override the method "),cr=a(xr,"A",{href:!0});var Zh=n(cr);Ed=l(Zh,"setup()"),Zh.forEach(o),Td=l(xr,` if your tool as an expensive operation to perform before being
usable (such as loading a model). `),pr=a(xr,"A",{href:!0});var Lh=n(pr);kd=l(Lh,"setup()"),Lh.forEach(o),xd=l(xr,` will be called the first time you use your tool, but not at
instantiation.`),xr.forEach(o),Id=d(j),st=a(j,"DIV",{class:!0});var Us=n(st);v(mo.$$.fragment,Us),Md=d(Us),ho=a(Us,"P",{});var Ds=n(ho);Pd=l(Ds,"Creates a "),mr=a(Ds,"A",{href:!0});var Sh=n(mr);jd=l(Sh,"Tool"),Sh.forEach(o),Jd=l(Ds," from a gradio tool."),Ds.forEach(o),Us.forEach(o),Ud=d(j),lt=a(j,"DIV",{class:!0});var Hs=n(lt);v(fo.$$.fragment,Hs),Dd=d(Hs),Ia=a(Hs,"P",{});var Wh=n(Ia);Hd=l(Wh,"Loads a tool defined on the Hub."),Wh.forEach(o),Hs.forEach(o),Cd=d(j),it=a(j,"DIV",{class:!0});var Cs=n(it);v(uo.$$.fragment,Cs),Nd=d(Cs),Ma=a(Cs,"P",{});var Gh=n(Ma);Od=l(Gh,"Upload the tool to the Hub."),Gh.forEach(o),Cs.forEach(o),Rd=d(j),Q=a(j,"DIV",{class:!0});var Dt=n(Q);v(go.$$.fragment,Dt),Zd=d(Dt),vo=a(Dt,"P",{});var Ns=n(vo);Ld=l(Ns,`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 `),Pa=a(Ns,"CODE",{});var qh=n(Pa);Sd=l(qh,"output_dir"),qh.forEach(o),Wd=l(Ns," as well as autogenerate:"),Ns.forEach(o),Gd=d(Dt),we=a(Dt,"UL",{});var Ir=n(we);hr=a(Ir,"LI",{});var Dm=n(hr);qd=l(Dm,"a config file named "),ja=a(Dm,"CODE",{});var zh=n(ja);zd=l(zh,"tool_config.json"),zh.forEach(o),Dm.forEach(o),Vd=d(Ir),_o=a(Ir,"LI",{});var Os=n(_o);Bd=l(Os,"an "),Ja=a(Os,"CODE",{});var Vh=n(Ja);Yd=l(Vh,"app.py"),Vh.forEach(o),Fd=l(Os," file so that your tool can be converted to a space"),Os.forEach(o),Qd=d(Ir),bo=a(Ir,"LI",{});var Rs=n(bo);Xd=l(Rs,"a "),Ua=a(Rs,"CODE",{});var Bh=n(Ua);Kd=l(Bh,"requirements.txt"),Bh.forEach(o),ec=l(Rs,` containing the names of the module used by your tool (as detected when inspecting its
code)`),Rs.forEach(o),Ir.forEach(o),tc=d(Dt),$o=a(Dt,"P",{});var Zs=n($o);oc=l(Zs,"You should only use this method to save tools that are defined in a separate module (not "),Da=a(Zs,"CODE",{});var Yh=n(Da);rc=l(Yh,"__main__"),Yh.forEach(o),ac=l(Zs,")."),Zs.forEach(o),Dt.forEach(o),nc=d(j),dt=a(j,"DIV",{class:!0});var Ls=n(dt);v(yo.$$.fragment,Ls),sc=d(Ls),Ha=a(Ls,"P",{});var Fh=n(Ha);lc=l(Fh,`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.`),Fh.forEach(o),Ls.forEach(o),j.forEach(o),ts=d(t),Ae=a(t,"H3",{class:!0});var Ss=n(Ae);ct=a(Ss,"A",{id:!0,class:!0,href:!0});var Qh=n(ct);Ca=a(Qh,"SPAN",{});var Xh=n(Ca);v(wo.$$.fragment,Xh),Xh.forEach(o),Qh.forEach(o),ic=d(Ss),Na=a(Ss,"SPAN",{});var Kh=n(Na);dc=l(Kh,"PipelineTool"),Kh.forEach(o),Ss.forEach(o),os=d(t),P=a(t,"DIV",{class:!0});var O=n(P);v(Ao.$$.fragment,O),cc=d(O),Ee=a(O,"P",{});var Mr=n(Ee);pc=l(Mr,"A "),fr=a(Mr,"A",{href:!0});var ef=n(fr);mc=l(ef,"Tool"),ef.forEach(o),hc=l(Mr," tailored towards Transformer models. On top of the class attributes of the base class "),ur=a(Mr,"A",{href:!0});var tf=n(ur);fc=l(tf,"Tool"),tf.forEach(o),uc=l(Mr,`, you will
need to specify:`),Mr.forEach(o),gc=d(O),oe=a(O,"UL",{});var Ht=n(oe);pt=a(Ht,"LI",{});var Cn=n(pt);Oa=a(Cn,"STRONG",{});var of=n(Oa);vc=l(of,"model_class"),of.forEach(o),_c=l(Cn," ("),Ra=a(Cn,"CODE",{});var rf=n(Ra);bc=l(rf,"type"),rf.forEach(o),$c=l(Cn,") \u2014 The class to use to load the model in this tool."),Cn.forEach(o),yc=d(Ht),mt=a(Ht,"LI",{});var Nn=n(mt);Za=a(Nn,"STRONG",{});var af=n(Za);wc=l(af,"default_checkpoint"),af.forEach(o),Ac=l(Nn," ("),La=a(Nn,"CODE",{});var nf=n(La);Ec=l(nf,"str"),nf.forEach(o),Tc=l(Nn,") \u2014 The default checkpoint that should be used when the user doesn\u2019t specify one."),Nn.forEach(o),kc=d(Ht),X=a(Ht,"LI",{});var Oe=n(X);Sa=a(Oe,"STRONG",{});var sf=n(Sa);xc=l(sf,"pre_processor_class"),sf.forEach(o),Ic=l(Oe," ("),Wa=a(Oe,"CODE",{});var lf=n(Wa);Mc=l(lf,"type"),lf.forEach(o),Pc=l(Oe,", "),Ga=a(Oe,"EM",{});var df=n(Ga);jc=l(df,"optional"),df.forEach(o),Jc=l(Oe,", defaults to "),gr=a(Oe,"A",{href:!0});var cf=n(gr);Uc=l(cf,"AutoProcessor"),cf.forEach(o),Dc=l(Oe,`) \u2014 The class to use to load the
pre-processor`),Oe.forEach(o),Hc=d(Ht),K=a(Ht,"LI",{});var Re=n(K);qa=a(Re,"STRONG",{});var pf=n(qa);Cc=l(pf,"post_processor_class"),pf.forEach(o),Nc=l(Re," ("),za=a(Re,"CODE",{});var mf=n(za);Oc=l(mf,"type"),mf.forEach(o),Rc=l(Re,", "),Va=a(Re,"EM",{});var hf=n(Va);Zc=l(hf,"optional"),hf.forEach(o),Lc=l(Re,", defaults to "),vr=a(Re,"A",{href:!0});var ff=n(vr);Sc=l(ff,"AutoProcessor"),ff.forEach(o),Wc=l(Re,`) \u2014 The class to use to load the
post-processor (when different from the pre-processor).`),Re.forEach(o),Ht.forEach(o),Gc=d(O),ht=a(O,"DIV",{class:!0});var Ws=n(ht);v(Eo.$$.fragment,Ws),qc=d(Ws),To=a(Ws,"P",{});var Gs=n(To);zc=l(Gs,"Uses the "),Ba=a(Gs,"CODE",{});var uf=n(Ba);Vc=l(uf,"post_processor"),uf.forEach(o),Bc=l(Gs," to decode the model output."),Gs.forEach(o),Ws.forEach(o),Yc=d(O),ft=a(O,"DIV",{class:!0});var qs=n(ft);v(ko.$$.fragment,qs),Fc=d(qs),Te=a(qs,"P",{});var Pr=n(Te);Qc=l(Pr,"Uses the "),Ya=a(Pr,"CODE",{});var gf=n(Ya);Xc=l(gf,"pre_processor"),gf.forEach(o),Kc=l(Pr," to prepare the inputs for the "),Fa=a(Pr,"CODE",{});var vf=n(Fa);ep=l(vf,"model"),vf.forEach(o),tp=l(Pr,"."),Pr.forEach(o),qs.forEach(o),op=d(O),ut=a(O,"DIV",{class:!0});var zs=n(ut);v(xo.$$.fragment,zs),rp=d(zs),Io=a(zs,"P",{});var Vs=n(Io);ap=l(Vs,"Sends the inputs through the "),Qa=a(Vs,"CODE",{});var _f=n(Qa);np=l(_f,"model"),_f.forEach(o),sp=l(Vs,"."),Vs.forEach(o),zs.forEach(o),lp=d(O),gt=a(O,"DIV",{class:!0});var Bs=n(gt);v(Mo.$$.fragment,Bs),ip=d(Bs),re=a(Bs,"P",{});var Ct=n(re);dp=l(Ct,"Instantiates the "),Xa=a(Ct,"CODE",{});var bf=n(Xa);cp=l(bf,"pre_processor"),bf.forEach(o),pp=l(Ct,", "),Ka=a(Ct,"CODE",{});var $f=n(Ka);mp=l($f,"model"),$f.forEach(o),hp=l(Ct," and "),en=a(Ct,"CODE",{});var yf=n(en);fp=l(yf,"post_processor"),yf.forEach(o),up=l(Ct," if necessary."),Ct.forEach(o),Bs.forEach(o),O.forEach(o),rs=d(t),ke=a(t,"H3",{class:!0});var Ys=n(ke);vt=a(Ys,"A",{id:!0,class:!0,href:!0});var wf=n(vt);tn=a(wf,"SPAN",{});var Af=n(tn);v(Po.$$.fragment,Af),Af.forEach(o),wf.forEach(o),gp=d(Ys),on=a(Ys,"SPAN",{});var Ef=n(on);vp=l(Ef,"RemoteTool"),Ef.forEach(o),Ys.forEach(o),as=d(t),W=a(t,"DIV",{class:!0});var Nt=n(W);v(jo.$$.fragment,Nt),_p=d(Nt),Jo=a(Nt,"P",{});var Fs=n(Jo);bp=l(Fs,"A "),_r=a(Fs,"A",{href:!0});var Tf=n(_r);$p=l(Tf,"Tool"),Tf.forEach(o),yp=l(Fs," that will make requests to an inference endpoint."),Fs.forEach(o),wp=d(Nt),_t=a(Nt,"DIV",{class:!0});var Qs=n(_t);v(Uo.$$.fragment,Qs),Ap=d(Qs),Do=a(Qs,"P",{});var Xs=n(Do);Ep=l(Xs,"You can override this method in your custom class of "),br=a(Xs,"A",{href:!0});var kf=n(br);Tp=l(kf,"RemoteTool"),kf.forEach(o),kp=l(Xs,` to apply some custom post-processing of the
outputs of the endpoint.`),Xs.forEach(o),Qs.forEach(o),xp=d(Nt),ie=a(Nt,"DIV",{class:!0});var jr=n(ie);v(Ho.$$.fragment,jr),Ip=d(jr),Co=a(jr,"P",{});var Ks=n(Co);Mp=l(Ks,`Prepare the inputs received for the HTTP client sending data to the endpoint. Positional arguments will be
matched with the signature of the `),rn=a(Ks,"CODE",{});var xf=n(rn);Pp=l(xf,"tool_class"),xf.forEach(o),jp=l(Ks,` if it was provided at instantation. Images will be encoded into
bytes.`),Ks.forEach(o),Jp=d(jr),No=a(jr,"P",{});var el=n(No);Up=l(el,"You can override this method in your custom class of "),$r=a(el,"A",{href:!0});var If=n($r);Dp=l(If,"RemoteTool"),If.forEach(o),Hp=l(el,"."),el.forEach(o),jr.forEach(o),Nt.forEach(o),ns=d(t),xe=a(t,"H3",{class:!0});var tl=n(xe);bt=a(tl,"A",{id:!0,class:!0,href:!0});var Mf=n(bt);an=a(Mf,"SPAN",{});var Pf=n(an);v(Oo.$$.fragment,Pf),Pf.forEach(o),Mf.forEach(o),Cp=d(tl),nn=a(tl,"SPAN",{});var jf=n(nn);Np=l(jf,"launch_gradio_demo"),jf.forEach(o),tl.forEach(o),ss=d(t),Ie=a(t,"DIV",{class:!0});var ol=n(Ie);v(Ro.$$.fragment,ol),Op=d(ol),Me=a(ol,"P",{});var Jr=n(Me);Rp=l(Jr,`Launches a gradio demo for a tool. The corresponding tool class needs to properly implement the class attributes
`),sn=a(Jr,"CODE",{});var Jf=n(sn);Zp=l(Jf,"inputs"),Jf.forEach(o),Lp=l(Jr," and "),ln=a(Jr,"CODE",{});var Uf=n(ln);Sp=l(Uf,"outputs"),Uf.forEach(o),Wp=l(Jr,"."),Jr.forEach(o),ol.forEach(o),ls=d(t),Pe=a(t,"H2",{class:!0});var rl=n(Pe);$t=a(rl,"A",{id:!0,class:!0,href:!0});var Df=n($t);dn=a(Df,"SPAN",{});var Hf=n(dn);v(Zo.$$.fragment,Hf),Hf.forEach(o),Df.forEach(o),Gp=d(rl),cn=a(rl,"SPAN",{});var Cf=n(cn);qp=l(Cf,"Agent Types"),Cf.forEach(o),rl.forEach(o),is=d(t),yr=a(t,"P",{});var Nf=n(yr);zp=l(Nf,`Agents can handle any type of object in-between tools; tools, being completely multimodal, can accept and return
text, image, audio, video, among other types. In order to increase compatibility between tools, as well as to
correctly render these returns in ipython (jupyter, colab, ipython notebooks, \u2026), we implement wrapper classes
around these types.`),Nf.forEach(o),ds=d(t),yt=a(t,"P",{});var al=n(yt);Vp=l(al,`The wrapped objects should continue behaving as initially; a text object should still behave as a string, an image
object should still behave as a `),pn=a(al,"CODE",{});var Of=n(pn);Bp=l(Of,"PIL.Image"),Of.forEach(o),Yp=l(al,"."),al.forEach(o),cs=d(t),wr=a(t,"P",{});var Rf=n(wr);Fp=l(Rf,"These types have three specific purposes:"),Rf.forEach(o),ps=d(t),de=a(t,"UL",{});var Ur=n(de);Lo=a(Ur,"LI",{});var nl=n(Lo);Qp=l(nl,"Calling "),mn=a(nl,"CODE",{});var Zf=n(mn);Xp=l(Zf,"to_raw"),Zf.forEach(o),Kp=l(nl," on the type should return the underlying object"),nl.forEach(o),em=d(Ur),je=a(Ur,"LI",{});var Dr=n(je);tm=l(Dr,"Calling "),hn=a(Dr,"CODE",{});var Lf=n(hn);om=l(Lf,"to_string"),Lf.forEach(o),rm=l(Dr," on the type should return the object as a string: that can be the string in case of an "),fn=a(Dr,"CODE",{});var Sf=n(fn);am=l(Sf,"AgentText"),Sf.forEach(o),nm=l(Dr,`
but will be the path of the serialized version of the object in other instances`),Dr.forEach(o),sm=d(Ur),un=a(Ur,"LI",{});var Wf=n(un);lm=l(Wf,"Displaying it in an ipython kernel should display the object correctly"),Wf.forEach(o),Ur.forEach(o),ms=d(t),Je=a(t,"H3",{class:!0});var sl=n(Je);wt=a(sl,"A",{id:!0,class:!0,href:!0});var Gf=n(wt);gn=a(Gf,"SPAN",{});var qf=n(gn);v(So.$$.fragment,qf),qf.forEach(o),Gf.forEach(o),im=d(sl),vn=a(sl,"SPAN",{});var zf=n(vn);dm=l(zf,"AgentText"),zf.forEach(o),sl.forEach(o),hs=d(t),Ue=a(t,"DIV",{class:!0});var ll=n(Ue);v(Wo.$$.fragment,ll),cm=d(ll),_n=a(ll,"P",{});var Vf=n(_n);pm=l(Vf,"Text type returned by the agent. Behaves as a string."),Vf.forEach(o),ll.forEach(o),fs=d(t),De=a(t,"H3",{class:!0});var il=n(De);At=a(il,"A",{id:!0,class:!0,href:!0});var Bf=n(At);bn=a(Bf,"SPAN",{});var Yf=n(bn);v(Go.$$.fragment,Yf),Yf.forEach(o),Bf.forEach(o),mm=d(il),$n=a(il,"SPAN",{});var Ff=n($n);hm=l(Ff,"AgentImage"),Ff.forEach(o),il.forEach(o),us=d(t),G=a(t,"DIV",{class:!0});var Ot=n(G);v(qo.$$.fragment,Ot),fm=d(Ot),yn=a(Ot,"P",{});var Qf=n(yn);um=l(Qf,"Image type returned by the agent. Behaves as a PIL.Image."),Qf.forEach(o),gm=d(Ot),Et=a(Ot,"DIV",{class:!0});var dl=n(Et);v(zo.$$.fragment,dl),vm=d(dl),wn=a(dl,"P",{});var Xf=n(wn);_m=l(Xf,"Returns the \u201Craw\u201D version of that object. In the case of an AgentImage, it is a PIL.Image."),Xf.forEach(o),dl.forEach(o),bm=d(Ot),Tt=a(Ot,"DIV",{class:!0});var cl=n(Tt);v(Vo.$$.fragment,cl),$m=d(cl),An=a(cl,"P",{});var Kf=n(An);ym=l(Kf,`Returns the stringified version of that object. In the case of an AgentImage, it is a path to the serialized
version of the image.`),Kf.forEach(o),cl.forEach(o),Ot.forEach(o),gs=d(t),He=a(t,"H3",{class:!0});var pl=n(He);kt=a(pl,"A",{id:!0,class:!0,href:!0});var eu=n(kt);En=a(eu,"SPAN",{});var tu=n(En);v(Bo.$$.fragment,tu),tu.forEach(o),eu.forEach(o),wm=d(pl),Tn=a(pl,"SPAN",{});var ou=n(Tn);Am=l(ou,"AgentAudio"),ou.forEach(o),pl.forEach(o),vs=d(t),q=a(t,"DIV",{class:!0});var Rt=n(q);v(Yo.$$.fragment,Rt),Em=d(Rt),kn=a(Rt,"P",{});var ru=n(kn);Tm=l(ru,"Audio type returned by the agent."),ru.forEach(o),km=d(Rt),xt=a(Rt,"DIV",{class:!0});var ml=n(xt);v(Fo.$$.fragment,ml),xm=d(ml),Qo=a(ml,"P",{});var hl=n(Qo);Im=l(hl,"Returns the \u201Craw\u201D version of that object. It is a "),xn=a(hl,"CODE",{});var au=n(xn);Mm=l(au,"torch.Tensor"),au.forEach(o),Pm=l(hl," object."),hl.forEach(o),ml.forEach(o),jm=d(Rt),It=a(Rt,"DIV",{class:!0});var fl=n(It);v(Xo.$$.fragment,fl),Jm=d(fl),In=a(fl,"P",{});var nu=n(In);Um=l(nu,`Returns the stringified version of that object. In the case of an AgentAudio, it is a path to the serialized
version of the audio.`),nu.forEach(o),fl.forEach(o),Rt.forEach(o),this.h()},h(){p(f,"name","hf:doc:metadata"),p(f,"content",JSON.stringify(wu)),p(u,"id","agents-tools"),p(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"),p(u,"href","#agents-tools"),p(w,"class","relative group"),p(nr,"href","../transformers_agents"),p(Le,"id","agents"),p(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"),p(Le,"href","#agents"),p(pe,"class","relative group"),p(sr,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.HfAgent"),p(lr,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.LocalAgent"),p(ir,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.OpenAiAgent"),p(Se,"id","transformers.HfAgent"),p(Se,"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"),p(Se,"href","#transformers.HfAgent"),p(me,"class","relative group"),p(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ge,"id","transformers.LocalAgent"),p(Ge,"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"),p(Ge,"href","#transformers.LocalAgent"),p(he,"class","relative group"),p(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ve,"id","transformers.OpenAiAgent"),p(Ve,"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"),p(Ve,"href","#transformers.OpenAiAgent"),p(fe,"class","relative group"),p(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Fe,"id","transformers.AzureOpenAiAgent"),p(Fe,"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"),p(Fe,"href","#transformers.AzureOpenAiAgent"),p(ue,"class","relative group"),p(Xt,"href","https://learn.microsoft.com/en-us/azure/cognitive-services/openai/"),p(Xt,"rel","nofollow"),p(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ke,"id","transformers.Agent"),p(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"),p(Ke,"href","#transformers.Agent"),p(ge,"class","relative group"),p(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(dr,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.Agent.chat"),p(ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(rt,"id","tools"),p(rt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(rt,"href","#tools"),p(ve,"class","relative group"),p(at,"id","transformers.load_tool"),p(at,"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"),p(at,"href","#transformers.load_tool"),p(_e,"class","relative group"),p(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(nt,"id","transformers.Tool"),p(nt,"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"),p(nt,"href","#transformers.Tool"),p($e,"class","relative group"),p(cr,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.Tool.setup"),p(pr,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.Tool.setup"),p(mr,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.Tool"),p(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ct,"id","transformers.PipelineTool"),p(ct,"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"),p(ct,"href","#transformers.PipelineTool"),p(Ae,"class","relative group"),p(fr,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.Tool"),p(ur,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.Tool"),p(gr,"href","/docs/transformers/v4.32.0/en/model_doc/auto#transformers.AutoProcessor"),p(vr,"href","/docs/transformers/v4.32.0/en/model_doc/auto#transformers.AutoProcessor"),p(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(vt,"id","transformers.RemoteTool"),p(vt,"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"),p(vt,"href","#transformers.RemoteTool"),p(ke,"class","relative group"),p(_r,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.Tool"),p(br,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.RemoteTool"),p(_t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p($r,"href","/docs/transformers/v4.32.0/en/main_classes/agent#transformers.RemoteTool"),p(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(bt,"id","transformers.launch_gradio_demo"),p(bt,"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"),p(bt,"href","#transformers.launch_gradio_demo"),p(xe,"class","relative group"),p(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p($t,"id","agent-types"),p($t,"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"),p($t,"href","#agent-types"),p(Pe,"class","relative group"),p(wt,"id","transformers.tools.agent_types.AgentText"),p(wt,"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"),p(wt,"href","#transformers.tools.agent_types.AgentText"),p(Je,"class","relative group"),p(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(At,"id","transformers.tools.agent_types.AgentImage"),p(At,"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"),p(At,"href","#transformers.tools.agent_types.AgentImage"),p(De,"class","relative group"),p(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(kt,"id","transformers.tools.agent_types.AgentAudio"),p(kt,"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"),p(kt,"href","#transformers.tools.agent_types.AgentAudio"),p(He,"class","relative group"),p(xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(It,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,m){e(document.head,f),h(t,T,m),h(t,w,m),e(w,u),e(u,E),_(c,E,null),e(w,A),e(w,R),e(R,H),h(t,M,m),_(N,t,m),h(t,ae,m),h(t,Ze,m),e(Ze,ul),e(Ze,nr),e(nr,gl),e(Ze,vl),h(t,On,m),h(t,pe,m),e(pe,Le),e(Le,Hr),_(Zt,Hr,null),e(pe,_l),e(pe,Cr),e(Cr,bl),h(t,Rn,m),h(t,B,m),e(B,$l),e(B,sr),e(sr,yl),e(B,wl),e(B,lr),e(lr,Al),e(B,El),e(B,ir),e(ir,Tl),e(B,kl),h(t,Zn,m),h(t,me,m),e(me,Se),e(Se,Nr),_(Lt,Nr,null),e(me,xl),e(me,Or),e(Or,Il),h(t,Ln,m),h(t,ee,m),_(St,ee,null),e(ee,Ml),e(ee,Rr),e(Rr,Pl),e(ee,jl),_(We,ee,null),h(t,Sn,m),h(t,he,m),e(he,Ge),e(Ge,Zr),_(Wt,Zr,null),e(he,Jl),e(he,Lr),e(Lr,Ul),h(t,Wn,m),h(t,Z,m),_(Gt,Z,null),e(Z,Dl),e(Z,Sr),e(Sr,Hl),e(Z,Cl),_(qe,Z,null),e(Z,Nl),e(Z,ne),_(qt,ne,null),e(ne,Ol),e(ne,zt),e(zt,Rl),e(zt,Wr),e(Wr,Zl),e(zt,Ll),e(ne,Sl),_(ze,ne,null),h(t,Gn,m),h(t,fe,m),e(fe,Ve),e(Ve,Gr),_(Vt,Gr,null),e(fe,Wl),e(fe,qr),e(qr,Gl),h(t,qn,m),h(t,L,m),_(Bt,L,null),e(L,ql),e(L,zr),e(zr,zl),e(L,Vl),_(Be,L,null),e(L,Bl),_(Ye,L,null),h(t,zn,m),h(t,ue,m),e(ue,Fe),e(Fe,Vr),_(Yt,Vr,null),e(ue,Yl),e(ue,Br),e(Br,Fl),h(t,Vn,m),h(t,S,m),_(Ft,S,null),e(S,Ql),e(S,Qt),e(Qt,Xl),e(Qt,Xt),e(Xt,Kl),e(Qt,ei),e(S,ti),_(Qe,S,null),e(S,oi),_(Xe,S,null),h(t,Bn,m),h(t,ge,m),e(ge,Ke),e(Ke,Yr),_(Kt,Yr,null),e(ge,ri),e(ge,Fr),e(Fr,ai),h(t,Yn,m),h(t,C,m),_(eo,C,null),e(C,ni),e(C,Qr),e(Qr,si),e(C,li),e(C,se),_(to,se,null),e(se,ii),e(se,Xr),e(Xr,di),e(se,ci),_(et,se,null),e(C,pi),e(C,le),_(oo,le,null),e(le,mi),e(le,Kr),e(Kr,hi),e(le,fi),_(tt,le,null),e(C,ui),e(C,ot),_(ro,ot,null),e(ot,gi),e(ot,ao),e(ao,vi),e(ao,dr),e(dr,_i),e(ao,bi),h(t,Fn,m),h(t,ve,m),e(ve,rt),e(rt,ea),_(no,ea,null),e(ve,$i),e(ve,ta),e(ta,yi),h(t,Qn,m),h(t,_e,m),e(_e,at),e(at,oa),_(so,oa,null),e(_e,wi),e(_e,ra),e(ra,Ai),h(t,Xn,m),h(t,be,m),_(lo,be,null),e(be,Ei),e(be,aa),e(aa,Ti),h(t,Kn,m),h(t,$e,m),e($e,nt),e(nt,na),_(io,na,null),e($e,ki),e($e,sa),e(sa,xi),h(t,es,m),h(t,x,m),_(co,x,null),e(x,Ii),e(x,po),e(po,Mi),e(po,la),e(la,Pi),e(po,ji),e(x,Ji),e(x,te),e(te,Y),e(Y,ia),e(ia,Ui),e(Y,Di),e(Y,da),e(da,Hi),e(Y,Ci),e(Y,ca),e(ca,Ni),e(Y,Oi),e(Y,pa),e(pa,Ri),e(Y,Zi),e(te,Li),e(te,F),e(F,ma),e(ma,Si),e(F,Wi),e(F,ha),e(ha,Gi),e(F,qi),e(F,fa),e(fa,zi),e(F,Vi),e(F,ua),e(ua,Bi),e(F,Yi),e(te,Fi),e(te,U),e(U,ga),e(ga,Qi),e(U,Xi),e(U,va),e(va,Ki),e(U,ed),e(U,_a),e(_a,td),e(U,od),e(U,ba),e(ba,rd),e(U,ad),e(U,$a),e($a,nd),e(U,sd),e(U,ya),e(ya,ld),e(U,id),e(te,dd),e(te,D),e(D,wa),e(wa,cd),e(D,pd),e(D,Aa),e(Aa,md),e(D,hd),e(D,Ea),e(Ea,fd),e(D,ud),e(D,Ta),e(Ta,gd),e(D,vd),e(D,ka),e(ka,_d),e(D,bd),e(D,xa),e(xa,$d),e(D,yd),e(x,wd),e(x,ye),e(ye,Ad),e(ye,cr),e(cr,Ed),e(ye,Td),e(ye,pr),e(pr,kd),e(ye,xd),e(x,Id),e(x,st),_(mo,st,null),e(st,Md),e(st,ho),e(ho,Pd),e(ho,mr),e(mr,jd),e(ho,Jd),e(x,Ud),e(x,lt),_(fo,lt,null),e(lt,Dd),e(lt,Ia),e(Ia,Hd),e(x,Cd),e(x,it),_(uo,it,null),e(it,Nd),e(it,Ma),e(Ma,Od),e(x,Rd),e(x,Q),_(go,Q,null),e(Q,Zd),e(Q,vo),e(vo,Ld),e(vo,Pa),e(Pa,Sd),e(vo,Wd),e(Q,Gd),e(Q,we),e(we,hr),e(hr,qd),e(hr,ja),e(ja,zd),e(we,Vd),e(we,_o),e(_o,Bd),e(_o,Ja),e(Ja,Yd),e(_o,Fd),e(we,Qd),e(we,bo),e(bo,Xd),e(bo,Ua),e(Ua,Kd),e(bo,ec),e(Q,tc),e(Q,$o),e($o,oc),e($o,Da),e(Da,rc),e($o,ac),e(x,nc),e(x,dt),_(yo,dt,null),e(dt,sc),e(dt,Ha),e(Ha,lc),h(t,ts,m),h(t,Ae,m),e(Ae,ct),e(ct,Ca),_(wo,Ca,null),e(Ae,ic),e(Ae,Na),e(Na,dc),h(t,os,m),h(t,P,m),_(Ao,P,null),e(P,cc),e(P,Ee),e(Ee,pc),e(Ee,fr),e(fr,mc),e(Ee,hc),e(Ee,ur),e(ur,fc),e(Ee,uc),e(P,gc),e(P,oe),e(oe,pt),e(pt,Oa),e(Oa,vc),e(pt,_c),e(pt,Ra),e(Ra,bc),e(pt,$c),e(oe,yc),e(oe,mt),e(mt,Za),e(Za,wc),e(mt,Ac),e(mt,La),e(La,Ec),e(mt,Tc),e(oe,kc),e(oe,X),e(X,Sa),e(Sa,xc),e(X,Ic),e(X,Wa),e(Wa,Mc),e(X,Pc),e(X,Ga),e(Ga,jc),e(X,Jc),e(X,gr),e(gr,Uc),e(X,Dc),e(oe,Hc),e(oe,K),e(K,qa),e(qa,Cc),e(K,Nc),e(K,za),e(za,Oc),e(K,Rc),e(K,Va),e(Va,Zc),e(K,Lc),e(K,vr),e(vr,Sc),e(K,Wc),e(P,Gc),e(P,ht),_(Eo,ht,null),e(ht,qc),e(ht,To),e(To,zc),e(To,Ba),e(Ba,Vc),e(To,Bc),e(P,Yc),e(P,ft),_(ko,ft,null),e(ft,Fc),e(ft,Te),e(Te,Qc),e(Te,Ya),e(Ya,Xc),e(Te,Kc),e(Te,Fa),e(Fa,ep),e(Te,tp),e(P,op),e(P,ut),_(xo,ut,null),e(ut,rp),e(ut,Io),e(Io,ap),e(Io,Qa),e(Qa,np),e(Io,sp),e(P,lp),e(P,gt),_(Mo,gt,null),e(gt,ip),e(gt,re),e(re,dp),e(re,Xa),e(Xa,cp),e(re,pp),e(re,Ka),e(Ka,mp),e(re,hp),e(re,en),e(en,fp),e(re,up),h(t,rs,m),h(t,ke,m),e(ke,vt),e(vt,tn),_(Po,tn,null),e(ke,gp),e(ke,on),e(on,vp),h(t,as,m),h(t,W,m),_(jo,W,null),e(W,_p),e(W,Jo),e(Jo,bp),e(Jo,_r),e(_r,$p),e(Jo,yp),e(W,wp),e(W,_t),_(Uo,_t,null),e(_t,Ap),e(_t,Do),e(Do,Ep),e(Do,br),e(br,Tp),e(Do,kp),e(W,xp),e(W,ie),_(Ho,ie,null),e(ie,Ip),e(ie,Co),e(Co,Mp),e(Co,rn),e(rn,Pp),e(Co,jp),e(ie,Jp),e(ie,No),e(No,Up),e(No,$r),e($r,Dp),e(No,Hp),h(t,ns,m),h(t,xe,m),e(xe,bt),e(bt,an),_(Oo,an,null),e(xe,Cp),e(xe,nn),e(nn,Np),h(t,ss,m),h(t,Ie,m),_(Ro,Ie,null),e(Ie,Op),e(Ie,Me),e(Me,Rp),e(Me,sn),e(sn,Zp),e(Me,Lp),e(Me,ln),e(ln,Sp),e(Me,Wp),h(t,ls,m),h(t,Pe,m),e(Pe,$t),e($t,dn),_(Zo,dn,null),e(Pe,Gp),e(Pe,cn),e(cn,qp),h(t,is,m),h(t,yr,m),e(yr,zp),h(t,ds,m),h(t,yt,m),e(yt,Vp),e(yt,pn),e(pn,Bp),e(yt,Yp),h(t,cs,m),h(t,wr,m),e(wr,Fp),h(t,ps,m),h(t,de,m),e(de,Lo),e(Lo,Qp),e(Lo,mn),e(mn,Xp),e(Lo,Kp),e(de,em),e(de,je),e(je,tm),e(je,hn),e(hn,om),e(je,rm),e(je,fn),e(fn,am),e(je,nm),e(de,sm),e(de,un),e(un,lm),h(t,ms,m),h(t,Je,m),e(Je,wt),e(wt,gn),_(So,gn,null),e(Je,im),e(Je,vn),e(vn,dm),h(t,hs,m),h(t,Ue,m),_(Wo,Ue,null),e(Ue,cm),e(Ue,_n),e(_n,pm),h(t,fs,m),h(t,De,m),e(De,At),e(At,bn),_(Go,bn,null),e(De,mm),e(De,$n),e($n,hm),h(t,us,m),h(t,G,m),_(qo,G,null),e(G,fm),e(G,yn),e(yn,um),e(G,gm),e(G,Et),_(zo,Et,null),e(Et,vm),e(Et,wn),e(wn,_m),e(G,bm),e(G,Tt),_(Vo,Tt,null),e(Tt,$m),e(Tt,An),e(An,ym),h(t,gs,m),h(t,He,m),e(He,kt),e(kt,En),_(Bo,En,null),e(He,wm),e(He,Tn),e(Tn,Am),h(t,vs,m),h(t,q,m),_(Yo,q,null),e(q,Em),e(q,kn),e(kn,Tm),e(q,km),e(q,xt),_(Fo,xt,null),e(xt,xm),e(xt,Qo),e(Qo,Im),e(Qo,xn),e(xn,Mm),e(Qo,Pm),e(q,jm),e(q,It),_(Xo,It,null),e(It,Jm),e(It,In),e(In,Um),_s=!0},p(t,[m]){const Ko={};m&2&&(Ko.$$scope={dirty:m,ctx:t}),N.$set(Ko);const Mn={};m&2&&(Mn.$$scope={dirty:m,ctx:t}),We.$set(Mn);const Pn={};m&2&&(Pn.$$scope={dirty:m,ctx:t}),qe.$set(Pn);const jn={};m&2&&(jn.$$scope={dirty:m,ctx:t}),ze.$set(jn);const er={};m&2&&(er.$$scope={dirty:m,ctx:t}),Be.$set(er);const Jn={};m&2&&(Jn.$$scope={dirty:m,ctx:t}),Ye.$set(Jn);const tr={};m&2&&(tr.$$scope={dirty:m,ctx:t}),Qe.$set(tr);const Un={};m&2&&(Un.$$scope={dirty:m,ctx:t}),Xe.$set(Un);const Dn={};m&2&&(Dn.$$scope={dirty:m,ctx:t}),et.$set(Dn);const Hn={};m&2&&(Hn.$$scope={dirty:m,ctx:t}),tt.$set(Hn)},i(t){_s||(b(c.$$.fragment,t),b(N.$$.fragment,t),b(Zt.$$.fragment,t),b(Lt.$$.fragment,t),b(St.$$.fragment,t),b(We.$$.fragment,t),b(Wt.$$.fragment,t),b(Gt.$$.fragment,t),b(qe.$$.fragment,t),b(qt.$$.fragment,t),b(ze.$$.fragment,t),b(Vt.$$.fragment,t),b(Bt.$$.fragment,t),b(Be.$$.fragment,t),b(Ye.$$.fragment,t),b(Yt.$$.fragment,t),b(Ft.$$.fragment,t),b(Qe.$$.fragment,t),b(Xe.$$.fragment,t),b(Kt.$$.fragment,t),b(eo.$$.fragment,t),b(to.$$.fragment,t),b(et.$$.fragment,t),b(oo.$$.fragment,t),b(tt.$$.fragment,t),b(ro.$$.fragment,t),b(no.$$.fragment,t),b(so.$$.fragment,t),b(lo.$$.fragment,t),b(io.$$.fragment,t),b(co.$$.fragment,t),b(mo.$$.fragment,t),b(fo.$$.fragment,t),b(uo.$$.fragment,t),b(go.$$.fragment,t),b(yo.$$.fragment,t),b(wo.$$.fragment,t),b(Ao.$$.fragment,t),b(Eo.$$.fragment,t),b(ko.$$.fragment,t),b(xo.$$.fragment,t),b(Mo.$$.fragment,t),b(Po.$$.fragment,t),b(jo.$$.fragment,t),b(Uo.$$.fragment,t),b(Ho.$$.fragment,t),b(Oo.$$.fragment,t),b(Ro.$$.fragment,t),b(Zo.$$.fragment,t),b(So.$$.fragment,t),b(Wo.$$.fragment,t),b(Go.$$.fragment,t),b(qo.$$.fragment,t),b(zo.$$.fragment,t),b(Vo.$$.fragment,t),b(Bo.$$.fragment,t),b(Yo.$$.fragment,t),b(Fo.$$.fragment,t),b(Xo.$$.fragment,t),_s=!0)},o(t){$(c.$$.fragment,t),$(N.$$.fragment,t),$(Zt.$$.fragment,t),$(Lt.$$.fragment,t),$(St.$$.fragment,t),$(We.$$.fragment,t),$(Wt.$$.fragment,t),$(Gt.$$.fragment,t),$(qe.$$.fragment,t),$(qt.$$.fragment,t),$(ze.$$.fragment,t),$(Vt.$$.fragment,t),$(Bt.$$.fragment,t),$(Be.$$.fragment,t),$(Ye.$$.fragment,t),$(Yt.$$.fragment,t),$(Ft.$$.fragment,t),$(Qe.$$.fragment,t),$(Xe.$$.fragment,t),$(Kt.$$.fragment,t),$(eo.$$.fragment,t),$(to.$$.fragment,t),$(et.$$.fragment,t),$(oo.$$.fragment,t),$(tt.$$.fragment,t),$(ro.$$.fragment,t),$(no.$$.fragment,t),$(so.$$.fragment,t),$(lo.$$.fragment,t),$(io.$$.fragment,t),$(co.$$.fragment,t),$(mo.$$.fragment,t),$(fo.$$.fragment,t),$(uo.$$.fragment,t),$(go.$$.fragment,t),$(yo.$$.fragment,t),$(wo.$$.fragment,t),$(Ao.$$.fragment,t),$(Eo.$$.fragment,t),$(ko.$$.fragment,t),$(xo.$$.fragment,t),$(Mo.$$.fragment,t),$(Po.$$.fragment,t),$(jo.$$.fragment,t),$(Uo.$$.fragment,t),$(Ho.$$.fragment,t),$(Oo.$$.fragment,t),$(Ro.$$.fragment,t),$(Zo.$$.fragment,t),$(So.$$.fragment,t),$(Wo.$$.fragment,t),$(Go.$$.fragment,t),$(qo.$$.fragment,t),$(zo.$$.fragment,t),$(Vo.$$.fragment,t),$(Bo.$$.fragment,t),$(Yo.$$.fragment,t),$(Fo.$$.fragment,t),$(Xo.$$.fragment,t),_s=!1},d(t){o(f),t&&o(T),t&&o(w),y(c),t&&o(M),y(N,t),t&&o(ae),t&&o(Ze),t&&o(On),t&&o(pe),y(Zt),t&&o(Rn),t&&o(B),t&&o(Zn),t&&o(me),y(Lt),t&&o(Ln),t&&o(ee),y(St),y(We),t&&o(Sn),t&&o(he),y(Wt),t&&o(Wn),t&&o(Z),y(Gt),y(qe),y(qt),y(ze),t&&o(Gn),t&&o(fe),y(Vt),t&&o(qn),t&&o(L),y(Bt),y(Be),y(Ye),t&&o(zn),t&&o(ue),y(Yt),t&&o(Vn),t&&o(S),y(Ft),y(Qe),y(Xe),t&&o(Bn),t&&o(ge),y(Kt),t&&o(Yn),t&&o(C),y(eo),y(to),y(et),y(oo),y(tt),y(ro),t&&o(Fn),t&&o(ve),y(no),t&&o(Qn),t&&o(_e),y(so),t&&o(Xn),t&&o(be),y(lo),t&&o(Kn),t&&o($e),y(io),t&&o(es),t&&o(x),y(co),y(mo),y(fo),y(uo),y(go),y(yo),t&&o(ts),t&&o(Ae),y(wo),t&&o(os),t&&o(P),y(Ao),y(Eo),y(ko),y(xo),y(Mo),t&&o(rs),t&&o(ke),y(Po),t&&o(as),t&&o(W),y(jo),y(Uo),y(Ho),t&&o(ns),t&&o(xe),y(Oo),t&&o(ss),t&&o(Ie),y(Ro),t&&o(ls),t&&o(Pe),y(Zo),t&&o(is),t&&o(yr),t&&o(ds),t&&o(yt),t&&o(cs),t&&o(wr),t&&o(ps),t&&o(de),t&&o(ms),t&&o(Je),y(So),t&&o(hs),t&&o(Ue),y(Wo),t&&o(fs),t&&o(De),y(Go),t&&o(us),t&&o(G),y(qo),y(zo),y(Vo),t&&o(gs),t&&o(He),y(Bo),t&&o(vs),t&&o(q),y(Yo),y(Fo),y(Xo)}}}const wu={local:"agents-tools",sections:[{local:"agents",sections:[{local:"transformers.HfAgent",title:"HfAgent"},{local:"transformers.LocalAgent",title:"LocalAgent"},{local:"transformers.OpenAiAgent",title:"OpenAiAgent"},{local:"transformers.AzureOpenAiAgent",title:"AzureOpenAiAgent"},{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"},{local:"agent-types",sections:[{local:"transformers.tools.agent_types.AgentText",title:"AgentText"},{local:"transformers.tools.agent_types.AgentImage",title:"AgentImage"},{local:"transformers.tools.agent_types.AgentAudio",title:"AgentAudio"}],title:"Agent Types"}],title:"Agents & Tools"};function Au(I){return cu(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pu extends su{constructor(f){super();lu(this,f,Au,yu,iu,{})}}export{Pu as default,wu as metadata};
