import{s as In,f as $n,o as xn,n as Wn}from"../chunks/scheduler.9bc65507.js";import{S as Rn,i as _n,g as i,s as n,r as M,A as Hn,h as o,f as l,c as a,j as Zn,u as d,x as p,k as us,y as kn,a as s,v as m,d as u,t as y,w as c}from"../chunks/index.707bf1b6.js";import{T as Vn}from"../chunks/Tip.c2ecdbf4.js";import{C as T}from"../chunks/CodeBlock.54a9f38d.js";import{H as b,E as Yn}from"../chunks/EditOnGithub.922df6ba.js";function Qn(re){let r,f="在使用大语言模型（LLM）生成代码时，生成的代码会被执行，避免导入或使用任何不安全的库或模块。";return{c(){r=i("p"),r.textContent=f},l(J){r=o(J,"P",{"data-svelte-h":!0}),p(r)!=="svelte-u6nm8e"&&(r.textContent=f)},m(J,ye){s(J,r,ye)},p:Wn,d(J){J&&l(r)}}}function Nn(re){let r,f,J,ye,h,be,j,ys="[[在colab里打开]]",Je,g,Ue,v,cs='大型语言模型（LLM）经过 <a href="./tasks/language_modeling">因果语言建模训练</a> 可以应对各种任务，但在一些基本任务（如逻辑推理、计算和搜索）上常常表现不佳。当它们被用在自己不擅长的领域时，往往无法生成我们期望的答案。',we,G,Ts="为了解决这个问题，可以创建<strong>智能体</strong>.",fe,B,rs="智能体是一个系统，它使用 LLM 作为引擎，并且能够访问称为<strong>工具</strong>的功能。",he,C,bs="这些<strong>工具</strong>是执行任务的函数，包含所有必要的描述信息，帮助智能体正确使用它们。",je,Z,Js="智能体可以被编程为：",ge,I,Us="<li>一次性设计一系列工具并同时执行它们，像  <code>CodeAgent</code></li> <li>一次执行一个工具，并等待每个工具的结果后再启动下一个，像 <code>ReactJsonAgent</code></li>",ve,$,Ge,x,Be,W,ws="此智能体包含一个规划步骤，然后生成 Python 代码一次性执行所有任务。它原生支持处理不同输入和输出类型，因此推荐用于多模态任务。",Ce,R,Ze,_,fs='这是解决推理任务的首选代理，因为 ReAct 框架 (<a href="https://huggingface.co/papers/2210.03629" rel="nofollow">Yao et al., 2022</a>) 使其在基于之前观察进行推理时非常高效。',Ie,H,hs="我们实现了两种版本的 ReactJsonAgent：",$e,k,js="<li><code>ReactJsonAgent</code> 将工具调用作为 JSON 格式输出。</li> <li><code>ReactCodeAgent</code> 是 ReactJsonAgent 的一种新型，生成工具调用的代码块，对于具备强大编程能力的 LLM 非常适用。</li>",xe,V,gs=`<p>[TIP]
阅读 <a href="https://huggingface.co/blog/open-source-llms-as-agents" rel="nofollow">Open-source LLMs as LangChain Agents</a> 博文，了解更多关于推理智能体的信息。</p>`,We,U,vs='<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"/>',Re,Y,Gs='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/open-source-llms-as-agents/ReAct.png" alt="推理智能体的框架"/>',_e,Q,Bs="以下是一个推理代码智能体如何处理以下问题的示例：",He,N,ke,z,Ve,L,Cs="要初始化一个智能体，您需要以下参数：",Ye,S,Zs="<li><strong>一个 LLM</strong> 来驱动智能体——智能体本身并不是 LLM，而是一个使用 LLM 作为引擎的程序。</li> <li><strong>一个系统提示</strong>：告诉 LLM 引擎应该如何生成输出。</li> <li><strong>一个工具箱</strong>，智能体可以从中选择工具执行。</li> <li><strong>一个解析器</strong>，从 LLM 输出中提取出哪些工具需要调用，以及使用哪些参数。</li>",Qe,E,Is="在智能体系统初始化时，工具属性将生成工具描述，并嵌入到智能体的系统提示中，告知智能体可以使用哪些工具，并且为什么使用它们。",Ne,F,$s="<strong>安装依赖</strong>",ze,X,xs="首先，您需要安装<strong>智能体</strong>所需的额外依赖：",Le,A,Se,q,Ws="<strong>创建LLM引擎</strong>",Ee,P,Rs='定义一个 <code>llm_engine</code> 方法，该方法接受一系列<a href="./chat_templating">消息</a>并返回文本。该 <code>callable</code> 还需要接受一个 <code>stop</code> 参数，用于指示何时停止生成输出。',Fe,D,Xe,K,_s="您可以使用任何符合以下要求的 <code>llm_engine</code> 方法：",Ae,O,Hs='<li><a href="./chat_templating">输入格式</a>为 (<code>List[Dict[str, str]]</code>)，并且返回一个字符串。</li> <li>它在 <code>stop_sequences</code> 参数传递的序列处停止生成输出。</li>',qe,tt,ks='此外，<code>llm_engine</code> 还可以接受一个 <code>grammar</code> 参数。如果在智能体初始化时指定了 <code>grammar</code>，则该参数将传递给 <code>llm_engine</code> 的调用，以允许<a href="https://huggingface.co/docs/text-generation-inference/conceptual/guidance" rel="nofollow">受限生成</a>，以强制生成格式正确的智能体输出。',Pe,et,Vs="您还需要一个 <code>tools</code> 参数，它接受一个 <code>Tools</code> 列表 —— 可以是空列表。您也可以通过定义可选参数 <code>add_base_tools=True</code> 来将默认工具箱添加到工具列表中。",De,lt,Ys="现在，您可以创建一个智能体，例如 <code>CodeAgent</code>，并运行它。您还可以创建一个 <code>TransformersEngine</code>，使用 <code>transformers</code> 在本地机器上运行预初始化的推理管道。 为了方便起见，由于智能体行为通常需要更强大的模型，例如 <code>Llama-3.1-70B-Instruct</code>，它们目前较难在本地运行，我们还提供了 <code>HfApiEngine</code> 类，它在底层初始化了一个 <code>huggingface_hub.InferenceClient</code>。",Ke,st,Oe,nt,Qs=`当你急需某个东西时这将会很有用!
您甚至可以将 <code>llm_engine</code> 参数留空，默认情况下会创建一个 <code>HfApiEngine</code>。`,tl,at,el,it,Ns="请注意，我们使用了额外的 <code>sentence</code> 参数：您可以将文本作为附加参数传递给模型。",ll,ot,zs="您还可以使用这个来指定本地或远程文件的路径供模型使用：",sl,pt,nl,Mt,Ls="系统提示和输出解析器会自动定义，但您可以通过调用智能体的 <code>system_prompt_template</code> 来轻松查看它们。",al,dt,il,mt,Ss=`尽可能清楚地解释您要执行的任务非常重要。 每次 <code>run()</code> 操作都是独立的，并且由于智能体是由 LLM 驱动的，提示中的细微变化可能会导致完全不同的结果。
您还可以连续运行多个任务，每次都会重新初始化智能体的 <code>agent.task</code> 和 <code>agent.logs</code> 属性。`,ol,ut,pl,yt,Es="Python 解释器在一组输入和工具上执行代码。 这应该是安全的，因为只能调用您提供的工具（特别是 Hugging Face 的工具）和 print 函数，因此您已经限制了可以执行的操作。",Ml,ct,Fs="Python 解释器默认不允许导入不在安全列表中的模块，因此大多数明显的攻击问题应该不成问题。 您仍然可以通过在 <code>ReactCodeAgent</code> 或 <code>CodeAgent</code> 初始化时通过 <code>additional_authorized_imports</code> 参数传递一个授权的模块列表来授权额外的导入：",dl,Tt,ml,rt,Xs="如果有任何代码尝试执行非法操作，或者生成的代码出现常规 Python 错误，执行将停止。",ul,w,yl,bt,cl,Jt,As="智能体，或者说驱动智能体的 LLM，根据系统提示生成输出。系统提示可以定制并根据目标任务进行调整。例如，检查 <code>ReactCodeAgent</code> 的系统提示（以下版本经过简化）。",Tl,Ut,rl,wt,qs="系统提示包括：",bl,ft,Ps="<li>解释智能体应该如何工作以及工具的<strong>介绍</strong>。</li> <li>所有工具的描述由 <code>&lt;&lt;tool_descriptions&gt;&gt;</code> 标记在运行时动态替换，这样智能体就知道可以使用哪些工具及其用途。<ul><li>工具的描述来自工具的属性,<code>name</code>、<code>description</code>、<code>inputs</code> 和 <code>output_type</code>，以及一个简单的 <code>jinja2</code> 模板，您可以根据需要进行调整。</li></ul></li> <li>期望的输出格式。</li>",Jl,ht,Ds="您可以通过向 <code>system_prompt</code> 参数传递自定义提示来最大程度地提高灵活性，从而覆盖整个系统提示模板。",Ul,jt,wl,gt,Ks=`<p>[WARNING]
必须在<code>template</code>中定义 <code>&lt;&lt;tool_descriptions&gt;&gt;</code> 这个变量，以便智能体能够正确地识别并使用可用的工具</p>`,fl,vt,hl,Gt,Os="以下是检查运行后发生了什么的一些有用属性：",jl,Bt,tn="<li><code>agent.logs</code> 存储了智能体的详细日志。每一步的所有内容都会存储在一个字典中，然后附加到 <code>agent.logs</code>。</li> <li>运行 <code>agent.write_inner_memory_from_logs()</code> 会从日志中创建智能体的内存，以便 LLM 查看，作为一系列聊天消息。此方法会遍历日志的每个步骤，只保存其感兴趣的消息：例如，它会单独保存系统提示和任务，然后为每个步骤保存 LLM 输出的消息，以及工具调用输出的消息。如果您想要更高层次的查看发生了什么，可以使用此方法 —— 但并不是每个日志都会被此方法转录。</li>",gl,Ct,vl,Zt,en="工具是智能体使用的基本功能。",Gl,It,ln="例如，您可以检查 <code>PythonInterpreterTool</code>：它有一个名称、描述、输入描述、输出类型和 <code>__call__</code> 方法来执行该操作。",Bl,$t,sn="当智能体初始化时，工具属性会用来生成工具描述，然后将其嵌入到智能体的系统提示中，这让智能体知道可以使用哪些工具以及为什么使用它们。",Cl,xt,Zl,Wt,nn="Transformers 提供了一个默认工具箱，用于增强智能体，您可以在初始化时通过 <code>add_base_tools=True</code> 参数将其添加到智能体中：",Il,Rt,an='<li><strong>文档问答</strong>：给定一个文档（如图像格式的 PDF），回答关于该文档的问题(<a href="./model_doc/donut">Donut</a>)</li> <li><strong>图像问答</strong>：给定一张图片，回答关于该图像的问题(<a href="./model_doc/vilt">VILT</a>)</li> <li><strong>语音转文本</strong>：给定一个人讲述的音频录音，将其转录为文本（Whisper）</li> <li><strong>文本转语音</strong>：将文本转换为语音(<a href="./model_doc/speecht5">SpeechT5</a>)</li> <li><strong>翻译</strong>：将给定的句子从源语言翻译为目标语言</li> <li><strong>DuckDuckGo 搜索</strong>：使用 <code>DuckDuckGo</code> 浏览器进行网络搜索</li> <li><strong>Python 代码解释器</strong>：在安全环境中运行 LLM 生成的 Python 代码。只有在初始化 <code>ReactJsonAgent</code> 时将 <code>add_base_tools=True</code> 时，代码智能体才会添加此工具，因为基于代码的智能体已经能够原生执行 Python 代码</li>',$l,_t,on="您可以通过调用 <code>load_tool()</code> 函数来手动使用某个工具并执行任务。",xl,Ht,Wl,kt,Rl,Vt,pn=`您可以为 <code>Hugging Face</code> 默认工具无法涵盖的用例创建自己的工具。
例如，假设我们要创建一个返回在 <code>Hugging Face Hub</code> 上某个任务中下载次数最多的模型的工具。`,_l,Yt,Mn="您将从以下代码开始：",Hl,Qt,kl,Nt,dn="这段代码可以很快转换为工具，只需将其包装成一个函数，并添加 <code>tool</code> 装饰器：",Vl,zt,Yl,Lt,mn="该函数需要：",Ql,St,un="<li>一个清晰的名称。名称通常描述工具的功能。由于代码返回某个任务中下载次数最多的模型，因此我们将其命名为 <code>model_download_tool</code>。</li> <li>对输入和输出进行类型提示</li> <li>描述，其中包括 ”<code>Args</code>:” 部分，描述每个参数（这次不需要类型指示，它会从类型提示中获取）。</li>",Nl,Et,yn="所有这些将自动嵌入到智能体的系统提示中，因此请尽量使它们尽可能清晰！",zl,Ft,cn=`<p>[TIP]
这个定义格式与 apply_chat_template 中使用的工具模式相同，唯一的区别是添加了 tool 装饰器：可以在我们的工具使用 API 中<a href="https://huggingface.co/blog/unified-tool-use#passing-tools-to-a-chat-template" rel="nofollow">了解更多</a>.</p>`,Ll,Xt,Tn="然后，您可以直接初始化您的智能体：",Sl,At,El,qt,rn="您将得到以下输出：",Fl,Pt,Xl,Dt,bn=`输出：
<code>&quot;The most downloaded model for the &#39;text-to-video&#39; task is ByteDance/AnimateDiff-Lightning.&quot;</code>`,Al,Kt,ql,Ot,Jn="如果您已经初始化了一个智能体，但想添加一个新的工具，重新初始化智能体会很麻烦。借助 Transformers，您可以通过添加或替换工具来管理智能体的工具箱。",Pl,te,Un="让我们将 <code>model_download_tool</code> 添加到一个仅初始化了默认工具箱的现有智能体中。",Dl,ee,Kl,le,wn="现在，我们可以同时使用新工具和之前的文本到语音工具：",Ol,se,ts,ne,fn='<thead><tr><th><strong>Audio</strong></th></tr></thead> <tbody><tr><td><audio controls=""><source src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/damo.wav" type="audio/wav"/></audio></td></tr></tbody>',es,ae,hn=`<p>[WARNING]
当向一个已经运行良好的代理添加工具时要小心，因为这可能会导致选择偏向你的工具，或者选择已经定义的工具之外的其他工具。</p>`,ls,ie,jn=`使用 agent.toolbox.update_tool() 方法可以替换智能体工具箱中的现有工具。
如果您的新工具完全替代了现有工具，这非常有用，因为智能体已经知道如何执行该特定任务。
只需确保新工具遵循与替换工具相同的 API，或者调整系统提示模板，以确保所有使用替换工具的示例都得到更新。`,ss,oe,ns,pe,gn=`您可以通过使用 ToolCollection 对象来利用工具集合，指定您想要使用的工具集合的 slug。
然后将这些工具作为列表传递给智能体进行初始化，并开始使用它们！`,as,Me,is,de,vn="为了加速启动，工具仅在智能体调用时加载。",os,me,Gn="这将生成如下图像：",ps,ce,Bn,Ms,ue,ds,Te,ms;return h=new b({props:{title:"智能体和工具",local:"智能体和工具",headingTag:"h1"}}),g=new b({props:{title:"什么是智能体 (Agent)？",local:"什么是智能体-agent",headingTag:"h3"}}),$=new b({props:{title:"智能体类型",local:"智能体类型",headingTag:"h3"}}),x=new b({props:{title:"代码智能体",local:"代码智能体",headingTag:"h4"}}),R=new b({props:{title:"推理智能体",local:"推理智能体",headingTag:"h4"}}),N=new T({props:{code:"YWdlbnQucnVuKCUwQSUyMCUyMCUyMCUyMCUyMkhvdyUyMG1hbnklMjBtb3JlJTIwYmxvY2tzJTIwKGFsc28lMjBkZW5vdGVkJTIwYXMlMjBsYXllcnMpJTIwaW4lMjBCRVJUJTIwYmFzZSUyMGVuY29kZXIlMjB0aGFuJTIwdGhlJTIwZW5jb2RlciUyMGZyb20lMjB0aGUlMjBhcmNoaXRlY3R1cmUlMjBwcm9wb3NlZCUyMGluJTIwQXR0ZW50aW9uJTIwaXMlMjBBbGwlMjBZb3UlMjBOZWVkJTNGJTIyJTJDJTBBKSUwQSUwQSUwQSUwQQ==",highlighted:`&gt;&gt;&gt; agent.<span class="hljs-built_in">run</span>(
<span class="hljs-built_in">..</span>.     <span class="hljs-string">&quot;How many more blocks (also denoted as layers) in BERT base encoder than the encoder from the architecture proposed in Attention is All You Need?&quot;</span>,
<span class="hljs-built_in">..</span>. )
=====New <span class="hljs-attribute">task</span>=====
How many more blocks (also denoted as layers) <span class="hljs-keyword">in</span> BERT base encoder than the encoder <span class="hljs-keyword">from</span> the architecture proposed <span class="hljs-keyword">in</span> Attention is All You Need?
====Agent is executing the code below:
bert_blocks = search(<span class="hljs-attribute">query</span>=<span class="hljs-string">&quot;number of blocks in BERT base encoder&quot;</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;BERT blocks:&quot;</span>, bert_blocks)
====
<span class="hljs-built_in">Print</span> outputs:
BERT blocks: twelve encoder blocks

====Agent is executing the code below:
attention_layer = search(<span class="hljs-attribute">query</span>=<span class="hljs-string">&quot;number of layers in Attention is All You Need&quot;</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Attention layers:&quot;</span>, attention_layer)
====
<span class="hljs-built_in">Print</span> outputs:
Attention layers: Encoder: The encoder is composed of a stack of N = 6 identical layers. Each layer has two sub-layers. The first is a multi-head self-attention mechanism, <span class="hljs-keyword">and</span> the second is a simple, position- 2<span class="hljs-built_in"> Page </span>3 Figure 1: The Transformer - model architecture.

====Agent is executing the code below:
bert_blocks = 12
attention_layers = 6
diff = bert_blocks - attention_layers
<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Difference in blocks:&quot;</span>, diff)
final_answer(diff)
====

<span class="hljs-built_in">Print</span> outputs:
Difference <span class="hljs-keyword">in</span> blocks: 6

Final answer: 6`,wrap:!1}}),z=new b({props:{title:"如何构建智能体？",local:"如何构建智能体",headingTag:"h3"}}),A=new T({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyU1QmFnZW50cyU1RA==",highlighted:"pip install transformers[agents]",wrap:!1}}),D=new T({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTJDJTIwSW5mZXJlbmNlQ2xpZW50JTBBJTBBbG9naW4oJTIyJTNDWU9VUl9IVUdHSU5HRkFDRUhVQl9BUElfVE9LRU4lM0UlMjIpJTBBJTBBY2xpZW50JTIwJTNEJTIwSW5mZXJlbmNlQ2xpZW50KG1vZGVsJTNEJTIybWV0YS1sbGFtYSUyRk1ldGEtTGxhbWEtMy03MEItSW5zdHJ1Y3QlMjIpJTBBJTBBZGVmJTIwbGxtX2VuZ2luZShtZXNzYWdlcyUyQyUyMHN0b3Bfc2VxdWVuY2VzJTNEJTVCJTIyVGFzayUyMiU1RCklMjAtJTNFJTIwc3RyJTNBJTBBJTIwJTIwJTIwJTIwcmVzcG9uc2UlMjAlM0QlMjBjbGllbnQuY2hhdF9jb21wbGV0aW9uKG1lc3NhZ2VzJTJDJTIwc3RvcCUzRHN0b3Bfc2VxdWVuY2VzJTJDJTIwbWF4X3Rva2VucyUzRDEwMDApJTBBJTIwJTIwJTIwJTIwYW5zd2VyJTIwJTNEJTIwcmVzcG9uc2UuY2hvaWNlcyU1QjAlNUQubWVzc2FnZS5jb250ZW50JTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYW5zd2Vy",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login, InferenceClient

login(<span class="hljs-string">&quot;&lt;YOUR_HUGGINGFACEHUB_API_TOKEN&gt;&quot;</span>)

client = InferenceClient(model=<span class="hljs-string">&quot;meta-llama/Meta-Llama-3-70B-Instruct&quot;</span>)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">llm_engine</span>(<span class="hljs-params">messages, stop_sequences=[<span class="hljs-string">&quot;Task&quot;</span>]</span>) -&gt; <span class="hljs-built_in">str</span>:
    response = client.chat_completion(messages, stop=stop_sequences, max_tokens=<span class="hljs-number">1000</span>)
    answer = response.choices[<span class="hljs-number">0</span>].message.content
    <span class="hljs-keyword">return</span> answer`,wrap:!1}}),st=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVBZ2VudCUyQyUyMEhmQXBpRW5naW5lJTBBJTBBbGxtX2VuZ2luZSUyMCUzRCUyMEhmQXBpRW5naW5lKG1vZGVsJTNEJTIybWV0YS1sbGFtYSUyRk1ldGEtTGxhbWEtMy03MEItSW5zdHJ1Y3QlMjIpJTBBYWdlbnQlMjAlM0QlMjBDb2RlQWdlbnQodG9vbHMlM0QlNUIlNUQlMkMlMjBsbG1fZW5naW5lJTNEbGxtX2VuZ2luZSUyQyUyMGFkZF9iYXNlX3Rvb2xzJTNEVHJ1ZSklMEElMEFhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIyQ291bGQlMjB5b3UlMjB0cmFuc2xhdGUlMjB0aGlzJTIwc2VudGVuY2UlMjBmcm9tJTIwRnJlbmNoJTJDJTIwc2F5JTIwaXQlMjBvdXQlMjBsb3VkJTIwYW5kJTIwcmV0dXJuJTIwdGhlJTIwYXVkaW8uJTIyJTJDJTBBJTIwJTIwJTIwJTIwc2VudGVuY2UlM0QlMjJPJUMzJUI5JTIwZXN0JTIwbGElMjBib3VsYW5nZXJpZSUyMGxhJTIwcGx1cyUyMHByb2NoZSUzRiUyMiUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeAgent, HfApiEngine

llm_engine = HfApiEngine(model=<span class="hljs-string">&quot;meta-llama/Meta-Llama-3-70B-Instruct&quot;</span>)
agent = CodeAgent(tools=[], llm_engine=llm_engine, add_base_tools=<span class="hljs-literal">True</span>)

agent.run(
    <span class="hljs-string">&quot;Could you translate this sentence from French, say it out loud and return the audio.&quot;</span>,
    sentence=<span class="hljs-string">&quot;Où est la boulangerie la plus proche?&quot;</span>,
)`,wrap:!1}}),at=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVBZ2VudCUwQSUwQWFnZW50JTIwJTNEJTIwQ29kZUFnZW50KHRvb2xzJTNEJTVCJTVEJTJDJTIwYWRkX2Jhc2VfdG9vbHMlM0RUcnVlKSUwQSUwQWFnZW50LnJ1biglMEElMjAlMjAlMjAlMjAlMjJDb3VsZCUyMHlvdSUyMHRyYW5zbGF0ZSUyMHRoaXMlMjBzZW50ZW5jZSUyMGZyb20lMjBGcmVuY2glMkMlMjBzYXklMjBpdCUyMG91dCUyMGxvdWQlMjBhbmQlMjBnaXZlJTIwbWUlMjB0aGUlMjBhdWRpby4lMjIlMkMlMEElMjAlMjAlMjAlMjBzZW50ZW5jZSUzRCUyMk8lQzMlQjklMjBlc3QlMjBsYSUyMGJvdWxhbmdlcmllJTIwbGElMjBwbHVzJTIwcHJvY2hlJTNGJTIyJTJDJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeAgent

agent = CodeAgent(tools=[], add_base_tools=<span class="hljs-literal">True</span>)

agent.run(
    <span class="hljs-string">&quot;Could you translate this sentence from French, say it out loud and give me the audio.&quot;</span>,
    sentence=<span class="hljs-string">&quot;Où est la boulangerie la plus proche?&quot;</span>,
)`,wrap:!1}}),pt=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0Q29kZUFnZW50JTBBJTBBYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCh0b29scyUzRCU1QiU1RCUyQyUyMGxsbV9lbmdpbmUlM0RsbG1fZW5naW5lJTJDJTIwYWRkX2Jhc2VfdG9vbHMlM0RUcnVlKSUwQSUwQWFnZW50LnJ1biglMjJXaHklMjBkb2VzJTIwTWlrZSUyMG5vdCUyMGtub3clMjBtYW55JTIwcGVvcGxlJTIwaW4lMjBOZXclMjBZb3JrJTNGJTIyJTJDJTIwYXVkaW8lM0QlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZodWdnaW5nZmFjZSUyRmRvY3VtZW50YXRpb24taW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZ0cmFuc2Zvcm1lcnMlMkZyZWNvcmRpbmcubXAzJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactCodeAgent

agent = ReactCodeAgent(tools=[], llm_engine=llm_engine, add_base_tools=<span class="hljs-literal">True</span>)

agent.run(<span class="hljs-string">&quot;Why does Mike not know many people in New York?&quot;</span>, audio=<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/recording.mp3&quot;</span>)`,wrap:!1}}),dt=new T({props:{code:"cHJpbnQoYWdlbnQuc3lzdGVtX3Byb21wdF90ZW1wbGF0ZSk=",highlighted:'<span class="hljs-built_in">print</span>(agent.system_prompt_template)',wrap:!1}}),ut=new b({props:{title:"代码执行",local:"代码执行",headingTag:"h4"}}),Tt=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0Q29kZUFnZW50JTBBJTBBYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCh0b29scyUzRCU1QiU1RCUyQyUyMGFkZGl0aW9uYWxfYXV0aG9yaXplZF9pbXBvcnRzJTNEJTVCJ3JlcXVlc3RzJyUyQyUyMCdiczQnJTVEKSUwQWFnZW50LnJ1biglMjJDb3VsZCUyMHlvdSUyMGdldCUyMG1lJTIwdGhlJTIwdGl0bGUlMjBvZiUyMHRoZSUyMHBhZ2UlMjBhdCUyMHVybCUyMCdodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGYmxvZyclM0YlMjIpJTBB",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactCodeAgent

<span class="hljs-meta">&gt;&gt;&gt; </span>agent = ReactCodeAgent(tools=[], additional_authorized_imports=[<span class="hljs-string">&#x27;requests&#x27;</span>, <span class="hljs-string">&#x27;bs4&#x27;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>agent.run(<span class="hljs-string">&quot;Could you get me the title of the page at url &#x27;https://huggingface.co/blog&#x27;?&quot;</span>)

(...)
<span class="hljs-string">&#x27;Hugging Face – Blog&#x27;</span>`,wrap:!1}}),w=new Vn({props:{warning:!0,$$slots:{default:[Qn]},$$scope:{ctx:re}}}),bt=new b({props:{title:"系统提示",local:"系统提示",headingTag:"h3"}}),Ut=new T({props:{code:"WW91JTIwd2lsbCUyMGJlJTIwZ2l2ZW4lMjBhJTIwdGFzayUyMHRvJTIwc29sdmUlMjBhcyUyMGJlc3QlMjB5b3UlMjBjYW4uJTBBWW91JTIwaGF2ZSUyMGFjY2VzcyUyMHRvJTIwdGhlJTIwZm9sbG93aW5nJTIwdG9vbHMlM0ElMEElM0MlM0N0b29sX2Rlc2NyaXB0aW9ucyUzRSUzRSUwQSUwQVRvJTIwc29sdmUlMjB0aGUlMjB0YXNrJTJDJTIweW91JTIwbXVzdCUyMHBsYW4lMjBmb3J3YXJkJTIwdG8lMjBwcm9jZWVkJTIwaW4lMjBhJTIwc2VyaWVzJTIwb2YlMjBzdGVwcyUyQyUyMGluJTIwYSUyMGN5Y2xlJTIwb2YlMjAnVGhvdWdodCUzQSclMkMlMjAnQ29kZSUzQSclMkMlMjBhbmQlMjAnT2JzZXJ2YXRpb24lM0EnJTIwc2VxdWVuY2VzLiUwQSUwQUF0JTIwZWFjaCUyMHN0ZXAlMkMlMjBpbiUyMHRoZSUyMCdUaG91Z2h0JTNBJyUyMHNlcXVlbmNlJTJDJTIweW91JTIwc2hvdWxkJTIwZmlyc3QlMjBleHBsYWluJTIweW91ciUyMHJlYXNvbmluZyUyMHRvd2FyZHMlMjBzb2x2aW5nJTIwdGhlJTIwdGFzayUyQyUyMHRoZW4lMjB0aGUlMjB0b29scyUyMHRoYXQlMjB5b3UlMjB3YW50JTIwdG8lMjB1c2UuJTBBVGhlbiUyMGluJTIwdGhlJTIwJ0NvZGUlM0EnJTIwc2VxdWVuY2UlMkMlMjB5b3UlMjBzaG91bGQlMjB3cml0ZSUyMHRoZSUyMGNvZGUlMjBpbiUyMHNpbXBsZSUyMFB5dGhvbi4lMjBUaGUlMjBjb2RlJTIwc2VxdWVuY2UlMjBtdXN0JTIwZW5kJTIwd2l0aCUyMCclMkZFbmQlMjBjb2RlJyUyMHNlcXVlbmNlLiUwQUR1cmluZyUyMGVhY2glMjBpbnRlcm1lZGlhdGUlMjBzdGVwJTJDJTIweW91JTIwY2FuJTIwdXNlJTIwJ3ByaW50KCknJTIwdG8lMjBzYXZlJTIwd2hhdGV2ZXIlMjBpbXBvcnRhbnQlMjBpbmZvcm1hdGlvbiUyMHlvdSUyMHdpbGwlMjB0aGVuJTIwbmVlZC4lMEFUaGVzZSUyMHByaW50JTIwb3V0cHV0cyUyMHdpbGwlMjB0aGVuJTIwYmUlMjBhdmFpbGFibGUlMjBpbiUyMHRoZSUyMCdPYnNlcnZhdGlvbiUzQSclMjBmaWVsZCUyQyUyMGZvciUyMHVzaW5nJTIwdGhpcyUyMGluZm9ybWF0aW9uJTIwYXMlMjBpbnB1dCUyMGZvciUyMHRoZSUyMG5leHQlMjBzdGVwLiUwQSUwQUluJTIwdGhlJTIwZW5kJTIweW91JTIwaGF2ZSUyMHRvJTIwcmV0dXJuJTIwYSUyMGZpbmFsJTIwYW5zd2VyJTIwdXNpbmclMjB0aGUlMjAlNjBmaW5hbF9hbnN3ZXIlNjAlMjB0b29sLiUwQSUwQUhlcmUlMjBhcmUlMjBhJTIwZmV3JTIwZXhhbXBsZXMlMjB1c2luZyUyMG5vdGlvbmFsJTIwdG9vbHMlM0ElMEEtLS0lMEElN0JleGFtcGxlcyU3RCUwQSUwQUFib3ZlJTIwZXhhbXBsZSUyMHdlcmUlMjB1c2luZyUyMG5vdGlvbmFsJTIwdG9vbHMlMjB0aGF0JTIwbWlnaHQlMjBub3QlMjBleGlzdCUyMGZvciUyMHlvdS4lMjBZb3UlMjBvbmx5JTIwaGF2ZSUyMGFjY2VzJTIwdG8lMjB0aG9zZSUyMHRvb2xzJTNBJTBBJTNDJTNDdG9vbF9uYW1lcyUzRSUzRSUwQVlvdSUyMGFsc28lMjBjYW4lMjBwZXJmb3JtJTIwY29tcHV0YXRpb25zJTIwaW4lMjB0aGUlMjBweXRob24lMjBjb2RlJTIweW91JTIwZ2VuZXJhdGUuJTBBJTBBQWx3YXlzJTIwcHJvdmlkZSUyMGElMjAnVGhvdWdodCUzQSclMjBhbmQlMjBhJTIwJ0NvZGUlM0ElNUNuJTYwJTYwJTYwcHknJTIwc2VxdWVuY2UlMjBlbmRpbmclMjB3aXRoJTIwJyU2MCU2MCU2MCUzQ2VuZF9jb2RlJTNFJyUyMHNlcXVlbmNlLiUyMFlvdSUyME1VU1QlMjBwcm92aWRlJTIwYXQlMjBsZWFzdCUyMHRoZSUyMCdDb2RlJTNBJyUyMHNlcXVlbmNlJTIwdG8lMjBtb3ZlJTIwZm9yd2FyZC4lMEElMEFSZW1lbWJlciUyMHRvJTIwbm90JTIwcGVyZm9ybSUyMHRvbyUyMG1hbnklMjBvcGVyYXRpb25zJTIwaW4lMjBhJTIwc2luZ2xlJTIwY29kZSUyMGJsb2NrISUyMFlvdSUyMHNob3VsZCUyMHNwbGl0JTIwdGhlJTIwdGFzayUyMGludG8lMjBpbnRlcm1lZGlhdGUlMjBjb2RlJTIwYmxvY2tzLiUwQVByaW50JTIwcmVzdWx0cyUyMGF0JTIwdGhlJTIwZW5kJTIwb2YlMjBlYWNoJTIwc3RlcCUyMHRvJTIwc2F2ZSUyMHRoZSUyMGludGVybWVkaWF0ZSUyMHJlc3VsdHMuJTIwVGhlbiUyMHVzZSUyMGZpbmFsX2Fuc3dlcigpJTIwdG8lMjByZXR1cm4lMjB0aGUlMjBmaW5hbCUyMHJlc3VsdC4lMEElMEFSZW1lbWJlciUyMHRvJTIwbWFrZSUyMHN1cmUlMjB0aGF0JTIwdmFyaWFibGVzJTIweW91JTIwdXNlJTIwYXJlJTIwYWxsJTIwZGVmaW5lZC4lMEElMEFOb3clMjBCZWdpbiE=",highlighted:`You will be given a task to solve as best you can.
You have access to the following tools:
&lt;&lt;tool_descriptions&gt;&gt;

To solve the task, you must plan forward to proceed in a series of steps, in a cycle of &#x27;Thought:&#x27;, &#x27;Code:&#x27;, and &#x27;Observation:&#x27; sequences.

At each step, in the &#x27;Thought:&#x27; sequence, you should first explain your reasoning towards solving the task, then the tools that you want to use.
Then in the &#x27;Code:&#x27; sequence, you should write the code in simple Python. The code sequence must end with &#x27;/End code&#x27; sequence.
During each intermediate step, you can use &#x27;print()&#x27; to save whatever important information you will then need.
These print outputs will then be available in the &#x27;Observation:&#x27; field, for using this information as input for the next step.

In the end you have to return a final answer using the \`final_answer\` tool.

Here are a few examples using notional tools:
---
{examples}

Above example were using notional tools that might not exist for you. You only have acces to those tools:
&lt;&lt;tool_names&gt;&gt;
You also can perform computations in the python code you generate.

Always provide a &#x27;Thought:&#x27; and a &#x27;Code:\\n\`\`\`py&#x27; sequence ending with &#x27;\`\`\`&lt;end_code&gt;&#x27; sequence. You MUST provide at least the &#x27;Code:&#x27; sequence to move forward.

Remember to not perform too many operations in a single code block! You should split the task into intermediate code blocks.
Print results at the end of each step to save the intermediate results. Then use final_answer() to return the final result.

Remember to make sure that variables you use are all defined.

Now Begin!`,wrap:!1}}),jt=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0SnNvbkFnZW50JTBBZnJvbSUyMHRyYW5zZm9ybWVycy5hZ2VudHMlMjBpbXBvcnQlMjBQeXRob25JbnRlcnByZXRlclRvb2wlMEElMEFhZ2VudCUyMCUzRCUyMFJlYWN0SnNvbkFnZW50KHRvb2xzJTNEJTVCUHl0aG9uSW50ZXJwcmV0ZXJUb29sKCklNUQlMkMlMjBzeXN0ZW1fcHJvbXB0JTNEJTIyJTdCeW91cl9jdXN0b21fcHJvbXB0JTdEJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactJsonAgent
<span class="hljs-keyword">from</span> transformers.agents <span class="hljs-keyword">import</span> PythonInterpreterTool

agent = ReactJsonAgent(tools=[PythonInterpreterTool()], system_prompt=<span class="hljs-string">&quot;{your_custom_prompt}&quot;</span>)`,wrap:!1}}),vt=new b({props:{title:"检查智能体的运行",local:"检查智能体的运行",headingTag:"h3"}}),Ct=new b({props:{title:"工具",local:"工具",headingTag:"h2"}}),xt=new b({props:{title:"默认工具箱",local:"默认工具箱",headingTag:"h3"}}),Ht=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGxvYWRfdG9vbCUwQSUwQXRvb2wlMjAlM0QlMjBsb2FkX3Rvb2woJTIydGV4dC10by1zcGVlY2glMjIpJTBBYXVkaW8lMjAlM0QlMjB0b29sKCUyMlRoaXMlMjBpcyUyMGElMjB0ZXh0JTIwdG8lMjBzcGVlY2glMjB0b29sJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> load_tool

tool = load_tool(<span class="hljs-string">&quot;text-to-speech&quot;</span>)
audio = tool(<span class="hljs-string">&quot;This is a text to speech tool&quot;</span>)`,wrap:!1}}),kt=new b({props:{title:"创建新工具",local:"创建新工具",headingTag:"h3"}}),Qt=new T({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxpc3RfbW9kZWxzJTBBJTBBdGFzayUyMCUzRCUyMCUyMnRleHQtY2xhc3NpZmljYXRpb24lMjIlMEElMEFtb2RlbCUyMCUzRCUyMG5leHQoaXRlcihsaXN0X21vZGVscyhmaWx0ZXIlM0R0YXNrJTJDJTIwc29ydCUzRCUyMmRvd25sb2FkcyUyMiUyQyUyMGRpcmVjdGlvbiUzRC0xKSkpJTBBcHJpbnQobW9kZWwuaWQp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> list_models

task = <span class="hljs-string">&quot;text-classification&quot;</span>

model = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(list_models(<span class="hljs-built_in">filter</span>=task, sort=<span class="hljs-string">&quot;downloads&quot;</span>, direction=-<span class="hljs-number">1</span>)))
<span class="hljs-built_in">print</span>(model.<span class="hljs-built_in">id</span>)`,wrap:!1}}),zt=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHRvb2wlMEElMEElNDB0b29sJTBBZGVmJTIwbW9kZWxfZG93bmxvYWRfdG9vbCh0YXNrJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMjAlMjAlMjAlMjBUaGlzJTIwaXMlMjBhJTIwdG9vbCUyMHRoYXQlMjByZXR1cm5zJTIwdGhlJTIwbW9zdCUyMGRvd25sb2FkZWQlMjBtb2RlbCUyMG9mJTIwYSUyMGdpdmVuJTIwdGFzayUyMG9uJTIwdGhlJTIwSHVnZ2luZyUyMEZhY2UlMjBIdWIuJTBBJTIwJTIwJTIwJTIwSXQlMjByZXR1cm5zJTIwdGhlJTIwbmFtZSUyMG9mJTIwdGhlJTIwY2hlY2twb2ludC4lMEElMEElMjAlMjAlMjAlMjBBcmdzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdGFzayUzQSUyMFRoZSUyMHRhc2slMjBmb3IlMjB3aGljaCUwQSUyMCUyMCUyMCUyMCUyMiUyMiUyMiUwQSUyMCUyMCUyMCUyMG1vZGVsJTIwJTNEJTIwbmV4dChpdGVyKGxpc3RfbW9kZWxzKGZpbHRlciUzRCUyMnRleHQtY2xhc3NpZmljYXRpb24lMjIlMkMlMjBzb3J0JTNEJTIyZG93bmxvYWRzJTIyJTJDJTIwZGlyZWN0aW9uJTNELTEpKSklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBtb2RlbC5pZA==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> tool

<span class="hljs-meta">@tool</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">model_download_tool</span>(<span class="hljs-params">task: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;
    This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub.
    It returns the name of the checkpoint.

    Args:
        task: The task for which
    &quot;&quot;&quot;</span>
    model = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(list_models(<span class="hljs-built_in">filter</span>=<span class="hljs-string">&quot;text-classification&quot;</span>, sort=<span class="hljs-string">&quot;downloads&quot;</span>, direction=-<span class="hljs-number">1</span>)))
    <span class="hljs-keyword">return</span> model.<span class="hljs-built_in">id</span>`,wrap:!1}}),At=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVBZ2VudCUwQWFnZW50JTIwJTNEJTIwQ29kZUFnZW50KHRvb2xzJTNEJTVCbW9kZWxfZG93bmxvYWRfdG9vbCU1RCUyQyUyMGxsbV9lbmdpbmUlM0RsbG1fZW5naW5lKSUwQWFnZW50LnJ1biglMEElMjAlMjAlMjAlMjAlMjJDYW4lMjB5b3UlMjBnaXZlJTIwbWUlMjB0aGUlMjBuYW1lJTIwb2YlMjB0aGUlMjBtb2RlbCUyMHRoYXQlMjBoYXMlMjB0aGUlMjBtb3N0JTIwZG93bmxvYWRzJTIwaW4lMjB0aGUlMjAndGV4dC10by12aWRlbyclMjB0YXNrJTIwb24lMjB0aGUlMjBIdWdnaW5nJTIwRmFjZSUyMEh1YiUzRiUyMiUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeAgent
agent = CodeAgent(tools=[model_download_tool], llm_engine=llm_engine)
agent.run(
    <span class="hljs-string">&quot;Can you give me the name of the model that has the most downloads in the &#x27;text-to-video&#x27; task on the Hugging Face Hub?&quot;</span>
)`,wrap:!1}}),Pt=new T({props:{code:"JTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTIwTmV3JTIwdGFzayUyMCUzRCUzRCUzRCUzRCUzRCUzRCUzRCUzRCUwQUNhbiUyMHlvdSUyMGdpdmUlMjBtZSUyMHRoZSUyMG5hbWUlMjBvZiUyMHRoZSUyMG1vZGVsJTIwdGhhdCUyMGhhcyUyMHRoZSUyMG1vc3QlMjBkb3dubG9hZHMlMjBpbiUyMHRoZSUyMCd0ZXh0LXRvLXZpZGVvJyUyMHRhc2slMjBvbiUyMHRoZSUyMEh1Z2dpbmclMjBGYWNlJTIwSHViJTNGJTBBJTNEJTNEJTNEJTNEJTIwQWdlbnQlMjBpcyUyMGV4ZWN1dGluZyUyMHRoZSUyMGNvZGUlMjBiZWxvdyUzQSUwQW1vc3RfZG93bmxvYWRlZF9tb2RlbCUyMCUzRCUyMG1vZGVsX2Rvd25sb2FkX3Rvb2wodGFzayUzRCUyMnRleHQtdG8tdmlkZW8lMjIpJTBBcHJpbnQoZiUyMlRoZSUyMG1vc3QlMjBkb3dubG9hZGVkJTIwbW9kZWwlMjBmb3IlMjB0aGUlMjAndGV4dC10by12aWRlbyclMjB0YXNrJTIwaXMlMjAlN0Jtb3N0X2Rvd25sb2FkZWRfbW9kZWwlN0QuJTIyKSUwQSUzRCUzRCUzRCUzRA==",highlighted:`======== New task ========
Can you give me the name of the model that has the most downloads in the &#x27;text-to-video&#x27; task on the Hugging Face Hub?
==== Agent is executing the code below:
most_downloaded_model = model_download_tool(task=&quot;text-to-video&quot;)
print(f&quot;The most downloaded model for the &#x27;text-to-video&#x27; task is {most_downloaded_model}.&quot;)
====`,wrap:!1}}),Kt=new b({props:{title:"管理智能体的工具箱",local:"管理智能体的工具箱",headingTag:"h3"}}),ee=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVBZ2VudCUwQSUwQWFnZW50JTIwJTNEJTIwQ29kZUFnZW50KHRvb2xzJTNEJTVCJTVEJTJDJTIwbGxtX2VuZ2luZSUzRGxsbV9lbmdpbmUlMkMlMjBhZGRfYmFzZV90b29scyUzRFRydWUpJTBBYWdlbnQudG9vbGJveC5hZGRfdG9vbChtb2RlbF9kb3dubG9hZF90b29sKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeAgent

agent = CodeAgent(tools=[], llm_engine=llm_engine, add_base_tools=<span class="hljs-literal">True</span>)
agent.toolbox.add_tool(model_download_tool)`,wrap:!1}}),se=new T({props:{code:"YWdlbnQucnVuKCUwQSUyMCUyMCUyMCUyMCUyMkNhbiUyMHlvdSUyMHJlYWQlMjBvdXQlMjBsb3VkJTIwdGhlJTIwbmFtZSUyMG9mJTIwdGhlJTIwbW9kZWwlMjB0aGF0JTIwaGFzJTIwdGhlJTIwbW9zdCUyMGRvd25sb2FkcyUyMGluJTIwdGhlJTIwJ3RleHQtdG8tdmlkZW8nJTIwdGFzayUyMG9uJTIwdGhlJTIwSHVnZ2luZyUyMEZhY2UlMjBIdWIlMjBhbmQlMjByZXR1cm4lMjB0aGUlMjBhdWRpbyUzRiUyMiUwQSk=",highlighted:`agent.run(
    <span class="hljs-string">&quot;Can you read out loud the name of the model that has the most downloads in the &#x27;text-to-video&#x27; task on the Hugging Face Hub and return the audio?&quot;</span>
)`,wrap:!1}}),oe=new b({props:{title:"使用工具集合",local:"使用工具集合",headingTag:"h3"}}),Me=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2xDb2xsZWN0aW9uJTJDJTIwUmVhY3RDb2RlQWdlbnQlMEElMEFpbWFnZV90b29sX2NvbGxlY3Rpb24lMjAlM0QlMjBUb29sQ29sbGVjdGlvbihjb2xsZWN0aW9uX3NsdWclM0QlMjJodWdnaW5nZmFjZS10b29scyUyRmRpZmZ1c2lvbi10b29scy02NjMwYmIxOWE5NDJjMjMwNmEyY2RiNmYlMjIpJTBBYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCh0b29scyUzRCU1QippbWFnZV90b29sX2NvbGxlY3Rpb24udG9vbHMlNUQlMkMlMjBhZGRfYmFzZV90b29scyUzRFRydWUpJTBBJTBBYWdlbnQucnVuKCUyMlBsZWFzZSUyMGRyYXclMjBtZSUyMGElMjBwaWN0dXJlJTIwb2YlMjByaXZlcnMlMjBhbmQlMjBsYWtlcy4lMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ToolCollection, ReactCodeAgent

image_tool_collection = ToolCollection(collection_slug=<span class="hljs-string">&quot;huggingface-tools/diffusion-tools-6630bb19a942c2306a2cdb6f&quot;</span>)
agent = ReactCodeAgent(tools=[*image_tool_collection.tools], add_base_tools=<span class="hljs-literal">True</span>)

agent.run(<span class="hljs-string">&quot;Please draw me a picture of rivers and lakes.&quot;</span>)`,wrap:!1}}),ue=new Yn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/agents.md"}}),{c(){r=i("meta"),f=n(),J=i("p"),ye=n(),M(h.$$.fragment),be=n(),j=i("p"),j.textContent=ys,Je=n(),M(g.$$.fragment),Ue=n(),v=i("p"),v.innerHTML=cs,we=n(),G=i("p"),G.innerHTML=Ts,fe=n(),B=i("p"),B.innerHTML=rs,he=n(),C=i("p"),C.innerHTML=bs,je=n(),Z=i("p"),Z.textContent=Js,ge=n(),I=i("ul"),I.innerHTML=Us,ve=n(),M($.$$.fragment),Ge=n(),M(x.$$.fragment),Be=n(),W=i("p"),W.textContent=ws,Ce=n(),M(R.$$.fragment),Ze=n(),_=i("p"),_.innerHTML=fs,Ie=n(),H=i("p"),H.textContent=hs,$e=n(),k=i("ul"),k.innerHTML=js,xe=n(),V=i("blockquote"),V.innerHTML=gs,We=n(),U=i("div"),U.innerHTML=vs,Re=n(),Y=i("p"),Y.innerHTML=Gs,_e=n(),Q=i("p"),Q.textContent=Bs,He=n(),M(N.$$.fragment),ke=n(),M(z.$$.fragment),Ve=n(),L=i("p"),L.textContent=Cs,Ye=n(),S=i("ul"),S.innerHTML=Zs,Qe=n(),E=i("p"),E.textContent=Is,Ne=n(),F=i("p"),F.innerHTML=$s,ze=n(),X=i("p"),X.innerHTML=xs,Le=n(),M(A.$$.fragment),Se=n(),q=i("p"),q.innerHTML=Ws,Ee=n(),P=i("p"),P.innerHTML=Rs,Fe=n(),M(D.$$.fragment),Xe=n(),K=i("p"),K.innerHTML=_s,Ae=n(),O=i("ol"),O.innerHTML=Hs,qe=n(),tt=i("p"),tt.innerHTML=ks,Pe=n(),et=i("p"),et.innerHTML=Vs,De=n(),lt=i("p"),lt.innerHTML=Ys,Ke=n(),M(st.$$.fragment),Oe=n(),nt=i("p"),nt.innerHTML=Qs,tl=n(),M(at.$$.fragment),el=n(),it=i("p"),it.innerHTML=Ns,ll=n(),ot=i("p"),ot.textContent=zs,sl=n(),M(pt.$$.fragment),nl=n(),Mt=i("p"),Mt.innerHTML=Ls,al=n(),M(dt.$$.fragment),il=n(),mt=i("p"),mt.innerHTML=Ss,ol=n(),M(ut.$$.fragment),pl=n(),yt=i("p"),yt.textContent=Es,Ml=n(),ct=i("p"),ct.innerHTML=Fs,dl=n(),M(Tt.$$.fragment),ml=n(),rt=i("p"),rt.textContent=Xs,ul=n(),M(w.$$.fragment),yl=n(),M(bt.$$.fragment),cl=n(),Jt=i("p"),Jt.innerHTML=As,Tl=n(),M(Ut.$$.fragment),rl=n(),wt=i("p"),wt.textContent=qs,bl=n(),ft=i("ul"),ft.innerHTML=Ps,Jl=n(),ht=i("p"),ht.innerHTML=Ds,Ul=n(),M(jt.$$.fragment),wl=n(),gt=i("blockquote"),gt.innerHTML=Ks,fl=n(),M(vt.$$.fragment),hl=n(),Gt=i("p"),Gt.textContent=Os,jl=n(),Bt=i("ul"),Bt.innerHTML=tn,gl=n(),M(Ct.$$.fragment),vl=n(),Zt=i("p"),Zt.textContent=en,Gl=n(),It=i("p"),It.innerHTML=ln,Bl=n(),$t=i("p"),$t.textContent=sn,Cl=n(),M(xt.$$.fragment),Zl=n(),Wt=i("p"),Wt.innerHTML=nn,Il=n(),Rt=i("ul"),Rt.innerHTML=an,$l=n(),_t=i("p"),_t.innerHTML=on,xl=n(),M(Ht.$$.fragment),Wl=n(),M(kt.$$.fragment),Rl=n(),Vt=i("p"),Vt.innerHTML=pn,_l=n(),Yt=i("p"),Yt.textContent=Mn,Hl=n(),M(Qt.$$.fragment),kl=n(),Nt=i("p"),Nt.innerHTML=dn,Vl=n(),M(zt.$$.fragment),Yl=n(),Lt=i("p"),Lt.textContent=mn,Ql=n(),St=i("ul"),St.innerHTML=un,Nl=n(),Et=i("p"),Et.textContent=yn,zl=n(),Ft=i("blockquote"),Ft.innerHTML=cn,Ll=n(),Xt=i("p"),Xt.textContent=Tn,Sl=n(),M(At.$$.fragment),El=n(),qt=i("p"),qt.textContent=rn,Fl=n(),M(Pt.$$.fragment),Xl=n(),Dt=i("p"),Dt.innerHTML=bn,Al=n(),M(Kt.$$.fragment),ql=n(),Ot=i("p"),Ot.textContent=Jn,Pl=n(),te=i("p"),te.innerHTML=Un,Dl=n(),M(ee.$$.fragment),Kl=n(),le=i("p"),le.textContent=wn,Ol=n(),M(se.$$.fragment),ts=n(),ne=i("table"),ne.innerHTML=fn,es=n(),ae=i("blockquote"),ae.innerHTML=hn,ls=n(),ie=i("p"),ie.textContent=jn,ss=n(),M(oe.$$.fragment),ns=n(),pe=i("p"),pe.textContent=gn,as=n(),M(Me.$$.fragment),is=n(),de=i("p"),de.textContent=vn,os=n(),me=i("p"),me.textContent=Gn,ps=n(),ce=i("img"),Ms=n(),M(ue.$$.fragment),ds=n(),Te=i("p"),this.h()},l(t){const e=Hn("svelte-u9bgzb",document.head);r=o(e,"META",{name:!0,content:!0}),e.forEach(l),f=a(t),J=o(t,"P",{}),Zn(J).forEach(l),ye=a(t),d(h.$$.fragment,t),be=a(t),j=o(t,"P",{"data-svelte-h":!0}),p(j)!=="svelte-1mvq2bg"&&(j.textContent=ys),Je=a(t),d(g.$$.fragment,t),Ue=a(t),v=o(t,"P",{"data-svelte-h":!0}),p(v)!=="svelte-ef32vy"&&(v.innerHTML=cs),we=a(t),G=o(t,"P",{"data-svelte-h":!0}),p(G)!=="svelte-cgqhc7"&&(G.innerHTML=Ts),fe=a(t),B=o(t,"P",{"data-svelte-h":!0}),p(B)!=="svelte-1a5pkgz"&&(B.innerHTML=rs),he=a(t),C=o(t,"P",{"data-svelte-h":!0}),p(C)!=="svelte-m65bgg"&&(C.innerHTML=bs),je=a(t),Z=o(t,"P",{"data-svelte-h":!0}),p(Z)!=="svelte-165m7j0"&&(Z.textContent=Js),ge=a(t),I=o(t,"UL",{"data-svelte-h":!0}),p(I)!=="svelte-209zju"&&(I.innerHTML=Us),ve=a(t),d($.$$.fragment,t),Ge=a(t),d(x.$$.fragment,t),Be=a(t),W=o(t,"P",{"data-svelte-h":!0}),p(W)!=="svelte-1117uxx"&&(W.textContent=ws),Ce=a(t),d(R.$$.fragment,t),Ze=a(t),_=o(t,"P",{"data-svelte-h":!0}),p(_)!=="svelte-1muyo28"&&(_.innerHTML=fs),Ie=a(t),H=o(t,"P",{"data-svelte-h":!0}),p(H)!=="svelte-16roas"&&(H.textContent=hs),$e=a(t),k=o(t,"UL",{"data-svelte-h":!0}),p(k)!=="svelte-1968zlw"&&(k.innerHTML=js),xe=a(t),V=o(t,"BLOCKQUOTE",{"data-svelte-h":!0}),p(V)!=="svelte-17g7gp3"&&(V.innerHTML=gs),We=a(t),U=o(t,"DIV",{class:!0,"data-svelte-h":!0}),p(U)!=="svelte-4ra9xq"&&(U.innerHTML=vs),Re=a(t),Y=o(t,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-lgcprl"&&(Y.innerHTML=Gs),_e=a(t),Q=o(t,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-1p0x3dx"&&(Q.textContent=Bs),He=a(t),d(N.$$.fragment,t),ke=a(t),d(z.$$.fragment,t),Ve=a(t),L=o(t,"P",{"data-svelte-h":!0}),p(L)!=="svelte-otz4wa"&&(L.textContent=Cs),Ye=a(t),S=o(t,"UL",{"data-svelte-h":!0}),p(S)!=="svelte-579rb7"&&(S.innerHTML=Zs),Qe=a(t),E=o(t,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1f0hfxw"&&(E.textContent=Is),Ne=a(t),F=o(t,"P",{"data-svelte-h":!0}),p(F)!=="svelte-14a83lq"&&(F.innerHTML=$s),ze=a(t),X=o(t,"P",{"data-svelte-h":!0}),p(X)!=="svelte-1783g40"&&(X.innerHTML=xs),Le=a(t),d(A.$$.fragment,t),Se=a(t),q=o(t,"P",{"data-svelte-h":!0}),p(q)!=="svelte-134u146"&&(q.innerHTML=Ws),Ee=a(t),P=o(t,"P",{"data-svelte-h":!0}),p(P)!=="svelte-icjv9l"&&(P.innerHTML=Rs),Fe=a(t),d(D.$$.fragment,t),Xe=a(t),K=o(t,"P",{"data-svelte-h":!0}),p(K)!=="svelte-1815xc7"&&(K.innerHTML=_s),Ae=a(t),O=o(t,"OL",{"data-svelte-h":!0}),p(O)!=="svelte-inph9l"&&(O.innerHTML=Hs),qe=a(t),tt=o(t,"P",{"data-svelte-h":!0}),p(tt)!=="svelte-lg0gbb"&&(tt.innerHTML=ks),Pe=a(t),et=o(t,"P",{"data-svelte-h":!0}),p(et)!=="svelte-1b12fu2"&&(et.innerHTML=Vs),De=a(t),lt=o(t,"P",{"data-svelte-h":!0}),p(lt)!=="svelte-o7u8ok"&&(lt.innerHTML=Ys),Ke=a(t),d(st.$$.fragment,t),Oe=a(t),nt=o(t,"P",{"data-svelte-h":!0}),p(nt)!=="svelte-1a2znd2"&&(nt.innerHTML=Qs),tl=a(t),d(at.$$.fragment,t),el=a(t),it=o(t,"P",{"data-svelte-h":!0}),p(it)!=="svelte-18lrtnx"&&(it.innerHTML=Ns),ll=a(t),ot=o(t,"P",{"data-svelte-h":!0}),p(ot)!=="svelte-ouwdnr"&&(ot.textContent=zs),sl=a(t),d(pt.$$.fragment,t),nl=a(t),Mt=o(t,"P",{"data-svelte-h":!0}),p(Mt)!=="svelte-18jeepa"&&(Mt.innerHTML=Ls),al=a(t),d(dt.$$.fragment,t),il=a(t),mt=o(t,"P",{"data-svelte-h":!0}),p(mt)!=="svelte-70xs9o"&&(mt.innerHTML=Ss),ol=a(t),d(ut.$$.fragment,t),pl=a(t),yt=o(t,"P",{"data-svelte-h":!0}),p(yt)!=="svelte-1feoyck"&&(yt.textContent=Es),Ml=a(t),ct=o(t,"P",{"data-svelte-h":!0}),p(ct)!=="svelte-rqycxe"&&(ct.innerHTML=Fs),dl=a(t),d(Tt.$$.fragment,t),ml=a(t),rt=o(t,"P",{"data-svelte-h":!0}),p(rt)!=="svelte-11s74o9"&&(rt.textContent=Xs),ul=a(t),d(w.$$.fragment,t),yl=a(t),d(bt.$$.fragment,t),cl=a(t),Jt=o(t,"P",{"data-svelte-h":!0}),p(Jt)!=="svelte-1pq1fgf"&&(Jt.innerHTML=As),Tl=a(t),d(Ut.$$.fragment,t),rl=a(t),wt=o(t,"P",{"data-svelte-h":!0}),p(wt)!=="svelte-1j37dx9"&&(wt.textContent=qs),bl=a(t),ft=o(t,"UL",{"data-svelte-h":!0}),p(ft)!=="svelte-1ipqwrz"&&(ft.innerHTML=Ps),Jl=a(t),ht=o(t,"P",{"data-svelte-h":!0}),p(ht)!=="svelte-1xzhos0"&&(ht.innerHTML=Ds),Ul=a(t),d(jt.$$.fragment,t),wl=a(t),gt=o(t,"BLOCKQUOTE",{"data-svelte-h":!0}),p(gt)!=="svelte-5gno07"&&(gt.innerHTML=Ks),fl=a(t),d(vt.$$.fragment,t),hl=a(t),Gt=o(t,"P",{"data-svelte-h":!0}),p(Gt)!=="svelte-1kdjfz1"&&(Gt.textContent=Os),jl=a(t),Bt=o(t,"UL",{"data-svelte-h":!0}),p(Bt)!=="svelte-1nsn75t"&&(Bt.innerHTML=tn),gl=a(t),d(Ct.$$.fragment,t),vl=a(t),Zt=o(t,"P",{"data-svelte-h":!0}),p(Zt)!=="svelte-bs4tii"&&(Zt.textContent=en),Gl=a(t),It=o(t,"P",{"data-svelte-h":!0}),p(It)!=="svelte-15minop"&&(It.innerHTML=ln),Bl=a(t),$t=o(t,"P",{"data-svelte-h":!0}),p($t)!=="svelte-1rnqdq2"&&($t.textContent=sn),Cl=a(t),d(xt.$$.fragment,t),Zl=a(t),Wt=o(t,"P",{"data-svelte-h":!0}),p(Wt)!=="svelte-1kj0t88"&&(Wt.innerHTML=nn),Il=a(t),Rt=o(t,"UL",{"data-svelte-h":!0}),p(Rt)!=="svelte-1b70i09"&&(Rt.innerHTML=an),$l=a(t),_t=o(t,"P",{"data-svelte-h":!0}),p(_t)!=="svelte-e4um8g"&&(_t.innerHTML=on),xl=a(t),d(Ht.$$.fragment,t),Wl=a(t),d(kt.$$.fragment,t),Rl=a(t),Vt=o(t,"P",{"data-svelte-h":!0}),p(Vt)!=="svelte-huooy7"&&(Vt.innerHTML=pn),_l=a(t),Yt=o(t,"P",{"data-svelte-h":!0}),p(Yt)!=="svelte-1tnmr3f"&&(Yt.textContent=Mn),Hl=a(t),d(Qt.$$.fragment,t),kl=a(t),Nt=o(t,"P",{"data-svelte-h":!0}),p(Nt)!=="svelte-1dkifp9"&&(Nt.innerHTML=dn),Vl=a(t),d(zt.$$.fragment,t),Yl=a(t),Lt=o(t,"P",{"data-svelte-h":!0}),p(Lt)!=="svelte-1mlpr5v"&&(Lt.textContent=mn),Ql=a(t),St=o(t,"UL",{"data-svelte-h":!0}),p(St)!=="svelte-1oor9vs"&&(St.innerHTML=un),Nl=a(t),Et=o(t,"P",{"data-svelte-h":!0}),p(Et)!=="svelte-ufthnr"&&(Et.textContent=yn),zl=a(t),Ft=o(t,"BLOCKQUOTE",{"data-svelte-h":!0}),p(Ft)!=="svelte-5lhgqx"&&(Ft.innerHTML=cn),Ll=a(t),Xt=o(t,"P",{"data-svelte-h":!0}),p(Xt)!=="svelte-1ulrxuj"&&(Xt.textContent=Tn),Sl=a(t),d(At.$$.fragment,t),El=a(t),qt=o(t,"P",{"data-svelte-h":!0}),p(qt)!=="svelte-pdu9a6"&&(qt.textContent=rn),Fl=a(t),d(Pt.$$.fragment,t),Xl=a(t),Dt=o(t,"P",{"data-svelte-h":!0}),p(Dt)!=="svelte-1nll0at"&&(Dt.innerHTML=bn),Al=a(t),d(Kt.$$.fragment,t),ql=a(t),Ot=o(t,"P",{"data-svelte-h":!0}),p(Ot)!=="svelte-1qumkxn"&&(Ot.textContent=Jn),Pl=a(t),te=o(t,"P",{"data-svelte-h":!0}),p(te)!=="svelte-v5lscd"&&(te.innerHTML=Un),Dl=a(t),d(ee.$$.fragment,t),Kl=a(t),le=o(t,"P",{"data-svelte-h":!0}),p(le)!=="svelte-8colcn"&&(le.textContent=wn),Ol=a(t),d(se.$$.fragment,t),ts=a(t),ne=o(t,"TABLE",{"data-svelte-h":!0}),p(ne)!=="svelte-1tqzmpy"&&(ne.innerHTML=fn),es=a(t),ae=o(t,"BLOCKQUOTE",{"data-svelte-h":!0}),p(ae)!=="svelte-1p3wr3m"&&(ae.innerHTML=hn),ls=a(t),ie=o(t,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-17cek8r"&&(ie.textContent=jn),ss=a(t),d(oe.$$.fragment,t),ns=a(t),pe=o(t,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-11mjdcu"&&(pe.textContent=gn),as=a(t),d(Me.$$.fragment,t),is=a(t),de=o(t,"P",{"data-svelte-h":!0}),p(de)!=="svelte-14d9o37"&&(de.textContent=vn),os=a(t),me=o(t,"P",{"data-svelte-h":!0}),p(me)!=="svelte-1ujnlvm"&&(me.textContent=Gn),ps=a(t),ce=o(t,"IMG",{src:!0}),Ms=a(t),d(ue.$$.fragment,t),ds=a(t),Te=o(t,"P",{}),Zn(Te).forEach(l),this.h()},h(){us(r,"name","hf:doc:metadata"),us(r,"content",zn),us(U,"class","flex justify-center"),$n(ce.src,Bn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes.png")||us(ce,"src",Bn)},m(t,e){kn(document.head,r),s(t,f,e),s(t,J,e),s(t,ye,e),m(h,t,e),s(t,be,e),s(t,j,e),s(t,Je,e),m(g,t,e),s(t,Ue,e),s(t,v,e),s(t,we,e),s(t,G,e),s(t,fe,e),s(t,B,e),s(t,he,e),s(t,C,e),s(t,je,e),s(t,Z,e),s(t,ge,e),s(t,I,e),s(t,ve,e),m($,t,e),s(t,Ge,e),m(x,t,e),s(t,Be,e),s(t,W,e),s(t,Ce,e),m(R,t,e),s(t,Ze,e),s(t,_,e),s(t,Ie,e),s(t,H,e),s(t,$e,e),s(t,k,e),s(t,xe,e),s(t,V,e),s(t,We,e),s(t,U,e),s(t,Re,e),s(t,Y,e),s(t,_e,e),s(t,Q,e),s(t,He,e),m(N,t,e),s(t,ke,e),m(z,t,e),s(t,Ve,e),s(t,L,e),s(t,Ye,e),s(t,S,e),s(t,Qe,e),s(t,E,e),s(t,Ne,e),s(t,F,e),s(t,ze,e),s(t,X,e),s(t,Le,e),m(A,t,e),s(t,Se,e),s(t,q,e),s(t,Ee,e),s(t,P,e),s(t,Fe,e),m(D,t,e),s(t,Xe,e),s(t,K,e),s(t,Ae,e),s(t,O,e),s(t,qe,e),s(t,tt,e),s(t,Pe,e),s(t,et,e),s(t,De,e),s(t,lt,e),s(t,Ke,e),m(st,t,e),s(t,Oe,e),s(t,nt,e),s(t,tl,e),m(at,t,e),s(t,el,e),s(t,it,e),s(t,ll,e),s(t,ot,e),s(t,sl,e),m(pt,t,e),s(t,nl,e),s(t,Mt,e),s(t,al,e),m(dt,t,e),s(t,il,e),s(t,mt,e),s(t,ol,e),m(ut,t,e),s(t,pl,e),s(t,yt,e),s(t,Ml,e),s(t,ct,e),s(t,dl,e),m(Tt,t,e),s(t,ml,e),s(t,rt,e),s(t,ul,e),m(w,t,e),s(t,yl,e),m(bt,t,e),s(t,cl,e),s(t,Jt,e),s(t,Tl,e),m(Ut,t,e),s(t,rl,e),s(t,wt,e),s(t,bl,e),s(t,ft,e),s(t,Jl,e),s(t,ht,e),s(t,Ul,e),m(jt,t,e),s(t,wl,e),s(t,gt,e),s(t,fl,e),m(vt,t,e),s(t,hl,e),s(t,Gt,e),s(t,jl,e),s(t,Bt,e),s(t,gl,e),m(Ct,t,e),s(t,vl,e),s(t,Zt,e),s(t,Gl,e),s(t,It,e),s(t,Bl,e),s(t,$t,e),s(t,Cl,e),m(xt,t,e),s(t,Zl,e),s(t,Wt,e),s(t,Il,e),s(t,Rt,e),s(t,$l,e),s(t,_t,e),s(t,xl,e),m(Ht,t,e),s(t,Wl,e),m(kt,t,e),s(t,Rl,e),s(t,Vt,e),s(t,_l,e),s(t,Yt,e),s(t,Hl,e),m(Qt,t,e),s(t,kl,e),s(t,Nt,e),s(t,Vl,e),m(zt,t,e),s(t,Yl,e),s(t,Lt,e),s(t,Ql,e),s(t,St,e),s(t,Nl,e),s(t,Et,e),s(t,zl,e),s(t,Ft,e),s(t,Ll,e),s(t,Xt,e),s(t,Sl,e),m(At,t,e),s(t,El,e),s(t,qt,e),s(t,Fl,e),m(Pt,t,e),s(t,Xl,e),s(t,Dt,e),s(t,Al,e),m(Kt,t,e),s(t,ql,e),s(t,Ot,e),s(t,Pl,e),s(t,te,e),s(t,Dl,e),m(ee,t,e),s(t,Kl,e),s(t,le,e),s(t,Ol,e),m(se,t,e),s(t,ts,e),s(t,ne,e),s(t,es,e),s(t,ae,e),s(t,ls,e),s(t,ie,e),s(t,ss,e),m(oe,t,e),s(t,ns,e),s(t,pe,e),s(t,as,e),m(Me,t,e),s(t,is,e),s(t,de,e),s(t,os,e),s(t,me,e),s(t,ps,e),s(t,ce,e),s(t,Ms,e),m(ue,t,e),s(t,ds,e),s(t,Te,e),ms=!0},p(t,[e]){const Cn={};e&2&&(Cn.$$scope={dirty:e,ctx:t}),w.$set(Cn)},i(t){ms||(u(h.$$.fragment,t),u(g.$$.fragment,t),u($.$$.fragment,t),u(x.$$.fragment,t),u(R.$$.fragment,t),u(N.$$.fragment,t),u(z.$$.fragment,t),u(A.$$.fragment,t),u(D.$$.fragment,t),u(st.$$.fragment,t),u(at.$$.fragment,t),u(pt.$$.fragment,t),u(dt.$$.fragment,t),u(ut.$$.fragment,t),u(Tt.$$.fragment,t),u(w.$$.fragment,t),u(bt.$$.fragment,t),u(Ut.$$.fragment,t),u(jt.$$.fragment,t),u(vt.$$.fragment,t),u(Ct.$$.fragment,t),u(xt.$$.fragment,t),u(Ht.$$.fragment,t),u(kt.$$.fragment,t),u(Qt.$$.fragment,t),u(zt.$$.fragment,t),u(At.$$.fragment,t),u(Pt.$$.fragment,t),u(Kt.$$.fragment,t),u(ee.$$.fragment,t),u(se.$$.fragment,t),u(oe.$$.fragment,t),u(Me.$$.fragment,t),u(ue.$$.fragment,t),ms=!0)},o(t){y(h.$$.fragment,t),y(g.$$.fragment,t),y($.$$.fragment,t),y(x.$$.fragment,t),y(R.$$.fragment,t),y(N.$$.fragment,t),y(z.$$.fragment,t),y(A.$$.fragment,t),y(D.$$.fragment,t),y(st.$$.fragment,t),y(at.$$.fragment,t),y(pt.$$.fragment,t),y(dt.$$.fragment,t),y(ut.$$.fragment,t),y(Tt.$$.fragment,t),y(w.$$.fragment,t),y(bt.$$.fragment,t),y(Ut.$$.fragment,t),y(jt.$$.fragment,t),y(vt.$$.fragment,t),y(Ct.$$.fragment,t),y(xt.$$.fragment,t),y(Ht.$$.fragment,t),y(kt.$$.fragment,t),y(Qt.$$.fragment,t),y(zt.$$.fragment,t),y(At.$$.fragment,t),y(Pt.$$.fragment,t),y(Kt.$$.fragment,t),y(ee.$$.fragment,t),y(se.$$.fragment,t),y(oe.$$.fragment,t),y(Me.$$.fragment,t),y(ue.$$.fragment,t),ms=!1},d(t){t&&(l(f),l(J),l(ye),l(be),l(j),l(Je),l(Ue),l(v),l(we),l(G),l(fe),l(B),l(he),l(C),l(je),l(Z),l(ge),l(I),l(ve),l(Ge),l(Be),l(W),l(Ce),l(Ze),l(_),l(Ie),l(H),l($e),l(k),l(xe),l(V),l(We),l(U),l(Re),l(Y),l(_e),l(Q),l(He),l(ke),l(Ve),l(L),l(Ye),l(S),l(Qe),l(E),l(Ne),l(F),l(ze),l(X),l(Le),l(Se),l(q),l(Ee),l(P),l(Fe),l(Xe),l(K),l(Ae),l(O),l(qe),l(tt),l(Pe),l(et),l(De),l(lt),l(Ke),l(Oe),l(nt),l(tl),l(el),l(it),l(ll),l(ot),l(sl),l(nl),l(Mt),l(al),l(il),l(mt),l(ol),l(pl),l(yt),l(Ml),l(ct),l(dl),l(ml),l(rt),l(ul),l(yl),l(cl),l(Jt),l(Tl),l(rl),l(wt),l(bl),l(ft),l(Jl),l(ht),l(Ul),l(wl),l(gt),l(fl),l(hl),l(Gt),l(jl),l(Bt),l(gl),l(vl),l(Zt),l(Gl),l(It),l(Bl),l($t),l(Cl),l(Zl),l(Wt),l(Il),l(Rt),l($l),l(_t),l(xl),l(Wl),l(Rl),l(Vt),l(_l),l(Yt),l(Hl),l(kl),l(Nt),l(Vl),l(Yl),l(Lt),l(Ql),l(St),l(Nl),l(Et),l(zl),l(Ft),l(Ll),l(Xt),l(Sl),l(El),l(qt),l(Fl),l(Xl),l(Dt),l(Al),l(ql),l(Ot),l(Pl),l(te),l(Dl),l(Kl),l(le),l(Ol),l(ts),l(ne),l(es),l(ae),l(ls),l(ie),l(ss),l(ns),l(pe),l(as),l(is),l(de),l(os),l(me),l(ps),l(ce),l(Ms),l(ds),l(Te)),l(r),c(h,t),c(g,t),c($,t),c(x,t),c(R,t),c(N,t),c(z,t),c(A,t),c(D,t),c(st,t),c(at,t),c(pt,t),c(dt,t),c(ut,t),c(Tt,t),c(w,t),c(bt,t),c(Ut,t),c(jt,t),c(vt,t),c(Ct,t),c(xt,t),c(Ht,t),c(kt,t),c(Qt,t),c(zt,t),c(At,t),c(Pt,t),c(Kt,t),c(ee,t),c(se,t),c(oe,t),c(Me,t),c(ue,t)}}}const zn='{"title":"智能体和工具","local":"智能体和工具","sections":[{"title":"什么是智能体 (Agent)？","local":"什么是智能体-agent","sections":[],"depth":3},{"title":"智能体类型","local":"智能体类型","sections":[{"title":"代码智能体","local":"代码智能体","sections":[],"depth":4},{"title":"推理智能体","local":"推理智能体","sections":[],"depth":4}],"depth":3},{"title":"如何构建智能体？","local":"如何构建智能体","sections":[{"title":"代码执行","local":"代码执行","sections":[],"depth":4}],"depth":3},{"title":"系统提示","local":"系统提示","sections":[],"depth":3},{"title":"检查智能体的运行","local":"检查智能体的运行","sections":[],"depth":3},{"title":"工具","local":"工具","sections":[{"title":"默认工具箱","local":"默认工具箱","sections":[],"depth":3},{"title":"创建新工具","local":"创建新工具","sections":[],"depth":3},{"title":"管理智能体的工具箱","local":"管理智能体的工具箱","sections":[],"depth":3},{"title":"使用工具集合","local":"使用工具集合","sections":[],"depth":3}],"depth":2}],"depth":1}';function Ln(re){return xn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qn extends Rn{constructor(r){super(),_n(this,r,Ln,Nn,In,{})}}export{qn as component};
