import{s as Rs,f as Zt,o as $s,n as Qs}from"../chunks/scheduler.37c15a92.js";import{S as Ss,i as Ws,g as n,s as M,r as y,A as Hs,h as J,f as t,c as U,j as Ft,u as i,x as a,k as j,y as xs,a as s,v as p,d as o,t as w,w as C,m as Kl,n as le}from"../chunks/index.2bf4358c.js";import{T as At}from"../chunks/Tip.363c041f.js";import{C as g}from"../chunks/CodeBlock.4e987730.js";import{C as _s}from"../chunks/CourseFloatingBanner.6add7356.js";import{H as h}from"../chunks/Heading.8ada512a.js";import{E as Ys}from"../chunks/index.f9c0018f.js";function Xs(f){let r,T,u="smolagents 文档中的这个指南",m;return{c(){r=Kl("如果你想了解更多关于为什么代码智能体如此有效的信息，请查看 "),T=n("a"),T.textContent=u,m=Kl("。"),this.h()},l(c){r=le(c,"如果你想了解更多关于为什么代码智能体如此有效的信息，请查看 "),T=J(c,"A",{href:!0,target:!0,"data-svelte-h":!0}),a(T)!=="svelte-13q8t7h"&&(T.textContent=u),m=le(c,"。"),this.h()},h(){j(T,"href","https://huggingface.co/docs/smolagents/en/conceptual_guides/intro_agents#code-agents"),j(T,"target","_blank")},m(c,I){s(c,r,I),s(c,T,I),s(c,m,I)},p:Qs,d(c){c&&(t(r),t(T),t(m))}}}function qs(f){let r,T,u="这个笔记本",m;return{c(){r=Kl("你可以在 "),T=n("a"),T.textContent=u,m=Kl(" 中跟随代码，可以使用 Google Colab 运行。"),this.h()},l(c){r=le(c,"你可以在 "),T=J(c,"A",{href:!0,target:!0,"data-svelte-h":!0}),a(T)!=="svelte-1rjsp7d"&&(T.textContent=u),m=le(c," 中跟随代码，可以使用 Google Colab 运行。"),this.h()},h(){j(T,"href","https://huggingface.co/agents-course/notebooks/blob/main/unit2/smolagents/code_agents.ipynb"),j(T,"target","_blank")},m(c,I){s(c,r,I),s(c,T,I),s(c,m,I)},p:Qs,d(c){c&&(t(r),t(T),t(m))}}}function Ls(f){let r;return{c(){r=Kl("如果你想分享你的智能体项目，请创建一个 space 并在 Hugging Face Hub 上标记 [agents-course](https://huggingface.co/agents-course)。我们很想看看你创造了什么！")},l(T){r=le(T,"如果你想分享你的智能体项目，请创建一个 space 并在 Hugging Face Hub 上标记 [agents-course](https://huggingface.co/agents-course)。我们很想看看你创造了什么！")},m(T,u){s(T,r,u)},d(T){T&&t(r)}}}function zs(f){let r,T,u,m,c,I,B,ee,N,Gt="代码智能体（Code agents）是 <code>smolagents</code> 中的默认智能体类型。它们生成 Python 工具调用来执行操作，实现高效、表达力强且准确的操作表示。",te,Z,vt="它们的简化方法减少了所需操作的数量，简化了复杂操作，并实现了对现有代码函数的重用。<code>smolagents</code> 提供了一个轻量级框架，用约 1,000 行代码实现构建代码智能体（code agents）。",se,F,Et=`<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/code_vs_json_actions.png" alt="代码与 JSON 操作对比"/>
图片来自论文 <a href="https://huggingface.co/papers/2402.01030" rel="nofollow">Executable Code Actions Elicit Better LLM Agents</a>`,Me,b,Ue,A,ne,G,Qt="在多步骤智能体过程中，大语言模型（LLM）编写并执行操作，通常涉及外部工具调用。传统方法使用 JSON 格式来指定工具名称和参数作为字符串，<strong>系统必须解析这些内容以确定要执行哪个工具</strong>。",Je,v,Rt='然而，研究表明，<strong>工具调用型大语言模型直接使用代码工作更有效</strong>。这是 <code>smolagents</code> 的核心原则，如上图所示，来自论文 <a href="https://huggingface.co/papers/2402.01030" rel="nofollow">Executable Code Actions Elicit Better LLM Agents</a>。',ae,E,$t="用代码而非 JSON 编写操作提供了几个关键优势：",Te,Q,St="<li><strong>可组合性（Composability）</strong>：轻松组合和重用操作</li> <li><strong>对象管理（Object Management）</strong>：直接处理复杂结构，如图像</li> <li><strong>通用性（Generality）</strong>：表达任何计算上可能的任务</li> <li><strong>适合大语言模型</strong>：高质量代码已存在于大语言模型的训练数据中</li>",ye,R,ie,$,Wt='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/codeagent_docs.png" alt="来自 https://huggingface.co/docs/smolagents/conceptual_guides/react"/>',pe,S,Ht="上图说明了 <code>CodeAgent.run()</code> 如何操作，遵循我们在第 1 单元中提到的 ReAct 框架。<code>smolagents</code> 中智能体的主要抽象是 <code>MultiStepAgent</code>，它作为核心构建块。如我们将在下面的示例中看到的，<code>CodeAgent</code> 是一种特殊的 <code>MultiStepAgent</code>。",oe,W,xt="<code>CodeAgent</code> 通过一系列步骤执行操作，将现有变量和知识整合到智能体的上下文中，这些内容保存在执行日志中：",we,H,_t='<li><p>系统提示存储在 <code>SystemPromptStep</code> 中，用户查询记录在 <code>TaskStep</code> 中。</p></li> <li><p>然后，执行以下循环：</p> <p>2.1 方法 <code>agent.write_memory_to_messages()</code> 将智能体的日志写入大语言模型可读的<a href="https://huggingface.co/docs/transformers/en/chat_templating" rel="nofollow">聊天消息</a>列表中。</p> <p>2.2 这些消息发送给 <code>Model</code>，生成补全（completion）。</p> <p>2.3 解析补全内容以提取操作，在我们的例子中，这应该是代码片段，因为我们使用的是 <code>CodeAgent</code>。</p> <p>2.4 执行该操作。</p> <p>2.5 将结果记录到内存中的 <code>ActionStep</code> 中。</p></li>',Ce,x,Yt="在每个步骤结束时，如果智能体包含任何函数调用（在 <code>agent.step_callback</code> 中），它们将被执行。",ce,_,re,V,je,Y,Xt="阿尔弗雷德（Alfred）正在韦恩家族大宅计划一场派对，需要你的帮助确保一切顺利进行。为了帮助他，我们将应用我们所学到的关于多步骤 <code>CodeAgent</code> 如何运作的知识。",me,X,qt,ue,q,Lt="如果你还没有安装 <code>smolagents</code>，可以运行以下命令进行安装：",ge,L,Ie,z,zt="让我们也登录到 Hugging Face Hub，以便访问无服务器推理 API（Serverless Inference API）。",de,P,he,O,fe,D,Pt="音乐是成功派对的重要组成部分！阿尔弗雷德需要一些帮助来选择播放列表。幸运的是，<code>smolagents</code> 能够帮助我们！我们可以构建一个能够使用 DuckDuckGo 搜索网络的智能体。要让智能体访问此工具，我们在创建智能体时将其包含在工具列表中。",be,K,Ot,Ve,ll,Dt='对于模型，我们将依赖 <code>InferenceClientModel</code>，它提供对 Hugging Face 的<a href="https://huggingface.co/docs/api-inference/index" rel="nofollow">无服务器推理 API</a>的访问。默认模型是 <code>&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</code>，它性能良好并可用于快速推理，但你可以从 Hub 中选择任何兼容的模型。',ke,el,Kt="运行智能体相当简单：",Be,tl,Ne,sl,ls="当你运行这个例子时，输出将<strong>显示正在执行的工作流步骤的跟踪</strong>。它还会打印相应的 Python 代码，并附带消息：",Ze,Ml,Fe,Ul,es="几个步骤后，你将看到阿尔弗雷德可以用于派对的生成播放列表！🎵",Ae,nl,Ge,Jl,ts,ve,al,ss="现在我们已经选择了播放列表，我们需要为客人组织菜单。同样，阿尔弗雷德可以利用 <code>smolagents</code> 来做到这一点。在这里，我们使用 <code>@tool</code> 装饰器定义一个作为工具的自定义函数。我们稍后将更详细地介绍工具创建，所以现在我们可以简单地运行代码。",Ee,Tl,Ms="如下例所示，我们将使用 <code>@tool</code> 装饰器创建一个工具，并将其包含在 <code>tools</code> 列表中。",Qe,yl,Re,il,Us="智能体将运行几个步骤，直到找到答案。",$e,pl,ns="菜单准备好了！🥗",Se,ol,We,wl,Js="我们已经准备好了播放列表和菜单，但我们需要检查另一个关键细节：准备时间！",He,Cl,as="阿尔弗雷德需要计算如果他现在开始准备，什么时候一切都会准备就绪，以防他们需要其他超级英雄的帮助。",xe,cl,Ts=`<code>smolagents</code> 专门用于编写和执行 Python 代码片段的智能体，为安全提供沙盒执行环境。<br/> <strong>代码执行有严格的安全措施</strong> - 默认情况下，预定义安全列表之外的导入被阻止。但是，您可以通过将它们作为字符串传递到 <code>additional_authorized_imports</code> 中来授权额外的导入。
有关安全代码执行的更多详情，请参阅官方<a href="https://huggingface.co/docs/smolagents/tutorials/secure_code_execution" rel="nofollow">指南</a>。`,_e,rl,ys="创建智能体时，我们将使用 <code>additional_authorized_imports</code> 来允许导入 <code>datetime</code> 模块。",Ye,jl,Xe,ml,is=`这些例子只是代码智能体能做的事情的开始，我们已经开始看到它们对准备派对的实用性。
你可以在 <a href="https://huggingface.co/docs/smolagents" rel="nofollow">smolagents 文档</a> 中了解更多关于如何构建代码智能体的信息。`,qe,ul,ps="总之，<code>smolagents</code> 专注于编写和执行 Python 代码片段的智能体，提供安全的沙盒执行环境。它支持本地和基于 API 的语言模型，使其适应各种开发环境。",Le,gl,ze,Il,os="<strong>将我们自己的阿尔弗雷德智能体与社区分享</strong>难道不会很棒吗？通过这样做，任何人都可以轻松地从 Hub 下载并直接使用这个智能体，将哥谭市的终极派对策划者带到他们的指尖！让我们实现这个想法！🎉",Pe,dl,ws="<code>smolagents</code> 库使这成为可能，允许你与社区分享完整的智能体，并下载其他人的智能体立即使用。这很简单，如下所示：",Oe,hl,De,fl,Cs="要再次下载智能体，请使用以下代码：",Ke,bl,lt,Vl,cs='令人兴奋的是，共享的智能体直接作为 Hugging Face Spaces 提供，允许你实时与它们交互。你可以在<a href="https://huggingface.co/spaces/davidberenstein1957/smolagents-and-tools" rel="nofollow">这里</a>探索其他智能体。',et,kl,rs='例如，<em>AlfredAgent</em> 在<a href="https://huggingface.co/spaces/sergiopaniego/AlfredAgent" rel="nofollow">这里</a>可用。你可以直接在下面尝试：',tt,d,js,st,Bl,ms="你可能想知道——阿尔弗雷德如何使用 <code>smolagents</code> 构建这样一个智能体？通过整合几个工具，他可以生成一个如下的智能体。现在不用担心这些工具，因为我们将在本单元后面有专门的部分详细探讨：",Mt,Nl,Ut,Zl,us="如你所见，我们创建了一个具有多种工具的 <code>CodeAgent</code>，这些工具增强了智能体的功能，将其变成了准备好与社区分享的终极派对策划者！🎉",nt,Fl,gs="现在，轮到你了：使用我们刚刚学到的知识，构建你自己的智能体并与社区分享！🕵️‍♂️💡",Jt,k,at,Al,Tt,Gl,Is="随着阿尔弗雷德对派对准备智能体的微调，他对调试其运行越来越疲惫。智能体本质上是不可预测的，难以检查。但由于他的目标是构建终极派对准备智能体并将其部署到生产环境中，他需要强大的可追踪性，用于未来的监控和分析。",yt,vl,ds='再一次，<code>smolagents</code> 来救援！它采用 <a href="https://opentelemetry.io/" rel="nofollow">OpenTelemetry</a> 标准来检测智能体运行，允许无缝检查和日志记录。在 <a href="https://langfuse.com/" rel="nofollow">Langfuse</a> 和 <code>SmolagentsInstrumentor</code> 的帮助下，阿尔弗雷德可以轻松跟踪和分析他的智能体行为。',it,El,hs="设置非常简单！",pt,Ql,fs="首先，我们需要安装必要的依赖项：",ot,Rl,wt,$l,bs='接下来，阿尔弗雷德已经在 Langfuse 上创建了一个账户，并准备好了他的 API 密钥。如果你还没有这样做，你可以在<a href="https://cloud.langfuse.com/" rel="nofollow">这里</a>注册 Langfuse Cloud 或探索<a href="https://huggingface.co/docs/smolagents/tutorials/inspect_runs" rel="nofollow">替代方案</a>。',Ct,Sl,Vs="一旦你有了 API 密钥，它们需要正确配置如下：",ct,Wl,rt,Hl,ks="最后，阿尔弗雷德准备初始化 <code>SmolagentsInstrumentor</code> 并开始跟踪他的智能体性能。",jt,xl,mt,_l,Bs="阿尔弗雷德现在已连接 🔌！来自 <code>smolagents</code> 的运行正在 Langfuse 中记录，让他完全可见智能体的行为。有了这个设置，他准备重新访问之前的运行并进一步改进他的派对准备智能体。",ut,Yl,gt,Xl,Ns='阿尔弗雷德现在可以在<a href="https://cloud.langfuse.com/project/cm7bq0abj025rad078ak3luwi/traces/995fc019255528e4f48cf6770b0ce27b?timestamp=2025-02-19T10%3A28%3A36.929Z" rel="nofollow">这里</a>访问这些日志来审查和分析它们。',It,ql,Zs='同时，<a href="https://open.spotify.com/playlist/0gZMMHjuxMrrybQ7wTMTpw" rel="nofollow">建议的播放列表</a>为派对准备设置了完美的氛围。很酷，对吧？🎶',dt,ht,ft,Ll,Fs="现在我们已经创建了我们的第一个代码智能体，让我们<strong>学习如何创建工具调用智能体（Tool Calling Agents）</strong>，这是 <code>smolagents</code> 中可用的第二种智能体类型。",bt,zl,Vt,Pl,As='<li><a href="https://huggingface.co/blog/smolagents" rel="nofollow">smolagents 博客</a> - smolagents 和代码交互介绍</li> <li><a href="https://huggingface.co/docs/smolagents/tutorials/building_good_agents" rel="nofollow">smolagents：构建好的智能体</a> - 可靠智能体的最佳实践</li> <li><a href="https://www.anthropic.com/research/building-effective-agents" rel="nofollow">构建有效的智能体 - Anthropic</a> - 智能体设计原则</li> <li><a href="https://huggingface.co/docs/smolagents/tutorials/inspect_runs" rel="nofollow">使用 OpenTelemetry 共享运行</a> - 关于如何为跟踪你的智能体设置 OpenTelemetry 的详细信息</li>',kt,Ol,Bt,Dl,Nt;return c=new _s({props:{chapter:2,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/agents-course/blob/main/notebooks/unit2/smolagents/code_agents.ipynb"}]}}),B=new h({props:{title:"构建使用代码的智能体",local:"构建使用代码的智能体",headingTag:"h1"}}),b=new At({props:{$$slots:{default:[Xs]},$$scope:{ctx:f}}}),A=new h({props:{title:"为什么选择代码智能体？",local:"为什么选择代码智能体",headingTag:"h2"}}),R=new h({props:{title:"代码智能体如何工作？",local:"代码智能体如何工作",headingTag:"h2"}}),_=new h({props:{title:"让我们看一些例子",local:"让我们看一些例子",headingTag:"h2"}}),V=new At({props:{$$slots:{default:[qs]},$$scope:{ctx:f}}}),L=new g({props:{code:"cGlwJTIwaW5zdGFsbCUyMHNtb2xhZ2VudHMlMjAtVQ==",highlighted:"pip install smolagents -U",wrap:!1}}),P=new g({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTBBJTBBbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login

login()`,wrap:!1}}),O=new h({props:{title:"使用 smolagents 为派对选择播放列表",local:"使用-smolagents-为派对选择播放列表",headingTag:"h3"}}),tl=new g({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBEdWNrRHVja0dvU2VhcmNoVG9vbCUyQyUyMEluZmVyZW5jZUNsaWVudE1vZGVsJTBBJTBBYWdlbnQlMjAlM0QlMjBDb2RlQWdlbnQodG9vbHMlM0QlNUJEdWNrRHVja0dvU2VhcmNoVG9vbCgpJTVEJTJDJTIwbW9kZWwlM0RJbmZlcmVuY2VDbGllbnRNb2RlbCgpKSUwQSUwQWFnZW50LnJ1biglMjJTZWFyY2glMjBmb3IlMjB0aGUlMjBiZXN0JTIwbXVzaWMlMjByZWNvbW1lbmRhdGlvbnMlMjBmb3IlMjBhJTIwcGFydHklMjBhdCUyMHRoZSUyMFdheW5lJ3MlMjBtYW5zaW9uLiUyMik=",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, DuckDuckGoSearchTool, InferenceClientModel

agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel())

agent.run(<span class="hljs-string">&quot;Search for the best music recommendations for a party at the Wayne&#x27;s mansion.&quot;</span>)`,wrap:!1}}),Ml=new g({props:{code:"JTIwJUUyJTk0JTgwJTIwRXhlY3V0aW5nJTIwcGFyc2VkJTIwY29kZSUzQSUyMCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCVFMiU5NCU4MCUyMCUwQSUyMCUyMHJlc3VsdHMlMjAlM0QlMjB3ZWJfc2VhcmNoKHF1ZXJ5JTNEJTIyYmVzdCUyMG11c2ljJTIwZm9yJTIwYSUyMEJhdG1hbiUyMHBhcnR5JTIyKSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUwQSUyMCUyMHByaW50KHJlc3VsdHMpJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTBBJTIwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJUUyJTk0JTgwJTIw",highlighted:` ─ Executing parsed code: ──────────────────────────────────────────────────────────────────────────────────────── 
  results = web_search(query=<span class="hljs-string">&quot;best music for a Batman party&quot;</span>)                                                      
  <span class="hljs-built_in">print</span>(results)                                                                                                   
 ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── `,wrap:!1}}),nl=new h({props:{title:"使用自定义工具准备菜单",local:"使用自定义工具准备菜单",headingTag:"h3"}}),yl=new g({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjB0b29sJTJDJTIwSW5mZXJlbmNlQ2xpZW50TW9kZWwlMEElMEElMjMlMjAlRTYlQTAlQjklRTYlOEQlQUUlRTUlOUMlQkElRTUlOTAlODglRTUlQkIlQkElRTglQUUlQUUlRTglOEYlOUMlRTUlOEQlOTUlRTclOUElODQlRTUlQjclQTUlRTUlODUlQjclMEElNDB0b29sJTBBZGVmJTIwc3VnZ2VzdF9tZW51KG9jY2FzaW9uJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMjAlMjAlMjAlMjBTdWdnZXN0cyUyMGElMjBtZW51JTIwYmFzZWQlMjBvbiUyMHRoZSUyMG9jY2FzaW9uLiUwQSUyMCUyMCUyMCUyMEFyZ3MlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvY2Nhc2lvbiUzQSUyMFRoZSUyMHR5cGUlMjBvZiUyMG9jY2FzaW9uJTIwZm9yJTIwdGhlJTIwcGFydHkuJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwaWYlMjBvY2Nhc2lvbiUyMCUzRCUzRCUyMCUyMmNhc3VhbCUyMiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCUyMlBpenphJTJDJTIwc25hY2tzJTJDJTIwYW5kJTIwZHJpbmtzLiUyMiUwQSUyMCUyMCUyMCUyMGVsaWYlMjBvY2Nhc2lvbiUyMCUzRCUzRCUyMCUyMmZvcm1hbCUyMiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCUyMjMtY291cnNlJTIwZGlubmVyJTIwd2l0aCUyMHdpbmUlMjBhbmQlMjBkZXNzZXJ0LiUyMiUwQSUyMCUyMCUyMCUyMGVsaWYlMjBvY2Nhc2lvbiUyMCUzRCUzRCUyMCUyMnN1cGVyaGVybyUyMiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCUyMkJ1ZmZldCUyMHdpdGglMjBoaWdoLWVuZXJneSUyMGFuZCUyMGhlYWx0aHklMjBmb29kLiUyMiUwQSUyMCUyMCUyMCUyMGVsc2UlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlMjJDdXN0b20lMjBtZW51JTIwZm9yJTIwdGhlJTIwYnV0bGVyLiUyMiUwQSUwQSUyMyUyMCVFNyVBRSVBMSVFNSVBRSVCNiVFOSU5OCVCRiVFNSVCMCU5NCVFNSVCQyU5NyVFOSU5QiVCNyVFNSVCRSVCNyVFRiVCQyU4QyVFNCVCOCVCQSVFNiVCNCVCRSVFNSVBRiVCOSVFNSU4NyU4NiVFNSVBNCU4NyVFOCU4RiU5QyVFNSU4RCU5NSUwQWFnZW50JTIwJTNEJTIwQ29kZUFnZW50KHRvb2xzJTNEJTVCc3VnZ2VzdF9tZW51JTVEJTJDJTIwbW9kZWwlM0RJbmZlcmVuY2VDbGllbnRNb2RlbCgpKSUwQSUwQSUyMyUyMCVFNCVCOCVCQSVFNiVCNCVCRSVFNSVBRiVCOSVFNSU4NyU4NiVFNSVBNCU4NyVFNiVBRCVBMyVFNSVCQyU4RiVFOCU4RiU5QyVFNSU4RCU5NSUwQWFnZW50LnJ1biglMjJQcmVwYXJlJTIwYSUyMGZvcm1hbCUyMG1lbnUlMjBmb3IlMjB0aGUlMjBwYXJ0eS4lMjIp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, tool, InferenceClientModel

<span class="hljs-comment"># 根据场合建议菜单的工具</span>
<span class="hljs-meta">@tool</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">suggest_menu</span>(<span class="hljs-params">occasion: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;
    Suggests a menu based on the occasion.
    Args:
        occasion: The type of occasion for the party.
    &quot;&quot;&quot;</span>
    <span class="hljs-keyword">if</span> occasion == <span class="hljs-string">&quot;casual&quot;</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Pizza, snacks, and drinks.&quot;</span>
    <span class="hljs-keyword">elif</span> occasion == <span class="hljs-string">&quot;formal&quot;</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;3-course dinner with wine and dessert.&quot;</span>
    <span class="hljs-keyword">elif</span> occasion == <span class="hljs-string">&quot;superhero&quot;</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Buffet with high-energy and healthy food.&quot;</span>
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Custom menu for the butler.&quot;</span>

<span class="hljs-comment"># 管家阿尔弗雷德，为派对准备菜单</span>
agent = CodeAgent(tools=[suggest_menu], model=InferenceClientModel())

<span class="hljs-comment"># 为派对准备正式菜单</span>
agent.run(<span class="hljs-string">&quot;Prepare a formal menu for the party.&quot;</span>)`,wrap:!1}}),ol=new h({props:{title:"在智能体内部使用 Python 导入",local:"在智能体内部使用-python-导入",headingTag:"h3"}}),jl=new g({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQWltcG9ydCUyMHRpbWUlMEFpbXBvcnQlMjBkYXRldGltZSUwQSUwQWFnZW50JTIwJTNEJTIwQ29kZUFnZW50KHRvb2xzJTNEJTVCJTVEJTJDJTIwbW9kZWwlM0RJbmZlcmVuY2VDbGllbnRNb2RlbCgpJTJDJTIwYWRkaXRpb25hbF9hdXRob3JpemVkX2ltcG9ydHMlM0QlNUInZGF0ZXRpbWUnJTVEKSUwQSUwQWFnZW50LnJ1biglMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMjAlMjAlMjAlMjBBbGZyZWQlMjBuZWVkcyUyMHRvJTIwcHJlcGFyZSUyMGZvciUyMHRoZSUyMHBhcnR5LiUyMEhlcmUlMjBhcmUlMjB0aGUlMjB0YXNrcyUzQSUwQSUyMCUyMCUyMCUyMDEuJTIwUHJlcGFyZSUyMHRoZSUyMGRyaW5rcyUyMC0lMjAzMCUyMG1pbnV0ZXMlMEElMjAlMjAlMjAlMjAyLiUyMERlY29yYXRlJTIwdGhlJTIwbWFuc2lvbiUyMC0lMjA2MCUyMG1pbnV0ZXMlMEElMjAlMjAlMjAlMjAzLiUyMFNldCUyMHVwJTIwdGhlJTIwbWVudSUyMC0lMjA0NSUyMG1pbnV0ZXMlMEElMjAlMjAlMjAlMjAzLiUyMFByZXBhcmUlMjB0aGUlMjBtdXNpYyUyMGFuZCUyMHBsYXlsaXN0JTIwLSUyMDQ1JTIwbWludXRlcyUwQSUwQSUyMCUyMCUyMCUyMElmJTIwd2UlMjBzdGFydCUyMHJpZ2h0JTIwbm93JTJDJTIwYXQlMjB3aGF0JTIwdGltZSUyMHdpbGwlMjB0aGUlMjBwYXJ0eSUyMGJlJTIwcmVhZHklM0YlMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEEp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, InferenceClientModel
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> time
<span class="hljs-keyword">import</span> datetime

agent = CodeAgent(tools=[], model=InferenceClientModel(), additional_authorized_imports=[<span class="hljs-string">&#x27;datetime&#x27;</span>])

agent.run(
    <span class="hljs-string">&quot;&quot;&quot;
    Alfred needs to prepare for the party. Here are the tasks:
    1. Prepare the drinks - 30 minutes
    2. Decorate the mansion - 60 minutes
    3. Set up the menu - 45 minutes
    3. Prepare the music and playlist - 45 minutes

    If we start right now, at what time will the party be ready?
    &quot;&quot;&quot;</span>
)`,wrap:!1}}),gl=new h({props:{title:"将我们的自定义派对准备智能体分享到 Hub",local:"将我们的自定义派对准备智能体分享到-hub",headingTag:"h3"}}),hl=new g({props:{code:"JTIzJTIwJUU2JTlCJUI0JUU2JTk0JUI5JUU0JUI4JUJBJUU0JUJEJUEwJUU3JTlBJTg0JUU3JTk0JUE4JUU2JTg4JUI3JUU1JTkwJThEJUU1JTkyJThDJUU0JUJCJTkzJUU1JUJBJTkzJUU1JTkwJThEJTBBYWdlbnQucHVzaF90b19odWIoJ3Nlcmdpb3BhbmllZ28lMkZBbGZyZWRBZ2VudCcp",highlighted:`<span class="hljs-comment"># 更改为你的用户名和仓库名</span>
agent.push_to_hub(<span class="hljs-string">&#x27;sergiopaniego/AlfredAgent&#x27;</span>)`,wrap:!1}}),bl=new g({props:{code:"JTIzJTIwJUU2JTlCJUI0JUU2JTk0JUI5JUU0JUI4JUJBJUU0JUJEJUEwJUU3JTlBJTg0JUU3JTk0JUE4JUU2JTg4JUI3JUU1JTkwJThEJUU1JTkyJThDJUU0JUJCJTkzJUU1JUJBJTkzJUU1JTkwJThEJTBBYWxmcmVkX2FnZW50JTIwJTNEJTIwYWdlbnQuZnJvbV9odWIoJ3Nlcmdpb3BhbmllZ28lMkZBbGZyZWRBZ2VudCcpJTBBJTBBYWxmcmVkX2FnZW50LnJ1biglMjJHaXZlJTIwbWUlMjB0aGUlMjBiZXN0JTIwcGxheWxpc3QlMjBmb3IlMjBhJTIwcGFydHklMjBhdCUyMFdheW5lJ3MlMjBtYW5zaW9uLiUyMFRoZSUyMHBhcnR5JTIwaWRlYSUyMGlzJTIwYSUyMCd2aWxsYWluJTIwbWFzcXVlcmFkZSclMjB0aGVtZSUyMiklMjAlMjA=",highlighted:`<span class="hljs-comment"># 更改为你的用户名和仓库名</span>
alfred_agent = agent.from_hub(<span class="hljs-string">&#x27;sergiopaniego/AlfredAgent&#x27;</span>)

alfred_agent.run(<span class="hljs-string">&quot;Give me the best playlist for a party at Wayne&#x27;s mansion. The party idea is a &#x27;villain masquerade&#x27; theme&quot;</span>)  `,wrap:!1}}),Nl=new g({props:{code:" ",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, InferenceClientModel, Tool, tool, VisitWebpageTool

<span class="hljs-meta">@tool</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">suggest_menu</span>(<span class="hljs-params">occasion: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;
    Suggests a menu based on the occasion.
    Args:
        occasion: The type of occasion for the party.
    &quot;&quot;&quot;</span>
    <span class="hljs-keyword">if</span> occasion == <span class="hljs-string">&quot;casual&quot;</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Pizza, snacks, and drinks.&quot;</span>
    <span class="hljs-keyword">elif</span> occasion == <span class="hljs-string">&quot;formal&quot;</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;3-course dinner with wine and dessert.&quot;</span>
    <span class="hljs-keyword">elif</span> occasion == <span class="hljs-string">&quot;superhero&quot;</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Buffet with high-energy and healthy food.&quot;</span>
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Custom menu for the butler.&quot;</span>

<span class="hljs-meta">@tool</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">catering_service_tool</span>(<span class="hljs-params">query: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;
    This tool returns the highest-rated catering service in Gotham City.
    
    Args:
        query: A search term for finding catering services.
    &quot;&quot;&quot;</span>
    <span class="hljs-comment"># 餐饮服务及其评分的示例列表    </span>
    services = {
        <span class="hljs-string">&quot;Gotham Catering Co.&quot;</span>: <span class="hljs-number">4.9</span>,
        <span class="hljs-string">&quot;Wayne Manor Catering&quot;</span>: <span class="hljs-number">4.8</span>,
        <span class="hljs-string">&quot;Gotham City Events&quot;</span>: <span class="hljs-number">4.7</span>,
    }
    
    <span class="hljs-comment"># 找到评分最高的餐饮服务（模拟搜索查询过滤）</span>
    best_service = <span class="hljs-built_in">max</span>(services, key=services.get)
    
    <span class="hljs-keyword">return</span> best_service

<span class="hljs-keyword">class</span> <span class="hljs-title class_">SuperheroPartyThemeTool</span>(<span class="hljs-title class_ inherited__">Tool</span>):
    name = <span class="hljs-string">&quot;superhero_party_theme_generator&quot;</span>
    description = <span class="hljs-string">&quot;&quot;&quot;
    This tool suggests creative superhero-themed party ideas based on a category.
    It returns a unique party theme idea.&quot;&quot;&quot;</span>
    
    inputs = {
        <span class="hljs-string">&quot;category&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 type of superhero party (e.g., &#x27;classic heroes&#x27;, &#x27;villain masquerade&#x27;, &#x27;futuristic Gotham&#x27;).&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, category: <span class="hljs-built_in">str</span></span>):
        themes = {
            <span class="hljs-string">&quot;classic heroes&quot;</span>: <span class="hljs-string">&quot;Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like &#x27;The Kryptonite Punch&#x27;.&quot;</span>,
            <span class="hljs-string">&quot;villain masquerade&quot;</span>: <span class="hljs-string">&quot;Gotham Rogues&#x27; Ball: A mysterious masquerade where guests dress as classic Batman villains.&quot;</span>,
            <span class="hljs-string">&quot;futuristic Gotham&quot;</span>: <span class="hljs-string">&quot;Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets.&quot;</span>
        }
        
        <span class="hljs-keyword">return</span> themes.get(category.lower(), <span class="hljs-string">&quot;Themed party idea not found. Try &#x27;classic heroes&#x27;, &#x27;villain masquerade&#x27;, or &#x27;futuristic Gotham&#x27;.&quot;</span>)


<span class="hljs-comment"># 管家阿尔弗雷德，为派对准备菜单</span>
agent = CodeAgent(
    tools=[
        DuckDuckGoSearchTool(), 
        VisitWebpageTool(),
        suggest_menu,
        catering_service_tool,
        SuperheroPartyThemeTool()
    ], 
    model=InferenceClientModel(),
    max_steps=<span class="hljs-number">10</span>,
    verbosity_level=<span class="hljs-number">2</span>
)

agent.run(<span class="hljs-string">&quot;Give me best playlist for a party at the Wayne&#x27;s mansion. The party idea is a &#x27;villain masquerade&#x27; theme&quot;</span>)`,wrap:!1}}),k=new At({props:{$$slots:{default:[Ls]},$$scope:{ctx:f}}}),Al=new h({props:{title:"使用 OpenTelemetry 和 Langfuse 检查我们的派对准备智能体 📡",local:"使用-opentelemetry-和-langfuse-检查我们的派对准备智能体-",headingTag:"h3"}}),Rl=new g({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wZW50ZWxlbWV0cnktc2RrJTIwb3BlbnRlbGVtZXRyeS1leHBvcnRlci1vdGxwJTIwb3BlbmluZmVyZW5jZS1pbnN0cnVtZW50YXRpb24tc21vbGFnZW50cw==",highlighted:"pip install opentelemetry-sdk opentelemetry-exporter-otlp openinference-instrumentation-smolagents",wrap:!1}}),Wl=new g({props:{code:"aW1wb3J0JTIwb3MlMEFpbXBvcnQlMjBiYXNlNjQlMEElMEFMQU5HRlVTRV9QVUJMSUNfS0VZJTNEJTIycGstbGYtLi4uJTIyJTBBTEFOR0ZVU0VfU0VDUkVUX0tFWSUzRCUyMnNrLWxmLS4uLiUyMiUwQUxBTkdGVVNFX0FVVEglM0RiYXNlNjQuYjY0ZW5jb2RlKGYlMjIlN0JMQU5HRlVTRV9QVUJMSUNfS0VZJTdEJTNBJTdCTEFOR0ZVU0VfU0VDUkVUX0tFWSU3RCUyMi5lbmNvZGUoKSkuZGVjb2RlKCklMEElMEFvcy5lbnZpcm9uJTVCJTIyT1RFTF9FWFBPUlRFUl9PVExQX0VORFBPSU5UJTIyJTVEJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZjbG91ZC5sYW5nZnVzZS5jb20lMkZhcGklMkZwdWJsaWMlMkZvdGVsJTIyJTIwJTIzJTIwRVUlMjAlRTYlOTUlQjAlRTYlOEQlQUUlRTUlOEMlQkElRTUlOUYlOUYlMEElMjMlMjBvcy5lbnZpcm9uJTVCJTIyT1RFTF9FWFBPUlRFUl9PVExQX0VORFBPSU5UJTIyJTVEJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZ1cy5jbG91ZC5sYW5nZnVzZS5jb20lMkZhcGklMkZwdWJsaWMlMkZvdGVsJTIyJTIwJTIzJTIwVVMlMjAlRTYlOTUlQjAlRTYlOEQlQUUlRTUlOEMlQkElRTUlOUYlOUYlMEFvcy5lbnZpcm9uJTVCJTIyT1RFTF9FWFBPUlRFUl9PVExQX0hFQURFUlMlMjIlNUQlMjAlM0QlMjBmJTIyQXV0aG9yaXphdGlvbiUzREJhc2ljJTIwJTdCTEFOR0ZVU0VfQVVUSCU3RCUyMg==",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">import</span> base64

LANGFUSE_PUBLIC_KEY=<span class="hljs-string">&quot;pk-lf-...&quot;</span>
LANGFUSE_SECRET_KEY=<span class="hljs-string">&quot;sk-lf-...&quot;</span>
LANGFUSE_AUTH=base64.b64encode(<span class="hljs-string">f&quot;<span class="hljs-subst">{LANGFUSE_PUBLIC_KEY}</span>:<span class="hljs-subst">{LANGFUSE_SECRET_KEY}</span>&quot;</span>.encode()).decode()

os.environ[<span class="hljs-string">&quot;OTEL_EXPORTER_OTLP_ENDPOINT&quot;</span>] = <span class="hljs-string">&quot;https://cloud.langfuse.com/api/public/otel&quot;</span> <span class="hljs-comment"># EU 数据区域</span>
<span class="hljs-comment"># os.environ[&quot;OTEL_EXPORTER_OTLP_ENDPOINT&quot;] = &quot;https://us.cloud.langfuse.com/api/public/otel&quot; # US 数据区域</span>
os.environ[<span class="hljs-string">&quot;OTEL_EXPORTER_OTLP_HEADERS&quot;</span>] = <span class="hljs-string">f&quot;Authorization=Basic <span class="hljs-subst">{LANGFUSE_AUTH}</span>&quot;</span>`,wrap:!1}}),xl=new g({props:{code:"ZnJvbSUyMG9wZW50ZWxlbWV0cnkuc2RrLnRyYWNlJTIwaW1wb3J0JTIwVHJhY2VyUHJvdmlkZXIlMEElMEFmcm9tJTIwb3BlbmluZmVyZW5jZS5pbnN0cnVtZW50YXRpb24uc21vbGFnZW50cyUyMGltcG9ydCUyMFNtb2xhZ2VudHNJbnN0cnVtZW50b3IlMEFmcm9tJTIwb3BlbnRlbGVtZXRyeS5leHBvcnRlci5vdGxwLnByb3RvLmh0dHAudHJhY2VfZXhwb3J0ZXIlMjBpbXBvcnQlMjBPVExQU3BhbkV4cG9ydGVyJTBBZnJvbSUyMG9wZW50ZWxlbWV0cnkuc2RrLnRyYWNlLmV4cG9ydCUyMGltcG9ydCUyMFNpbXBsZVNwYW5Qcm9jZXNzb3IlMEElMEF0cmFjZV9wcm92aWRlciUyMCUzRCUyMFRyYWNlclByb3ZpZGVyKCklMEF0cmFjZV9wcm92aWRlci5hZGRfc3Bhbl9wcm9jZXNzb3IoU2ltcGxlU3BhblByb2Nlc3NvcihPVExQU3BhbkV4cG9ydGVyKCkpKSUwQSUwQVNtb2xhZ2VudHNJbnN0cnVtZW50b3IoKS5pbnN0cnVtZW50KHRyYWNlcl9wcm92aWRlciUzRHRyYWNlX3Byb3ZpZGVyKQ==",highlighted:`<span class="hljs-keyword">from</span> opentelemetry.sdk.trace <span class="hljs-keyword">import</span> TracerProvider

<span class="hljs-keyword">from</span> openinference.instrumentation.smolagents <span class="hljs-keyword">import</span> SmolagentsInstrumentor
<span class="hljs-keyword">from</span> opentelemetry.exporter.otlp.proto.http.trace_exporter <span class="hljs-keyword">import</span> OTLPSpanExporter
<span class="hljs-keyword">from</span> opentelemetry.sdk.trace.export <span class="hljs-keyword">import</span> SimpleSpanProcessor

trace_provider = TracerProvider()
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))

SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)`,wrap:!1}}),Yl=new g({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCUwQSUwQWFnZW50JTIwJTNEJTIwQ29kZUFnZW50KHRvb2xzJTNEJTVCJTVEJTJDJTIwbW9kZWwlM0RJbmZlcmVuY2VDbGllbnRNb2RlbCgpKSUwQWFsZnJlZF9hZ2VudCUyMCUzRCUyMGFnZW50LmZyb21faHViKCdzZXJnaW9wYW5pZWdvJTJGQWxmcmVkQWdlbnQnJTJDJTIwdHJ1c3RfcmVtb3RlX2NvZGUlM0RUcnVlKSUwQWFsZnJlZF9hZ2VudC5ydW4oJTIyR2l2ZSUyMG1lJTIwdGhlJTIwYmVzdCUyMHBsYXlsaXN0JTIwZm9yJTIwYSUyMHBhcnR5JTIwYXQlMjBXYXluZSdzJTIwbWFuc2lvbi4lMjBUaGUlMjBwYXJ0eSUyMGlkZWElMjBpcyUyMGElMjAndmlsbGFpbiUyMG1hc3F1ZXJhZGUnJTIwdGhlbWUlMjIpJTIwJTIw",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, InferenceClientModel

agent = CodeAgent(tools=[], model=InferenceClientModel())
alfred_agent = agent.from_hub(<span class="hljs-string">&#x27;sergiopaniego/AlfredAgent&#x27;</span>, trust_remote_code=<span class="hljs-literal">True</span>)
alfred_agent.run(<span class="hljs-string">&quot;Give me the best playlist for a party at Wayne&#x27;s mansion. The party idea is a &#x27;villain masquerade&#x27; theme&quot;</span>)  `,wrap:!1}}),zl=new h({props:{title:"资源",local:"资源",headingTag:"h2"}}),Ol=new Ys({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/zh-CN/unit2/smolagents/code_agents.mdx"}}),{c(){r=n("meta"),T=M(),u=n("p"),m=M(),y(c.$$.fragment),I=M(),y(B.$$.fragment),ee=M(),N=n("p"),N.innerHTML=Gt,te=M(),Z=n("p"),Z.innerHTML=vt,se=M(),F=n("p"),F.innerHTML=Et,Me=M(),y(b.$$.fragment),Ue=M(),y(A.$$.fragment),ne=M(),G=n("p"),G.innerHTML=Qt,Je=M(),v=n("p"),v.innerHTML=Rt,ae=M(),E=n("p"),E.textContent=$t,Te=M(),Q=n("ul"),Q.innerHTML=St,ye=M(),y(R.$$.fragment),ie=M(),$=n("p"),$.innerHTML=Wt,pe=M(),S=n("p"),S.innerHTML=Ht,oe=M(),W=n("p"),W.innerHTML=xt,we=M(),H=n("ol"),H.innerHTML=_t,Ce=M(),x=n("p"),x.innerHTML=Yt,ce=M(),y(_.$$.fragment),re=M(),y(V.$$.fragment),je=M(),Y=n("p"),Y.innerHTML=Xt,me=M(),X=n("img"),ue=M(),q=n("p"),q.innerHTML=Lt,ge=M(),y(L.$$.fragment),Ie=M(),z=n("p"),z.textContent=zt,de=M(),y(P.$$.fragment),he=M(),y(O.$$.fragment),fe=M(),D=n("p"),D.innerHTML=Pt,be=M(),K=n("img"),Ve=M(),ll=n("p"),ll.innerHTML=Dt,ke=M(),el=n("p"),el.textContent=Kt,Be=M(),y(tl.$$.fragment),Ne=M(),sl=n("p"),sl.innerHTML=ls,Ze=M(),y(Ml.$$.fragment),Fe=M(),Ul=n("p"),Ul.textContent=es,Ae=M(),y(nl.$$.fragment),Ge=M(),Jl=n("img"),ve=M(),al=n("p"),al.innerHTML=ss,Ee=M(),Tl=n("p"),Tl.innerHTML=Ms,Qe=M(),y(yl.$$.fragment),Re=M(),il=n("p"),il.textContent=Us,$e=M(),pl=n("p"),pl.textContent=ns,Se=M(),y(ol.$$.fragment),We=M(),wl=n("p"),wl.textContent=Js,He=M(),Cl=n("p"),Cl.textContent=as,xe=M(),cl=n("p"),cl.innerHTML=Ts,_e=M(),rl=n("p"),rl.innerHTML=ys,Ye=M(),y(jl.$$.fragment),Xe=M(),ml=n("p"),ml.innerHTML=is,qe=M(),ul=n("p"),ul.innerHTML=ps,Le=M(),y(gl.$$.fragment),ze=M(),Il=n("p"),Il.innerHTML=os,Pe=M(),dl=n("p"),dl.innerHTML=ws,Oe=M(),y(hl.$$.fragment),De=M(),fl=n("p"),fl.textContent=Cs,Ke=M(),y(bl.$$.fragment),lt=M(),Vl=n("p"),Vl.innerHTML=cs,et=M(),kl=n("p"),kl.innerHTML=rs,tt=M(),d=n("iframe"),st=M(),Bl=n("p"),Bl.innerHTML=ms,Mt=M(),y(Nl.$$.fragment),Ut=M(),Zl=n("p"),Zl.innerHTML=us,nt=M(),Fl=n("p"),Fl.textContent=gs,Jt=M(),y(k.$$.fragment),at=M(),y(Al.$$.fragment),Tt=M(),Gl=n("p"),Gl.textContent=Is,yt=M(),vl=n("p"),vl.innerHTML=ds,it=M(),El=n("p"),El.textContent=hs,pt=M(),Ql=n("p"),Ql.textContent=fs,ot=M(),y(Rl.$$.fragment),wt=M(),$l=n("p"),$l.innerHTML=bs,Ct=M(),Sl=n("p"),Sl.textContent=Vs,ct=M(),y(Wl.$$.fragment),rt=M(),Hl=n("p"),Hl.innerHTML=ks,jt=M(),y(xl.$$.fragment),mt=M(),_l=n("p"),_l.innerHTML=Bs,ut=M(),y(Yl.$$.fragment),gt=M(),Xl=n("p"),Xl.innerHTML=Ns,It=M(),ql=n("p"),ql.innerHTML=Zs,dt=M(),ht=n("hr"),ft=M(),Ll=n("p"),Ll.innerHTML=Fs,bt=M(),y(zl.$$.fragment),Vt=M(),Pl=n("ul"),Pl.innerHTML=As,kt=M(),y(Ol.$$.fragment),Bt=M(),Dl=n("p"),this.h()},l(l){const e=Hs("svelte-u9bgzb",document.head);r=J(e,"META",{name:!0,content:!0}),e.forEach(t),T=U(l),u=J(l,"P",{}),Ft(u).forEach(t),m=U(l),i(c.$$.fragment,l),I=U(l),i(B.$$.fragment,l),ee=U(l),N=J(l,"P",{"data-svelte-h":!0}),a(N)!=="svelte-9ymf39"&&(N.innerHTML=Gt),te=U(l),Z=J(l,"P",{"data-svelte-h":!0}),a(Z)!=="svelte-fp3c5i"&&(Z.innerHTML=vt),se=U(l),F=J(l,"P",{"data-svelte-h":!0}),a(F)!=="svelte-1fe7zeb"&&(F.innerHTML=Et),Me=U(l),i(b.$$.fragment,l),Ue=U(l),i(A.$$.fragment,l),ne=U(l),G=J(l,"P",{"data-svelte-h":!0}),a(G)!=="svelte-l5zfvz"&&(G.innerHTML=Qt),Je=U(l),v=J(l,"P",{"data-svelte-h":!0}),a(v)!=="svelte-hwuo60"&&(v.innerHTML=Rt),ae=U(l),E=J(l,"P",{"data-svelte-h":!0}),a(E)!=="svelte-7wpd4j"&&(E.textContent=$t),Te=U(l),Q=J(l,"UL",{"data-svelte-h":!0}),a(Q)!=="svelte-1o5j9s7"&&(Q.innerHTML=St),ye=U(l),i(R.$$.fragment,l),ie=U(l),$=J(l,"P",{"data-svelte-h":!0}),a($)!=="svelte-11zkmfo"&&($.innerHTML=Wt),pe=U(l),S=J(l,"P",{"data-svelte-h":!0}),a(S)!=="svelte-19v0aru"&&(S.innerHTML=Ht),oe=U(l),W=J(l,"P",{"data-svelte-h":!0}),a(W)!=="svelte-1y2sq4s"&&(W.innerHTML=xt),we=U(l),H=J(l,"OL",{"data-svelte-h":!0}),a(H)!=="svelte-zvc6d4"&&(H.innerHTML=_t),Ce=U(l),x=J(l,"P",{"data-svelte-h":!0}),a(x)!=="svelte-1iis6f"&&(x.innerHTML=Yt),ce=U(l),i(_.$$.fragment,l),re=U(l),i(V.$$.fragment,l),je=U(l),Y=J(l,"P",{"data-svelte-h":!0}),a(Y)!=="svelte-1n6vc7y"&&(Y.innerHTML=Xt),me=U(l),X=J(l,"IMG",{src:!0,alt:!0}),ue=U(l),q=J(l,"P",{"data-svelte-h":!0}),a(q)!=="svelte-utbpgy"&&(q.innerHTML=Lt),ge=U(l),i(L.$$.fragment,l),Ie=U(l),z=J(l,"P",{"data-svelte-h":!0}),a(z)!=="svelte-1db12br"&&(z.textContent=zt),de=U(l),i(P.$$.fragment,l),he=U(l),i(O.$$.fragment,l),fe=U(l),D=J(l,"P",{"data-svelte-h":!0}),a(D)!=="svelte-12eqykj"&&(D.innerHTML=Pt),be=U(l),K=J(l,"IMG",{src:!0,alt:!0}),Ve=U(l),ll=J(l,"P",{"data-svelte-h":!0}),a(ll)!=="svelte-w6dexj"&&(ll.innerHTML=Dt),ke=U(l),el=J(l,"P",{"data-svelte-h":!0}),a(el)!=="svelte-wei6ii"&&(el.textContent=Kt),Be=U(l),i(tl.$$.fragment,l),Ne=U(l),sl=J(l,"P",{"data-svelte-h":!0}),a(sl)!=="svelte-1fgov2e"&&(sl.innerHTML=ls),Ze=U(l),i(Ml.$$.fragment,l),Fe=U(l),Ul=J(l,"P",{"data-svelte-h":!0}),a(Ul)!=="svelte-1tb9ak8"&&(Ul.textContent=es),Ae=U(l),i(nl.$$.fragment,l),Ge=U(l),Jl=J(l,"IMG",{src:!0,alt:!0}),ve=U(l),al=J(l,"P",{"data-svelte-h":!0}),a(al)!=="svelte-v2hosz"&&(al.innerHTML=ss),Ee=U(l),Tl=J(l,"P",{"data-svelte-h":!0}),a(Tl)!=="svelte-1ypx3hb"&&(Tl.innerHTML=Ms),Qe=U(l),i(yl.$$.fragment,l),Re=U(l),il=J(l,"P",{"data-svelte-h":!0}),a(il)!=="svelte-a8jfmd"&&(il.textContent=Us),$e=U(l),pl=J(l,"P",{"data-svelte-h":!0}),a(pl)!=="svelte-g3pzw9"&&(pl.textContent=ns),Se=U(l),i(ol.$$.fragment,l),We=U(l),wl=J(l,"P",{"data-svelte-h":!0}),a(wl)!=="svelte-15uzzdb"&&(wl.textContent=Js),He=U(l),Cl=J(l,"P",{"data-svelte-h":!0}),a(Cl)!=="svelte-1c12mmu"&&(Cl.textContent=as),xe=U(l),cl=J(l,"P",{"data-svelte-h":!0}),a(cl)!=="svelte-1mvdut1"&&(cl.innerHTML=Ts),_e=U(l),rl=J(l,"P",{"data-svelte-h":!0}),a(rl)!=="svelte-1w0bcf1"&&(rl.innerHTML=ys),Ye=U(l),i(jl.$$.fragment,l),Xe=U(l),ml=J(l,"P",{"data-svelte-h":!0}),a(ml)!=="svelte-nmbtz8"&&(ml.innerHTML=is),qe=U(l),ul=J(l,"P",{"data-svelte-h":!0}),a(ul)!=="svelte-1m8jf34"&&(ul.innerHTML=ps),Le=U(l),i(gl.$$.fragment,l),ze=U(l),Il=J(l,"P",{"data-svelte-h":!0}),a(Il)!=="svelte-qdl6e5"&&(Il.innerHTML=os),Pe=U(l),dl=J(l,"P",{"data-svelte-h":!0}),a(dl)!=="svelte-lx3ox3"&&(dl.innerHTML=ws),Oe=U(l),i(hl.$$.fragment,l),De=U(l),fl=J(l,"P",{"data-svelte-h":!0}),a(fl)!=="svelte-gf9unb"&&(fl.textContent=Cs),Ke=U(l),i(bl.$$.fragment,l),lt=U(l),Vl=J(l,"P",{"data-svelte-h":!0}),a(Vl)!=="svelte-1wixttm"&&(Vl.innerHTML=cs),et=U(l),kl=J(l,"P",{"data-svelte-h":!0}),a(kl)!=="svelte-1oeri7k"&&(kl.innerHTML=rs),tt=U(l),d=J(l,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),Ft(d).forEach(t),st=U(l),Bl=J(l,"P",{"data-svelte-h":!0}),a(Bl)!=="svelte-4djxsr"&&(Bl.innerHTML=ms),Mt=U(l),i(Nl.$$.fragment,l),Ut=U(l),Zl=J(l,"P",{"data-svelte-h":!0}),a(Zl)!=="svelte-10guegr"&&(Zl.innerHTML=us),nt=U(l),Fl=J(l,"P",{"data-svelte-h":!0}),a(Fl)!=="svelte-1bia4fv"&&(Fl.textContent=gs),Jt=U(l),i(k.$$.fragment,l),at=U(l),i(Al.$$.fragment,l),Tt=U(l),Gl=J(l,"P",{"data-svelte-h":!0}),a(Gl)!=="svelte-1dqmr61"&&(Gl.textContent=Is),yt=U(l),vl=J(l,"P",{"data-svelte-h":!0}),a(vl)!=="svelte-risard"&&(vl.innerHTML=ds),it=U(l),El=J(l,"P",{"data-svelte-h":!0}),a(El)!=="svelte-45pd9s"&&(El.textContent=hs),pt=U(l),Ql=J(l,"P",{"data-svelte-h":!0}),a(Ql)!=="svelte-1tvhb6o"&&(Ql.textContent=fs),ot=U(l),i(Rl.$$.fragment,l),wt=U(l),$l=J(l,"P",{"data-svelte-h":!0}),a($l)!=="svelte-1jcoxv6"&&($l.innerHTML=bs),Ct=U(l),Sl=J(l,"P",{"data-svelte-h":!0}),a(Sl)!=="svelte-bbwrb5"&&(Sl.textContent=Vs),ct=U(l),i(Wl.$$.fragment,l),rt=U(l),Hl=J(l,"P",{"data-svelte-h":!0}),a(Hl)!=="svelte-s74a79"&&(Hl.innerHTML=ks),jt=U(l),i(xl.$$.fragment,l),mt=U(l),_l=J(l,"P",{"data-svelte-h":!0}),a(_l)!=="svelte-1pnj6yu"&&(_l.innerHTML=Bs),ut=U(l),i(Yl.$$.fragment,l),gt=U(l),Xl=J(l,"P",{"data-svelte-h":!0}),a(Xl)!=="svelte-1rlcqk3"&&(Xl.innerHTML=Ns),It=U(l),ql=J(l,"P",{"data-svelte-h":!0}),a(ql)!=="svelte-15hdrrv"&&(ql.innerHTML=Zs),dt=U(l),ht=J(l,"HR",{}),ft=U(l),Ll=J(l,"P",{"data-svelte-h":!0}),a(Ll)!=="svelte-zrixdg"&&(Ll.innerHTML=Fs),bt=U(l),i(zl.$$.fragment,l),Vt=U(l),Pl=J(l,"UL",{"data-svelte-h":!0}),a(Pl)!=="svelte-1dvfmxx"&&(Pl.innerHTML=As),kt=U(l),i(Ol.$$.fragment,l),Bt=U(l),Dl=J(l,"P",{}),Ft(Dl).forEach(t),this.h()},h(){j(r,"name","hf:doc:metadata"),j(r,"content",Ps),Zt(X.src,qt="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/smolagents/alfred-party.jpg")||j(X,"src",qt),j(X,"alt","Alfred 派对"),Zt(K.src,Ot="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/smolagents/alfred-playlist.jpg")||j(K,"src",Ot),j(K,"alt","Alfred 播放列表"),Zt(Jl.src,ts="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/smolagents/alfred-menu.jpg")||j(Jl,"src",ts),j(Jl,"alt","Alfred 菜单"),Zt(d.src,js="https://sergiopaniego-alfredagent.hf.space/")||j(d,"src",js),j(d,"frameborder","0"),j(d,"width","850"),j(d,"height","450")},m(l,e){xs(document.head,r),s(l,T,e),s(l,u,e),s(l,m,e),p(c,l,e),s(l,I,e),p(B,l,e),s(l,ee,e),s(l,N,e),s(l,te,e),s(l,Z,e),s(l,se,e),s(l,F,e),s(l,Me,e),p(b,l,e),s(l,Ue,e),p(A,l,e),s(l,ne,e),s(l,G,e),s(l,Je,e),s(l,v,e),s(l,ae,e),s(l,E,e),s(l,Te,e),s(l,Q,e),s(l,ye,e),p(R,l,e),s(l,ie,e),s(l,$,e),s(l,pe,e),s(l,S,e),s(l,oe,e),s(l,W,e),s(l,we,e),s(l,H,e),s(l,Ce,e),s(l,x,e),s(l,ce,e),p(_,l,e),s(l,re,e),p(V,l,e),s(l,je,e),s(l,Y,e),s(l,me,e),s(l,X,e),s(l,ue,e),s(l,q,e),s(l,ge,e),p(L,l,e),s(l,Ie,e),s(l,z,e),s(l,de,e),p(P,l,e),s(l,he,e),p(O,l,e),s(l,fe,e),s(l,D,e),s(l,be,e),s(l,K,e),s(l,Ve,e),s(l,ll,e),s(l,ke,e),s(l,el,e),s(l,Be,e),p(tl,l,e),s(l,Ne,e),s(l,sl,e),s(l,Ze,e),p(Ml,l,e),s(l,Fe,e),s(l,Ul,e),s(l,Ae,e),p(nl,l,e),s(l,Ge,e),s(l,Jl,e),s(l,ve,e),s(l,al,e),s(l,Ee,e),s(l,Tl,e),s(l,Qe,e),p(yl,l,e),s(l,Re,e),s(l,il,e),s(l,$e,e),s(l,pl,e),s(l,Se,e),p(ol,l,e),s(l,We,e),s(l,wl,e),s(l,He,e),s(l,Cl,e),s(l,xe,e),s(l,cl,e),s(l,_e,e),s(l,rl,e),s(l,Ye,e),p(jl,l,e),s(l,Xe,e),s(l,ml,e),s(l,qe,e),s(l,ul,e),s(l,Le,e),p(gl,l,e),s(l,ze,e),s(l,Il,e),s(l,Pe,e),s(l,dl,e),s(l,Oe,e),p(hl,l,e),s(l,De,e),s(l,fl,e),s(l,Ke,e),p(bl,l,e),s(l,lt,e),s(l,Vl,e),s(l,et,e),s(l,kl,e),s(l,tt,e),s(l,d,e),s(l,st,e),s(l,Bl,e),s(l,Mt,e),p(Nl,l,e),s(l,Ut,e),s(l,Zl,e),s(l,nt,e),s(l,Fl,e),s(l,Jt,e),p(k,l,e),s(l,at,e),p(Al,l,e),s(l,Tt,e),s(l,Gl,e),s(l,yt,e),s(l,vl,e),s(l,it,e),s(l,El,e),s(l,pt,e),s(l,Ql,e),s(l,ot,e),p(Rl,l,e),s(l,wt,e),s(l,$l,e),s(l,Ct,e),s(l,Sl,e),s(l,ct,e),p(Wl,l,e),s(l,rt,e),s(l,Hl,e),s(l,jt,e),p(xl,l,e),s(l,mt,e),s(l,_l,e),s(l,ut,e),p(Yl,l,e),s(l,gt,e),s(l,Xl,e),s(l,It,e),s(l,ql,e),s(l,dt,e),s(l,ht,e),s(l,ft,e),s(l,Ll,e),s(l,bt,e),p(zl,l,e),s(l,Vt,e),s(l,Pl,e),s(l,kt,e),p(Ol,l,e),s(l,Bt,e),s(l,Dl,e),Nt=!0},p(l,[e]){const Gs={};e&2&&(Gs.$$scope={dirty:e,ctx:l}),b.$set(Gs);const vs={};e&2&&(vs.$$scope={dirty:e,ctx:l}),V.$set(vs);const Es={};e&2&&(Es.$$scope={dirty:e,ctx:l}),k.$set(Es)},i(l){Nt||(o(c.$$.fragment,l),o(B.$$.fragment,l),o(b.$$.fragment,l),o(A.$$.fragment,l),o(R.$$.fragment,l),o(_.$$.fragment,l),o(V.$$.fragment,l),o(L.$$.fragment,l),o(P.$$.fragment,l),o(O.$$.fragment,l),o(tl.$$.fragment,l),o(Ml.$$.fragment,l),o(nl.$$.fragment,l),o(yl.$$.fragment,l),o(ol.$$.fragment,l),o(jl.$$.fragment,l),o(gl.$$.fragment,l),o(hl.$$.fragment,l),o(bl.$$.fragment,l),o(Nl.$$.fragment,l),o(k.$$.fragment,l),o(Al.$$.fragment,l),o(Rl.$$.fragment,l),o(Wl.$$.fragment,l),o(xl.$$.fragment,l),o(Yl.$$.fragment,l),o(zl.$$.fragment,l),o(Ol.$$.fragment,l),Nt=!0)},o(l){w(c.$$.fragment,l),w(B.$$.fragment,l),w(b.$$.fragment,l),w(A.$$.fragment,l),w(R.$$.fragment,l),w(_.$$.fragment,l),w(V.$$.fragment,l),w(L.$$.fragment,l),w(P.$$.fragment,l),w(O.$$.fragment,l),w(tl.$$.fragment,l),w(Ml.$$.fragment,l),w(nl.$$.fragment,l),w(yl.$$.fragment,l),w(ol.$$.fragment,l),w(jl.$$.fragment,l),w(gl.$$.fragment,l),w(hl.$$.fragment,l),w(bl.$$.fragment,l),w(Nl.$$.fragment,l),w(k.$$.fragment,l),w(Al.$$.fragment,l),w(Rl.$$.fragment,l),w(Wl.$$.fragment,l),w(xl.$$.fragment,l),w(Yl.$$.fragment,l),w(zl.$$.fragment,l),w(Ol.$$.fragment,l),Nt=!1},d(l){l&&(t(T),t(u),t(m),t(I),t(ee),t(N),t(te),t(Z),t(se),t(F),t(Me),t(Ue),t(ne),t(G),t(Je),t(v),t(ae),t(E),t(Te),t(Q),t(ye),t(ie),t($),t(pe),t(S),t(oe),t(W),t(we),t(H),t(Ce),t(x),t(ce),t(re),t(je),t(Y),t(me),t(X),t(ue),t(q),t(ge),t(Ie),t(z),t(de),t(he),t(fe),t(D),t(be),t(K),t(Ve),t(ll),t(ke),t(el),t(Be),t(Ne),t(sl),t(Ze),t(Fe),t(Ul),t(Ae),t(Ge),t(Jl),t(ve),t(al),t(Ee),t(Tl),t(Qe),t(Re),t(il),t($e),t(pl),t(Se),t(We),t(wl),t(He),t(Cl),t(xe),t(cl),t(_e),t(rl),t(Ye),t(Xe),t(ml),t(qe),t(ul),t(Le),t(ze),t(Il),t(Pe),t(dl),t(Oe),t(De),t(fl),t(Ke),t(lt),t(Vl),t(et),t(kl),t(tt),t(d),t(st),t(Bl),t(Mt),t(Ut),t(Zl),t(nt),t(Fl),t(Jt),t(at),t(Tt),t(Gl),t(yt),t(vl),t(it),t(El),t(pt),t(Ql),t(ot),t(wt),t($l),t(Ct),t(Sl),t(ct),t(rt),t(Hl),t(jt),t(mt),t(_l),t(ut),t(gt),t(Xl),t(It),t(ql),t(dt),t(ht),t(ft),t(Ll),t(bt),t(Vt),t(Pl),t(kt),t(Bt),t(Dl)),t(r),C(c,l),C(B,l),C(b,l),C(A,l),C(R,l),C(_,l),C(V,l),C(L,l),C(P,l),C(O,l),C(tl,l),C(Ml,l),C(nl,l),C(yl,l),C(ol,l),C(jl,l),C(gl,l),C(hl,l),C(bl,l),C(Nl,l),C(k,l),C(Al,l),C(Rl,l),C(Wl,l),C(xl,l),C(Yl,l),C(zl,l),C(Ol,l)}}}const Ps='{"title":"构建使用代码的智能体","local":"构建使用代码的智能体","sections":[{"title":"为什么选择代码智能体？","local":"为什么选择代码智能体","sections":[],"depth":2},{"title":"代码智能体如何工作？","local":"代码智能体如何工作","sections":[],"depth":2},{"title":"让我们看一些例子","local":"让我们看一些例子","sections":[{"title":"使用 smolagents 为派对选择播放列表","local":"使用-smolagents-为派对选择播放列表","sections":[],"depth":3},{"title":"使用自定义工具准备菜单","local":"使用自定义工具准备菜单","sections":[],"depth":3},{"title":"在智能体内部使用 Python 导入","local":"在智能体内部使用-python-导入","sections":[],"depth":3},{"title":"将我们的自定义派对准备智能体分享到 Hub","local":"将我们的自定义派对准备智能体分享到-hub","sections":[],"depth":3},{"title":"使用 OpenTelemetry 和 Langfuse 检查我们的派对准备智能体 📡","local":"使用-opentelemetry-和-langfuse-检查我们的派对准备智能体-","sections":[],"depth":3}],"depth":2},{"title":"资源","local":"资源","sections":[],"depth":2}],"depth":1}';function Os(f){return $s(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class UM extends Ss{constructor(r){super(),Ws(this,r,Os,zs,Rs,{})}}export{UM as component};
