import{s as at,n as lt,o as st}from"../chunks/scheduler.00b97157.js";import{S as it,i as ot,e as i,s as l,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 a,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.4b5f77d2.js";function ct(N){let m,M,L,T,p,A,c,H,u,Q='ReAct 框架（<a href="https://huggingface.co/papers/2210.03629" rel="nofollow">Yao et al., 2022</a>）是目前构建 agent 的主要方法。',P,h,V="该名称基于两个词的组合：“Reason” （推理）和 “Act” （行动）。实际上，遵循此架构的 agent 将根据需要尽可能多的步骤来解决其任务，每个步骤包括一个推理步骤，然后是一个行动步骤，在该步骤中，它制定工具调用，使其更接近解决手头的任务。",y,C,Y="ReAct 过程涉及保留过去步骤的记忆。",w,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,d,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,v,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/main/zh/reference/agents#smolagents.ToolCallingAgent">ToolCallingAgent</a> 在其输出中生成 JSON 格式的工具调用。</li> <li><a href="/docs/smolagents/main/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;"}}),c=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=l(),L=i("p"),T=l(),B(p.$$.fragment),A=l(),B(c.$$.fragment),H=l(),u=i("p"),u.innerHTML=Q,P=l(),h=i("p"),h.textContent=V,y=l(),C=i("p"),C.textContent=Y,w=l(),f=i("blockquote"),f.innerHTML=F,k=l(),d=i("p"),d.textContent=W,E=l(),r=i("div"),r.innerHTML=X,z=l(),v=i("p"),v.innerHTML=Z,R=l(),_=i("p"),_.textContent=tt,j=l(),x=i("ul"),x.innerHTML=et,q=l(),B($.$$.fragment),O=l(),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(c.$$.fragment,t),H=s(t),u=o(t,"P",{"data-svelte-h":!0}),g(u)!=="svelte-gm4bn2"&&(u.innerHTML=Q),P=s(t),h=o(t,"P",{"data-svelte-h":!0}),g(h)!=="svelte-ktrkfc"&&(h.textContent=V),y=s(t),C=o(t,"P",{"data-svelte-h":!0}),g(C)!=="svelte-lhy2wj"&&(C.textContent=Y),w=s(t),f=o(t,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),g(f)!=="svelte-1syzs5b"&&(f.innerHTML=F),k=s(t),d=o(t,"P",{"data-svelte-h":!0}),g(d)!=="svelte-1ghba8i"&&(d.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),v=o(t,"P",{"data-svelte-h":!0}),g(v)!=="svelte-1qm66iv"&&(v.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-icav5y"&&(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",ut),U(f,"class","tip"),U(r,"class","flex justify-center")},m(t,e){gt(document.head,m),a(t,M,e),a(t,L,e),a(t,T,e),G(p,t,e),a(t,A,e),G(c,t,e),a(t,H,e),a(t,u,e),a(t,P,e),a(t,h,e),a(t,y,e),a(t,C,e),a(t,w,e),a(t,f,e),a(t,k,e),a(t,d,e),a(t,E,e),a(t,r,e),a(t,z,e),a(t,v,e),a(t,R,e),a(t,_,e),a(t,j,e),a(t,x,e),a(t,q,e),G($,t,e),a(t,O,e),a(t,b,e),S=!0},p:lt,i(t){S||(I(p.$$.fragment,t),I(c.$$.fragment,t),I($.$$.fragment,t),S=!0)},o(t){J(p.$$.fragment,t),J(c.$$.fragment,t),J($.$$.fragment,t),S=!1},d(t){t&&(n(M),n(L),n(T),n(A),n(H),n(u),n(P),n(h),n(y),n(C),n(w),n(f),n(k),n(d),n(E),n(r),n(z),n(v),n(R),n(_),n(j),n(x),n(q),n(O),n(b)),n(m),K(p,t),K(c,t),K($,t)}}}const ut='{"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,ct,at,{})}}export{_t as component};
