import{s as gJ,f as jJ,n as OJ,o as oJ}from"../chunks/scheduler.889ebb13.js";import{S as SJ,i as cJ,g as e,s as T,r as M,A as wJ,h as n,f as J,c as s,j as BJ,u as V,x as a,k as GU,y as uJ,a as t,v as Q,d as i,t as C,w as p}from"../chunks/index.ca18042b.js";import{C as y}from"../chunks/CodeBlock.1db71023.js";import{H as YU,E as IJ}from"../chunks/EditOnGithub.b0b59db6.js";function kJ(fU){let N,ol,jl,Sl,R,cl,F,DU,wl,E,xU="本课程是框架无关的，因为我们想要<strong>专注于 AI 智能体（AI Agent）的概念，避免陷入特定框架的细节中</strong>。",ul,h,$U="同时，我们希望学生能够在自己的项目中使用他们在本课程中学到的概念，使用任何他们喜欢的框架。",Il,B,_U="因此，在第一单元中，我们将使用一个简单智能体库和一个简单的无服务器 API (serverless API) 来访问我们的 LLM 引擎。",kl,g,AU="你可能不会在生产环境中使用这些，但它们将作为<strong>理解智能体如何工作的良好起点</strong>。",ml,j,XU="在本节之后，你将准备好<strong>使用 <code>smolagents</code> 创建一个简单的智能体</strong>。",rl,O,ZU="在接下来的单元中，我们还将使用其他 AI 智能体库，如 <code>LangGraph</code>、<code>LangChain</code> 和 <code>LlamaIndex</code>。",dl,o,zU="为了保持简单，我们将使用一个简单的 Python 函数作为工具和智能体。",bl,S,vU="我们将使用内置的 Python 包，如 <code>datetime</code> 和 <code>os</code>，这样你可以在任何环境中尝试它。",Gl,c,qU='你可以<a href="https://huggingface.co/agents-course/notebooks/blob/main/dummy_agent_library.ipynb" rel="nofollow">在这个 notebook 中</a>跟随过程并<strong>自己运行代码</strong>。',Yl,w,fl,u,WU="在 Hugging Face 生态系统中，有一个称为无服务器 API 的便捷功能，它允许你轻松地在许多模型上运行推理。不需要安装或部署。",Dl,I,xl,k,$l,m,HU="输出:",_l,r,Al,d,LU="如 LLM 部分所见，如果我们只做解码，<strong>模型只会在预测到 EOS 令牌时停止</strong>，而这里没有发生，因为这是一个会话（聊天）模型，<strong>我们没有应用它期望的聊天模板</strong>。",Xl,b,PU='如果我们现在添加与我们使用的<a href="https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct">Llama-3.2-3B-Instruct 模型</a>相关的特殊令牌，行为会改变，现在会产生预期的 EOS。',Zl,G,zl,Y,KU="输出：",vl,f,ql,D,lJ="使用”chat”方法是应用聊天模板的更方便和可靠的方式：",Wl,x,Hl,$,UJ="输出：",Ll,_,Pl,A,JJ="chat 方法是推荐使用的方法，以确保模型之间的平滑过渡，但由于这个 notebook 只是教育性质的，我们将继续使用 “text_generation” 方法来理解细节。",Kl,X,lU,Z,tJ="在前面的部分中，我们看到智能体库的核心是在系统提示中附加信息。",UU,z,TJ="这个系统提示比我们之前看到的要复杂一些，但它已经包含：",JU,v,sJ="<li><strong>工具信息</strong></li> <li><strong>循环指令</strong> （思考 → 行动 → 观察）</li>",tU,q,TU,W,eJ="由于我们正在运行“text_generation”方法，因此我们需要手动应用提示：",sU,H,eU,L,nJ="我们也可以这样做，这就是在 <code>chat</code> 方法内部发生的情况：",nU,P,aU,K,aJ="现在的提示是：",MU,ll,VU,Ul,MJ="Let’s decode!",QU,Jl,iU,tl,VJ="输出:",CU,Tl,pU,sl,QJ="你看到问题了吗？",yU,el,iJ=`<p>答案是模型产生的幻觉。我们需要停下来真正执行这个函数！
现在让我们停在“观察”上，这样我们就不会产生实际函数响应的幻觉。</p>`,NU,nl,RU,al,CJ="输出:",FU,Ml,EU,Vl,pJ=`好多了！
现在让我们创建一个虚拟的获取天气函数。在实际情况下，您可能会调用 API。`,hU,Ql,BU,il,yJ="输出:",gU,Cl,jU,pl,NJ="我们将基本提示、函数执行前的完成以及函数的结果连接起来作为观察并恢复生成。",OU,yl,oU,Nl,RJ="这是新的提示：",SU,Rl,cU,Fl,FJ="输出:",wU,El,uU,IU,kU,hl,EJ="我们学习了如何使用 Python 代码从头开始创建智能体，并且我们<strong>看到了这个过程是多么繁琐</strong>。幸运的是，许多智能体库通过为您处理大部分繁重的工作来简化这项工作。",mU,Bl,hJ="现在，我们已准备好使用 <code>smolagents</code> 库<strong>创建我们的第一个真正的智能体</strong>。",rU,gl,dU,Ol,bU;return R=new YU({props:{title:"简单智能体库 (Dummy Agent Library)",local:"简单智能体库-dummy-agent-library",headingTag:"h1"}}),w=new YU({props:{title:"无服务器 API (Serverless API)",local:"无服务器-api-serverless-api",headingTag:"h2"}}),I=new y({props:{code:"aW1wb3J0JTIwb3MlMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaHViJTIwaW1wb3J0JTIwSW5mZXJlbmNlQ2xpZW50JTBBJTBBJTIzJTIzJTIwJUU0JUJEJUEwJUU5JTlDJTgwJUU4JUE2JTgxJUU0JUI4JTgwJUU0JUI4JUFBJUU2JTlEJUE1JUU4JTg3JUFBJTIwaHR0cHMlM0ElMkYlMkZoZi5jbyUyRnNldHRpbmdzJTJGdG9rZW5zJTIwJUU3JTlBJTg0JUU0JUJCJUE0JUU3JTg5JThDJUVGJUJDJThDJUU3JUExJUFFJUU0JUJGJTlEJUU0JUJEJUEwJUU5JTgwJTg5JUU2JThCJUE5J3JlYWQnJUU0JUJEJTlDJUU0JUI4JUJBJUU0JUJCJUE0JUU3JTg5JThDJUU3JUIxJUJCJUU1JTlFJThCJUUzJTgwJTgyJUU1JUE2JTgyJUU2JTlFJTlDJUU0JUJEJUEwJUU1JTlDJUE4JTIwR29vZ2xlJTIwQ29sYWIlMjAlRTQlQjglOEElRTglQkYlOTAlRTglQTElOEMlRUYlQkMlOEMlRTQlQkQlQTAlRTUlOEYlQUYlRTQlQkIlQTUlRTUlOUMlQTglMjJzZXR0aW5ncyUyMiVFNiVBMCU4NyVFNyVBRCVCRSVFNCVCOCU4QiVFNyU5QSU4NCUyMnNlY3JldHMlMjIlRTQlQjglQUQlRTglQUUlQkUlRTclQkQlQUUlRTUlQUUlODMlRTMlODAlODIlRTclQTElQUUlRTQlQkYlOUQlRTUlQjAlODYlRTUlODUlQjYlRTUlOTElQkQlRTUlOTAlOEQlRTQlQjglQkElMjJIRl9UT0tFTiUyMiUwQW9zLmVudmlyb24lNUIlMjJIRl9UT0tFTiUyMiU1RCUzRCUyMmhmX3h4eHh4eHh4eHh4eHh4JTIyJTBBJTBBY2xpZW50JTIwJTNEJTIwSW5mZXJlbmNlQ2xpZW50KCUyMm1ldGEtbGxhbWElMkZMbGFtYS0zLjItM0ItSW5zdHJ1Y3QlMjIpJTBBJTIzJTIwJUU1JUE2JTgyJUU2JTlFJTlDJUU0JUI4JThCJUU0JUI4JTgwJUU0JUI4JUFBJUU1JThEJTk1JUU1JTg1JTgzJUU2JUEwJUJDJUU3JTlBJTg0JUU4JUJFJTkzJUU1JTg3JUJBJUU0JUI4JThEJUU2JUFEJUEzJUU3JUExJUFFJUVGJUJDJThDJUU1JTg1JThEJUU4JUI0JUI5JUU2JUE4JUExJUU1JTlFJThCJUU1JThGJUFGJUU4JTgzJUJEJUU4JUJGJTg3JUU4JUJEJUJEJUUzJTgwJTgyJUU0JUJEJUEwJUU0JUI5JTlGJUU1JThGJUFGJUU0JUJCJUE1JUU0JUJEJUJGJUU3JTk0JUE4JUU4JUJGJTk5JUU0JUI4JUFBJUU1JThDJTg1JUU1JTkwJUFCJTIwTGxhbWEtMy4yLTNCLUluc3RydWN0JTIwJUU3JTlBJTg0JUU1JTg1JUFDJUU1JTg1JUIxJUU3JUFCJUFGJUU3JTgyJUI5JTBBJTIzJTIwY2xpZW50JTIwJTNEJTIwSW5mZXJlbmNlQ2xpZW50KCUyMmh0dHBzJTNBJTJGJTJGamMyNm13ZzIyOG1rajhkdy51cy1lYXN0LTEuYXdzLmVuZHBvaW50cy5odWdnaW5nZmFjZS5jbG91ZCUyMik=",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 的令牌，确保你选择&#x27;read&#x27;作为令牌类型。如果你在 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(<span class="hljs-string">&quot;meta-llama/Llama-3.2-3B-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}}),k=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}}),r=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}}),G=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}}),f=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}}),X=new YU({props:{title:"简单智能体 (Dummy Agent)",local:"简单智能体-dummy-agent",headingTag:"h2"}}),q=new y({props:{code:"JUU4JUFGJUI3JUU1JUIwJUJEJUU1JThGJUFGJUU4JTgzJUJEJUU1JTg3JTg2JUU3JUExJUFFJUU1JTlDJUIwJUU1JTlCJTlFJUU3JUFEJTk0JUU0JUJCJUE1JUU0JUI4JThCJUU5JTk3JUFFJUU5JUEyJTk4JUUzJTgwJTgyJUU0JUJEJUEwJUU1JThGJUFGJUU0JUJCJUE1JUU0JUJEJUJGJUU3JTk0JUE4JUU0JUJCJUE1JUU0JUI4JThCJUU1JUI3JUE1JUU1JTg1JUI3JUVGJUJDJTlBJTBBJTBBZ2V0X3dlYXRoZXIlM0ElMjAlRTglOEUlQjclRTUlOEYlOTYlRTYlOEMlODclRTUlQUUlOUElRTUlOUMlQjAlRTclODIlQjklRTclOUElODQlRTUlQkQlOTMlRTUlODklOEQlRTUlQTQlQTklRTYlQjAlOTQlMEElMEElRTQlQkQlQkYlRTclOTQlQTglRTUlQjclQTUlRTUlODUlQjclRTclOUElODQlRTYlOTYlQjklRTUlQkMlOEYlRTYlOTglQUYlRTklODAlOUElRTglQkYlODclRTYlOEMlODclRTUlQUUlOUElRTQlQjglODAlRTQlQjglQUElMjBKU09OJTIwYmxvYiVFMyU4MCU4MiVFNSU4NSVCNyVFNCVCRCU5MyVFNiU5RCVBNSVFOCVBRiVCNCVFRiV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klRTUlODclQkElRTYlOUMlODAlRTclQkIlODglRTclQUQlOTQlRTYlQTElODg=",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}}),H=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}}),P=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}}),ll=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}}),Jl=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}}),Tl=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}}),nl=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}}),Ml=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}}),Cl=new y({props:{code:"JUUyJTgwJTlDJUU0JUJDJUE2JUU2JTk1JUE2JUU1JUE0JUE5JUU2JUIwJTk0JUU2JTk5JUI0JUU2JTlDJTk3JUVGJUJDJThDJUU2JUIwJTk0JUU2JUI4JUE5JUU4JUJFJTgzJUU0JUJEJThFJUUzJTgwJTgyJTVDbiVFMiU4MCU5RA==",highlighted:'“伦敦天气晴朗，气温较低。<span class="hljs-string">\\n”</span>',wrap:!1}}),yl=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}}),Rl=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}}),El=new y({props:{code:"JUU2JTlDJTgwJUU3JUJCJTg4JUU3JUFEJTk0JUU2JUExJTg4JUVGJUJDJTlBJUU0JUJDJUE2JUU2JTk1JUE2JUU1JUE0JUE5JUU2JUIwJTk0JUU2JTk5JUI0JUU2JTlDJTk3JUVGJUJDJThDJUU2JUIwJTk0JUU2JUI4JUE5JUU4JUJFJTgzJUU0JUJEJThFJUUzJTgwJTgy",highlighted:"最终答案：伦敦天气晴朗，气温较低。",wrap:!1}}),gl=new IJ({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/zh-CN/unit1/dummy-agent-library.mdx"}}),{c(){N=e("meta"),ol=T(),jl=e("p"),Sl=T(),M(R.$$.fragment),cl=T(),F=e("img"),wl=T(),E=e("p"),E.innerHTML=xU,ul=T(),h=e("p"),h.textContent=$U,Il=T(),B=e("p"),B.textContent=_U,kl=T(),g=e("p"),g.innerHTML=AU,ml=T(),j=e("p"),j.innerHTML=XU,rl=T(),O=e("p"),O.innerHTML=ZU,dl=T(),o=e("p"),o.textContent=zU,bl=T(),S=e("p"),S.innerHTML=vU,Gl=T(),c=e("p"),c.innerHTML=qU,Yl=T(),M(w.$$.fragment),fl=T(),u=e("p"),u.textContent=WU,Dl=T(),M(I.$$.fragment),xl=T(),M(k.$$.fragment),$l=T(),m=e("p"),m.textContent=HU,_l=T(),M(r.$$.fragment),Al=T(),d=e("p"),d.innerHTML=LU,Xl=T(),b=e("p"),b.innerHTML=PU,Zl=T(),M(G.$$.fragment),zl=T(),Y=e("p"),Y.textContent=KU,vl=T(),M(f.$$.fragment),ql=T(),D=e("p"),D.textContent=lJ,Wl=T(),M(x.$$.fragment),Hl=T(),$=e("p"),$.textContent=UJ,Ll=T(),M(_.$$.fragment),Pl=T(),A=e("p"),A.textContent=JJ,Kl=T(),M(X.$$.fragment),lU=T(),Z=e("p"),Z.textContent=tJ,UU=T(),z=e("p"),z.textContent=TJ,JU=T(),v=e("ol"),v.innerHTML=sJ,tU=T(),M(q.$$.fragment),TU=T(),W=e("p"),W.textContent=eJ,sU=T(),M(H.$$.fragment),eU=T(),L=e("p"),L.innerHTML=nJ,nU=T(),M(P.$$.fragment),aU=T(),K=e("p"),K.textContent=aJ,MU=T(),M(ll.$$.fragment),VU=T(),Ul=e("p"),Ul.textContent=MJ,QU=T(),M(Jl.$$.fragment),iU=T(),tl=e("p"),tl.textContent=VJ,CU=T(),M(Tl.$$.fragment),pU=T(),sl=e("p"),sl.textContent=QJ,yU=T(),el=e("blockquote"),el.innerHTML=iJ,NU=T(),M(nl.$$.fragment),RU=T(),al=e("p"),al.textContent=CJ,FU=T(),M(Ml.$$.fragment),EU=T(),Vl=e("p"),Vl.textContent=pJ,hU=T(),M(Ql.$$.fragment),BU=T(),il=e("p"),il.textContent=yJ,gU=T(),M(Cl.$$.fragment),jU=T(),pl=e("p"),pl.textContent=NJ,OU=T(),M(yl.$$.fragment),oU=T(),Nl=e("p"),Nl.textContent=RJ,SU=T(),M(Rl.$$.fragment),cU=T(),Fl=e("p"),Fl.textContent=FJ,wU=T(),M(El.$$.fragment),uU=T(),IU=e("hr"),kU=T(),hl=e("p"),hl.innerHTML=EJ,mU=T(),Bl=e("p"),Bl.innerHTML=hJ,rU=T(),M(gl.$$.fragment),dU=T(),Ol=e("p"),this.h()},l(l){const U=wJ("svelte-u9bgzb",document.head);N=n(U,"META",{name:!0,content:!0}),U.forEach(J),ol=s(l),jl=n(l,"P",{}),BJ(jl).forEach(J),Sl=s(l),V(R.$$.fragment,l),cl=s(l),F=n(l,"IMG",{src:!0,alt:!0}),wl=s(l),E=n(l,"P",{"data-svelte-h":!0}),a(E)!=="svelte-ykre0p"&&(E.innerHTML=xU),ul=s(l),h=n(l,"P",{"data-svelte-h":!0}),a(h)!=="svelte-10oqqh"&&(h.textContent=$U),Il=s(l),B=n(l,"P",{"data-svelte-h":!0}),a(B)!=="svelte-1y981z0"&&(B.textContent=_U),kl=s(l),g=n(l,"P",{"data-svelte-h":!0}),a(g)!=="svelte-os2dtm"&&(g.innerHTML=AU),ml=s(l),j=n(l,"P",{"data-svelte-h":!0}),a(j)!=="svelte-5oz1k9"&&(j.innerHTML=XU),rl=s(l),O=n(l,"P",{"data-svelte-h":!0}),a(O)!=="svelte-1izdqov"&&(O.innerHTML=ZU),dl=s(l),o=n(l,"P",{"data-svelte-h":!0}),a(o)!=="svelte-znyazr"&&(o.textContent=zU),bl=s(l),S=n(l,"P",{"data-svelte-h":!0}),a(S)!=="svelte-fybg6d"&&(S.innerHTML=vU),Gl=s(l),c=n(l,"P",{"data-svelte-h":!0}),a(c)!=="svelte-1povww"&&(c.innerHTML=qU),Yl=s(l),V(w.$$.fragment,l),fl=s(l),u=n(l,"P",{"data-svelte-h":!0}),a(u)!=="svelte-h2g20r"&&(u.textContent=WU),Dl=s(l),V(I.$$.fragment,l),xl=s(l),V(k.$$.fragment,l),$l=s(l),m=n(l,"P",{"data-svelte-h":!0}),a(m)!=="svelte-19x0bp9"&&(m.textContent=HU),_l=s(l),V(r.$$.fragment,l),Al=s(l),d=n(l,"P",{"data-svelte-h":!0}),a(d)!=="svelte-1iqfqq4"&&(d.innerHTML=LU),Xl=s(l),b=n(l,"P",{"data-svelte-h":!0}),a(b)!=="svelte-9upmqe"&&(b.innerHTML=PU),Zl=s(l),V(G.$$.fragment,l),zl=s(l),Y=n(l,"P",{"data-svelte-h":!0}),a(Y)!=="svelte-zy1vml"&&(Y.textContent=KU),vl=s(l),V(f.$$.fragment,l),ql=s(l),D=n(l,"P",{"data-svelte-h":!0}),a(D)!=="svelte-59gevo"&&(D.textContent=lJ),Wl=s(l),V(x.$$.fragment,l),Hl=s(l),$=n(l,"P",{"data-svelte-h":!0}),a($)!=="svelte-zy1vml"&&($.textContent=UJ),Ll=s(l),V(_.$$.fragment,l),Pl=s(l),A=n(l,"P",{"data-svelte-h":!0}),a(A)!=="svelte-7if628"&&(A.textContent=JJ),Kl=s(l),V(X.$$.fragment,l),lU=s(l),Z=n(l,"P",{"data-svelte-h":!0}),a(Z)!=="svelte-120d778"&&(Z.textContent=tJ),UU=s(l),z=n(l,"P",{"data-svelte-h":!0}),a(z)!=="svelte-14sbibc"&&(z.textContent=TJ),JU=s(l),v=n(l,"OL",{"data-svelte-h":!0}),a(v)!=="svelte-1irzk7o"&&(v.innerHTML=sJ),tU=s(l),V(q.$$.fragment,l),TU=s(l),W=n(l,"P",{"data-svelte-h":!0}),a(W)!=="svelte-1yqjhpz"&&(W.textContent=eJ),sU=s(l),V(H.$$.fragment,l),eU=s(l),L=n(l,"P",{"data-svelte-h":!0}),a(L)!=="svelte-4zbcb7"&&(L.innerHTML=nJ),nU=s(l),V(P.$$.fragment,l),aU=s(l),K=n(l,"P",{"data-svelte-h":!0}),a(K)!=="svelte-1bq1767"&&(K.textContent=aJ),MU=s(l),V(ll.$$.fragment,l),VU=s(l),Ul=n(l,"P",{"data-svelte-h":!0}),a(Ul)!=="svelte-18yryy0"&&(Ul.textContent=MJ),QU=s(l),V(Jl.$$.fragment,l),iU=s(l),tl=n(l,"P",{"data-svelte-h":!0}),a(tl)!=="svelte-19x0bp9"&&(tl.textContent=VJ),CU=s(l),V(Tl.$$.fragment,l),pU=s(l),sl=n(l,"P",{"data-svelte-h":!0}),a(sl)!=="svelte-1y8poqx"&&(sl.textContent=QJ),yU=s(l),el=n(l,"BLOCKQUOTE",{"data-svelte-h":!0}),a(el)!=="svelte-n2wzua"&&(el.innerHTML=iJ),NU=s(l),V(nl.$$.fragment,l),RU=s(l),al=n(l,"P",{"data-svelte-h":!0}),a(al)!=="svelte-19x0bp9"&&(al.textContent=CJ),FU=s(l),V(Ml.$$.fragment,l),EU=s(l),Vl=n(l,"P",{"data-svelte-h":!0}),a(Vl)!=="svelte-6diome"&&(Vl.textContent=pJ),hU=s(l),V(Ql.$$.fragment,l),BU=s(l),il=n(l,"P",{"data-svelte-h":!0}),a(il)!=="svelte-19x0bp9"&&(il.textContent=yJ),gU=s(l),V(Cl.$$.fragment,l),jU=s(l),pl=n(l,"P",{"data-svelte-h":!0}),a(pl)!=="svelte-19ufdym"&&(pl.textContent=NJ),OU=s(l),V(yl.$$.fragment,l),oU=s(l),Nl=n(l,"P",{"data-svelte-h":!0}),a(Nl)!=="svelte-5x4qf0"&&(Nl.textContent=RJ),SU=s(l),V(Rl.$$.fragment,l),cU=s(l),Fl=n(l,"P",{"data-svelte-h":!0}),a(Fl)!=="svelte-19x0bp9"&&(Fl.textContent=FJ),wU=s(l),V(El.$$.fragment,l),uU=s(l),IU=n(l,"HR",{}),kU=s(l),hl=n(l,"P",{"data-svelte-h":!0}),a(hl)!=="svelte-161c24g"&&(hl.innerHTML=EJ),mU=s(l),Bl=n(l,"P",{"data-svelte-h":!0}),a(Bl)!=="svelte-1eafy7y"&&(Bl.innerHTML=hJ),rU=s(l),V(gl.$$.fragment,l),dU=s(l),Ol=n(l,"P",{}),BJ(Ol).forEach(J),this.h()},h(){GU(N,"name","hf:doc:metadata"),GU(N,"content",mJ),jJ(F.src,DU="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub3DONE.jpg")||GU(F,"src",DU),GU(F,"alt","Unit 1 planning")},m(l,U){uJ(document.head,N),t(l,ol,U),t(l,jl,U),t(l,Sl,U),Q(R,l,U),t(l,cl,U),t(l,F,U),t(l,wl,U),t(l,E,U),t(l,ul,U),t(l,h,U),t(l,Il,U),t(l,B,U),t(l,kl,U),t(l,g,U),t(l,ml,U),t(l,j,U),t(l,rl,U),t(l,O,U),t(l,dl,U),t(l,o,U),t(l,bl,U),t(l,S,U),t(l,Gl,U),t(l,c,U),t(l,Yl,U),Q(w,l,U),t(l,fl,U),t(l,u,U),t(l,Dl,U),Q(I,l,U),t(l,xl,U),Q(k,l,U),t(l,$l,U),t(l,m,U),t(l,_l,U),Q(r,l,U),t(l,Al,U),t(l,d,U),t(l,Xl,U),t(l,b,U),t(l,Zl,U),Q(G,l,U),t(l,zl,U),t(l,Y,U),t(l,vl,U),Q(f,l,U),t(l,ql,U),t(l,D,U),t(l,Wl,U),Q(x,l,U),t(l,Hl,U),t(l,$,U),t(l,Ll,U),Q(_,l,U),t(l,Pl,U),t(l,A,U),t(l,Kl,U),Q(X,l,U),t(l,lU,U),t(l,Z,U),t(l,UU,U),t(l,z,U),t(l,JU,U),t(l,v,U),t(l,tU,U),Q(q,l,U),t(l,TU,U),t(l,W,U),t(l,sU,U),Q(H,l,U),t(l,eU,U),t(l,L,U),t(l,nU,U),Q(P,l,U),t(l,aU,U),t(l,K,U),t(l,MU,U),Q(ll,l,U),t(l,VU,U),t(l,Ul,U),t(l,QU,U),Q(Jl,l,U),t(l,iU,U),t(l,tl,U),t(l,CU,U),Q(Tl,l,U),t(l,pU,U),t(l,sl,U),t(l,yU,U),t(l,el,U),t(l,NU,U),Q(nl,l,U),t(l,RU,U),t(l,al,U),t(l,FU,U),Q(Ml,l,U),t(l,EU,U),t(l,Vl,U),t(l,hU,U),Q(Ql,l,U),t(l,BU,U),t(l,il,U),t(l,gU,U),Q(Cl,l,U),t(l,jU,U),t(l,pl,U),t(l,OU,U),Q(yl,l,U),t(l,oU,U),t(l,Nl,U),t(l,SU,U),Q(Rl,l,U),t(l,cU,U),t(l,Fl,U),t(l,wU,U),Q(El,l,U),t(l,uU,U),t(l,IU,U),t(l,kU,U),t(l,hl,U),t(l,mU,U),t(l,Bl,U),t(l,rU,U),Q(gl,l,U),t(l,dU,U),t(l,Ol,U),bU=!0},p:OJ,i(l){bU||(i(R.$$.fragment,l),i(w.$$.fragment,l),i(I.$$.fragment,l),i(k.$$.fragment,l),i(r.$$.fragment,l),i(G.$$.fragment,l),i(f.$$.fragment,l),i(x.$$.fragment,l),i(_.$$.fragment,l),i(X.$$.fragment,l),i(q.$$.fragment,l),i(H.$$.fragment,l),i(P.$$.fragment,l),i(ll.$$.fragment,l),i(Jl.$$.fragment,l),i(Tl.$$.fragment,l),i(nl.$$.fragment,l),i(Ml.$$.fragment,l),i(Ql.$$.fragment,l),i(Cl.$$.fragment,l),i(yl.$$.fragment,l),i(Rl.$$.fragment,l),i(El.$$.fragment,l),i(gl.$$.fragment,l),bU=!0)},o(l){C(R.$$.fragment,l),C(w.$$.fragment,l),C(I.$$.fragment,l),C(k.$$.fragment,l),C(r.$$.fragment,l),C(G.$$.fragment,l),C(f.$$.fragment,l),C(x.$$.fragment,l),C(_.$$.fragment,l),C(X.$$.fragment,l),C(q.$$.fragment,l),C(H.$$.fragment,l),C(P.$$.fragment,l),C(ll.$$.fragment,l),C(Jl.$$.fragment,l),C(Tl.$$.fragment,l),C(nl.$$.fragment,l),C(Ml.$$.fragment,l),C(Ql.$$.fragment,l),C(Cl.$$.fragment,l),C(yl.$$.fragment,l),C(Rl.$$.fragment,l),C(El.$$.fragment,l),C(gl.$$.fragment,l),bU=!1},d(l){l&&(J(ol),J(jl),J(Sl),J(cl),J(F),J(wl),J(E),J(ul),J(h),J(Il),J(B),J(kl),J(g),J(ml),J(j),J(rl),J(O),J(dl),J(o),J(bl),J(S),J(Gl),J(c),J(Yl),J(fl),J(u),J(Dl),J(xl),J($l),J(m),J(_l),J(Al),J(d),J(Xl),J(b),J(Zl),J(zl),J(Y),J(vl),J(ql),J(D),J(Wl),J(Hl),J($),J(Ll),J(Pl),J(A),J(Kl),J(lU),J(Z),J(UU),J(z),J(JU),J(v),J(tU),J(TU),J(W),J(sU),J(eU),J(L),J(nU),J(aU),J(K),J(MU),J(VU),J(Ul),J(QU),J(iU),J(tl),J(CU),J(pU),J(sl),J(yU),J(el),J(NU),J(RU),J(al),J(FU),J(EU),J(Vl),J(hU),J(BU),J(il),J(gU),J(jU),J(pl),J(OU),J(oU),J(Nl),J(SU),J(cU),J(Fl),J(wU),J(uU),J(IU),J(kU),J(hl),J(mU),J(Bl),J(rU),J(dU),J(Ol)),J(N),p(R,l),p(w,l),p(I,l),p(k,l),p(r,l),p(G,l),p(f,l),p(x,l),p(_,l),p(X,l),p(q,l),p(H,l),p(P,l),p(ll,l),p(Jl,l),p(Tl,l),p(nl,l),p(Ml,l),p(Ql,l),p(Cl,l),p(yl,l),p(Rl,l),p(El,l),p(gl,l)}}}const mJ='{"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 rJ(fU){return oJ(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fJ extends SJ{constructor(N){super(),cJ(this,N,rJ,kJ,gJ,{})}}export{fJ as component};
