import{s as et,o as nt,n as at}from"../chunks/scheduler.f6319a2a.js";import{S as st,i as lt,g as o,s as l,r as O,A as it,h as m,f as n,c as i,j as tt,u as U,x as r,k as D,y as ot,a,v as G,d as I,t as J,w as N}from"../chunks/index.85aa684c.js";import{T as mt}from"../chunks/Tip.3d397a88.js";import{H as gt,E as rt}from"../chunks/getInferenceSnippets.743412b2.js";function ft(M){let s,p='阅读 <a href="https://huggingface.co/blog/open-source-llms-as-agents" rel="nofollow">Open-source LLMs as LangChain Agents</a> 博客文章以了解更多关于多步 agent 的信息。';return{c(){s=o("p"),s.innerHTML=p},l(g){s=m(g,"P",{"data-svelte-h":!0}),r(s)!=="svelte-1mbau4"&&(s.innerHTML=p)},m(g,L){a(g,s,L)},p:at,d(g){g&&n(s)}}}function ct(M){let s,p,g,L,u,b,h,V='ReAct 框架（<a href="https://huggingface.co/papers/2210.03629" rel="nofollow">Yao et al., 2022</a>）是目前构建 agent 的主要方法。',w,$,Y="该名称基于两个词的组合：“Reason” （推理）和 “Act” （行动）。实际上，遵循此架构的 agent 将根据需要尽可能多的步骤来解决其任务，每个步骤包括一个推理步骤，然后是一个行动步骤，在该步骤中，它制定工具调用，使其更接近解决手头的任务。",P,d,B="ReAct 过程涉及保留过去步骤的记忆。",H,f,E,v,F="以下是其工作原理的视频概述：",k,c,K='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/Agent_ManimCE.gif"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/Agent_ManimCE.gif"/>',j,_,Q='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/open-source-llms-as-agents/ReAct.png" alt="ReAct agent 的框架"/>',y,C,W="我们实现了两个版本的 ToolCallingAgent：",R,x,X='<li><a href="/docs/smolagents/v1.21.0/zh/reference/agents#smolagents.ToolCallingAgent">ToolCallingAgent</a> 在其输出中生成 JSON 格式的工具调用。</li> <li><a href="/docs/smolagents/v1.21.0/zh/reference/agents#smolagents.CodeAgent">CodeAgent</a> 是一种新型的 ToolCallingAgent，它生成代码块形式的工具调用，这对于具有强大编码性能的 LLM 非常有效。</li>',z,T,S,A,q;return u=new gt({props:{title:"多步骤 agent 是如何工作的？",local:"多步骤-agent-是如何工作的",headingTag:"h1"}}),f=new mt({props:{warning:!1,$$slots:{default:[ft]},$$scope:{ctx:M}}}),T=new rt({props:{source:"https://github.com/huggingface/smolagents/blob/main/docs/source/zh/conceptual_guides/react.md"}}),{c(){s=o("meta"),p=l(),g=o("p"),L=l(),O(u.$$.fragment),b=l(),h=o("p"),h.innerHTML=V,w=l(),$=o("p"),$.textContent=Y,P=l(),d=o("p"),d.textContent=B,H=l(),O(f.$$.fragment),E=l(),v=o("p"),v.textContent=F,k=l(),c=o("div"),c.innerHTML=K,j=l(),_=o("p"),_.innerHTML=Q,y=l(),C=o("p"),C.textContent=W,R=l(),x=o("ul"),x.innerHTML=X,z=l(),O(T.$$.fragment),S=l(),A=o("p"),this.h()},l(t){const e=it("svelte-u9bgzb",document.head);s=m(e,"META",{name:!0,content:!0}),e.forEach(n),p=i(t),g=m(t,"P",{}),tt(g).forEach(n),L=i(t),U(u.$$.fragment,t),b=i(t),h=m(t,"P",{"data-svelte-h":!0}),r(h)!=="svelte-gm4bn2"&&(h.innerHTML=V),w=i(t),$=m(t,"P",{"data-svelte-h":!0}),r($)!=="svelte-ktrkfc"&&($.textContent=Y),P=i(t),d=m(t,"P",{"data-svelte-h":!0}),r(d)!=="svelte-lhy2wj"&&(d.textContent=B),H=i(t),U(f.$$.fragment,t),E=i(t),v=m(t,"P",{"data-svelte-h":!0}),r(v)!=="svelte-1ghba8i"&&(v.textContent=F),k=i(t),c=m(t,"DIV",{class:!0,"data-svelte-h":!0}),r(c)!=="svelte-4ra9xq"&&(c.innerHTML=K),j=i(t),_=m(t,"P",{"data-svelte-h":!0}),r(_)!=="svelte-1qm66iv"&&(_.innerHTML=Q),y=i(t),C=m(t,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1j4ubj4"&&(C.textContent=W),R=i(t),x=m(t,"UL",{"data-svelte-h":!0}),r(x)!=="svelte-1rjyvsw"&&(x.innerHTML=X),z=i(t),U(T.$$.fragment,t),S=i(t),A=m(t,"P",{}),tt(A).forEach(n),this.h()},h(){D(s,"name","hf:doc:metadata"),D(s,"content",pt),D(c,"class","flex justify-center")},m(t,e){ot(document.head,s),a(t,p,e),a(t,g,e),a(t,L,e),G(u,t,e),a(t,b,e),a(t,h,e),a(t,w,e),a(t,$,e),a(t,P,e),a(t,d,e),a(t,H,e),G(f,t,e),a(t,E,e),a(t,v,e),a(t,k,e),a(t,c,e),a(t,j,e),a(t,_,e),a(t,y,e),a(t,C,e),a(t,R,e),a(t,x,e),a(t,z,e),G(T,t,e),a(t,S,e),a(t,A,e),q=!0},p(t,[e]){const Z={};e&2&&(Z.$$scope={dirty:e,ctx:t}),f.$set(Z)},i(t){q||(I(u.$$.fragment,t),I(f.$$.fragment,t),I(T.$$.fragment,t),q=!0)},o(t){J(u.$$.fragment,t),J(f.$$.fragment,t),J(T.$$.fragment,t),q=!1},d(t){t&&(n(p),n(g),n(L),n(b),n(h),n(w),n($),n(P),n(d),n(H),n(E),n(v),n(k),n(c),n(j),n(_),n(y),n(C),n(R),n(x),n(z),n(S),n(A)),n(s),N(u,t),N(f,t),N(T,t)}}}const pt='{"title":"多步骤 agent 是如何工作的？","local":"多步骤-agent-是如何工作的","sections":[],"depth":1}';function ut(M){return nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _t extends st{constructor(s){super(),lt(this,s,ut,ct,et,{})}}export{_t as component};
