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 f,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 ft}from"../chunks/getInferenceSnippets.743412b2.js";function rt(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}),f(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 的主要方法。',P,$,Y="该名称基于两个词的组合：“Reason” （推理）和 “Act” （行动）。实际上，遵循此架构的 agent 将根据需要尽可能多的步骤来解决其任务，每个步骤包括一个推理步骤，然后是一个行动步骤，在该步骤中，它制定工具调用，使其更接近解决手头的任务。",w,d,B="ReAct 过程涉及保留过去步骤的记忆。",H,r,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"/>',R,_,Q='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/open-source-llms-as-agents/ReAct.png" alt="ReAct agent 的框架"/>',j,C,W="我们实现了两个版本的 ToolCallingAgent：",y,x,X='<li><a href="/docs/smolagents/v1.21.1/zh/reference/agents#smolagents.ToolCallingAgent">ToolCallingAgent</a> 在其输出中生成 JSON 格式的工具调用。</li> <li><a href="/docs/smolagents/v1.21.1/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"}}),r=new mt({props:{warning:!1,$$slots:{default:[rt]},$$scope:{ctx:M}}}),T=new ft({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,P=l(),$=o("p"),$.textContent=Y,w=l(),d=o("p"),d.textContent=B,H=l(),O(r.$$.fragment),E=l(),v=o("p"),v.textContent=F,k=l(),c=o("div"),c.innerHTML=K,R=l(),_=o("p"),_.innerHTML=Q,j=l(),C=o("p"),C.textContent=W,y=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}),f(h)!=="svelte-gm4bn2"&&(h.innerHTML=V),P=i(t),$=m(t,"P",{"data-svelte-h":!0}),f($)!=="svelte-ktrkfc"&&($.textContent=Y),w=i(t),d=m(t,"P",{"data-svelte-h":!0}),f(d)!=="svelte-lhy2wj"&&(d.textContent=B),H=i(t),U(r.$$.fragment,t),E=i(t),v=m(t,"P",{"data-svelte-h":!0}),f(v)!=="svelte-1ghba8i"&&(v.textContent=F),k=i(t),c=m(t,"DIV",{class:!0,"data-svelte-h":!0}),f(c)!=="svelte-4ra9xq"&&(c.innerHTML=K),R=i(t),_=m(t,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1qm66iv"&&(_.innerHTML=Q),j=i(t),C=m(t,"P",{"data-svelte-h":!0}),f(C)!=="svelte-1j4ubj4"&&(C.textContent=W),y=i(t),x=m(t,"UL",{"data-svelte-h":!0}),f(x)!=="svelte-1iox8h8"&&(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,P,e),a(t,$,e),a(t,w,e),a(t,d,e),a(t,H,e),G(r,t,e),a(t,E,e),a(t,v,e),a(t,k,e),a(t,c,e),a(t,R,e),a(t,_,e),a(t,j,e),a(t,C,e),a(t,y,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}),r.$set(Z)},i(t){q||(I(u.$$.fragment,t),I(r.$$.fragment,t),I(T.$$.fragment,t),q=!0)},o(t){J(u.$$.fragment,t),J(r.$$.fragment,t),J(T.$$.fragment,t),q=!1},d(t){t&&(n(p),n(g),n(L),n(b),n(h),n(P),n($),n(w),n(d),n(H),n(E),n(v),n(k),n(c),n(R),n(_),n(j),n(C),n(y),n(x),n(z),n(S),n(A)),n(s),N(u,t),N(r,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};
