import{s as OJ,a as oJ,n as SJ,o as cJ}from"../chunks/scheduler.505acc25.js";import{S as wJ,i as uJ,e,s as T,c as M,h as IJ,a as n,d as J,b as s,f as gJ,g as V,j as a,k as YU,l as kJ,m as t,n as i,t as Q,o as C,p}from"../chunks/index.b1175496.js";import{C as mJ,H as DU}from"../chunks/Heading.eda51538.js";import{C as y}from"../chunks/CodeBlock.9d480d26.js";import{E as rJ}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.ea377ea6.js";function dJ($U){let N,Sl,Ol,cl,R,wl,F,ul,E,xU,Il,h,ZU="本课程是框架无关的，因为我们想要<strong>专注于 AI 智能体（AI Agent）的概念，避免陷入特定框架的细节中</strong>。",kl,B,_U="同时，我们希望学生能够在自己的项目中使用他们在本课程中学到的概念，使用任何他们喜欢的框架。",ml,j,XU="因此，在第一单元中，我们将使用一个简单智能体库和一个简单的无服务器 API (serverless API) 来访问我们的 LLM 引擎。",rl,g,AU="你可能不会在生产环境中使用这些，但它们将作为<strong>理解智能体如何工作的良好起点</strong>。",dl,O,vU="在本节之后，你将准备好<strong>使用 <code>smolagents</code> 创建一个简单的智能体</strong>。",bl,o,zU="在接下来的单元中，我们还将使用其他 AI 智能体库，如 <code>LangGraph</code> 和 <code>LlamaIndex</code>。",Gl,S,WU="为了保持简单，我们将使用一个简单的 Python 函数作为工具和智能体。",fl,c,qU="我们将使用内置的 Python 包，如 <code>datetime</code> 和 <code>os</code>，这样你可以在任何环境中尝试它。",Yl,w,HU='你可以<a href="https://huggingface.co/agents-course/notebooks/blob/main/unit1/dummy_agent_library.ipynb" rel="nofollow">在这个 notebook 中</a>跟随过程并<strong>自己运行代码</strong>。',Dl,u,$l,I,LU="在 Hugging Face 生态系统中，有一个称为无服务器 API 的便捷功能，它允许你轻松地在许多模型上运行推理。不需要安装或部署。",xl,k,Zl,m,_l,r,PU="输出:",Xl,d,Al,b,KU="如 LLM 部分所见，如果我们只做解码，<strong>模型只会在预测到 EOS token 时停止</strong>，而这里没有发生，因为这是一个会话（聊天）模型，<strong>我们没有应用它期望的聊天模板</strong>。",vl,G,lJ='如果我们现在添加与我们使用的<a href="https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct">Llama-3.2-3B-Instruct 模型</a>相关的特殊 token，行为会改变，现在会产生预期的 EOS。',zl,f,Wl,Y,UJ="输出：",ql,D,Hl,$,JJ="使用”chat”方法是应用聊天模板的更方便和可靠的方式：",Ll,x,Pl,Z,tJ="输出：",Kl,_,lU,X,TJ="chat 方法是推荐使用的方法，以确保模型之间的平滑过渡，但由于这个 notebook 只是教育性质的，我们将继续使用 “text_generation” 方法来理解细节。",UU,A,JU,v,sJ="在前面的部分中，我们看到智能体库的核心是在系统提示中附加信息。",tU,z,eJ="这个系统提示比我们之前看到的要复杂一些，但它已经包含：",TU,W,nJ="<li><strong>工具信息</strong></li> <li><strong>循环指令</strong> （思考 → 行动 → 观察）</li>",sU,q,eU,H,aJ="由于我们正在运行“text_generation”方法，因此我们需要手动应用提示：",nU,L,aU,P,MJ="我们也可以这样做，这就是在 <code>chat</code> 方法内部发生的情况：",MU,K,VU,ll,VJ="现在的提示是：",iU,Ul,QU,Jl,iJ="Let’s decode!",CU,tl,pU,Tl,QJ="输出:",yU,sl,NU,el,CJ="你看到问题了吗？",RU,nl,pJ=`<p>答案是模型产生的幻觉。我们需要停下来真正执行这个函数！
现在让我们停在“观察”上，这样我们就不会产生实际函数响应的幻觉。</p>`,FU,al,EU,Ml,yJ="输出:",hU,Vl,BU,il,NJ=`好多了！
现在让我们创建一个虚拟的获取天气函数。在实际情况下，您可能会调用 API。`,jU,Ql,gU,Cl,RJ="输出:",OU,pl,oU,yl,FJ="我们将基本提示、函数执行前的完成以及函数的结果连接起来作为观察并恢复生成。",SU,Nl,cU,Rl,EJ="这是新的提示：",wU,Fl,uU,El,hJ="输出:",IU,hl,kU,mU,rU,Bl,BJ="我们学习了如何使用 Python 代码从头开始创建智能体，并且我们<strong>看到了这个过程是多么繁琐</strong>。幸运的是，许多智能体库通过为您处理大部分繁重的工作来简化这项工作。",dU,jl,jJ="现在，我们已准备好使用 <code>smolagents</code> 库<strong>创建我们的第一个真正的智能体</strong>。",bU,gl,GU,ol,fU;return R=new mJ({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),F=new DU({props:{title:"简单智能体库 (Dummy Agent Library)",local:"简单智能体库-dummy-agent-library",headingTag:"h1"}}),u=new DU({props:{title:"无服务器 API (Serverless API)",local:"无服务器-api-serverless-api",headingTag:"h2"}}),k=new y({props:{code:"aW1wb3J0JTIwb3MlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwSW5mZXJlbmNlQ2xpZW50JTBBJTBBJTIzJTIzJTIwJUU0JUJEJUEwJUU5JTlDJTgwJUU4JUE2JTgxJUU0JUI4JTgwJUU0JUI4JUFBJUU2JTlEJUE1JUU4JTg3JUFBJTIwaHR0cHMlM0ElMkYlMkZoZi5jbyUyRnNldHRpbmdzJTJGdG9rZW5zJTIwJUU3JTlBJTg0JTIwdG9rZW4lRUYlQkMlOEMlRTclQTElQUUlRTQlQkYlOUQlRTQlQkQlQTAlRTklODAlODklRTYlOEIlQTkncmVhZCclRTQlQkQlOUMlRTQlQjglQkElMjB0b2tlbiUyMCVFNyVCMSVCQiVFNSU5RSU4QiVFMyU4MCU4MiVFNSVBNiU4MiVFNiU5RSU5QyVFNCVCRCVBMCVFNSU5QyVBOCUyMEdvb2dsZSUyMENvbGFiJTIwJUU0JUI4JThBJUU4JUJGJTkwJUU4JUExJThDJUVGJUJDJThDJUU0JUJEJUEwJUU1JThGJUFGJUU0JUJCJUE1JUU1JTlDJUE4JTIyc2V0dGluZ3MlMjIlRTYlQTAlODclRTclQUQlQkUlRTQlQjglOEIlRTclOUElODQlMjJzZWNyZXRzJTIyJUU0JUI4JUFEJUU4JUFFJUJFJUU3JUJEJUFFJUU1JUFFJTgzJUUzJTgwJTgyJUU3JUExJUFFJUU0JUJGJTlEJUU1JUIwJTg2JUU1JTg1JUI2JUU1JTkxJUJEJUU1JTkwJThEJUU0JUI4JUJBJTIySEZfVE9LRU4lMjIlMEFvcy5lbnZpcm9uJTVCJTIySEZfVE9LRU4lMjIlNUQlM0QlMjJoZl94eHh4eHh4eHh4eHh4eCUyMiUwQSUwQWNsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudChwcm92aWRlciUzRCUyMmhmLWluZmVyZW5jZSUyMiUyQyUyMG1vZGVsJTNEJTIybWV0YS1sbGFtYSUyRkxsYW1hLTMuMy03MEItSW5zdHJ1Y3QlMjIpJTBBJTIzJTIwJUU1JUE2JTgyJUU2JTlFJTlDJUU0JUI4JThCJUU0JUI4JTgwJUU0JUI4JUFBJUU1JThEJTk1JUU1JTg1JTgzJUU2JUEwJUJDJUU3JTlBJTg0JUU4JUJFJTkzJUU1JTg3JUJBJUU0JUI4JThEJUU2JUFEJUEzJUU3JUExJUFFJUVGJUJDJThDJUU1JTg1JThEJUU4JUI0JUI5JUU2JUE4JUExJUU1JTlFJThCJUU1JThGJUFGJUU4JTgzJUJEJUU4JUJGJTg3JUU4JUJEJUJEJUUzJTgwJTgyJUU0JUJEJUEwJUU0JUI5JTlGJUU1JThGJUFGJUU0JUJCJUE1JUU0JUJEJUJGJUU3JTk0JUE4JUU4JUJGJTk5JUU0JUI4JUFBJUU1JThDJTg1JUU1JTkwJUFCJTIwTGxhbWEtMy4yLTNCLUluc3RydWN0JTIwJUU3JTlBJTg0JUU1JTg1JUFDJUU1JTg1JUIxJUU3JUFCJUFGJUU3JTgyJUI5JTBBJTIzJTIwY2xpZW50JTIwJTNEJTIwSW5mZXJlbmNlQ2xpZW50KCUyMmh0dHBzJTNBJTJGJTJGamMyNm13ZzIyOG1rajhkdy51cy1lYXN0LTEuYXdzLmVuZHBvaW50cy5odWdnaW5nZmFjZS5jbG91ZCUyMik=",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

<span class="hljs-comment">## 你需要一个来自 https://hf.co/settings/tokens 的 token，确保你选择&#x27;read&#x27;作为 token 类型。如果你在 Google Colab 上运行，你可以在&quot;settings&quot;标签下的&quot;secrets&quot;中设置它。确保将其命名为&quot;HF_TOKEN&quot;</span>
os.environ[<span class="hljs-string">&quot;HF_TOKEN&quot;</span>]=<span class="hljs-string">&quot;hf_xxxxxxxxxxxxxx&quot;</span>

client = InferenceClient(provider=<span class="hljs-string">&quot;hf-inference&quot;</span>, model=<span class="hljs-string">&quot;meta-llama/Llama-3.3-70B-Instruct&quot;</span>)
<span class="hljs-comment"># 如果下一个单元格的输出不正确，免费模型可能过载。你也可以使用这个包含 Llama-3.2-3B-Instruct 的公共端点</span>
<span class="hljs-comment"># client = InferenceClient(&quot;https://jc26mwg228mkj8dw.us-east-1.aws.endpoints.huggingface.cloud&quot;)</span>`,wrap:!1}}),m=new y({props:{code:"b3V0cHV0JTIwJTNEJTIwY2xpZW50LnRleHRfZ2VuZXJhdGlvbiglMEElMjAlMjAlMjAlMjAlMjJUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTBBKSUwQSUwQXByaW50KG91dHB1dCk=",highlighted:`output = client.text_generation(
    <span class="hljs-string">&quot;The capital of France is&quot;</span>,
    max_new_tokens=<span class="hljs-number">100</span>,
)

<span class="hljs-built_in">print</span>(output)`,wrap:!1}}),d=new y({props:{code:"UGFyaXMuJTIwVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4lMjBUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMFBhcmlzLiUyMFRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwUGFyaXMuJTIwVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4lMjBUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMFBhcmlzLiUyMFRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwUGFyaXMuJTIwVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4lMjBUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMFBhcmlzLiUyMFRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwUGFyaXMuJTIwVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4lMjBUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMFBhcmlzLiUyMFRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwUGFyaXMuJTIwVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4lMjBUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMFBhcmlzLg==",highlighted:'Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris. The capital of France <span class="hljs-keyword">is</span> Paris.',wrap:!1}}),f=new y({props:{code:"cHJvbXB0JTNEJTIyJTIyJTIyJTNDJTdDYmVnaW5fb2ZfdGV4dCU3QyUzRSUzQyU3Q3N0YXJ0X2hlYWRlcl9pZCU3QyUzRXVzZXIlM0MlN0NlbmRfaGVhZGVyX2lkJTdDJTNFJTBBVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlM0MlN0Nlb3RfaWQlN0MlM0UlM0MlN0NzdGFydF9oZWFkZXJfaWQlN0MlM0Vhc3Npc3RhbnQlM0MlN0NlbmRfaGVhZGVyX2lkJTdDJTNFJTIyJTIyJTIyJTBBb3V0cHV0JTIwJTNEJTIwY2xpZW50LnRleHRfZ2VuZXJhdGlvbiglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDEwMCUyQyUwQSklMEElMEFwcmludChvdXRwdXQp",highlighted:`prompt=<span class="hljs-string">&quot;&quot;&quot;&lt;|begin_of_text|&gt;&lt;|start_header_id|&gt;user&lt;|end_header_id|&gt;
The capital of France is&lt;|eot_id|&gt;&lt;|start_header_id|&gt;assistant&lt;|end_header_id|&gt;&quot;&quot;&quot;</span>
output = client.text_generation(
    prompt,
    max_new_tokens=<span class="hljs-number">100</span>,
)

<span class="hljs-built_in">print</span>(output)`,wrap:!1}}),D=new y({props:{code:"VGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4=",highlighted:'The capital of France <span class="hljs-keyword">is</span> Paris.',wrap:!1}}),x=new y({props:{code:"b3V0cHV0JTIwJTNEJTIwY2xpZW50LmNoYXQuY29tcGxldGlvbnMuY3JlYXRlKCUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjBzdHJlYW0lM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDI0JTJDJTBBKSUwQXByaW50KG91dHB1dC5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlLmNvbnRlbnQp",highlighted:`output = client.chat.completions.create(
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;The capital of France is&quot;</span>},
    ],
    stream=<span class="hljs-literal">False</span>,
    max_tokens=<span class="hljs-number">1024</span>,
)
<span class="hljs-built_in">print</span>(output.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),_=new y({props:{code:"UGFyaXMu",highlighted:"Paris.",wrap:!1}}),A=new DU({props:{title:"简单智能体 (Dummy Agent)",local:"简单智能体-dummy-agent",headingTag:"h2"}}),q=new y({props:{code:"JUU4JUFGJUI3JUU1JUIwJUJEJUU1JThGJUFGJUU4JTgzJUJEJUU1JTg3JTg2JUU3JUExJUFFJUU1JTlDJUIwJUU1JTlCJTlFJUU3JUFEJTk0JUU0JUJCJUE1JUU0JUI4JThCJUU5JTk3JUFFJUU5JUEyJTk4JUUzJTgwJTgyJUU0JUJEJUEwJUU1JThGJUFGJUU0JUJCJUE1JUU0JUJEJUJGJUU3JTk0JUE4JUU0JUJCJUE1JUU0JUI4JThCJUU1JUI3JUE1JUU1JTg1JUI3JUVGJUJDJTlBJTBBJTBBZ2V0X3dlYXRoZXIlM0ElMjAlRTglOEUlQjclRTUlOEYlOTYlRTYlOEMlODclRTUlQUUlOUElRTUlOUMlQjAlRTclODIlQjklRTclOUElODQlRTUlQkQlOTMlRTUlODklOEQlRTUlQTQlQTklRTYlQjAlOTQlMEElMEElRTQlQkQlQkYlRTclOTQlQTglRTUlQjclQTUlRTUlODUlQjclRTclOUElODQlRTYlOTYlQjklRTUlQkMlOEYlRTYlOT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JCJTg4JUU0JUJEJUJGJUU3JTk0JUE4JUU3JUIyJUJFJUU3JUExJUFFJUU1JUFEJTk3JUU3JUFDJUE2JTIwJTYwRmluYWwlMjBBbnN3ZXIlM0ElNjAlMjAlRTYlOUQlQTUlRTclQkIlOTklRTUlODclQkElRTYlOUMlODAlRTclQkIlODglRTclQUQlOTQlRTYlQTElODg=",highlighted:`请尽可能准确地回答以下问题。你可以使用以下工具：

<span class="hljs-symbol">get_weather:</span> 获取指定地点的当前天气

使用工具的方式是通过指定一个 JSON blob。具体来说，这个 JSON 应该包含 \`action\` 键（工具名称）和 \`action_input\` 键（工具输入参数）。

<span class="hljs-string">&quot;action&quot;</span> 字段唯一允许的值是：
<span class="hljs-symbol">get_weather:</span> 获取指定地点的当前天气，参数：{<span class="hljs-string">&quot;location&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>}}
使用示例：

{{
  <span class="hljs-string">&quot;action&quot;</span>: <span class="hljs-string">&quot;get_weather&quot;</span>,
  <span class="hljs-string">&quot;action_input&quot;</span>: {<span class="hljs-string">&quot;location&quot;</span>: <span class="hljs-string">&quot;New York&quot;</span>}
}}

必须始终使用以下格式：

<span class="hljs-symbol">Question:</span> 需要回答的输入问题
<span class="hljs-symbol">Thought:</span> 你应该始终思考要采取的一个行动（每次只能执行一个行动）
<span class="hljs-symbol">Action:</span>

$JSON_BLOB (inside markdown cell)

<span class="hljs-symbol">Observation:</span> 行动执行结果（这是唯一且完整的事实依据）
...（这个 Thought/Action/Observation 循环可根据需要重复多次，$JSON_BLOB 必须使用 markdown 格式且每次仅执行一个行动）

最后必须以下列格式结束：

<span class="hljs-symbol">Thought:</span> 我现在知道最终答案
Final Answer: 对原始问题的最终回答

现在开始！请始终使用精确字符 \`Final Answer:\` 来给出最终答案`,wrap:!1}}),L=new y({props:{code:"cHJvbXB0JTNEZiUyMiUyMiUyMiUzQyU3Q2JlZ2luX29mX3RleHQlN0MlM0UlM0MlN0NzdGFydF9oZWFkZXJfaWQlN0MlM0VzeXN0ZW0lM0MlN0NlbmRfaGVhZGVyX2lkJTdDJTNFJTBBJTdCU1lTVEVNX1BST01QVCU3RCUwQSUzQyU3Q2VvdF9pZCU3QyUzRSUzQyU3Q3N0YXJ0X2hlYWRlcl9pZCU3QyUzRXVzZXIlM0MlN0NlbmRfaGVhZGVyX2lkJTdDJTNFJTBBV2hhdCdzJTIwdGhlJTIwd2VhdGhlciUyMGluJTIwTG9uZG9uJTIwJTNGJTBBJTNDJTdDZW90X2lkJTdDJTNFJTNDJTdDc3RhcnRfaGVhZGVyX2lkJTdDJTNFYXNzaXN0YW50JTNDJTdDZW5kX2hlYWRlcl9pZCU3QyUzRSUwQSUyMiUyMiUyMg==",highlighted:`prompt=<span class="hljs-string">f&quot;&quot;&quot;&lt;|begin_of_text|&gt;&lt;|start_header_id|&gt;system&lt;|end_header_id|&gt;
<span class="hljs-subst">{SYSTEM_PROMPT}</span>
&lt;|eot_id|&gt;&lt;|start_header_id|&gt;user&lt;|end_header_id|&gt;
What&#x27;s the weather in London ?
&lt;|eot_id|&gt;&lt;|start_header_id|&gt;assistant&lt;|end_header_id|&gt;
&quot;&quot;&quot;</span>`,wrap:!1}}),K=new y({props:{code:"bWVzc2FnZXMlM0QlNUIlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMFNZU1RFTV9QUk9NUFQlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJXaGF0J3MlMjB0aGUlMjB3ZWF0aGVyJTIwaW4lMjBMb25kb24lMjAlM0YlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlNUQlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMm1ldGEtbGxhbWElMkZMbGFtYS0zLjItM0ItSW5zdHJ1Y3QlMjIpJTBBJTBBdG9rZW5pemVyLmFwcGx5X2NoYXRfdGVtcGxhdGUobWVzc2FnZXMlMkMlMjB0b2tlbml6ZSUzREZhbHNlJTJDYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSk=",highlighted:`messages=[
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: SYSTEM_PROMPT},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;What&#x27;s the weather in London ?&quot;</span>},
    ]
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;meta-llama/Llama-3.2-3B-Instruct&quot;</span>)

tokenizer.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>,add_generation_prompt=<span class="hljs-literal">True</span>)`,wrap:!1}}),Ul=new y({props:{code:" ",highlighted:`&lt;|<span class="hljs-type">begin_of_text</span>|<span class="hljs-type">&gt;&lt;|start_header_id</span>|<span class="hljs-type">&gt;system</span>&lt;|<span class="hljs-type">end_header_id</span>|<span class="hljs-type">&gt;
请尽可能准确地回答以下问题。你可以使用以下工具：

get_weather</span>: 获取指定地点的当前天气

使用工具的方式是通过指定一个 JSON blob。具体来说，这个 JSON 应该包含 \`action\` 键（工具名称）和 \`action_input\` 键（工具输入参数）。

<span class="hljs-string">&quot;action&quot;</span> 字段唯一允许的值是：
get_weather: 获取指定地点的当前天气，参数：{<span class="hljs-string">&quot;location&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>}}
使用示例：

{{
  <span class="hljs-string">&quot;action&quot;</span>: <span class="hljs-string">&quot;get_weather&quot;</span>,
  <span class="hljs-string">&quot;action_input&quot;</span>: {<span class="hljs-string">&quot;location&quot;</span>: <span class="hljs-string">&quot;New York&quot;</span>}
}}

必须始终使用以下格式：

Question: 需要回答的输入问题
Thought: 你应该始终思考要采取的一个行动（每次只能执行一个行动）
Action:

$JSON_BLOB (markdown 单元格内部)

Observation: 行动执行结果（这是唯一且完整的事实依据）
...（这个 Thought/Action/Observation 循环可根据需要重复多次，$JSON_BLOB 必须使用 markdown 格式且每次仅执行一个行动）

最后必须以下列格式结束：

Thought: 我现在知道最终答案 Final Answer: 对原始问题的最终回答

现在开始！请始终使用精确字符 \`Final Answer:\` 来给出最终答案
&lt;|<span class="hljs-type">eot_id</span>|<span class="hljs-type">&gt;&lt;|start_header_id</span>|<span class="hljs-type">&gt;user</span>&lt;|<span class="hljs-type">end_header_id</span>|<span class="hljs-type">&gt;
What</span>&#x27;s the weather <span class="hljs-built_in">in</span> London ?
&lt;|<span class="hljs-type">eot_id</span>|<span class="hljs-type">&gt;&lt;|start_header_id</span>|<span class="hljs-type">&gt;assistant</span>&lt;|<span class="hljs-type">end_header_id</span>|<span class="hljs-type">&gt;</span>`,wrap:!1}}),tl=new y({props:{code:"b3V0cHV0JTIwJTNEJTIwY2xpZW50LnRleHRfZ2VuZXJhdGlvbiglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDIwMCUyQyUwQSklMEElMEFwcmludChvdXRwdXQp",highlighted:`output = client.text_generation(
    prompt,
    max_new_tokens=<span class="hljs-number">200</span>,
)

<span class="hljs-built_in">print</span>(output)`,wrap:!1}}),sl=new y({props:{code:"QWN0aW9uJTNBJTBBJTYwJTYwJTYwJTBBJTdCJTBBJTIwJTIwJTIyYWN0aW9uJTIyJTNBJTIwJTIyZ2V0X3dlYXRoZXIlMjIlMkMlMEElMjAlMjAlMjJhY3Rpb25faW5wdXQlMjIlM0ElMjAlN0IlMjJsb2NhdGlvbiUyMiUzQSUyMCUyMkxvbmRvbiUyMiU3RCUwQSU3RCUwQSU2MCU2MCU2MCUwQVRob3VnaHQlRUYlQkMlOUElRTYlODglOTElRTglQTYlODElRTYlOUYlQTUlRTclOUMlOEIlRTQlQjglODAlRTQlQjglOEIlRTQlQkMlQTYlRTYlOTUlQTYlRTclOUElODQlRTUlQTQlQTklRTYlQjAlOTQlRTMlODAlODIlMEFPYnNlcnZhdGlvbiVFRiVCQyU5QSVFNCVCQyVBNiVFNiU5NSVBNiVFNyU5QiVBRSVFNSU4OSU4RCVFNyU5QSU4NCVFNSVBNCVBOSVFNiVCMCU5NCVFNSVBNCU5QSVFNCVCQSU5MSVFRiVCQyU4QyVFNiU5QyU4MCVFOSVBQiU5OCVFNiVCMCU5NCVFNiVCOCVBOSUyMDEyJUMyJUIwQyVFRiVCQyU4QyVFNiU5QyU4MCVFNCVCRCU4RSVFNiVCMCU5NCVFNiVCOCVBOSUyMDglQzIlQjBDJUUzJTgwJTgy",highlighted:`<span class="hljs-title">Action:</span>
\`\`\`
{
  <span class="hljs-string">&quot;action&quot;</span>: <span class="hljs-string">&quot;get_weather&quot;</span>,
  <span class="hljs-string">&quot;action_input&quot;</span>: {<span class="hljs-string">&quot;location&quot;</span>: <span class="hljs-string">&quot;London&quot;</span>}
}
\`\`\`
Thought：我要查看一下伦敦的天气。
Observation：伦敦目前的天气多云，最高气温 <span class="hljs-number">12</span>°C，最低气温 <span class="hljs-number">8</span>°C。`,wrap:!1}}),al=new y({props:{code:"b3V0cHV0JTIwJTNEJTIwY2xpZW50LnRleHRfZ2VuZXJhdGlvbiglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDIwMCUyQyUwQSUyMCUyMCUyMCUyMHN0b3AlM0QlNUIlMjJPYnNlcnZhdGlvbiUzQSUyMiU1RCUyMCUyMyUyMExldCdzJTIwc3RvcCUyMGJlZm9yZSUyMGFueSUyMGFjdHVhbCUyMGZ1bmN0aW9uJTIwaXMlMjBjYWxsZWQlMEEpJTBBJTBBcHJpbnQob3V0cHV0KQ==",highlighted:`output = client.text_generation(
    prompt,
    max_new_tokens=<span class="hljs-number">200</span>,
    stop=[<span class="hljs-string">&quot;Observation:&quot;</span>] <span class="hljs-comment"># Let&#x27;s stop before any actual function is called</span>
)

<span class="hljs-built_in">print</span>(output)`,wrap:!1}}),Vl=new y({props:{code:"QWN0aW9uJTNBJTBBJTYwJTYwJTYwJTBBJTdCJTBBJTIwJTIwJTIyYWN0aW9uJTIyJTNBJTIwJTIyZ2V0X3dlYXRoZXIlMjIlMkMlMEElMjAlMjAlMjJhY3Rpb25faW5wdXQlMjIlM0ElMjAlN0IlMjJsb2NhdGlvbiUyMiUzQSUyMCUyMkxvbmRvbiUyMiU3RCUwQSU3RCUwQSU2MCU2MCU2MCUwQVRob3VnaHQlM0ElMjAlRTYlODglOTElRTQlQkMlOUElRTYlOUYlQTUlRTclOUMlOEIlRTQlQkMlQTYlRTYlOTUlQTYlRTclOUElODQlRTUlQTQlQTklRTYlQjAlOTQlRTMlODAlODIlMEFPYnNlcnZhdGlvbiUzQQ==",highlighted:`<span class="hljs-title">Action:</span>
\`\`\`
{
  <span class="hljs-string">&quot;action&quot;</span>: <span class="hljs-string">&quot;get_weather&quot;</span>,
  <span class="hljs-string">&quot;action_input&quot;</span>: {<span class="hljs-string">&quot;location&quot;</span>: <span class="hljs-string">&quot;London&quot;</span>}
}
\`\`\`
<span class="hljs-title">Thought:</span> 我会查看伦敦的天气。
<span class="hljs-title">Observation:</span>`,wrap:!1}}),Ql=new y({props:{code:"JTIzJTIwRHVtbXklMjBmdW5jdGlvbiUwQWRlZiUyMGdldF93ZWF0aGVyKGxvY2F0aW9uKSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGYlMjJ0aGUlMjB3ZWF0aGVyJTIwaW4lMjAlN0Jsb2NhdGlvbiU3RCUyMGlzJTIwc3VubnklMjB3aXRoJTIwbG93JTIwdGVtcGVyYXR1cmVzLiUyMCU1Q24lMjIlMEElMEFnZXRfd2VhdGhlcignTG9uZG9uJyk=",highlighted:`<span class="hljs-comment"># Dummy function</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_weather</span>(<span class="hljs-params">location</span>):
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;the weather in <span class="hljs-subst">{location}</span> is sunny with low temperatures. \\n&quot;</span>

get_weather(<span class="hljs-string">&#x27;London&#x27;</span>)`,wrap:!1}}),pl=new y({props:{code:"JUUyJTgwJTlDJUU0JUJDJUE2JUU2JTk1JUE2JUU1JUE0JUE5JUU2JUIwJTk0JUU2JTk5JUI0JUU2JTlDJTk3JUVGJUJDJThDJUU2JUIwJTk0JUU2JUI4JUE5JUU4JUJFJTgzJUU0JUJEJThFJUUzJTgwJTgyJTVDbiVFMiU4MCU5RA==",highlighted:'“伦敦天气晴朗，气温较低。<span class="hljs-string">\\n”</span>',wrap:!1}}),Nl=new y({props:{code:"bmV3X3Byb21wdCUyMCUzRCUyMHByb21wdCUyMCUyQiUyMG91dHB1dCUyMCUyQiUyMGdldF93ZWF0aGVyKCdMb25kb24nKSUwQWZpbmFsX291dHB1dCUyMCUzRCUyMGNsaWVudC50ZXh0X2dlbmVyYXRpb24oJTBBJTIwJTIwJTIwJTIwbmV3X3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMG1heF9uZXdfdG9rZW5zJTNEMjAwJTJDJTBBKSUwQSUwQXByaW50KGZpbmFsX291dHB1dCk=",highlighted:`new_prompt = prompt + output + get_weather(<span class="hljs-string">&#x27;London&#x27;</span>)
final_output = client.text_generation(
    new_prompt,
    max_new_tokens=<span class="hljs-number">200</span>,
)

<span class="hljs-built_in">print</span>(final_output)`,wrap:!1}}),Fl=new y({props:{code:" ",highlighted:`&lt;|<span class="hljs-type">begin_of_text</span>|<span class="hljs-type">&gt;&lt;|start_header_id</span>|<span class="hljs-type">&gt;system</span>&lt;|<span class="hljs-type">end_header_id</span>|<span class="hljs-type">&gt;
    尽可能回答以下问题。您可以使用以下工具：

get_weather</span>：获取给定位置的当前天气

使用工具的方式是指定 json blob。

具体来说，此 json 应具有 \`action\` 键（包含要使用的工具的名称）和 \`action_input\` 键（包含工具的输入）。

“action”字段中应包含的唯一值是：

get_weather：获取给定位置的当前天气，参数：{<span class="hljs-string">&quot;location&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>}}
示例用法：

{{
  <span class="hljs-string">&quot;action&quot;</span>: <span class="hljs-string">&quot;get_weather&quot;</span>,
  <span class="hljs-string">&quot;action_input&quot;</span>: {<span class="hljs-string">&quot;location&quot;</span>: <span class="hljs-string">&quot;New York&quot;</span>}
}}

始终使用以下格式：

Question: 您必须回答的输入问题
Thought: 您应该始终考虑采取一项行动。每次只能采取一项行动，格式如下：
Action:

$JSON_BLOB (inside markdown cell)

Observation：行动的结果。这种观察是独一无二的、完整的，也是真相的来源。
...（这种 Thought/Action/Observation 可以重复 N 次，您应该在需要时采取几个步骤。$JSON_BLOB 必须格式化为 markdown，并且一次只能使用一个操作。）

您必须始终以以下格式结束输出：

想法：我现在知道最终答案
最终答案：对原始输入问题的最终答案

现在开始！提醒您，当您提供明确答案时，始终使用精确字符“最终答案：”。
&lt;|<span class="hljs-type">eot_id</span>|<span class="hljs-type">&gt;&lt;|start_header_id</span>|<span class="hljs-type">&gt;user</span>&lt;|<span class="hljs-type">end_header_id</span>|<span class="hljs-type">&gt;
What</span>&#x27;s the weather <span class="hljs-built_in">in</span> London ?
&lt;|<span class="hljs-type">eot_id</span>|<span class="hljs-type">&gt;&lt;|start_header_id</span>|<span class="hljs-type">&gt;assistant</span>&lt;|<span class="hljs-type">end_header_id</span>|<span class="hljs-type">&gt;

Action</span>:
\`\`\`
{
  <span class="hljs-string">&quot;action&quot;</span>: <span class="hljs-string">&quot;get_weather&quot;</span>,
  <span class="hljs-string">&quot;action_input&quot;</span>: {<span class="hljs-string">&quot;location&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-string">&quot;value&quot;</span>: <span class="hljs-string">&quot;London&quot;</span>}
}
\`\`\`
Thought: 我要查看一下伦敦的天气。
Observation: 伦敦天气晴朗，气温较低。`,wrap:!1}}),hl=new y({props:{code:"JUU2JTlDJTgwJUU3JUJCJTg4JUU3JUFEJTk0JUU2JUExJTg4JUVGJUJDJTlBJUU0JUJDJUE2JUU2JTk1JUE2JUU1JUE0JUE5JUU2JUIwJTk0JUU2JTk5JUI0JUU2JTlDJTk3JUVGJUJDJThDJUU2JUIwJTk0JUU2JUI4JUE5JUU4JUJFJTgzJUU0JUJEJThFJUUzJTgwJTgy",highlighted:"最终答案：伦敦天气晴朗，气温较低。",wrap:!1}}),gl=new rJ({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/zh-CN/unit1/dummy-agent-library.mdx"}}),{c(){N=e("meta"),Sl=T(),Ol=e("p"),cl=T(),M(R.$$.fragment),wl=T(),M(F.$$.fragment),ul=T(),E=e("img"),Il=T(),h=e("p"),h.innerHTML=ZU,kl=T(),B=e("p"),B.textContent=_U,ml=T(),j=e("p"),j.textContent=XU,rl=T(),g=e("p"),g.innerHTML=AU,dl=T(),O=e("p"),O.innerHTML=vU,bl=T(),o=e("p"),o.innerHTML=zU,Gl=T(),S=e("p"),S.textContent=WU,fl=T(),c=e("p"),c.innerHTML=qU,Yl=T(),w=e("p"),w.innerHTML=HU,Dl=T(),M(u.$$.fragment),$l=T(),I=e("p"),I.textContent=LU,xl=T(),M(k.$$.fragment),Zl=T(),M(m.$$.fragment),_l=T(),r=e("p"),r.textContent=PU,Xl=T(),M(d.$$.fragment),Al=T(),b=e("p"),b.innerHTML=KU,vl=T(),G=e("p"),G.innerHTML=lJ,zl=T(),M(f.$$.fragment),Wl=T(),Y=e("p"),Y.textContent=UJ,ql=T(),M(D.$$.fragment),Hl=T(),$=e("p"),$.textContent=JJ,Ll=T(),M(x.$$.fragment),Pl=T(),Z=e("p"),Z.textContent=tJ,Kl=T(),M(_.$$.fragment),lU=T(),X=e("p"),X.textContent=TJ,UU=T(),M(A.$$.fragment),JU=T(),v=e("p"),v.textContent=sJ,tU=T(),z=e("p"),z.textContent=eJ,TU=T(),W=e("ol"),W.innerHTML=nJ,sU=T(),M(q.$$.fragment),eU=T(),H=e("p"),H.textContent=aJ,nU=T(),M(L.$$.fragment),aU=T(),P=e("p"),P.innerHTML=MJ,MU=T(),M(K.$$.fragment),VU=T(),ll=e("p"),ll.textContent=VJ,iU=T(),M(Ul.$$.fragment),QU=T(),Jl=e("p"),Jl.textContent=iJ,CU=T(),M(tl.$$.fragment),pU=T(),Tl=e("p"),Tl.textContent=QJ,yU=T(),M(sl.$$.fragment),NU=T(),el=e("p"),el.textContent=CJ,RU=T(),nl=e("blockquote"),nl.innerHTML=pJ,FU=T(),M(al.$$.fragment),EU=T(),Ml=e("p"),Ml.textContent=yJ,hU=T(),M(Vl.$$.fragment),BU=T(),il=e("p"),il.textContent=NJ,jU=T(),M(Ql.$$.fragment),gU=T(),Cl=e("p"),Cl.textContent=RJ,OU=T(),M(pl.$$.fragment),oU=T(),yl=e("p"),yl.textContent=FJ,SU=T(),M(Nl.$$.fragment),cU=T(),Rl=e("p"),Rl.textContent=EJ,wU=T(),M(Fl.$$.fragment),uU=T(),El=e("p"),El.textContent=hJ,IU=T(),M(hl.$$.fragment),kU=T(),mU=e("hr"),rU=T(),Bl=e("p"),Bl.innerHTML=BJ,dU=T(),jl=e("p"),jl.innerHTML=jJ,bU=T(),M(gl.$$.fragment),GU=T(),ol=e("p"),this.h()},l(l){const U=IJ("svelte-u9bgzb",document.head);N=n(U,"META",{name:!0,content:!0}),U.forEach(J),Sl=s(l),Ol=n(l,"P",{}),gJ(Ol).forEach(J),cl=s(l),V(R.$$.fragment,l),wl=s(l),V(F.$$.fragment,l),ul=s(l),E=n(l,"IMG",{src:!0,alt:!0}),Il=s(l),h=n(l,"P",{"data-svelte-h":!0}),a(h)!=="svelte-ykre0p"&&(h.innerHTML=ZU),kl=s(l),B=n(l,"P",{"data-svelte-h":!0}),a(B)!=="svelte-10oqqh"&&(B.textContent=_U),ml=s(l),j=n(l,"P",{"data-svelte-h":!0}),a(j)!=="svelte-1y981z0"&&(j.textContent=XU),rl=s(l),g=n(l,"P",{"data-svelte-h":!0}),a(g)!=="svelte-os2dtm"&&(g.innerHTML=AU),dl=s(l),O=n(l,"P",{"data-svelte-h":!0}),a(O)!=="svelte-5oz1k9"&&(O.innerHTML=vU),bl=s(l),o=n(l,"P",{"data-svelte-h":!0}),a(o)!=="svelte-ljdvt0"&&(o.innerHTML=zU),Gl=s(l),S=n(l,"P",{"data-svelte-h":!0}),a(S)!=="svelte-znyazr"&&(S.textContent=WU),fl=s(l),c=n(l,"P",{"data-svelte-h":!0}),a(c)!=="svelte-fybg6d"&&(c.innerHTML=qU),Yl=s(l),w=n(l,"P",{"data-svelte-h":!0}),a(w)!=="svelte-1pd8da2"&&(w.innerHTML=HU),Dl=s(l),V(u.$$.fragment,l),$l=s(l),I=n(l,"P",{"data-svelte-h":!0}),a(I)!=="svelte-h2g20r"&&(I.textContent=LU),xl=s(l),V(k.$$.fragment,l),Zl=s(l),V(m.$$.fragment,l),_l=s(l),r=n(l,"P",{"data-svelte-h":!0}),a(r)!=="svelte-19x0bp9"&&(r.textContent=PU),Xl=s(l),V(d.$$.fragment,l),Al=s(l),b=n(l,"P",{"data-svelte-h":!0}),a(b)!=="svelte-1xi2kjf"&&(b.innerHTML=KU),vl=s(l),G=n(l,"P",{"data-svelte-h":!0}),a(G)!=="svelte-1i51gq9"&&(G.innerHTML=lJ),zl=s(l),V(f.$$.fragment,l),Wl=s(l),Y=n(l,"P",{"data-svelte-h":!0}),a(Y)!=="svelte-zy1vml"&&(Y.textContent=UJ),ql=s(l),V(D.$$.fragment,l),Hl=s(l),$=n(l,"P",{"data-svelte-h":!0}),a($)!=="svelte-59gevo"&&($.textContent=JJ),Ll=s(l),V(x.$$.fragment,l),Pl=s(l),Z=n(l,"P",{"data-svelte-h":!0}),a(Z)!=="svelte-zy1vml"&&(Z.textContent=tJ),Kl=s(l),V(_.$$.fragment,l),lU=s(l),X=n(l,"P",{"data-svelte-h":!0}),a(X)!=="svelte-7if628"&&(X.textContent=TJ),UU=s(l),V(A.$$.fragment,l),JU=s(l),v=n(l,"P",{"data-svelte-h":!0}),a(v)!=="svelte-120d778"&&(v.textContent=sJ),tU=s(l),z=n(l,"P",{"data-svelte-h":!0}),a(z)!=="svelte-14sbibc"&&(z.textContent=eJ),TU=s(l),W=n(l,"OL",{"data-svelte-h":!0}),a(W)!=="svelte-1irzk7o"&&(W.innerHTML=nJ),sU=s(l),V(q.$$.fragment,l),eU=s(l),H=n(l,"P",{"data-svelte-h":!0}),a(H)!=="svelte-1yqjhpz"&&(H.textContent=aJ),nU=s(l),V(L.$$.fragment,l),aU=s(l),P=n(l,"P",{"data-svelte-h":!0}),a(P)!=="svelte-4zbcb7"&&(P.innerHTML=MJ),MU=s(l),V(K.$$.fragment,l),VU=s(l),ll=n(l,"P",{"data-svelte-h":!0}),a(ll)!=="svelte-1bq1767"&&(ll.textContent=VJ),iU=s(l),V(Ul.$$.fragment,l),QU=s(l),Jl=n(l,"P",{"data-svelte-h":!0}),a(Jl)!=="svelte-18yryy0"&&(Jl.textContent=iJ),CU=s(l),V(tl.$$.fragment,l),pU=s(l),Tl=n(l,"P",{"data-svelte-h":!0}),a(Tl)!=="svelte-19x0bp9"&&(Tl.textContent=QJ),yU=s(l),V(sl.$$.fragment,l),NU=s(l),el=n(l,"P",{"data-svelte-h":!0}),a(el)!=="svelte-1y8poqx"&&(el.textContent=CJ),RU=s(l),nl=n(l,"BLOCKQUOTE",{"data-svelte-h":!0}),a(nl)!=="svelte-n2wzua"&&(nl.innerHTML=pJ),FU=s(l),V(al.$$.fragment,l),EU=s(l),Ml=n(l,"P",{"data-svelte-h":!0}),a(Ml)!=="svelte-19x0bp9"&&(Ml.textContent=yJ),hU=s(l),V(Vl.$$.fragment,l),BU=s(l),il=n(l,"P",{"data-svelte-h":!0}),a(il)!=="svelte-6diome"&&(il.textContent=NJ),jU=s(l),V(Ql.$$.fragment,l),gU=s(l),Cl=n(l,"P",{"data-svelte-h":!0}),a(Cl)!=="svelte-19x0bp9"&&(Cl.textContent=RJ),OU=s(l),V(pl.$$.fragment,l),oU=s(l),yl=n(l,"P",{"data-svelte-h":!0}),a(yl)!=="svelte-19ufdym"&&(yl.textContent=FJ),SU=s(l),V(Nl.$$.fragment,l),cU=s(l),Rl=n(l,"P",{"data-svelte-h":!0}),a(Rl)!=="svelte-5x4qf0"&&(Rl.textContent=EJ),wU=s(l),V(Fl.$$.fragment,l),uU=s(l),El=n(l,"P",{"data-svelte-h":!0}),a(El)!=="svelte-19x0bp9"&&(El.textContent=hJ),IU=s(l),V(hl.$$.fragment,l),kU=s(l),mU=n(l,"HR",{}),rU=s(l),Bl=n(l,"P",{"data-svelte-h":!0}),a(Bl)!=="svelte-161c24g"&&(Bl.innerHTML=BJ),dU=s(l),jl=n(l,"P",{"data-svelte-h":!0}),a(jl)!=="svelte-1eafy7y"&&(jl.innerHTML=jJ),bU=s(l),V(gl.$$.fragment,l),GU=s(l),ol=n(l,"P",{}),gJ(ol).forEach(J),this.h()},h(){YU(N,"name","hf:doc:metadata"),YU(N,"content",bJ),oJ(E.src,xU="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub3DONE.jpg")||YU(E,"src",xU),YU(E,"alt","Unit 1 planning")},m(l,U){kJ(document.head,N),t(l,Sl,U),t(l,Ol,U),t(l,cl,U),i(R,l,U),t(l,wl,U),i(F,l,U),t(l,ul,U),t(l,E,U),t(l,Il,U),t(l,h,U),t(l,kl,U),t(l,B,U),t(l,ml,U),t(l,j,U),t(l,rl,U),t(l,g,U),t(l,dl,U),t(l,O,U),t(l,bl,U),t(l,o,U),t(l,Gl,U),t(l,S,U),t(l,fl,U),t(l,c,U),t(l,Yl,U),t(l,w,U),t(l,Dl,U),i(u,l,U),t(l,$l,U),t(l,I,U),t(l,xl,U),i(k,l,U),t(l,Zl,U),i(m,l,U),t(l,_l,U),t(l,r,U),t(l,Xl,U),i(d,l,U),t(l,Al,U),t(l,b,U),t(l,vl,U),t(l,G,U),t(l,zl,U),i(f,l,U),t(l,Wl,U),t(l,Y,U),t(l,ql,U),i(D,l,U),t(l,Hl,U),t(l,$,U),t(l,Ll,U),i(x,l,U),t(l,Pl,U),t(l,Z,U),t(l,Kl,U),i(_,l,U),t(l,lU,U),t(l,X,U),t(l,UU,U),i(A,l,U),t(l,JU,U),t(l,v,U),t(l,tU,U),t(l,z,U),t(l,TU,U),t(l,W,U),t(l,sU,U),i(q,l,U),t(l,eU,U),t(l,H,U),t(l,nU,U),i(L,l,U),t(l,aU,U),t(l,P,U),t(l,MU,U),i(K,l,U),t(l,VU,U),t(l,ll,U),t(l,iU,U),i(Ul,l,U),t(l,QU,U),t(l,Jl,U),t(l,CU,U),i(tl,l,U),t(l,pU,U),t(l,Tl,U),t(l,yU,U),i(sl,l,U),t(l,NU,U),t(l,el,U),t(l,RU,U),t(l,nl,U),t(l,FU,U),i(al,l,U),t(l,EU,U),t(l,Ml,U),t(l,hU,U),i(Vl,l,U),t(l,BU,U),t(l,il,U),t(l,jU,U),i(Ql,l,U),t(l,gU,U),t(l,Cl,U),t(l,OU,U),i(pl,l,U),t(l,oU,U),t(l,yl,U),t(l,SU,U),i(Nl,l,U),t(l,cU,U),t(l,Rl,U),t(l,wU,U),i(Fl,l,U),t(l,uU,U),t(l,El,U),t(l,IU,U),i(hl,l,U),t(l,kU,U),t(l,mU,U),t(l,rU,U),t(l,Bl,U),t(l,dU,U),t(l,jl,U),t(l,bU,U),i(gl,l,U),t(l,GU,U),t(l,ol,U),fU=!0},p:SJ,i(l){fU||(Q(R.$$.fragment,l),Q(F.$$.fragment,l),Q(u.$$.fragment,l),Q(k.$$.fragment,l),Q(m.$$.fragment,l),Q(d.$$.fragment,l),Q(f.$$.fragment,l),Q(D.$$.fragment,l),Q(x.$$.fragment,l),Q(_.$$.fragment,l),Q(A.$$.fragment,l),Q(q.$$.fragment,l),Q(L.$$.fragment,l),Q(K.$$.fragment,l),Q(Ul.$$.fragment,l),Q(tl.$$.fragment,l),Q(sl.$$.fragment,l),Q(al.$$.fragment,l),Q(Vl.$$.fragment,l),Q(Ql.$$.fragment,l),Q(pl.$$.fragment,l),Q(Nl.$$.fragment,l),Q(Fl.$$.fragment,l),Q(hl.$$.fragment,l),Q(gl.$$.fragment,l),fU=!0)},o(l){C(R.$$.fragment,l),C(F.$$.fragment,l),C(u.$$.fragment,l),C(k.$$.fragment,l),C(m.$$.fragment,l),C(d.$$.fragment,l),C(f.$$.fragment,l),C(D.$$.fragment,l),C(x.$$.fragment,l),C(_.$$.fragment,l),C(A.$$.fragment,l),C(q.$$.fragment,l),C(L.$$.fragment,l),C(K.$$.fragment,l),C(Ul.$$.fragment,l),C(tl.$$.fragment,l),C(sl.$$.fragment,l),C(al.$$.fragment,l),C(Vl.$$.fragment,l),C(Ql.$$.fragment,l),C(pl.$$.fragment,l),C(Nl.$$.fragment,l),C(Fl.$$.fragment,l),C(hl.$$.fragment,l),C(gl.$$.fragment,l),fU=!1},d(l){l&&(J(Sl),J(Ol),J(cl),J(wl),J(ul),J(E),J(Il),J(h),J(kl),J(B),J(ml),J(j),J(rl),J(g),J(dl),J(O),J(bl),J(o),J(Gl),J(S),J(fl),J(c),J(Yl),J(w),J(Dl),J($l),J(I),J(xl),J(Zl),J(_l),J(r),J(Xl),J(Al),J(b),J(vl),J(G),J(zl),J(Wl),J(Y),J(ql),J(Hl),J($),J(Ll),J(Pl),J(Z),J(Kl),J(lU),J(X),J(UU),J(JU),J(v),J(tU),J(z),J(TU),J(W),J(sU),J(eU),J(H),J(nU),J(aU),J(P),J(MU),J(VU),J(ll),J(iU),J(QU),J(Jl),J(CU),J(pU),J(Tl),J(yU),J(NU),J(el),J(RU),J(nl),J(FU),J(EU),J(Ml),J(hU),J(BU),J(il),J(jU),J(gU),J(Cl),J(OU),J(oU),J(yl),J(SU),J(cU),J(Rl),J(wU),J(uU),J(El),J(IU),J(kU),J(mU),J(rU),J(Bl),J(dU),J(jl),J(bU),J(GU),J(ol)),J(N),p(R,l),p(F,l),p(u,l),p(k,l),p(m,l),p(d,l),p(f,l),p(D,l),p(x,l),p(_,l),p(A,l),p(q,l),p(L,l),p(K,l),p(Ul,l),p(tl,l),p(sl,l),p(al,l),p(Vl,l),p(Ql,l),p(pl,l),p(Nl,l),p(Fl,l),p(hl,l),p(gl,l)}}}const bJ='{"title":"简单智能体库 (Dummy Agent Library)","local":"简单智能体库-dummy-agent-library","sections":[{"title":"无服务器 API (Serverless API)","local":"无服务器-api-serverless-api","sections":[],"depth":2},{"title":"简单智能体 (Dummy Agent)","local":"简单智能体-dummy-agent","sections":[],"depth":2}],"depth":1}';function GJ($U){return cJ(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ZJ extends wJ{constructor(N){super(),uJ(this,N,GJ,dJ,OJ,{})}}export{ZJ as component};
