import{s as Pl,f as xl,o as Kl,n as ul}from"../chunks/scheduler.25b97de1.js";import{S as Dl,i as Ol,g as M,s as a,r,A as et,h as i,f as t,c as n,j as Ll,u as m,x as p,k as Tl,y as lt,a as s,v as d,d as y,t as c,w}from"../chunks/index.d9030fc9.js";import{T as Jl}from"../chunks/Tip.baa67368.js";import{C as U}from"../chunks/CodeBlock.e6cd0d95.js";import{D as tt}from"../chunks/DocNotebookDropdown.5ea6cb78.js";import{H as j,E as st}from"../chunks/EditOnGithub.91d95064.js";function at(f){let o,b=`如果你是 <code>transformers.agents</code> 的新手，请先阅读主文档 <a href="./agents">智能体文档 </a>.
在本页面中，我们将重点介绍 <code>transformers.agents</code> 的几种高级用法。`;return{c(){o=M("p"),o.innerHTML=b},l(T){o=i(T,"P",{"data-svelte-h":!0}),p(o)!=="svelte-1bccwv4"&&(o.innerHTML=b)},m(T,u){s(T,o,u)},p:ul,d(T){T&&t(o)}}}function nt(f){let o,b='如果你想深入了解如何高效地实现多智能体系统，请查看 <a href="https://huggingface.co/blog/beating-gaia" rel="nofollow">how we pushed our multi-agent system to the top of the GAIA leaderboard</a>.';return{c(){o=M("p"),o.innerHTML=b},l(T){o=i(T,"P",{"data-svelte-h":!0}),p(o)!=="svelte-n7lhha"&&(o.innerHTML=b)},m(T,u){s(T,o,u)},p:ul,d(T){T&&t(o)}}}function ot(f){let o,b="gradio-tools 需要 <strong>文本</strong> 输入和输出，即使在处理像图像和音频这样的不同模态时也是如此。目前，图像和音频的输入输出与此不兼容。",T,u,g;return u=new j({props:{title:"使用 LangChain 工具",local:"使用-langchain-工具",headingTag:"h3"}}),{c(){o=M("p"),o.innerHTML=b,T=a(),r(u.$$.fragment)},l(J){o=i(J,"P",{"data-svelte-h":!0}),p(o)!=="svelte-vaxd4g"&&(o.innerHTML=b),T=n(J),m(u.$$.fragment,J)},m(J,h){s(J,o,h),s(J,T,h),d(u,J,h),g=!0},p:ul,i(J){g||(y(u.$$.fragment,J),g=!0)},o(J){c(u.$$.fragment,J),g=!1},d(J){J&&(t(o),t(T)),w(u,J)}}}function Mt(f){let o,b,T,u,g,J,h,ge,$,he,I,Ue,v,je,_,bl=`多智能体功能是微软框架 <a href="https://huggingface.co/papers/2308.08155" rel="nofollow">Autogen</a> 中引入的。
它的意思是让多个智能体一起工作来解决任务，而不是只有一个智能体。
经验表明，在大多数基准测试中，这种方法能带来更好的性能。之所以有更好的性能，原因很简单：对于许多任务，通常我们更愿意让多个单独的单元专注于子任务，而不是让一个系统做所有事情。这里，拥有不同工具集和记忆的多个智能体可以实现高效的专业化。`,fe,B,gl="你可以轻松地用 <code>transformers.agents</code> 构建层次化的多智能体系统。",Ie,W,hl="为此，需要将智能体封装在 <code>ManagedAgent</code> 对象中。这个对象需要 <code>agent</code>、<code>name</code> 和 <code>description</code> 这几个参数，这些信息会嵌入到管理智能体的系统提示中，帮助它知道如何调用这个管理的智能体，就像我们对工具所做的那样。",Ce,G,Ul="下面是一个通过使用我们的 <code>DuckDuckGoSearchTool</code> 创建一个管理特定网络搜索智能体的示例：",Ze,k,$e,C,ve,R,_e,H,Be,Q,jl="让我们再次使用主文档中的工具示例，我们已经实现了一个 <code>tool</code> 装饰器。",We,E,fl="如果你需要添加一些变化，比如为工具自定义属性，可以按照更细粒度的方法构建工具：构建一个继承自 <code>Tool</code> 超类的类。",Ge,X,Il="自定义工具需要：",ke,Y,Cl="<li><code>name</code> 属性：表示工具本身的名称，通常描述工具的作用。由于代码返回了针对任务下载量最多的模型，我们将其命名为 model_download_counter。</li> <li><code>description</code> 属性：用于填充智能体的系统提示。</li> <li><code>inputs</code> 属性：这是一个包含 “type” 和 “description” 键的字典。它包含了有助于 Python 解释器做出选择的输入信息。</li> <li><code>output_type</code> 属性：指定输出类型。</li> <li><code>forward</code> 方法：其中包含执行推理代码。</li>",Re,V,Zl='<code>inputs</code> 和 <code>output_type</code> 的类型应当是 <a href="https://docs.pydantic.dev/latest/concepts/json_schema/#generating-json-schema" rel="nofollow">Pydantic 格式</a>。',He,F,Qe,A,$l="现在，自定义的 <code>HfModelDownloadsTool</code> 类已经准备好，可以将其保存到名为 <code>model_downloads.py</code> 的文件中，并导入使用。",Ee,S,Xe,N,vl="你还可以通过调用 <code>push_to_hub()</code> 将自定义工具推送到 Hub。确保你已经为该工具创建了一个仓库，并使用具有读取访问权限的许可。",Ye,q,Ve,z,_l="通过 <code>~Tool.load_tool</code> 函数加载工具，并将其传递给智能体的 tools 参数。",Fe,x,Ae,L,Se,P,Bl="你可以直接通过 <code>Tool.from_space()</code> 方法将 Hub 上的 Space 导入为工具！",Ne,K,Wl='只需要提供 Space 在 Hub 上的 ID、名称和描述，帮助智能体理解工具的作用。在幕后，这将使用 <a href="https://pypi.org/project/gradio-client/" rel="nofollow"><code>gradio-client</code></a> 库来调用 Space。',qe,D,Gl="例如，下面是从 Hub 导入 <code>FLUX.1-dev</code> Space 并用其生成图像的示例：",ze,O,xe,ee,kl="看！这就是你生成的图像！🏖️",Le,Je,Rl,Pe,le,Hl="然后，你可以像使用其他工具一样使用这个工具。例如，改进提示 <code>穿宇航服的兔子</code> 并生成其图像：",Ke,te,De,se,Oe,ue,Ql,el,ae,El="这真酷吧？🤩",ll,ne,tl,oe,Xl='<a href="https://github.com/freddyaboulton/gradio-tools" rel="nofollow">gradio-tools</a> 是一个强大的库，允许使用 Hugging Face Spaces 作为工具。它支持许多现有的 Spaces，也支持自定义 Spaces。',sl,Me,Yl='transformers 支持通过 <code>Tool.from_gradio()</code> 方法使用 <code>gradio_tools</code>。例如，下面是如何使用来自 <code>gradio-tools</code> 工具包的 <a href="https://github.com/freddyaboulton/gradio-tools/blob/main/gradio_tools/tools/prompt_generator.py" rel="nofollow"><code>StableDiffusionPromptGeneratorTool</code></a> 来改进提示，以生成更好的图像：',al,ie,Vl="导入和实例化工具，并将其传递给 <code>Tool.from_gradio</code> 方法:",nl,pe,ol,Z,Ml,re,Fl=`我们很喜欢 LangChain，并认为它有一套非常有吸引力的工具。
要从 LangChain 导入工具，可以使用 <code>from_langchain()</code> 方法。`,il,me,Al="例如，下面是如何使用它来重新创建上面介绍的搜索结果，使用一个 LangChain 网络搜索工具。该工具需要 <code>pip install google-search-results</code> 来正常工作。",pl,de,rl,ye,ml,ce,Sl="你可以利用 <code>gradio.Chatbot</code> 来展示智能体的思考过程，通过 <code>stream_to_gradio</code>，下面是一个示例：",dl,we,yl,Te,cl,be,wl;return g=new j({props:{title:"智能体，超强版 - 多智能体、外部工具等",local:"智能体超强版---多智能体外部工具等",headingTag:"h1"}}),h=new tt({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/zh/agents_advanced.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/zh/pytorch/agents_advanced.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/zh/tensorflow/agents_advanced.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/zh/agents_advanced.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/zh/pytorch/agents_advanced.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/zh/tensorflow/agents_advanced.ipynb"}]}}),$=new j({props:{title:"什么是智能体？",local:"什么是智能体",headingTag:"h3"}}),I=new Jl({props:{warning:!1,$$slots:{default:[at]},$$scope:{ctx:f}}}),v=new j({props:{title:"多智能体",local:"多智能体",headingTag:"h2"}}),k=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5hZ2VudHMlMjBpbXBvcnQlMjBSZWFjdENvZGVBZ2VudCUyQyUyMEhmQXBpRW5naW5lJTJDJTIwRHVja0R1Y2tHb1NlYXJjaFRvb2wlMkMlMjBNYW5hZ2VkQWdlbnQlMEElMEFsbG1fZW5naW5lJTIwJTNEJTIwSGZBcGlFbmdpbmUoKSUwQSUwQXdlYl9hZ2VudCUyMCUzRCUyMFJlYWN0Q29kZUFnZW50KHRvb2xzJTNEJTVCRHVja0R1Y2tHb1NlYXJjaFRvb2woKSU1RCUyQyUyMGxsbV9lbmdpbmUlM0RsbG1fZW5naW5lKSUwQSUwQW1hbmFnZWRfd2ViX2FnZW50JTIwJTNEJTIwTWFuYWdlZEFnZW50KCUwQSUyMCUyMCUyMCUyMGFnZW50JTNEd2ViX2FnZW50JTJDJTBBJTIwJTIwJTIwJTIwbmFtZSUzRCUyMndlYl9zZWFyY2glMjIlMkMlMEElMjAlMjAlMjAlMjBkZXNjcmlwdGlvbiUzRCUyMlJ1bnMlMjB3ZWIlMjBzZWFyY2hlcyUyMGZvciUyMHlvdS4lMjBHaXZlJTIwaXQlMjB5b3VyJTIwcXVlcnklMjBhcyUyMGFuJTIwYXJndW1lbnQuJTIyJTBBKSUwQSUwQW1hbmFnZXJfYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCglMEElMjAlMjAlMjAlMjB0b29scyUzRCU1QiU1RCUyQyUyMGxsbV9lbmdpbmUlM0RsbG1fZW5naW5lJTJDJTIwbWFuYWdlZF9hZ2VudHMlM0QlNUJtYW5hZ2VkX3dlYl9hZ2VudCU1RCUwQSklMEElMEFtYW5hZ2VyX2FnZW50LnJ1biglMjJXaG8lMjBpcyUyMHRoZSUyMENFTyUyMG9mJTIwSHVnZ2luZyUyMEZhY2UlM0YlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers.agents <span class="hljs-keyword">import</span> ReactCodeAgent, HfApiEngine, DuckDuckGoSearchTool, ManagedAgent

llm_engine = HfApiEngine()

web_agent = ReactCodeAgent(tools=[DuckDuckGoSearchTool()], llm_engine=llm_engine)

managed_web_agent = ManagedAgent(
    agent=web_agent,
    name=<span class="hljs-string">&quot;web_search&quot;</span>,
    description=<span class="hljs-string">&quot;Runs web searches for you. Give it your query as an argument.&quot;</span>
)

manager_agent = ReactCodeAgent(
    tools=[], llm_engine=llm_engine, managed_agents=[managed_web_agent]
)

manager_agent.run(<span class="hljs-string">&quot;Who is the CEO of Hugging Face?&quot;</span>)`,wrap:!1}}),C=new Jl({props:{warning:!1,$$slots:{default:[nt]},$$scope:{ctx:f}}}),R=new j({props:{title:"高级工具使用",local:"高级工具使用",headingTag:"h2"}}),H=new j({props:{title:"通过子类化 Tool 来直接定义工具，并将其共享到 Hub",local:"通过子类化-tool-来直接定义工具并将其共享到-hub",headingTag:"h3"}}),F=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2wlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwbGlzdF9tb2RlbHMlMEElMEFjbGFzcyUyMEhGTW9kZWxEb3dubG9hZHNUb29sKFRvb2wpJTNBJTBBJTIwJTIwJTIwJTIwbmFtZSUyMCUzRCUyMCUyMm1vZGVsX2Rvd25sb2FkX2NvdW50ZXIlMjIlMEElMjAlMjAlMjAlMjBkZXNjcmlwdGlvbiUyMCUzRCUyMCUyMiUyMiUyMiUwQSUyMCUyMCUyMCUyMFRoaXMlMjBpcyUyMGElMjB0b29sJTIwdGhhdCUyMHJldHVybnMlMjB0aGUlMjBtb3N0JTIwZG93bmxvYWRlZCUyMG1vZGVsJTIwb2YlMjBhJTIwZ2l2ZW4lMjB0YXNrJTIwb24lMjB0aGUlMjBIdWdnaW5nJTIwRmFjZSUyMEh1Yi4lMEElMjAlMjAlMjAlMjBJdCUyMHJldHVybnMlMjB0aGUlMjBuYW1lJTIwb2YlMjB0aGUlMjBjaGVja3BvaW50LiUyMiUyMiUyMiUwQSUwQSUyMCUyMCUyMCUyMGlucHV0cyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnRhc2slMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0eXBlJTIyJTNBJTIwJTIyc3RyaW5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyZGVzY3JpcHRpb24lMjIlM0ElMjAlMjJ0aGUlMjB0YXNrJTIwY2F0ZWdvcnklMjAoc3VjaCUyMGFzJTIwdGV4dC1jbGFzc2lmaWNhdGlvbiUyQyUyMGRlcHRoLWVzdGltYXRpb24lMkMlMjBldGMpJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwb3V0cHV0X3R5cGUlMjAlM0QlMjAlMjJzdHJpbmclMjIlMEElMEElMjAlMjAlMjAlMjBkZWYlMjBmb3J3YXJkKHNlbGYlMkMlMjB0YXNrJTNBJTIwc3RyKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1vZGVsJTIwJTNEJTIwbmV4dChpdGVyKGxpc3RfbW9kZWxzKGZpbHRlciUzRHRhc2slMkMlMjBzb3J0JTNEJTIyZG93bmxvYWRzJTIyJTJDJTIwZGlyZWN0aW9uJTNELTEpKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBtb2RlbC5pZA==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Tool
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> list_models

<span class="hljs-keyword">class</span> <span class="hljs-title class_">HFModelDownloadsTool</span>(<span class="hljs-title class_ inherited__">Tool</span>):
    name = <span class="hljs-string">&quot;model_download_counter&quot;</span>
    description = <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.&quot;&quot;&quot;</span>

    inputs = {
        <span class="hljs-string">&quot;task&quot;</span>: {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
            <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;the task category (such as text-classification, depth-estimation, etc)&quot;</span>,
        }
    }
    output_type = <span class="hljs-string">&quot;string&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, task: <span class="hljs-built_in">str</span></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-keyword">return</span> model.<span class="hljs-built_in">id</span>`,wrap:!1}}),S=new U({props:{code:"ZnJvbSUyMG1vZGVsX2Rvd25sb2FkcyUyMGltcG9ydCUyMEhGTW9kZWxEb3dubG9hZHNUb29sJTBBJTBBdG9vbCUyMCUzRCUyMEhGTW9kZWxEb3dubG9hZHNUb29sKCk=",highlighted:`<span class="hljs-keyword">from</span> model_downloads <span class="hljs-keyword">import</span> HFModelDownloadsTool

tool = HFModelDownloadsTool()`,wrap:!1}}),q=new U({props:{code:"dG9vbC5wdXNoX3RvX2h1YiglMjIlN0J5b3VyX3VzZXJuYW1lJTdEJTJGaGYtbW9kZWwtZG93bmxvYWRzJTIyKQ==",highlighted:'tool.push_to_hub(<span class="hljs-string">&quot;{your_username}/hf-model-downloads&quot;</span>)',wrap:!1}}),x=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGxvYWRfdG9vbCUyQyUyMENvZGVBZ2VudCUwQSUwQW1vZGVsX2Rvd25sb2FkX3Rvb2wlMjAlM0QlMjBsb2FkX3Rvb2woJTIybS1yaWMlMkZoZi1tb2RlbC1kb3dubG9hZHMlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> load_tool, CodeAgent

model_download_tool = load_tool(<span class="hljs-string">&quot;m-ric/hf-model-downloads&quot;</span>)`,wrap:!1}}),L=new j({props:{title:"将 Space 导入为工具 🚀",local:"将-space-导入为工具-",headingTag:"h3"}}),O=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2wlMEFpbWFnZV9nZW5lcmF0aW9uX3Rvb2wlMjAlM0QlMjBUb29sLmZyb21fc3BhY2UoJTBBJTIwJTIwJTIwJTIwJTIyYmxhY2stZm9yZXN0LWxhYnMlMkZGTFVYLjEtZGV2JTIyJTJDJTBBJTIwJTIwJTIwJTIwbmFtZSUzRCUyMmltYWdlX2dlbmVyYXRvciUyMiUyQyUwQSUyMCUyMCUyMCUyMGRlc2NyaXB0aW9uJTNEJTIyR2VuZXJhdGUlMjBhbiUyMGltYWdlJTIwZnJvbSUyMGElMjBwcm9tcHQlMjIpJTBBaW1hZ2VfZ2VuZXJhdGlvbl90b29sKCUyMkElMjBzdW5ueSUyMGJlYWNoJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers import<span class="hljs-built_in"> Tool
</span>image_generation_tool = Tool.from_space(
    <span class="hljs-string">&quot;black-forest-labs/FLUX.1-dev&quot;</span>,
    <span class="hljs-attribute">name</span>=<span class="hljs-string">&quot;image_generator&quot;</span>,
    <span class="hljs-attribute">description</span>=<span class="hljs-string">&quot;Generate an image from a prompt&quot;</span>)
image_generation_tool(<span class="hljs-string">&quot;A sunny beach&quot;</span>)`,wrap:!1}}),te=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0Q29kZUFnZW50JTBBJTBBYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCh0b29scyUzRCU1QmltYWdlX2dlbmVyYXRpb25fdG9vbCU1RCklMEElMEFhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIySW1wcm92ZSUyMHRoaXMlMjBwcm9tcHQlMkMlMjB0aGVuJTIwZ2VuZXJhdGUlMjBhbiUyMGltYWdlJTIwb2YlMjBpdC4lMjIlMkMlMjBwcm9tcHQlM0QnQSUyMHJhYmJpdCUyMHdlYXJpbmclMjBhJTIwc3BhY2UlMjBzdWl0JyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactCodeAgent

agent = ReactCodeAgent(tools=[image_generation_tool])

agent.run(
    <span class="hljs-string">&quot;Improve this prompt, then generate an image of it.&quot;</span>, prompt=<span class="hljs-string">&#x27;A rabbit wearing a space suit&#x27;</span>
)`,wrap:!1}}),se=new U({props:{code:"QWdlbnQlMjBpcyUyMGV4ZWN1dGluZyUyMHRoZSUyMGNvZGUlMjBiZWxvdyUzQQ==",highlighted:`=== Agent thoughts:
improved_prompt could be &quot;A bright blue space suit wearing rabbit, on the surface of the moon, under a bright orange sunset, with the Earth visible in the background&quot;
Now that I have improved the prompt, I can use the image generator tool to generate an image based on this prompt.
&gt;&gt;&gt; Agent is executing the code below:
image = image_generator(prompt=&quot;A bright blue space suit wearing rabbit, on the surface of the moon, under a bright orange sunset, with the Earth visible in the background&quot;)
final_answer(image)`,wrap:!1}}),ne=new j({props:{title:"使用 gradio-tools",local:"使用-gradio-tools",headingTag:"h3"}}),pe=new U({props:{code:"ZnJvbSUyMGdyYWRpb190b29scyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblByb21wdEdlbmVyYXRvclRvb2wlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwVG9vbCUyQyUyMGxvYWRfdG9vbCUyQyUyMENvZGVBZ2VudCUwQSUwQWdyYWRpb19wcm9tcHRfZ2VuZXJhdG9yX3Rvb2wlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25Qcm9tcHRHZW5lcmF0b3JUb29sKCklMEFwcm9tcHRfZ2VuZXJhdG9yX3Rvb2wlMjAlM0QlMjBUb29sLmZyb21fZ3JhZGlvKGdyYWRpb19wcm9tcHRfZ2VuZXJhdG9yX3Rvb2wp",highlighted:`<span class="hljs-keyword">from</span> gradio_tools <span class="hljs-keyword">import</span> StableDiffusionPromptGeneratorTool
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Tool, load_tool, CodeAgent

gradio_prompt_generator_tool = StableDiffusionPromptGeneratorTool()
prompt_generator_tool = Tool.from_gradio(gradio_prompt_generator_tool)`,wrap:!1}}),Z=new Jl({props:{warning:!0,$$slots:{default:[ot]},$$scope:{ctx:f}}}),de=new U({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi5hZ2VudHMlMjBpbXBvcnQlMjBsb2FkX3Rvb2xzJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2wlMkMlMjBSZWFjdENvZGVBZ2VudCUwQSUwQXNlYXJjaF90b29sJTIwJTNEJTIwVG9vbC5mcm9tX2xhbmdjaGFpbihsb2FkX3Rvb2xzKCU1QiUyMnNlcnBhcGklMjIlNUQpJTVCMCU1RCklMEElMEFhZ2VudCUyMCUzRCUyMFJlYWN0Q29kZUFnZW50KHRvb2xzJTNEJTVCc2VhcmNoX3Rvb2wlNUQpJTBBJTBBYWdlbnQucnVuKCUyMkhvdyUyMG1hbnklMjBtb3JlJTIwYmxvY2tzJTIwKGFsc28lMjBkZW5vdGVkJTIwYXMlMjBsYXllcnMpJTIwYXJlJTIwaW4lMjBCRVJUJTIwYmFzZSUyMGVuY29kZXIlMjBjb21wYXJlZCUyMHRvJTIwdGhlJTIwZW5jb2RlciUyMGZyb20lMjB0aGUlMjBhcmNoaXRlY3R1cmUlMjBwcm9wb3NlZCUyMGluJTIwQXR0ZW50aW9uJTIwaXMlMjBBbGwlMjBZb3UlMjBOZWVkJTNGJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> langchain.agents <span class="hljs-keyword">import</span> load_tools
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Tool, ReactCodeAgent

search_tool = Tool.from_langchain(load_tools([<span class="hljs-string">&quot;serpapi&quot;</span>])[<span class="hljs-number">0</span>])

agent = ReactCodeAgent(tools=[search_tool])

agent.run(<span class="hljs-string">&quot;How many more blocks (also denoted as layers) are in BERT base encoder compared to the encoder from the architecture proposed in Attention is All You Need?&quot;</span>)`,wrap:!1}}),ye=new j({props:{title:"在酷炫的 Gradio 界面中展示智能体运行",local:"在酷炫的-gradio-界面中展示智能体运行",headingTag:"h2"}}),we=new U({props:{code:"aW1wb3J0JTIwZ3JhZGlvJTIwYXMlMjBnciUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjAoJTBBJTIwJTIwJTIwJTIwbG9hZF90b29sJTJDJTBBJTIwJTIwJTIwJTIwUmVhY3RDb2RlQWdlbnQlMkMlMEElMjAlMjAlMjAlMjBIZkFwaUVuZ2luZSUyQyUwQSUyMCUyMCUyMCUyMHN0cmVhbV90b19ncmFkaW8lMkMlMEEpJTBBJTBBJTIzJTIwSW1wb3J0JTIwdG9vbCUyMGZyb20lMjBIdWIlMEFpbWFnZV9nZW5lcmF0aW9uX3Rvb2wlMjAlM0QlMjBsb2FkX3Rvb2woJTIybS1yaWMlMkZ0ZXh0LXRvLWltYWdlJTIyKSUwQSUwQWxsbV9lbmdpbmUlMjAlM0QlMjBIZkFwaUVuZ2luZSglMjJtZXRhLWxsYW1hJTJGTWV0YS1MbGFtYS0zLTcwQi1JbnN0cnVjdCUyMiklMEElMEElMjMlMjBJbml0aWFsaXplJTIwdGhlJTIwYWdlbnQlMjB3aXRoJTIwdGhlJTIwaW1hZ2UlMjBnZW5lcmF0aW9uJTIwdG9vbCUwQWFnZW50JTIwJTNEJTIwUmVhY3RDb2RlQWdlbnQodG9vbHMlM0QlNUJpbWFnZV9nZW5lcmF0aW9uX3Rvb2wlNUQlMkMlMjBsbG1fZW5naW5lJTNEbGxtX2VuZ2luZSklMEElMEElMEFkZWYlMjBpbnRlcmFjdF93aXRoX2FnZW50KHRhc2spJTNBJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlMjAlM0QlMjAlNUIlNUQlMEElMjAlMjAlMjAlMjBtZXNzYWdlcy5hcHBlbmQoZ3IuQ2hhdE1lc3NhZ2Uocm9sZSUzRCUyMnVzZXIlMjIlMkMlMjBjb250ZW50JTNEdGFzaykpJTBBJTIwJTIwJTIwJTIweWllbGQlMjBtZXNzYWdlcyUwQSUyMCUyMCUyMCUyMGZvciUyMG1zZyUyMGluJTIwc3RyZWFtX3RvX2dyYWRpbyhhZ2VudCUyQyUyMHRhc2spJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbWVzc2FnZXMuYXBwZW5kKG1zZyklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB5aWVsZCUyMG1lc3NhZ2VzJTIwJTJCJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZ3IuQ2hhdE1lc3NhZ2Uocm9sZSUzRCUyMmFzc2lzdGFudCUyMiUyQyUyMGNvbnRlbnQlM0QlMjIlRTIlOEYlQjMlMjBUYXNrJTIwbm90JTIwZmluaXNoZWQlMjB5ZXQhJTIyKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMHlpZWxkJTIwbWVzc2FnZXMlMEElMEElMEF3aXRoJTIwZ3IuQmxvY2tzKCklMjBhcyUyMGRlbW8lM0ElMEElMjAlMjAlMjAlMjB0ZXh0X2lucHV0JTIwJTNEJTIwZ3IuVGV4dGJveChsaW5lcyUzRDElMkMlMjBsYWJlbCUzRCUyMkNoYXQlMjBNZXNzYWdlJTIyJTJDJTIwdmFsdWUlM0QlMjJNYWtlJTIwbWUlMjBhJTIwcGljdHVyZSUyMG9mJTIwdGhlJTIwU3RhdHVlJTIwb2YlMjBMaWJlcnR5LiUyMiklMEElMjAlMjAlMjAlMjBzdWJtaXQlMjAlM0QlMjBnci5CdXR0b24oJTIyUnVuJTIwaWxsdXN0cmF0b3IlMjBhZ2VudCElMjIpJTBBJTIwJTIwJTIwJTIwY2hhdGJvdCUyMCUzRCUyMGdyLkNoYXRib3QoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGFiZWwlM0QlMjJBZ2VudCUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHR5cGUlM0QlMjJtZXNzYWdlcyUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGF2YXRhcl9pbWFnZXMlM0QoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwTm9uZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGZW0tY29udGVudC56b2JqLm5ldCUyRnNvdXJjZSUyRnR3aXR0ZXIlMkY1MyUyRnJvYm90LWZhY2VfMWY5MTYucG5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUyQyUwQSUyMCUyMCUyMCUyMCklMEElMjAlMjAlMjAlMjBzdWJtaXQuY2xpY2soaW50ZXJhY3Rfd2l0aF9hZ2VudCUyQyUyMCU1QnRleHRfaW5wdXQlNUQlMkMlMjAlNUJjaGF0Ym90JTVEKSUwQSUwQWlmJTIwX19uYW1lX18lMjAlM0QlM0QlMjAlMjJfX21haW5fXyUyMiUzQSUwQSUyMCUyMCUyMCUyMGRlbW8ubGF1bmNoKCk=",highlighted:`<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    load_tool,
    ReactCodeAgent,
    HfApiEngine,
    stream_to_gradio,
)

<span class="hljs-comment"># Import tool from Hub</span>
image_generation_tool = load_tool(<span class="hljs-string">&quot;m-ric/text-to-image&quot;</span>)

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

<span class="hljs-comment"># Initialize the agent with the image generation tool</span>
agent = ReactCodeAgent(tools=[image_generation_tool], llm_engine=llm_engine)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">interact_with_agent</span>(<span class="hljs-params">task</span>):
    messages = []
    messages.append(gr.ChatMessage(role=<span class="hljs-string">&quot;user&quot;</span>, content=task))
    <span class="hljs-keyword">yield</span> messages
    <span class="hljs-keyword">for</span> msg <span class="hljs-keyword">in</span> stream_to_gradio(agent, task):
        messages.append(msg)
        <span class="hljs-keyword">yield</span> messages + [
            gr.ChatMessage(role=<span class="hljs-string">&quot;assistant&quot;</span>, content=<span class="hljs-string">&quot;⏳ Task not finished yet!&quot;</span>)
        ]
    <span class="hljs-keyword">yield</span> messages


<span class="hljs-keyword">with</span> gr.Blocks() <span class="hljs-keyword">as</span> demo:
    text_input = gr.Textbox(lines=<span class="hljs-number">1</span>, label=<span class="hljs-string">&quot;Chat Message&quot;</span>, value=<span class="hljs-string">&quot;Make me a picture of the Statue of Liberty.&quot;</span>)
    submit = gr.Button(<span class="hljs-string">&quot;Run illustrator agent!&quot;</span>)
    chatbot = gr.Chatbot(
        label=<span class="hljs-string">&quot;Agent&quot;</span>,
        <span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;messages&quot;</span>,
        avatar_images=(
            <span class="hljs-literal">None</span>,
            <span class="hljs-string">&quot;https://em-content.zobj.net/source/twitter/53/robot-face_1f916.png&quot;</span>,
        ),
    )
    submit.click(interact_with_agent, [text_input], [chatbot])

<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&quot;__main__&quot;</span>:
    demo.launch()`,wrap:!1}}),Te=new st({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/agents_advanced.md"}}),{c(){o=M("meta"),b=a(),T=M("p"),u=a(),r(g.$$.fragment),J=a(),r(h.$$.fragment),ge=a(),r($.$$.fragment),he=a(),r(I.$$.fragment),Ue=a(),r(v.$$.fragment),je=a(),_=M("p"),_.innerHTML=bl,fe=a(),B=M("p"),B.innerHTML=gl,Ie=a(),W=M("p"),W.innerHTML=hl,Ce=a(),G=M("p"),G.innerHTML=Ul,Ze=a(),r(k.$$.fragment),$e=a(),r(C.$$.fragment),ve=a(),r(R.$$.fragment),_e=a(),r(H.$$.fragment),Be=a(),Q=M("p"),Q.innerHTML=jl,We=a(),E=M("p"),E.innerHTML=fl,Ge=a(),X=M("p"),X.textContent=Il,ke=a(),Y=M("ul"),Y.innerHTML=Cl,Re=a(),V=M("p"),V.innerHTML=Zl,He=a(),r(F.$$.fragment),Qe=a(),A=M("p"),A.innerHTML=$l,Ee=a(),r(S.$$.fragment),Xe=a(),N=M("p"),N.innerHTML=vl,Ye=a(),r(q.$$.fragment),Ve=a(),z=M("p"),z.innerHTML=_l,Fe=a(),r(x.$$.fragment),Ae=a(),r(L.$$.fragment),Se=a(),P=M("p"),P.innerHTML=Bl,Ne=a(),K=M("p"),K.innerHTML=Wl,qe=a(),D=M("p"),D.innerHTML=Gl,ze=a(),r(O.$$.fragment),xe=a(),ee=M("p"),ee.textContent=kl,Le=a(),Je=M("img"),Pe=a(),le=M("p"),le.innerHTML=Hl,Ke=a(),r(te.$$.fragment),De=a(),r(se.$$.fragment),Oe=a(),ue=M("img"),el=a(),ae=M("p"),ae.textContent=El,ll=a(),r(ne.$$.fragment),tl=a(),oe=M("p"),oe.innerHTML=Xl,sl=a(),Me=M("p"),Me.innerHTML=Yl,al=a(),ie=M("p"),ie.innerHTML=Vl,nl=a(),r(pe.$$.fragment),ol=a(),r(Z.$$.fragment),Ml=a(),re=M("p"),re.innerHTML=Fl,il=a(),me=M("p"),me.innerHTML=Al,pl=a(),r(de.$$.fragment),rl=a(),r(ye.$$.fragment),ml=a(),ce=M("p"),ce.innerHTML=Sl,dl=a(),r(we.$$.fragment),yl=a(),r(Te.$$.fragment),cl=a(),be=M("p"),this.h()},l(e){const l=et("svelte-u9bgzb",document.head);o=i(l,"META",{name:!0,content:!0}),l.forEach(t),b=n(e),T=i(e,"P",{}),Ll(T).forEach(t),u=n(e),m(g.$$.fragment,e),J=n(e),m(h.$$.fragment,e),ge=n(e),m($.$$.fragment,e),he=n(e),m(I.$$.fragment,e),Ue=n(e),m(v.$$.fragment,e),je=n(e),_=i(e,"P",{"data-svelte-h":!0}),p(_)!=="svelte-totimq"&&(_.innerHTML=bl),fe=n(e),B=i(e,"P",{"data-svelte-h":!0}),p(B)!=="svelte-1r96vbd"&&(B.innerHTML=gl),Ie=n(e),W=i(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-dlhop1"&&(W.innerHTML=hl),Ce=n(e),G=i(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-oc8zw9"&&(G.innerHTML=Ul),Ze=n(e),m(k.$$.fragment,e),$e=n(e),m(C.$$.fragment,e),ve=n(e),m(R.$$.fragment,e),_e=n(e),m(H.$$.fragment,e),Be=n(e),Q=i(e,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-micy32"&&(Q.innerHTML=jl),We=n(e),E=i(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1jpr09r"&&(E.innerHTML=fl),Ge=n(e),X=i(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-1keugyy"&&(X.textContent=Il),ke=n(e),Y=i(e,"UL",{"data-svelte-h":!0}),p(Y)!=="svelte-16lz2qs"&&(Y.innerHTML=Cl),Re=n(e),V=i(e,"P",{"data-svelte-h":!0}),p(V)!=="svelte-qnowqs"&&(V.innerHTML=Zl),He=n(e),m(F.$$.fragment,e),Qe=n(e),A=i(e,"P",{"data-svelte-h":!0}),p(A)!=="svelte-4ct6tl"&&(A.innerHTML=$l),Ee=n(e),m(S.$$.fragment,e),Xe=n(e),N=i(e,"P",{"data-svelte-h":!0}),p(N)!=="svelte-1bzhdnq"&&(N.innerHTML=vl),Ye=n(e),m(q.$$.fragment,e),Ve=n(e),z=i(e,"P",{"data-svelte-h":!0}),p(z)!=="svelte-1mkhfvt"&&(z.innerHTML=_l),Fe=n(e),m(x.$$.fragment,e),Ae=n(e),m(L.$$.fragment,e),Se=n(e),P=i(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-1a8cvmg"&&(P.innerHTML=Bl),Ne=n(e),K=i(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-hwugyu"&&(K.innerHTML=Wl),qe=n(e),D=i(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-yzqvex"&&(D.innerHTML=Gl),ze=n(e),m(O.$$.fragment,e),xe=n(e),ee=i(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-131amij"&&(ee.textContent=kl),Le=n(e),Je=i(e,"IMG",{src:!0}),Pe=n(e),le=i(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-bef63s"&&(le.innerHTML=Hl),Ke=n(e),m(te.$$.fragment,e),De=n(e),m(se.$$.fragment,e),Oe=n(e),ue=i(e,"IMG",{src:!0}),el=n(e),ae=i(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-v9mf86"&&(ae.textContent=El),ll=n(e),m(ne.$$.fragment,e),tl=n(e),oe=i(e,"P",{"data-svelte-h":!0}),p(oe)!=="svelte-sxe16i"&&(oe.innerHTML=Xl),sl=n(e),Me=i(e,"P",{"data-svelte-h":!0}),p(Me)!=="svelte-4jf5ve"&&(Me.innerHTML=Yl),al=n(e),ie=i(e,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-1aq2ajx"&&(ie.innerHTML=Vl),nl=n(e),m(pe.$$.fragment,e),ol=n(e),m(Z.$$.fragment,e),Ml=n(e),re=i(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-1b2suqg"&&(re.innerHTML=Fl),il=n(e),me=i(e,"P",{"data-svelte-h":!0}),p(me)!=="svelte-veju0s"&&(me.innerHTML=Al),pl=n(e),m(de.$$.fragment,e),rl=n(e),m(ye.$$.fragment,e),ml=n(e),ce=i(e,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-16e4xgz"&&(ce.innerHTML=Sl),dl=n(e),m(we.$$.fragment,e),yl=n(e),m(Te.$$.fragment,e),cl=n(e),be=i(e,"P",{}),Ll(be).forEach(t),this.h()},h(){Tl(o,"name","hf:doc:metadata"),Tl(o,"content",it),xl(Je.src,Rl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/sunny_beach.webp")||Tl(Je,"src",Rl),xl(ue.src,Ql="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit_spacesuit_flux.webp")||Tl(ue,"src",Ql)},m(e,l){lt(document.head,o),s(e,b,l),s(e,T,l),s(e,u,l),d(g,e,l),s(e,J,l),d(h,e,l),s(e,ge,l),d($,e,l),s(e,he,l),d(I,e,l),s(e,Ue,l),d(v,e,l),s(e,je,l),s(e,_,l),s(e,fe,l),s(e,B,l),s(e,Ie,l),s(e,W,l),s(e,Ce,l),s(e,G,l),s(e,Ze,l),d(k,e,l),s(e,$e,l),d(C,e,l),s(e,ve,l),d(R,e,l),s(e,_e,l),d(H,e,l),s(e,Be,l),s(e,Q,l),s(e,We,l),s(e,E,l),s(e,Ge,l),s(e,X,l),s(e,ke,l),s(e,Y,l),s(e,Re,l),s(e,V,l),s(e,He,l),d(F,e,l),s(e,Qe,l),s(e,A,l),s(e,Ee,l),d(S,e,l),s(e,Xe,l),s(e,N,l),s(e,Ye,l),d(q,e,l),s(e,Ve,l),s(e,z,l),s(e,Fe,l),d(x,e,l),s(e,Ae,l),d(L,e,l),s(e,Se,l),s(e,P,l),s(e,Ne,l),s(e,K,l),s(e,qe,l),s(e,D,l),s(e,ze,l),d(O,e,l),s(e,xe,l),s(e,ee,l),s(e,Le,l),s(e,Je,l),s(e,Pe,l),s(e,le,l),s(e,Ke,l),d(te,e,l),s(e,De,l),d(se,e,l),s(e,Oe,l),s(e,ue,l),s(e,el,l),s(e,ae,l),s(e,ll,l),d(ne,e,l),s(e,tl,l),s(e,oe,l),s(e,sl,l),s(e,Me,l),s(e,al,l),s(e,ie,l),s(e,nl,l),d(pe,e,l),s(e,ol,l),d(Z,e,l),s(e,Ml,l),s(e,re,l),s(e,il,l),s(e,me,l),s(e,pl,l),d(de,e,l),s(e,rl,l),d(ye,e,l),s(e,ml,l),s(e,ce,l),s(e,dl,l),d(we,e,l),s(e,yl,l),d(Te,e,l),s(e,cl,l),s(e,be,l),wl=!0},p(e,[l]){const Nl={};l&2&&(Nl.$$scope={dirty:l,ctx:e}),I.$set(Nl);const ql={};l&2&&(ql.$$scope={dirty:l,ctx:e}),C.$set(ql);const zl={};l&2&&(zl.$$scope={dirty:l,ctx:e}),Z.$set(zl)},i(e){wl||(y(g.$$.fragment,e),y(h.$$.fragment,e),y($.$$.fragment,e),y(I.$$.fragment,e),y(v.$$.fragment,e),y(k.$$.fragment,e),y(C.$$.fragment,e),y(R.$$.fragment,e),y(H.$$.fragment,e),y(F.$$.fragment,e),y(S.$$.fragment,e),y(q.$$.fragment,e),y(x.$$.fragment,e),y(L.$$.fragment,e),y(O.$$.fragment,e),y(te.$$.fragment,e),y(se.$$.fragment,e),y(ne.$$.fragment,e),y(pe.$$.fragment,e),y(Z.$$.fragment,e),y(de.$$.fragment,e),y(ye.$$.fragment,e),y(we.$$.fragment,e),y(Te.$$.fragment,e),wl=!0)},o(e){c(g.$$.fragment,e),c(h.$$.fragment,e),c($.$$.fragment,e),c(I.$$.fragment,e),c(v.$$.fragment,e),c(k.$$.fragment,e),c(C.$$.fragment,e),c(R.$$.fragment,e),c(H.$$.fragment,e),c(F.$$.fragment,e),c(S.$$.fragment,e),c(q.$$.fragment,e),c(x.$$.fragment,e),c(L.$$.fragment,e),c(O.$$.fragment,e),c(te.$$.fragment,e),c(se.$$.fragment,e),c(ne.$$.fragment,e),c(pe.$$.fragment,e),c(Z.$$.fragment,e),c(de.$$.fragment,e),c(ye.$$.fragment,e),c(we.$$.fragment,e),c(Te.$$.fragment,e),wl=!1},d(e){e&&(t(b),t(T),t(u),t(J),t(ge),t(he),t(Ue),t(je),t(_),t(fe),t(B),t(Ie),t(W),t(Ce),t(G),t(Ze),t($e),t(ve),t(_e),t(Be),t(Q),t(We),t(E),t(Ge),t(X),t(ke),t(Y),t(Re),t(V),t(He),t(Qe),t(A),t(Ee),t(Xe),t(N),t(Ye),t(Ve),t(z),t(Fe),t(Ae),t(Se),t(P),t(Ne),t(K),t(qe),t(D),t(ze),t(xe),t(ee),t(Le),t(Je),t(Pe),t(le),t(Ke),t(De),t(Oe),t(ue),t(el),t(ae),t(ll),t(tl),t(oe),t(sl),t(Me),t(al),t(ie),t(nl),t(ol),t(Ml),t(re),t(il),t(me),t(pl),t(rl),t(ml),t(ce),t(dl),t(yl),t(cl),t(be)),t(o),w(g,e),w(h,e),w($,e),w(I,e),w(v,e),w(k,e),w(C,e),w(R,e),w(H,e),w(F,e),w(S,e),w(q,e),w(x,e),w(L,e),w(O,e),w(te,e),w(se,e),w(ne,e),w(pe,e),w(Z,e),w(de,e),w(ye,e),w(we,e),w(Te,e)}}}const it='{"title":"智能体，超强版 - 多智能体、外部工具等","local":"智能体超强版---多智能体外部工具等","sections":[{"title":"什么是智能体？","local":"什么是智能体","sections":[],"depth":3},{"title":"多智能体","local":"多智能体","sections":[],"depth":2},{"title":"高级工具使用","local":"高级工具使用","sections":[{"title":"通过子类化 Tool 来直接定义工具，并将其共享到 Hub","local":"通过子类化-tool-来直接定义工具并将其共享到-hub","sections":[],"depth":3},{"title":"将 Space 导入为工具 🚀","local":"将-space-导入为工具-","sections":[],"depth":3},{"title":"使用 gradio-tools","local":"使用-gradio-tools","sections":[],"depth":3},{"title":"使用 LangChain 工具","local":"使用-langchain-工具","sections":[],"depth":3}],"depth":2},{"title":"在酷炫的 Gradio 界面中展示智能体运行","local":"在酷炫的-gradio-界面中展示智能体运行","sections":[],"depth":2}],"depth":1}';function pt(f){return Kl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Tt extends Dl{constructor(o){super(),Ol(this,o,pt,Mt,Pl,{})}}export{Tt as component};
