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