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