import{s as Rs,f as Zt,o as Qs,n as $s}from"../chunks/scheduler.889ebb13.js";import{S as Ws,i as Hs,g as J,s as M,r as i,A as Ss,h as n,f as t,c as U,j as Ft,u as y,x as T,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.ca18042b.js";import{T as vt}from"../chunks/Tip.b8116e3c.js";import{C as I}from"../chunks/CodeBlock.1db71023.js";import{C as _s}from"../chunks/CourseFloatingBanner.bff79cca.js";import{H as h,E as Ys}from"../chunks/EditOnGithub.b0b59db6.js";function Xs(f){let r,a,u="smolagents 文档中的这个指南",m;return{c(){r=Kl("如果你想了解更多关于为什么代码智能体如此有效的信息，请查看 "),a=J("a"),a.textContent=u,m=Kl("。"),this.h()},l(c){r=le(c,"如果你想了解更多关于为什么代码智能体如此有效的信息，请查看 "),a=n(c,"A",{href:!0,target:!0,"data-svelte-h":!0}),T(a)!=="svelte-13q8t7h"&&(a.textContent=u),m=le(c,"。"),this.h()},h(){j(a,"href","https://huggingface.co/docs/smolagents/en/conceptual_guides/intro_agents#code-agents"),j(a,"target","_blank")},m(c,g){s(c,r,g),s(c,a,g),s(c,m,g)},p:$s,d(c){c&&(t(r),t(a),t(m))}}}function qs(f){let r,a,u="这个笔记本",m;return{c(){r=Kl("你可以在 "),a=J("a"),a.textContent=u,m=Kl(" 中跟随代码，可以使用 Google Colab 运行。"),this.h()},l(c){r=le(c,"你可以在 "),a=n(c,"A",{href:!0,target:!0,"data-svelte-h":!0}),T(a)!=="svelte-1rjsp7d"&&(a.textContent=u),m=le(c," 中跟随代码，可以使用 Google Colab 运行。"),this.h()},h(){j(a,"href","https://huggingface.co/agents-course/notebooks/blob/main/unit2/smolagents/code_agents.ipynb"),j(a,"target","_blank")},m(c,g){s(c,r,g),s(c,a,g),s(c,m,g)},p:$s,d(c){c&&(t(r),t(a),t(m))}}}function zs(f){let r;return{c(){r=Kl("如果你想分享你的智能体项目，请创建一个 space 并在 Hugging Face Hub 上标记 [agents-course](https://huggingface.co/agents-course)。我们很想看看你创造了什么！")},l(a){r=le(a,"如果你想分享你的智能体项目，请创建一个 space 并在 Hugging Face Hub 上标记 [agents-course](https://huggingface.co/agents-course)。我们很想看看你创造了什么！")},m(a,u){s(a,r,u)},d(a){a&&t(r)}}}function Ls(f){let r,a,u,m,c,g,k,ee,N,At="代码智能体（Code agents）是 <code>smolagents</code> 中的默认智能体类型。它们生成 Python 工具调用来执行操作，实现高效、表达力强且准确的操作表示。",te,Z,Gt="它们的简化方法减少了所需操作的数量，简化了复杂操作，并实现了对现有代码函数的重用。<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,v,Je,A,$t="在多步骤智能体过程中，大语言模型（LLM）编写并执行操作，通常涉及外部工具调用。传统方法使用 JSON 格式来指定工具名称和参数作为字符串，<strong>系统必须解析这些内容以确定要执行哪个工具</strong>。",ne,G,Rt='然而，研究表明，<strong>工具调用型大语言模型直接使用代码工作更有效</strong>。这是 <code>smolagents</code> 的核心原则，如上图所示，来自论文 <a href="https://huggingface.co/papers/2402.01030" rel="nofollow">Executable Code Actions Elicit Better LLM Agents</a>。',Te,E,Qt="用代码而非 JSON 编写操作提供了几个关键优势：",ae,$,Wt="<li><strong>可组合性（Composability）</strong>：轻松组合和重用操作</li> <li><strong>对象管理（Object Management）</strong>：直接处理复杂结构，如图像</li> <li><strong>通用性（Generality）</strong>：表达任何计算上可能的任务</li> <li><strong>适合大语言模型</strong>：高质量代码已存在于大语言模型的训练数据中</li>",ie,R,ye,Q,Ht='<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,W,St="上图说明了 <code>CodeAgent.run()</code> 如何操作，遵循我们在第 1 单元中提到的 ReAct 框架。<code>smolagents</code> 中智能体的主要抽象是 <code>MultiStepAgent</code>，它作为核心构建块。如我们将在下面的示例中看到的，<code>CodeAgent</code> 是一种特殊的 <code>MultiStepAgent</code>。",oe,H,xt="<code>CodeAgent</code> 通过一系列步骤执行操作，将现有变量和知识整合到智能体的上下文中，这些内容保存在执行日志中：",we,S,_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,zt="如果你还没有安装 <code>smolagents</code>，可以运行以下命令进行安装：",Ie,z,ge,L,Lt="让我们也登录到 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>HfApiModel</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 中选择任何兼容的模型。',Be,el,Kt="运行智能体相当简单：",ke,tl,Ne,sl,ls="当你运行这个例子时，输出将<strong>显示正在执行的工作流步骤的跟踪</strong>。它还会打印相应的 Python 代码，并附带消息：",Ze,Ml,Fe,Ul,es="几个步骤后，你将看到阿尔弗雷德可以用于派对的生成播放列表！🎵",ve,Jl,Ae,nl,ts,Ge,Tl,ss="现在我们已经选择了播放列表，我们需要为客人组织菜单。同样，阿尔弗雷德可以利用 <code>smolagents</code> 来做到这一点。在这里，我们使用 <code>@tool</code> 装饰器定义一个作为工具的自定义函数。我们稍后将更详细地介绍工具创建，所以现在我们可以简单地运行代码。",Ee,al,Ms="如下例所示，我们将使用 <code>@tool</code> 装饰器创建一个工具，并将其包含在 <code>tools</code> 列表中。",$e,il,Re,yl,Us="智能体将运行几个步骤，直到找到答案。",Qe,pl,Js="菜单准备好了！🥗",We,ol,He,wl,ns="我们已经准备好了播放列表和菜单，但我们需要检查另一个关键细节：准备时间！",Se,Cl,Ts="阿尔弗雷德需要计算如果他现在开始准备，什么时候一切都会准备就绪，以防他们需要其他超级英雄的帮助。",xe,cl,as=`<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,is="创建智能体时，我们将使用 <code>additional_authorized_imports</code> 来允许导入 <code>datetime</code> 模块。",Ye,jl,Xe,ml,ys=`这些例子只是代码智能体能做的事情的开始，我们已经开始看到它们对准备派对的实用性。
你可以在 <a href="https://huggingface.co/docs/smolagents" rel="nofollow">smolagents 文档</a> 中了解更多关于如何构建代码智能体的信息。`,qe,ul,ps="总之，<code>smolagents</code> 专注于编写和执行 Python 代码片段的智能体，提供安全的沙盒执行环境。它支持本地和基于 API 的语言模型，使其适应各种开发环境。",ze,Il,Le,gl,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,Bl,rs='例如，<em>AlfredAgent</em> 在<a href="https://huggingface.co/spaces/sergiopaniego/AlfredAgent" rel="nofollow">这里</a>可用。你可以直接在下面尝试：',tt,d,js,st,kl,ms="你可能想知道——阿尔弗雷德如何使用 <code>smolagents</code> 构建这样一个智能体？通过整合几个工具，他可以生成一个如下的智能体。现在不用担心这些工具，因为我们将在本单元后面有专门的部分详细探讨：",Mt,Nl,Ut,Zl,us="如你所见，我们创建了一个具有多种工具的 <code>CodeAgent</code>，这些工具增强了智能体的功能，将其变成了准备好与社区分享的终极派对策划者！🎉",Jt,Fl,Is="现在，轮到你了：使用我们刚刚学到的知识，构建你自己的智能体并与社区分享！🕵️‍♂️💡",nt,B,Tt,vl,at,Al,gs="随着阿尔弗雷德对派对准备智能体的微调，他对调试其运行越来越疲惫。智能体本质上是不可预测的，难以检查。但由于他的目标是构建终极派对准备智能体并将其部署到生产环境中，他需要强大的可追踪性，用于未来的监控和分析。",it,Gl,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> 的帮助下，阿尔弗雷德可以轻松跟踪和分析他的智能体行为。',yt,El,hs="设置非常简单！",pt,$l,fs="首先，我们需要安装必要的依赖项：",ot,Rl,wt,Ql,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,Wl,Vs="一旦你有了 API 密钥，它们需要正确配置如下：",ct,Hl,rt,Sl,Bs="最后，阿尔弗雷德准备初始化 <code>SmolagentsInstrumentor</code> 并开始跟踪他的智能体性能。",jt,xl,mt,_l,ks="阿尔弗雷德现在已连接 🔌！来自 <code>smolagents</code> 的运行正在 Langfuse 中记录，让他完全可见智能体的行为。有了这个设置，他准备重新访问之前的运行并进一步改进他的派对准备智能体。",ut,Yl,It,Xl,Ns='阿尔弗雷德现在可以在<a href="https://cloud.langfuse.com/project/cm7bq0abj025rad078ak3luwi/traces/995fc019255528e4f48cf6770b0ce27b?timestamp=2025-02-19T10%3A28%3A36.929Z" rel="nofollow">这里</a>访问这些日志来审查和分析它们。',gt,ql,Zs='同时，<a href="https://open.spotify.com/playlist/0gZMMHjuxMrrybQ7wTMTpw" rel="nofollow">建议的播放列表</a>为派对准备设置了完美的氛围。很酷，对吧？🎶',dt,ht,ft,zl,Fs="现在我们已经创建了我们的第一个代码智能体，让我们<strong>学习如何创建工具调用智能体（Tool Calling Agents）</strong>，这是 <code>smolagents</code> 中可用的第二种智能体类型。",bt,Ll,Vt,Pl,vs='<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>',Bt,Ol,kt,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"}]}}),k=new h({props:{title:"构建使用代码的智能体",local:"构建使用代码的智能体",headingTag:"h1"}}),b=new vt({props:{$$slots:{default:[Xs]},$$scope:{ctx:f}}}),v=new h({props:{title:"为什么选择代码智能体？",local:"为什么选择代码智能体",headingTag:"h2"}}),R=new h({props:{title:"代码智能体如何工作？",local:"代码智能体如何工作",headingTag:"h2"}}),_=new h({props:{title:"让我们看一些例子",local:"让我们看一些例子",headingTag:"h2"}}),V=new vt({props:{$$slots:{default:[qs]},$$scope:{ctx:f}}}),z=new I({props:{code:"cGlwJTIwaW5zdGFsbCUyMHNtb2xhZ2VudHMlMjAtVQ==",highlighted:"pip install smolagents -U",wrap:!1}}),P=new I({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 I({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBEdWNrRHVja0dvU2VhcmNoVG9vbCUyQyUyMEhmQXBpTW9kZWwlMEElMEFhZ2VudCUyMCUzRCUyMENvZGVBZ2VudCh0b29scyUzRCU1QkR1Y2tEdWNrR29TZWFyY2hUb29sKCklNUQlMkMlMjBtb2RlbCUzREhmQXBpTW9kZWwoKSklMEElMEFhZ2VudC5ydW4oJTIyU2VhcmNoJTIwZm9yJTIwdGhlJTIwYmVzdCUyMG11c2ljJTIwcmVjb21tZW5kYXRpb25zJTIwZm9yJTIwYSUyMHBhcnR5JTIwYXQlMjB0aGUlMjBXYXluZSdzJTIwbWFuc2lvbi4lMjIp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, DuckDuckGoSearchTool, HfApiModel

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

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 I({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}}),Jl=new h({props:{title:"使用自定义工具准备菜单",local:"使用自定义工具准备菜单",headingTag:"h3"}}),il=new I({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjB0b29sJTBBJTBBJTIzJTIwJUU2JUEwJUI5JUU2JThEJUFFJUU1JTlDJUJBJUU1JTkwJTg4JUU1JUJCJUJBJUU4JUFFJUFFJUU4JThGJTlDJUU1JThEJTk1JUU3JTlBJTg0JUU1JUI3JUE1JUU1JTg1JUI3JTBBJTQwdG9vbCUwQWRlZiUyMHN1Z2dlc3RfbWVudShvY2Nhc2lvbiUzQSUyMHN0ciklMjAtJTNFJTIwc3RyJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwU3VnZ2VzdHMlMjBhJTIwbWVudSUyMGJhc2VkJTIwb24lMjB0aGUlMjBvY2Nhc2lvbi4lMEElMjAlMjAlMjAlMjBBcmdzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb2NjYXNpb24lM0ElMjBUaGUlMjB0eXBlJTIwb2YlMjBvY2Nhc2lvbiUyMGZvciUyMHRoZSUyMHBhcnR5LiUwQSUyMCUyMCUyMCUyMCUyMiUyMiUyMiUwQSUyMCUyMCUyMCUyMGlmJTIwb2NjYXNpb24lMjAlM0QlM0QlMjAlMjJjYXN1YWwlMjIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlMjJQaXp6YSUyQyUyMHNuYWNrcyUyQyUyMGFuZCUyMGRyaW5rcy4lMjIlMEElMjAlMjAlMjAlMjBlbGlmJTIwb2NjYXNpb24lMjAlM0QlM0QlMjAlMjJmb3JtYWwlMjIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlMjIzLWNvdXJzZSUyMGRpbm5lciUyMHdpdGglMjB3aW5lJTIwYW5kJTIwZGVzc2VydC4lMjIlMEElMjAlMjAlMjAlMjBlbGlmJTIwb2NjYXNpb24lMjAlM0QlM0QlMjAlMjJzdXBlcmhlcm8lMjIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlMjJCdWZmZXQlMjB3aXRoJTIwaGlnaC1lbmVyZ3klMjBhbmQlMjBoZWFsdGh5JTIwZm9vZC4lMjIlMEElMjAlMjAlMjAlMjBlbHNlJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTIyQ3VzdG9tJTIwbWVudSUyMGZvciUyMHRoZSUyMGJ1dGxlci4lMjIlMEElMEElMjMlMjAlRTclQUUlQTElRTUlQUUlQjYlRTklOTglQkYlRTUlQjAlOTQlRTUlQkMlOTclRTklOUIlQjclRTUlQkUlQjclRUYlQkMlOEMlRTQlQjglQkElRTYlQjQlQkUlRTUlQUYlQjklRTUlODclODYlRTUlQTQlODclRTglOEYlOUMlRTUlOEQlOTUlMEFhZ2VudCUyMCUzRCUyMENvZGVBZ2VudCh0b29scyUzRCU1QnN1Z2dlc3RfbWVudSU1RCUyQyUyMG1vZGVsJTNESGZBcGlNb2RlbCgpKSUwQSUwQSUyMyUyMCVFNCVCOCVCQSVFNiVCNCVCRSVFNSVBRiVCOSVFNSU4NyU4NiVFNSVBNCU4NyVFNiVBRCVBMyVFNSVCQyU4RiVFOCU4RiU5QyVFNSU4RCU5NSUwQWFnZW50LnJ1biglMjJQcmVwYXJlJTIwYSUyMGZvcm1hbCUyMG1lbnUlMjBmb3IlMjB0aGUlMjBwYXJ0eS4lMjIp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, tool

<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=HfApiModel())

<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 I({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBIZkFwaU1vZGVsJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdGltZSUwQWltcG9ydCUyMGRhdGV0aW1lJTBBJTBBYWdlbnQlMjAlM0QlMjBDb2RlQWdlbnQodG9vbHMlM0QlNUIlNUQlMkMlMjBtb2RlbCUzREhmQXBpTW9kZWwoKSUyQyUyMGFkZGl0aW9uYWxfYXV0aG9yaXplZF9pbXBvcnRzJTNEJTVCJ2RhdGV0aW1lJyU1RCklMEElMEFhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwQWxmcmVkJTIwbmVlZHMlMjB0byUyMHByZXBhcmUlMjBmb3IlMjB0aGUlMjBwYXJ0eS4lMjBIZXJlJTIwYXJlJTIwdGhlJTIwdGFza3MlM0ElMEElMjAlMjAlMjAlMjAxLiUyMFByZXBhcmUlMjB0aGUlMjBkcmlua3MlMjAtJTIwMzAlMjBtaW51dGVzJTBBJTIwJTIwJTIwJTIwMi4lMjBEZWNvcmF0ZSUyMHRoZSUyMG1hbnNpb24lMjAtJTIwNjAlMjBtaW51dGVzJTBBJTIwJTIwJTIwJTIwMy4lMjBTZXQlMjB1cCUyMHRoZSUyMG1lbnUlMjAtJTIwNDUlMjBtaW51dGVzJTBBJTIwJTIwJTIwJTIwMy4lMjBQcmVwYXJlJTIwdGhlJTIwbXVzaWMlMjBhbmQlMjBwbGF5bGlzdCUyMC0lMjA0NSUyMG1pbnV0ZXMlMEElMEElMjAlMjAlMjAlMjBJZiUyMHdlJTIwc3RhcnQlMjByaWdodCUyMG5vdyUyQyUyMGF0JTIwd2hhdCUyMHRpbWUlMjB3aWxsJTIwdGhlJTIwcGFydHklMjBiZSUyMHJlYWR5JTNGJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, HfApiModel
<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=HfApiModel(), 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}}),Il=new h({props:{title:"将我们的自定义派对准备智能体分享到 Hub",local:"将我们的自定义派对准备智能体分享到-hub",headingTag:"h3"}}),hl=new I({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 I({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 I({props:{code:" ",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, HfApiModel, 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=HfApiModel(),
    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}}),B=new vt({props:{$$slots:{default:[zs]},$$scope:{ctx:f}}}),vl=new h({props:{title:"使用 OpenTelemetry 和 Langfuse 检查我们的派对准备智能体 📡",local:"使用-opentelemetry-和-langfuse-检查我们的派对准备智能体-",headingTag:"h3"}}),Rl=new I({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wZW50ZWxlbWV0cnktc2RrJTIwb3BlbnRlbGVtZXRyeS1leHBvcnRlci1vdGxwJTIwb3BlbmluZmVyZW5jZS1pbnN0cnVtZW50YXRpb24tc21vbGFnZW50cw==",highlighted:"pip install opentelemetry-sdk opentelemetry-exporter-otlp openinference-instrumentation-smolagents",wrap:!1}}),Hl=new I({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 I({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 I({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMkMlMjBIZkFwaU1vZGVsJTBBJTBBYWdlbnQlMjAlM0QlMjBDb2RlQWdlbnQodG9vbHMlM0QlNUIlNUQlMkMlMjBtb2RlbCUzREhmQXBpTW9kZWwoKSklMEFhbGZyZWRfYWdlbnQlMjAlM0QlMjBhZ2VudC5mcm9tX2h1Yignc2VyZ2lvcGFuaWVnbyUyRkFsZnJlZEFnZW50JyUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFhbGZyZWRfYWdlbnQucnVuKCUyMkdpdmUlMjBtZSUyMHRoZSUyMGJlc3QlMjBwbGF5bGlzdCUyMGZvciUyMGElMjBwYXJ0eSUyMGF0JTIwV2F5bmUncyUyMG1hbnNpb24uJTIwVGhlJTIwcGFydHklMjBpZGVhJTIwaXMlMjBhJTIwJ3ZpbGxhaW4lMjBtYXNxdWVyYWRlJyUyMHRoZW1lJTIyKSUyMCUyMA==",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, HfApiModel

agent = CodeAgent(tools=[], model=HfApiModel())
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}}),Ll=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=J("meta"),a=M(),u=J("p"),m=M(),i(c.$$.fragment),g=M(),i(k.$$.fragment),ee=M(),N=J("p"),N.innerHTML=At,te=M(),Z=J("p"),Z.innerHTML=Gt,se=M(),F=J("p"),F.innerHTML=Et,Me=M(),i(b.$$.fragment),Ue=M(),i(v.$$.fragment),Je=M(),A=J("p"),A.innerHTML=$t,ne=M(),G=J("p"),G.innerHTML=Rt,Te=M(),E=J("p"),E.textContent=Qt,ae=M(),$=J("ul"),$.innerHTML=Wt,ie=M(),i(R.$$.fragment),ye=M(),Q=J("p"),Q.innerHTML=Ht,pe=M(),W=J("p"),W.innerHTML=St,oe=M(),H=J("p"),H.innerHTML=xt,we=M(),S=J("ol"),S.innerHTML=_t,Ce=M(),x=J("p"),x.innerHTML=Yt,ce=M(),i(_.$$.fragment),re=M(),i(V.$$.fragment),je=M(),Y=J("p"),Y.innerHTML=Xt,me=M(),X=J("img"),ue=M(),q=J("p"),q.innerHTML=zt,Ie=M(),i(z.$$.fragment),ge=M(),L=J("p"),L.textContent=Lt,de=M(),i(P.$$.fragment),he=M(),i(O.$$.fragment),fe=M(),D=J("p"),D.innerHTML=Pt,be=M(),K=J("img"),Ve=M(),ll=J("p"),ll.innerHTML=Dt,Be=M(),el=J("p"),el.textContent=Kt,ke=M(),i(tl.$$.fragment),Ne=M(),sl=J("p"),sl.innerHTML=ls,Ze=M(),i(Ml.$$.fragment),Fe=M(),Ul=J("p"),Ul.textContent=es,ve=M(),i(Jl.$$.fragment),Ae=M(),nl=J("img"),Ge=M(),Tl=J("p"),Tl.innerHTML=ss,Ee=M(),al=J("p"),al.innerHTML=Ms,$e=M(),i(il.$$.fragment),Re=M(),yl=J("p"),yl.textContent=Us,Qe=M(),pl=J("p"),pl.textContent=Js,We=M(),i(ol.$$.fragment),He=M(),wl=J("p"),wl.textContent=ns,Se=M(),Cl=J("p"),Cl.textContent=Ts,xe=M(),cl=J("p"),cl.innerHTML=as,_e=M(),rl=J("p"),rl.innerHTML=is,Ye=M(),i(jl.$$.fragment),Xe=M(),ml=J("p"),ml.innerHTML=ys,qe=M(),ul=J("p"),ul.innerHTML=ps,ze=M(),i(Il.$$.fragment),Le=M(),gl=J("p"),gl.innerHTML=os,Pe=M(),dl=J("p"),dl.innerHTML=ws,Oe=M(),i(hl.$$.fragment),De=M(),fl=J("p"),fl.textContent=Cs,Ke=M(),i(bl.$$.fragment),lt=M(),Vl=J("p"),Vl.innerHTML=cs,et=M(),Bl=J("p"),Bl.innerHTML=rs,tt=M(),d=J("iframe"),st=M(),kl=J("p"),kl.innerHTML=ms,Mt=M(),i(Nl.$$.fragment),Ut=M(),Zl=J("p"),Zl.innerHTML=us,Jt=M(),Fl=J("p"),Fl.textContent=Is,nt=M(),i(B.$$.fragment),Tt=M(),i(vl.$$.fragment),at=M(),Al=J("p"),Al.textContent=gs,it=M(),Gl=J("p"),Gl.innerHTML=ds,yt=M(),El=J("p"),El.textContent=hs,pt=M(),$l=J("p"),$l.textContent=fs,ot=M(),i(Rl.$$.fragment),wt=M(),Ql=J("p"),Ql.innerHTML=bs,Ct=M(),Wl=J("p"),Wl.textContent=Vs,ct=M(),i(Hl.$$.fragment),rt=M(),Sl=J("p"),Sl.innerHTML=Bs,jt=M(),i(xl.$$.fragment),mt=M(),_l=J("p"),_l.innerHTML=ks,ut=M(),i(Yl.$$.fragment),It=M(),Xl=J("p"),Xl.innerHTML=Ns,gt=M(),ql=J("p"),ql.innerHTML=Zs,dt=M(),ht=J("hr"),ft=M(),zl=J("p"),zl.innerHTML=Fs,bt=M(),i(Ll.$$.fragment),Vt=M(),Pl=J("ul"),Pl.innerHTML=vs,Bt=M(),i(Ol.$$.fragment),kt=M(),Dl=J("p"),this.h()},l(l){const e=Ss("svelte-u9bgzb",document.head);r=n(e,"META",{name:!0,content:!0}),e.forEach(t),a=U(l),u=n(l,"P",{}),Ft(u).forEach(t),m=U(l),y(c.$$.fragment,l),g=U(l),y(k.$$.fragment,l),ee=U(l),N=n(l,"P",{"data-svelte-h":!0}),T(N)!=="svelte-9ymf39"&&(N.innerHTML=At),te=U(l),Z=n(l,"P",{"data-svelte-h":!0}),T(Z)!=="svelte-fp3c5i"&&(Z.innerHTML=Gt),se=U(l),F=n(l,"P",{"data-svelte-h":!0}),T(F)!=="svelte-1fe7zeb"&&(F.innerHTML=Et),Me=U(l),y(b.$$.fragment,l),Ue=U(l),y(v.$$.fragment,l),Je=U(l),A=n(l,"P",{"data-svelte-h":!0}),T(A)!=="svelte-l5zfvz"&&(A.innerHTML=$t),ne=U(l),G=n(l,"P",{"data-svelte-h":!0}),T(G)!=="svelte-hwuo60"&&(G.innerHTML=Rt),Te=U(l),E=n(l,"P",{"data-svelte-h":!0}),T(E)!=="svelte-7wpd4j"&&(E.textContent=Qt),ae=U(l),$=n(l,"UL",{"data-svelte-h":!0}),T($)!=="svelte-1o5j9s7"&&($.innerHTML=Wt),ie=U(l),y(R.$$.fragment,l),ye=U(l),Q=n(l,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-11zkmfo"&&(Q.innerHTML=Ht),pe=U(l),W=n(l,"P",{"data-svelte-h":!0}),T(W)!=="svelte-19v0aru"&&(W.innerHTML=St),oe=U(l),H=n(l,"P",{"data-svelte-h":!0}),T(H)!=="svelte-1y2sq4s"&&(H.innerHTML=xt),we=U(l),S=n(l,"OL",{"data-svelte-h":!0}),T(S)!=="svelte-zvc6d4"&&(S.innerHTML=_t),Ce=U(l),x=n(l,"P",{"data-svelte-h":!0}),T(x)!=="svelte-1iis6f"&&(x.innerHTML=Yt),ce=U(l),y(_.$$.fragment,l),re=U(l),y(V.$$.fragment,l),je=U(l),Y=n(l,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-1n6vc7y"&&(Y.innerHTML=Xt),me=U(l),X=n(l,"IMG",{src:!0,alt:!0}),ue=U(l),q=n(l,"P",{"data-svelte-h":!0}),T(q)!=="svelte-utbpgy"&&(q.innerHTML=zt),Ie=U(l),y(z.$$.fragment,l),ge=U(l),L=n(l,"P",{"data-svelte-h":!0}),T(L)!=="svelte-1db12br"&&(L.textContent=Lt),de=U(l),y(P.$$.fragment,l),he=U(l),y(O.$$.fragment,l),fe=U(l),D=n(l,"P",{"data-svelte-h":!0}),T(D)!=="svelte-12eqykj"&&(D.innerHTML=Pt),be=U(l),K=n(l,"IMG",{src:!0,alt:!0}),Ve=U(l),ll=n(l,"P",{"data-svelte-h":!0}),T(ll)!=="svelte-at08d1"&&(ll.innerHTML=Dt),Be=U(l),el=n(l,"P",{"data-svelte-h":!0}),T(el)!=="svelte-wei6ii"&&(el.textContent=Kt),ke=U(l),y(tl.$$.fragment,l),Ne=U(l),sl=n(l,"P",{"data-svelte-h":!0}),T(sl)!=="svelte-1fgov2e"&&(sl.innerHTML=ls),Ze=U(l),y(Ml.$$.fragment,l),Fe=U(l),Ul=n(l,"P",{"data-svelte-h":!0}),T(Ul)!=="svelte-1tb9ak8"&&(Ul.textContent=es),ve=U(l),y(Jl.$$.fragment,l),Ae=U(l),nl=n(l,"IMG",{src:!0,alt:!0}),Ge=U(l),Tl=n(l,"P",{"data-svelte-h":!0}),T(Tl)!=="svelte-v2hosz"&&(Tl.innerHTML=ss),Ee=U(l),al=n(l,"P",{"data-svelte-h":!0}),T(al)!=="svelte-1ypx3hb"&&(al.innerHTML=Ms),$e=U(l),y(il.$$.fragment,l),Re=U(l),yl=n(l,"P",{"data-svelte-h":!0}),T(yl)!=="svelte-a8jfmd"&&(yl.textContent=Us),Qe=U(l),pl=n(l,"P",{"data-svelte-h":!0}),T(pl)!=="svelte-g3pzw9"&&(pl.textContent=Js),We=U(l),y(ol.$$.fragment,l),He=U(l),wl=n(l,"P",{"data-svelte-h":!0}),T(wl)!=="svelte-15uzzdb"&&(wl.textContent=ns),Se=U(l),Cl=n(l,"P",{"data-svelte-h":!0}),T(Cl)!=="svelte-1c12mmu"&&(Cl.textContent=Ts),xe=U(l),cl=n(l,"P",{"data-svelte-h":!0}),T(cl)!=="svelte-1mvdut1"&&(cl.innerHTML=as),_e=U(l),rl=n(l,"P",{"data-svelte-h":!0}),T(rl)!=="svelte-1w0bcf1"&&(rl.innerHTML=is),Ye=U(l),y(jl.$$.fragment,l),Xe=U(l),ml=n(l,"P",{"data-svelte-h":!0}),T(ml)!=="svelte-nmbtz8"&&(ml.innerHTML=ys),qe=U(l),ul=n(l,"P",{"data-svelte-h":!0}),T(ul)!=="svelte-1m8jf34"&&(ul.innerHTML=ps),ze=U(l),y(Il.$$.fragment,l),Le=U(l),gl=n(l,"P",{"data-svelte-h":!0}),T(gl)!=="svelte-qdl6e5"&&(gl.innerHTML=os),Pe=U(l),dl=n(l,"P",{"data-svelte-h":!0}),T(dl)!=="svelte-lx3ox3"&&(dl.innerHTML=ws),Oe=U(l),y(hl.$$.fragment,l),De=U(l),fl=n(l,"P",{"data-svelte-h":!0}),T(fl)!=="svelte-gf9unb"&&(fl.textContent=Cs),Ke=U(l),y(bl.$$.fragment,l),lt=U(l),Vl=n(l,"P",{"data-svelte-h":!0}),T(Vl)!=="svelte-1wixttm"&&(Vl.innerHTML=cs),et=U(l),Bl=n(l,"P",{"data-svelte-h":!0}),T(Bl)!=="svelte-1oeri7k"&&(Bl.innerHTML=rs),tt=U(l),d=n(l,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),Ft(d).forEach(t),st=U(l),kl=n(l,"P",{"data-svelte-h":!0}),T(kl)!=="svelte-4djxsr"&&(kl.innerHTML=ms),Mt=U(l),y(Nl.$$.fragment,l),Ut=U(l),Zl=n(l,"P",{"data-svelte-h":!0}),T(Zl)!=="svelte-10guegr"&&(Zl.innerHTML=us),Jt=U(l),Fl=n(l,"P",{"data-svelte-h":!0}),T(Fl)!=="svelte-1bia4fv"&&(Fl.textContent=Is),nt=U(l),y(B.$$.fragment,l),Tt=U(l),y(vl.$$.fragment,l),at=U(l),Al=n(l,"P",{"data-svelte-h":!0}),T(Al)!=="svelte-1dqmr61"&&(Al.textContent=gs),it=U(l),Gl=n(l,"P",{"data-svelte-h":!0}),T(Gl)!=="svelte-risard"&&(Gl.innerHTML=ds),yt=U(l),El=n(l,"P",{"data-svelte-h":!0}),T(El)!=="svelte-45pd9s"&&(El.textContent=hs),pt=U(l),$l=n(l,"P",{"data-svelte-h":!0}),T($l)!=="svelte-1tvhb6o"&&($l.textContent=fs),ot=U(l),y(Rl.$$.fragment,l),wt=U(l),Ql=n(l,"P",{"data-svelte-h":!0}),T(Ql)!=="svelte-1jcoxv6"&&(Ql.innerHTML=bs),Ct=U(l),Wl=n(l,"P",{"data-svelte-h":!0}),T(Wl)!=="svelte-bbwrb5"&&(Wl.textContent=Vs),ct=U(l),y(Hl.$$.fragment,l),rt=U(l),Sl=n(l,"P",{"data-svelte-h":!0}),T(Sl)!=="svelte-s74a79"&&(Sl.innerHTML=Bs),jt=U(l),y(xl.$$.fragment,l),mt=U(l),_l=n(l,"P",{"data-svelte-h":!0}),T(_l)!=="svelte-1pnj6yu"&&(_l.innerHTML=ks),ut=U(l),y(Yl.$$.fragment,l),It=U(l),Xl=n(l,"P",{"data-svelte-h":!0}),T(Xl)!=="svelte-1rlcqk3"&&(Xl.innerHTML=Ns),gt=U(l),ql=n(l,"P",{"data-svelte-h":!0}),T(ql)!=="svelte-15hdrrv"&&(ql.innerHTML=Zs),dt=U(l),ht=n(l,"HR",{}),ft=U(l),zl=n(l,"P",{"data-svelte-h":!0}),T(zl)!=="svelte-zrixdg"&&(zl.innerHTML=Fs),bt=U(l),y(Ll.$$.fragment,l),Vt=U(l),Pl=n(l,"UL",{"data-svelte-h":!0}),T(Pl)!=="svelte-1dvfmxx"&&(Pl.innerHTML=vs),Bt=U(l),y(Ol.$$.fragment,l),kt=U(l),Dl=n(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(nl.src,ts="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/smolagents/alfred-menu.jpg")||j(nl,"src",ts),j(nl,"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,a,e),s(l,u,e),s(l,m,e),p(c,l,e),s(l,g,e),p(k,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(v,l,e),s(l,Je,e),s(l,A,e),s(l,ne,e),s(l,G,e),s(l,Te,e),s(l,E,e),s(l,ae,e),s(l,$,e),s(l,ie,e),p(R,l,e),s(l,ye,e),s(l,Q,e),s(l,pe,e),s(l,W,e),s(l,oe,e),s(l,H,e),s(l,we,e),s(l,S,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,Ie,e),p(z,l,e),s(l,ge,e),s(l,L,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,Be,e),s(l,el,e),s(l,ke,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,ve,e),p(Jl,l,e),s(l,Ae,e),s(l,nl,e),s(l,Ge,e),s(l,Tl,e),s(l,Ee,e),s(l,al,e),s(l,$e,e),p(il,l,e),s(l,Re,e),s(l,yl,e),s(l,Qe,e),s(l,pl,e),s(l,We,e),p(ol,l,e),s(l,He,e),s(l,wl,e),s(l,Se,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,ze,e),p(Il,l,e),s(l,Le,e),s(l,gl,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,Bl,e),s(l,tt,e),s(l,d,e),s(l,st,e),s(l,kl,e),s(l,Mt,e),p(Nl,l,e),s(l,Ut,e),s(l,Zl,e),s(l,Jt,e),s(l,Fl,e),s(l,nt,e),p(B,l,e),s(l,Tt,e),p(vl,l,e),s(l,at,e),s(l,Al,e),s(l,it,e),s(l,Gl,e),s(l,yt,e),s(l,El,e),s(l,pt,e),s(l,$l,e),s(l,ot,e),p(Rl,l,e),s(l,wt,e),s(l,Ql,e),s(l,Ct,e),s(l,Wl,e),s(l,ct,e),p(Hl,l,e),s(l,rt,e),s(l,Sl,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,It,e),s(l,Xl,e),s(l,gt,e),s(l,ql,e),s(l,dt,e),s(l,ht,e),s(l,ft,e),s(l,zl,e),s(l,bt,e),p(Ll,l,e),s(l,Vt,e),s(l,Pl,e),s(l,Bt,e),p(Ol,l,e),s(l,kt,e),s(l,Dl,e),Nt=!0},p(l,[e]){const As={};e&2&&(As.$$scope={dirty:e,ctx:l}),b.$set(As);const Gs={};e&2&&(Gs.$$scope={dirty:e,ctx:l}),V.$set(Gs);const Es={};e&2&&(Es.$$scope={dirty:e,ctx:l}),B.$set(Es)},i(l){Nt||(o(c.$$.fragment,l),o(k.$$.fragment,l),o(b.$$.fragment,l),o(v.$$.fragment,l),o(R.$$.fragment,l),o(_.$$.fragment,l),o(V.$$.fragment,l),o(z.$$.fragment,l),o(P.$$.fragment,l),o(O.$$.fragment,l),o(tl.$$.fragment,l),o(Ml.$$.fragment,l),o(Jl.$$.fragment,l),o(il.$$.fragment,l),o(ol.$$.fragment,l),o(jl.$$.fragment,l),o(Il.$$.fragment,l),o(hl.$$.fragment,l),o(bl.$$.fragment,l),o(Nl.$$.fragment,l),o(B.$$.fragment,l),o(vl.$$.fragment,l),o(Rl.$$.fragment,l),o(Hl.$$.fragment,l),o(xl.$$.fragment,l),o(Yl.$$.fragment,l),o(Ll.$$.fragment,l),o(Ol.$$.fragment,l),Nt=!0)},o(l){w(c.$$.fragment,l),w(k.$$.fragment,l),w(b.$$.fragment,l),w(v.$$.fragment,l),w(R.$$.fragment,l),w(_.$$.fragment,l),w(V.$$.fragment,l),w(z.$$.fragment,l),w(P.$$.fragment,l),w(O.$$.fragment,l),w(tl.$$.fragment,l),w(Ml.$$.fragment,l),w(Jl.$$.fragment,l),w(il.$$.fragment,l),w(ol.$$.fragment,l),w(jl.$$.fragment,l),w(Il.$$.fragment,l),w(hl.$$.fragment,l),w(bl.$$.fragment,l),w(Nl.$$.fragment,l),w(B.$$.fragment,l),w(vl.$$.fragment,l),w(Rl.$$.fragment,l),w(Hl.$$.fragment,l),w(xl.$$.fragment,l),w(Yl.$$.fragment,l),w(Ll.$$.fragment,l),w(Ol.$$.fragment,l),Nt=!1},d(l){l&&(t(a),t(u),t(m),t(g),t(ee),t(N),t(te),t(Z),t(se),t(F),t(Me),t(Ue),t(Je),t(A),t(ne),t(G),t(Te),t(E),t(ae),t($),t(ie),t(ye),t(Q),t(pe),t(W),t(oe),t(H),t(we),t(S),t(Ce),t(x),t(ce),t(re),t(je),t(Y),t(me),t(X),t(ue),t(q),t(Ie),t(ge),t(L),t(de),t(he),t(fe),t(D),t(be),t(K),t(Ve),t(ll),t(Be),t(el),t(ke),t(Ne),t(sl),t(Ze),t(Fe),t(Ul),t(ve),t(Ae),t(nl),t(Ge),t(Tl),t(Ee),t(al),t($e),t(Re),t(yl),t(Qe),t(pl),t(We),t(He),t(wl),t(Se),t(Cl),t(xe),t(cl),t(_e),t(rl),t(Ye),t(Xe),t(ml),t(qe),t(ul),t(ze),t(Le),t(gl),t(Pe),t(dl),t(Oe),t(De),t(fl),t(Ke),t(lt),t(Vl),t(et),t(Bl),t(tt),t(d),t(st),t(kl),t(Mt),t(Ut),t(Zl),t(Jt),t(Fl),t(nt),t(Tt),t(at),t(Al),t(it),t(Gl),t(yt),t(El),t(pt),t($l),t(ot),t(wt),t(Ql),t(Ct),t(Wl),t(ct),t(rt),t(Sl),t(jt),t(mt),t(_l),t(ut),t(It),t(Xl),t(gt),t(ql),t(dt),t(ht),t(ft),t(zl),t(bt),t(Vt),t(Pl),t(Bt),t(kt),t(Dl)),t(r),C(c,l),C(k,l),C(b,l),C(v,l),C(R,l),C(_,l),C(V,l),C(z,l),C(P,l),C(O,l),C(tl,l),C(Ml,l),C(Jl,l),C(il,l),C(ol,l),C(jl,l),C(Il,l),C(hl,l),C(bl,l),C(Nl,l),C(B,l),C(vl,l),C(Rl,l),C(Hl,l),C(xl,l),C(Yl,l),C(Ll,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 Qs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class MM extends Ws{constructor(r){super(),Hs(this,r,Os,Ls,Rs,{})}}export{MM as component};
