import{s as wt,n as It,o as vt}from"../chunks/scheduler.65852ee5.js";import{S as Ct,i as kt,g as i,s as n,r as p,A as Rt,h as r,f as t,c as a,j as ht,u as y,x as o,k as Tt,y as Zt,a as l,v as M,d as m,t as c,w as d}from"../chunks/index.aa74147d.js";import{D as Bt,C as U}from"../chunks/DocNotebookDropdown.1a7e6a42.js";import{H as u,E as Gt}from"../chunks/index.e2566494.js";function qt(Vs){let j,Ce,Ie,ke,b,Re,J,Ze,f,Ns='<em>作者: <a href="https://huggingface.co/m-ric" rel="nofollow">Aymeric Roucher</a></em>',Be,g,Es='这个 notebook 展示了如何使用 <a href="https://huggingface.co/docs/transformers/en/agents" rel="nofollow"><strong>Transformers Agents</strong></a> 来构建出色的<strong>智能体</strong>！',Ge,h,$s="什么是<strong>智能体</strong>？智能体是由大型语言模型（LLM）驱动的系统，它们使得 LLM（通过精心设计的提示和输出解析）能够使用特定的<em>工具</em>来解决问题。",qe,T,Qs='这些<em>工具</em>基本上是 LLM 自身无法很好执行的功能：例如，对于像 <a href="https://huggingface.co/meta-llama/Meta-Llama-3-70B-Instruct" rel="nofollow">Llama-3-70B</a> 这样的文本生成 LLM，这可能是一个图像生成工具、网络搜索工具、计算器…',Ae,w,zs='什么是 <strong>Transformers Agents</strong> ？它是我们 <code>transformers</code> 库的一个扩展，提供了构建自己的智能体的构建块！在<a href="https://huggingface.co/docs/transformers/en/agents" rel="nofollow">文档</a>中了解更多信息。',_e,I,xs="让我们看看如何使用它，以及它能解决哪些用例。",We,v,Ss="我们从源代码安装 transformers agents ，你可以使用 <code>pip install transformers[agents]</code> 轻松安装。",Ve,C,Ne,k,Xs=`Requirement already satisfied: smolagents in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (1.0.0)
Requirement already satisfied: torch in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (2.3.0)
Requirement already satisfied: torchaudio in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (2.3.0)
Requirement already satisfied: torchvision in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (0.18.0)
Requirement already satisfied: transformers>=4.0.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (4.47.1)
Requirement already satisfied: requests>=2.32.3 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (2.32.3)
Requirement already satisfied: rich>=13.9.4 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (13.9.4)
Requirement already satisfied: pandas>=2.2.3 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (2.2.3)
Requirement already satisfied: jinja2>=3.1.4 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (3.1.4)
Requirement already satisfied: pillow>=11.0.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (11.1.0)
Requirement already satisfied: markdownify>=0.14.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (0.14.1)
Requirement already satisfied: gradio>=5.8.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (5.9.1)
Requirement already satisfied: duckduckgo-search>=6.3.7 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (7.2.0)
Requirement already satisfied: python-dotenv>=1.0.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (1.0.1)
Requirement already satisfied: e2b-code-interpreter>=1.0.3 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (1.0.3)
Requirement already satisfied: litellm>=1.55.10 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from smolagents) (1.57.0)
Requirement already satisfied: click>=8.1.7 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from duckduckgo-search>=6.3.7->smolagents) (8.1.7)
Requirement already satisfied: primp>=0.9.3 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from duckduckgo-search>=6.3.7->smolagents) (0.9.3)
Requirement already satisfied: lxml>=5.3.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from duckduckgo-search>=6.3.7->smolagents) (5.3.0)
Requirement already satisfied: attrs>=21.3.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from e2b-code-interpreter>=1.0.3->smolagents) (23.2.0)
Requirement already satisfied: e2b<2.0.0,>=1.0.4 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from e2b-code-interpreter>=1.0.3->smolagents) (1.0.5)
Requirement already satisfied: httpx<1.0.0,>=0.20.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from e2b-code-interpreter>=1.0.3->smolagents) (0.27.2)
Requirement already satisfied: aiofiles<24.0,>=22.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (23.2.1)
Requirement already satisfied: anyio<5.0,>=3.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (3.7.1)
Requirement already satisfied: fastapi<1.0,>=0.115.2 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.115.6)
Requirement already satisfied: ffmpy in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.4.0)
Requirement already satisfied: gradio-client==1.5.2 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (1.5.2)
Requirement already satisfied: huggingface-hub>=0.25.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.27.1)
Requirement already satisfied: markupsafe~=2.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (2.1.5)
Requirement already satisfied: numpy<3.0,>=1.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (2.1.3)
Requirement already satisfied: orjson~=3.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (3.10.11)
Requirement already satisfied: packaging in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (24.2)
Requirement already satisfied: pydantic>=2.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (2.9.2)
Requirement already satisfied: pydub in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.25.1)
Requirement already satisfied: python-multipart>=0.0.18 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.0.20)
Requirement already satisfied: pyyaml<7.0,>=5.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (6.0.1)
Requirement already satisfied: ruff>=0.2.2 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.3.4)
Requirement already satisfied: safehttpx<0.2.0,>=0.1.6 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.1.6)
Requirement already satisfied: semantic-version~=2.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (2.10.0)
Requirement already satisfied: starlette<1.0,>=0.40.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.41.3)
Requirement already satisfied: tomlkit<0.14.0,>=0.12.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.12.0)
Requirement already satisfied: typer<1.0,>=0.12 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.12.5)
Requirement already satisfied: typing-extensions~=4.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (4.12.2)
Requirement already satisfied: uvicorn>=0.14.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio>=5.8.0->smolagents) (0.30.6)
Requirement already satisfied: fsspec in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio-client==1.5.2->gradio>=5.8.0->smolagents) (2024.3.1)
Requirement already satisfied: websockets<15.0,>=10.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from gradio-client==1.5.2->gradio>=5.8.0->smolagents) (12.0)
Requirement already satisfied: aiohttp in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from litellm>=1.55.10->smolagents) (3.9.3)
Requirement already satisfied: importlib-metadata>=6.8.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from litellm>=1.55.10->smolagents) (8.5.0)
Requirement already satisfied: jsonschema<5.0.0,>=4.22.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from litellm>=1.55.10->smolagents) (4.22.0)
Requirement already satisfied: openai>=1.55.3 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from litellm>=1.55.10->smolagents) (1.59.3)
Requirement already satisfied: tiktoken>=0.7.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from litellm>=1.55.10->smolagents) (0.8.0)
Requirement already satisfied: tokenizers in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from litellm>=1.55.10->smolagents) (0.21.0)
Requirement already satisfied: beautifulsoup4<5,>=4.9 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from markdownify>=0.14.1->smolagents) (4.12.3)
Requirement already satisfied: six<2,>=1.15 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from markdownify>=0.14.1->smolagents) (1.16.0)
Requirement already satisfied: python-dateutil>=2.8.2 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from pandas>=2.2.3->smolagents) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from pandas>=2.2.3->smolagents) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from pandas>=2.2.3->smolagents) (2024.1)
Requirement already satisfied: charset-normalizer<4,>=2 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from requests>=2.32.3->smolagents) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from requests>=2.32.3->smolagents) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from requests>=2.32.3->smolagents) (2.0.7)
Requirement already satisfied: certifi>=2017.4.17 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from requests>=2.32.3->smolagents) (2023.11.17)
Requirement already satisfied: markdown-it-py>=2.2.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from rich>=13.9.4->smolagents) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from rich>=13.9.4->smolagents) (2.18.0)
Requirement already satisfied: filelock in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from transformers>=4.0.0->smolagents) (3.13.1)
Requirement already satisfied: regex!=2019.12.17 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from transformers>=4.0.0->smolagents) (2024.5.10)
Requirement already satisfied: safetensors>=0.4.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from transformers>=4.0.0->smolagents) (0.4.3)
Requirement already satisfied: tqdm>=4.27 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from transformers>=4.0.0->smolagents) (4.66.1)
Requirement already satisfied: sympy in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from torch->smolagents) (1.12)
Requirement already satisfied: networkx in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from torch->smolagents) (3.3)
Requirement already satisfied: sniffio>=1.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from anyio<5.0,>=3.0->gradio>=5.8.0->smolagents) (1.3.0)
Requirement already satisfied: soupsieve>1.2 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from beautifulsoup4<5,>=4.9->markdownify>=0.14.1->smolagents) (2.5)
Requirement already satisfied: httpcore<2.0.0,>=1.0.5 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from e2b<2.0.0,>=1.0.4->e2b-code-interpreter>=1.0.3->smolagents) (1.0.7)
Requirement already satisfied: protobuf<6.0.0,>=3.20.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from e2b<2.0.0,>=1.0.4->e2b-code-interpreter>=1.0.3->smolagents) (5.29.0)
Requirement already satisfied: h11<0.15,>=0.13 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from httpcore<2.0.0,>=1.0.5->e2b<2.0.0,>=1.0.4->e2b-code-interpreter>=1.0.3->smolagents) (0.14.0)
Requirement already satisfied: zipp>=3.20 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from importlib-metadata>=6.8.0->litellm>=1.55.10->smolagents) (3.21.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from jsonschema<5.0.0,>=4.22.0->litellm>=1.55.10->smolagents) (2023.12.1)
Requirement already satisfied: referencing>=0.28.4 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from jsonschema<5.0.0,>=4.22.0->litellm>=1.55.10->smolagents) (0.35.1)
Requirement already satisfied: rpds-py>=0.7.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from jsonschema<5.0.0,>=4.22.0->litellm>=1.55.10->smolagents) (0.18.1)
Requirement already satisfied: mdurl~=0.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from markdown-it-py>=2.2.0->rich>=13.9.4->smolagents) (0.1.2)
Requirement already satisfied: distro<2,>=1.7.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from openai>=1.55.3->litellm>=1.55.10->smolagents) (1.8.0)
Requirement already satisfied: jiter<1,>=0.4.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from openai>=1.55.3->litellm>=1.55.10->smolagents) (0.7.1)
Requirement already satisfied: annotated-types>=0.6.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from pydantic>=2.0->gradio>=5.8.0->smolagents) (0.6.0)
Requirement already satisfied: pydantic-core==2.23.4 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from pydantic>=2.0->gradio>=5.8.0->smolagents) (2.23.4)
Requirement already satisfied: shellingham>=1.3.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from typer<1.0,>=0.12->gradio>=5.8.0->smolagents) (1.5.4)
Requirement already satisfied: aiosignal>=1.1.2 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from aiohttp->litellm>=1.55.10->smolagents) (1.3.1)
Requirement already satisfied: frozenlist>=1.1.1 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from aiohttp->litellm>=1.55.10->smolagents) (1.4.1)
Requirement already satisfied: multidict<7.0,>=4.5 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from aiohttp->litellm>=1.55.10->smolagents) (6.0.5)
Requirement already satisfied: yarl<2.0,>=1.0 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from aiohttp->litellm>=1.55.10->smolagents) (1.9.4)
Requirement already satisfied: mpmath>=0.19 in /Users/aymeric/.pyenv/versions/3.12.0/lib/python3.12/site-packages (from sympy->torch->smolagents) (1.3.0)
`,Ee,R,$e,Z,Qe,B,Ys="对于这个用例，我们想要展示一个能够浏览网络并能够生成图像的智能体。",ze,G,Hs="为了构建它，我们只需要准备两个工具：图像生成和网络搜索。",xe,q,Fs="<li>对于图像生成，我们从 Hub 加载一个工具，该工具使用 HF 推理 API（无服务器）使用 Stable Diffusion 生成图像。</li> <li>对于网络搜索，我们加载一个 LangChain 工具。</li>",Se,A,Xe,_,Ls='<img src="https://huggingface.co/datasets/huggingface/cookbook-images/resolve/main/agents_db5.png" alt="Image of an Aston Martin DB5"/>',Ye,W,He,V,Ps="快速定义：检索增强生成（RAG）是 <strong><em>“使用大型语言模型（LLM）来回答用户查询，但基于从知识库检索到的信息来构建答案”</em></strong>。",Fe,N,Ks="这种方法相比使用普通或微调的 LLM 有许多优势：列举一些，它允许将答案建立在真实事实的基础上并减少虚构，它允许为 LLM 提供特定领域的知识，并且它允许对知识库中的信息访问进行细粒度控制。",Le,E,Ds="<li><p>现在假设我们想要执行 RAG，但增加了动态生成某些参数的约束。例如，根据用户查询，我们可能想要将搜索限制在知识库的特定子集，或者我们可能想要调整检索到的文档数量。难点在于：<strong>如何根据用户查询动态调整这些参数？</strong></p></li> <li><p>RAG 的一个常见失败案例是基于用户查询的检索没有返回任何相关的支持文档。<strong>有没有一种方法，在之前的结果不相关时，通过修改查询重新调用检索器来进行迭代？</strong></p></li>",Pe,$,Os="🔧 好吧，我们可以以简单的方式解决上述问题：我们将<strong>让我们的智能体控制检索器的参数！</strong>",Ke,Q,et="➡️ 让我们展示如何做到这一点。我们首先加载一个我们想要执行 RAG 的知识库：这个数据集是许多 <code>huggingface</code> 包的文档页面汇总，以 markdown 格式存储。",De,z,Oe,x,st="现在我们通过处理数据集并将其存储到向量数据库中来准备知识库，以便检索器使用。我们将使用 LangChain，因为它具有用于向量数据库的优秀工具：",es,S,ss,X,tt="现在我们已经准备好了数据库，让我们构建一个基于它回答用户查询的 RAG 系统！",ts,Y,lt="我们希望我们的系统根据查询只从最相关的信息来源中选择。",ls,H,nt="我们的文档页面来自以下来源：",ns,F,as,L,at=`['evaluate', 'course', 'deep-rl-class', 'peft', 'hf-endpoints-documentation', 'blog', 'gradio', 'datasets', 'datasets-server', 'transformers', 'optimum', 'hub-docs', 'pytorch-image-models', 'diffusers']
`,is,P,rs,K,os,D,it="要将你的工具分享到 Hub，首先将检索器工具定义单元格中的代码复制粘贴到一个名为例如 <code>retriever.py</code> 的新文件中。",ps,O,rt="当工具从单独的文件加载后，你可以使用以下代码将其推送到 Hub（确保使用具有<code>写入</code>访问权限的 token 登录）",ys,ee,Ms,se,ms,te,cs,le,ot=`Final output:
https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py
`,ds,ne,pt="发生了什么？首先，智能体启动了检索器，并考虑了特定的来源（<code>[&#39;transformers&#39;, &#39;blog&#39;]</code>）。",Us,ae,yt="但是这次检索没有产生足够的结果 ⇒ 没关系！智能体可以迭代之前的结果，因此它只是用不那么严格的搜索参数重新运行了它的检索。",js,ie,Mt="因此，研究成功了！",us,re,mt="请注意，<strong>使用调用检索器作为工具并可以动态修改查询和其他检索参数的 LLM 智能体</strong>是 RAG 的<strong>更一般的表述</strong>，这也涵盖了像迭代查询优化这样的许多 RAG 改进技术。",bs,oe,Js,pe,fs,ye,ct="正如你所看到的，智能体尝试了给定的代码，遇到错误，分析错误，纠正代码，并在验证代码可以正常工作后返回它！",gs,Me,dt="最终的代码是纠正后的代码：",hs,me,Ts,ce,Ut=`list=[0, 1, 2]

for i in range(4):
    print(list(i))
`,ws,de,Is,Ue,jt=`设置你自己的 LLM 引擎真的非常简单：
它只需要一个具有以下标准的<code>__call__</code>方法：`,vs,je,ut='<li>接受<a href="https://huggingface.co/docs/transformers/main/en/chat_templating#introduction" rel="nofollow">ChatML 格式</a>的消息列表作为输入并输出答案。</li> <li>接受一个 <code>stop_sequences</code> 参数，以传递生成停止的序列。</li> <li>根据你的 LLM 接受哪种类型的消息角色，你可能还需要转换一些消息角色。</li>',Cs,ue,ks,be,Rs,Je,bt=`my_list = [0, 1, 2]  # Renamed the list to avoid using the built-in name

for i in range(len(my_list)):  # Changed the range to be within the length of the list
    print(my_list[i])  # Corrected the list access syntax
`,Zs,fe,Bs,ge,Jt="上述用例应该让你对我们智能体框架的可能性有了初步了解！",Gs,he,ft='想要了解更多高级用法，请阅读<a href="https://huggingface.co/docs/transformers/en/transformers_agents" rel="nofollow">文档</a>， 以及<a href="https://github.com/aymeric-roucher/agent_reasoning_benchmark/blob/main/benchmark_gaia.ipynb" rel="nofollow">此实验</a>，它让我们能够基于 Llama-3-70B 构建自己的智能体，并在非常困难的<a href="https://huggingface.co/spaces/gaia-benchmark/leaderboard" rel="nofollow">GAIA 排行榜</a>上击败许多 GPT-4 智能体！',qs,Te,gt="欢迎所有反馈，这将帮助我们改进框架！ 🚀",As,we,_s,ve,Ws;return b=new Bt({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/cookbook/blob/main/notebooks/zh-CN/agents.ipynb"}]}}),J=new u({props:{title:"使用 Transformers Agents 构建具有工具调用超能力的智能体 🦸",local:"使用-transformers-agents-构建具有工具调用超能力的智能体-",headingTag:"h1"}}),C=new U({props:{code:"IXBpcCUyMGluc3RhbGwlMjBzbW9sYWdlbnRz",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>!pip install smolagents',wrap:!1}}),R=new U({props:{code:"IXBpcCUyMGluc3RhbGwlMjBkYXRhc2V0cyUyMGh1Z2dpbmdmYWNlX2h1YiUyMGxhbmdjaGFpbiUyMHNlbnRlbmNlLXRyYW5zZm9ybWVycyUyMGZhaXNzLWNwdSUyMHNlcnBhcGklMjBnb29nbGUtc2VhcmNoLXJlc3VsdHMlMjBvcGVuYWklMjAtcQ==",highlighted:"!pip install datasets huggingface_hub langchain sentence-transformers faiss-cpu serpapi google-search-results openai -q",wrap:!1}}),Z=new u({props:{title:"1. 🏞️ 多模态 + 🌐 网络浏览助手",local:"1--多模态---网络浏览助手",headingTag:"h2"}}),A=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRvb2wlMkMlMjBsb2FkX3Rvb2wlMkMlMjBDb2RlQWdlbnQlMkMlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCUwQSUwQSUyMyUyMEltcG9ydCUyMHRvb2wlMjBmcm9tJTIwSHViJTBBaW1hZ2VfZ2VuZXJhdGlvbl90b29sJTIwJTNEJTIwbG9hZF90b29sKCUyMm0tcmljJTJGdGV4dC10by1pbWFnZSUyMiUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEElMEElMjMlMjBJbXBvcnQlMjB0b29sJTIwZnJvbSUyMExhbmdDaGFpbiUwQWZyb20lMjBsYW5nY2hhaW4uYWdlbnRzJTIwaW1wb3J0JTIwbG9hZF90b29scyUwQSUwQXNlYXJjaF90b29sJTIwJTNEJTIwVG9vbC5mcm9tX2xhbmdjaGFpbihsb2FkX3Rvb2xzKCU1QiUyMnNlcnBhcGklMjIlNUQpJTVCMCU1RCklMEElMEElMEFtb2RlbCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudE1vZGVsKCUyMm1ldGEtbGxhbWElMkZMbGFtYS0zLjEtNzBCLUluc3RydWN0JTIyKSUwQSUyMyUyMEluaXRpYWxpemUlMjB0aGUlMjBhZ2VudCUyMHdpdGglMjBib3RoJTIwdG9vbHMlMEFhZ2VudCUyMCUzRCUyMENvZGVBZ2VudCh0b29scyUzRCU1QmltYWdlX2dlbmVyYXRpb25fdG9vbCUyQyUyMHNlYXJjaF90b29sJTVEJTJDJTIwbW9kZWwlM0Rtb2RlbCklMEElMEElMjMlMjBSdW4lMjBpdCElMEFyZXN1bHQlMjAlM0QlMjBhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIyR2VuZXJhdGUlMjBtZSUyMGElMjBwaG90byUyMG9mJTIwdGhlJTIwY2FyJTIwdGhhdCUyMEphbWVzJTIwYm9uZCUyMGRyb3ZlJTIwaW4lMjB0aGUlMjBsYXRlc3QlMjBtb3ZpZS4lMjIlMkMlMEEpJTBBcmVzdWx0",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Tool, load_tool, CodeAgent, InferenceClientModel

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

<span class="hljs-comment"># Import tool from LangChain</span>
<span class="hljs-keyword">from</span> langchain.agents <span class="hljs-keyword">import</span> load_tools

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


model = InferenceClientModel(<span class="hljs-string">&quot;meta-llama/Llama-3.1-70B-Instruct&quot;</span>)
<span class="hljs-comment"># Initialize the agent with both tools</span>
agent = CodeAgent(tools=[image_generation_tool, search_tool], model=model)

<span class="hljs-comment"># Run it!</span>
result = agent.run(
    <span class="hljs-string">&quot;Generate me a photo of the car that James bond drove in the latest movie.&quot;</span>,
)
result`,wrap:!1}}),W=new u({props:{title:"2. 📚💬 带有迭代查询优化和来源选择的 RAG",local:"2--带有迭代查询优化和来源选择的-rag",headingTag:"h2"}}),z=new U({props:{code:"aW1wb3J0JTIwZGF0YXNldHMlMEElMEFrbm93bGVkZ2VfYmFzZSUyMCUzRCUyMGRhdGFzZXRzLmxvYWRfZGF0YXNldCglMjJtLXJpYyUyRmh1Z2dpbmdmYWNlX2RvYyUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lMjIp",highlighted:`<span class="hljs-keyword">import</span> datasets

knowledge_base = datasets.load_dataset(<span class="hljs-string">&quot;m-ric/huggingface_doc&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)`,wrap:!1}}),S=new U({props:{code:"ZnJvbSUyMGxhbmdjaGFpbi5kb2NzdG9yZS5kb2N1bWVudCUyMGltcG9ydCUyMERvY3VtZW50JTBBZnJvbSUyMGxhbmdjaGFpbi50ZXh0X3NwbGl0dGVyJTIwaW1wb3J0JTIwUmVjdXJzaXZlQ2hhcmFjdGVyVGV4dFNwbGl0dGVyJTBBZnJvbSUyMGxhbmdjaGFpbi52ZWN0b3JzdG9yZXMlMjBpbXBvcnQlMjBGQUlTUyUwQWZyb20lMjBsYW5nY2hhaW5fY29tbXVuaXR5LmVtYmVkZGluZ3MlMjBpbXBvcnQlMjBIdWdnaW5nRmFjZUVtYmVkZGluZ3MlMEElMEFzb3VyY2VfZG9jcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMERvY3VtZW50KHBhZ2VfY29udGVudCUzRGRvYyU1QiUyMnRleHQlMjIlNUQlMkMlMjBtZXRhZGF0YSUzRCU3QiUyMnNvdXJjZSUyMiUzQSUyMGRvYyU1QiUyMnNvdXJjZSUyMiU1RC5zcGxpdCglMjIlMkYlMjIpJTVCMSU1RCU3RCklMjBmb3IlMjBkb2MlMjBpbiUyMGtub3dsZWRnZV9iYXNlJTBBJTVEJTBBJTBBZG9jc19wcm9jZXNzZWQlMjAlM0QlMjBSZWN1cnNpdmVDaGFyYWN0ZXJUZXh0U3BsaXR0ZXIoY2h1bmtfc2l6ZSUzRDUwMCkuc3BsaXRfZG9jdW1lbnRzKHNvdXJjZV9kb2NzKSU1QiUzQTEwMDAlNUQlMEElMEFlbWJlZGRpbmdfbW9kZWwlMjAlM0QlMjBIdWdnaW5nRmFjZUVtYmVkZGluZ3MobW9kZWxfbmFtZSUzRCUyMnRoZW5scGVyJTJGZ3RlLXNtYWxsJTIyKSUwQXZlY3RvcmRiJTIwJTNEJTIwRkFJU1MuZnJvbV9kb2N1bWVudHMoZG9jdW1lbnRzJTNEZG9jc19wcm9jZXNzZWQlMkMlMjBlbWJlZGRpbmclM0RlbWJlZGRpbmdfbW9kZWwp",highlighted:`<span class="hljs-keyword">from</span> langchain.docstore.document <span class="hljs-keyword">import</span> Document
<span class="hljs-keyword">from</span> langchain.text_splitter <span class="hljs-keyword">import</span> RecursiveCharacterTextSplitter
<span class="hljs-keyword">from</span> langchain.vectorstores <span class="hljs-keyword">import</span> FAISS
<span class="hljs-keyword">from</span> langchain_community.embeddings <span class="hljs-keyword">import</span> HuggingFaceEmbeddings

source_docs = [
    Document(page_content=doc[<span class="hljs-string">&quot;text&quot;</span>], metadata={<span class="hljs-string">&quot;source&quot;</span>: doc[<span class="hljs-string">&quot;source&quot;</span>].split(<span class="hljs-string">&quot;/&quot;</span>)[<span class="hljs-number">1</span>]}) <span class="hljs-keyword">for</span> doc <span class="hljs-keyword">in</span> knowledge_base
]

docs_processed = RecursiveCharacterTextSplitter(chunk_size=<span class="hljs-number">500</span>).split_documents(source_docs)[:<span class="hljs-number">1000</span>]

embedding_model = HuggingFaceEmbeddings(model_name=<span class="hljs-string">&quot;thenlper/gte-small&quot;</span>)
vectordb = FAISS.from_documents(documents=docs_processed, embedding=embedding_model)`,wrap:!1}}),F=new U({props:{code:"YWxsX3NvdXJjZXMlMjAlM0QlMjBsaXN0KHNldCglNUJkb2MubWV0YWRhdGElNUIlMjJzb3VyY2UlMjIlNUQlMjBmb3IlMjBkb2MlMjBpbiUyMGRvY3NfcHJvY2Vzc2VkJTVEKSklMEFwcmludChhbGxfc291cmNlcyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>all_sources = <span class="hljs-built_in">list</span>(<span class="hljs-built_in">set</span>([doc.metadata[<span class="hljs-string">&quot;source&quot;</span>] <span class="hljs-keyword">for</span> doc <span class="hljs-keyword">in</span> docs_processed]))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(all_sources)`,wrap:!1}}),P=new U({props:{code:" ",highlighted:`<span class="hljs-keyword">import</span> json
<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> Tool
<span class="hljs-keyword">from</span> langchain_core.vectorstores <span class="hljs-keyword">import</span> VectorStore


<span class="hljs-keyword">class</span> <span class="hljs-title class_">RetrieverTool</span>(<span class="hljs-title class_ inherited__">Tool</span>):
    name = <span class="hljs-string">&quot;retriever&quot;</span>
    description = (
        <span class="hljs-string">&quot;Retrieves some documents from the knowledge base that have the closest embeddings to the input query.&quot;</span>
    )
    inputs = {
        <span class="hljs-string">&quot;query&quot;</span>: {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>,
            <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;The query to perform. This should be semantically close to your target documents. Use the affirmative form rather than a question.&quot;</span>,
        },
        <span class="hljs-string">&quot;source&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;&quot;</span>},
        <span class="hljs-string">&quot;number_of_documents&quot;</span>: {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>,
            <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;the number of documents to retrieve. Stay under 10 to avoid drowning in docs&quot;</span>,
        },
    }
    output_type = <span class="hljs-string">&quot;text&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, vectordb: VectorStore, all_sources: <span class="hljs-built_in">str</span>, **kwargs</span>):
        <span class="hljs-built_in">super</span>().__init__(**kwargs)
        self.vectordb = vectordb
        self.inputs[<span class="hljs-string">&quot;source&quot;</span>][
            <span class="hljs-string">&quot;description&quot;</span>
        ] = <span class="hljs-string">f&quot;The source of the documents to search, as a str representation of a list. Possible values in the list are: <span class="hljs-subst">{all_sources}</span>. If this argument is not provided, all sources will be searched.&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, query: <span class="hljs-built_in">str</span>, source: <span class="hljs-built_in">str</span> = <span class="hljs-literal">None</span>, number_of_documents=<span class="hljs-number">7</span></span>) -&gt; <span class="hljs-built_in">str</span>:
        <span class="hljs-keyword">assert</span> <span class="hljs-built_in">isinstance</span>(query, <span class="hljs-built_in">str</span>), <span class="hljs-string">&quot;Your search query must be a string&quot;</span>
        number_of_documents = <span class="hljs-built_in">int</span>(number_of_documents)

        <span class="hljs-keyword">if</span> source:
            <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(source, <span class="hljs-built_in">str</span>) <span class="hljs-keyword">and</span> <span class="hljs-string">&quot;[&quot;</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">str</span>(source):  <span class="hljs-comment"># if the source is not representing a list</span>
                source = [source]
            source = json.loads(<span class="hljs-built_in">str</span>(source).replace(<span class="hljs-string">&quot;&#x27;&quot;</span>, <span class="hljs-string">&#x27;&quot;&#x27;</span>))

        docs = self.vectordb.similarity_search(
            query,
            <span class="hljs-built_in">filter</span>=({<span class="hljs-string">&quot;source&quot;</span>: source} <span class="hljs-keyword">if</span> source <span class="hljs-keyword">else</span> <span class="hljs-literal">None</span>),
            k=number_of_documents,
        )

        <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(docs) == <span class="hljs-number">0</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;No documents found with this filtering. Try removing the source filter.&quot;</span>
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Retrieved documents:\\n\\n&quot;</span> + <span class="hljs-string">&quot;\\n===Document===\\n&quot;</span>.join([doc.page_content <span class="hljs-keyword">for</span> doc <span class="hljs-keyword">in</span> docs])`,wrap:!1}}),K=new u({props:{title:"可选：将你的检索器工具分享到 Hub",local:"可选将你的检索器工具分享到-hub",headingTag:"h3"}}),ee=new U({props:{code:"c2hhcmVfdG9faHViJTIwJTNEJTIwRmFsc2UlMEElMEFpZiUyMHNoYXJlX3RvX2h1YiUzQSUwQSUyMCUyMCUyMCUyMGZyb20lMjBodWdnaW5nZmFjZV9odWIlMjBpbXBvcnQlMjBsb2dpbiUwQSUyMCUyMCUyMCUyMGZyb20lMjByZXRyaWV2ZXIlMjBpbXBvcnQlMjBSZXRyaWV2ZXJUb29sJTBBJTBBJTIwJTIwJTIwJTIwbG9naW4oJTIyeW91cl90b2tlbiUyMiklMEElMEElMjAlMjAlMjAlMjB0b29sJTIwJTNEJTIwUmV0cmlldmVyVG9vbCh2ZWN0b3JkYiUyQyUyMGFsbF9zb3VyY2VzKSUwQSUwQSUyMCUyMCUyMCUyMHRvb2wucHVzaF90b19odWIocmVwb19pZCUzRCUyMm0tcmljJTJGcmV0cmlldmVyLXRvb2wlMjIp",highlighted:`share_to_hub = <span class="hljs-literal">False</span>

<span class="hljs-keyword">if</span> share_to_hub:
    <span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login
    <span class="hljs-keyword">from</span> retriever <span class="hljs-keyword">import</span> RetrieverTool

    login(<span class="hljs-string">&quot;your_token&quot;</span>)

    tool = RetrieverTool(vectordb, all_sources)

    tool.push_to_hub(repo_id=<span class="hljs-string">&quot;m-ric/retriever-tool&quot;</span>)`,wrap:!1}}),se=new u({props:{title:"运行智能体!",local:"运行智能体",headingTag:"h3"}}),te=new U({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBIZk1vZGVsJTJDJTIwVG9vbENhbGxpbmdBZ2VudCUyQyUyMGxvYWRfdG9vbCUwQSUwQW1vZGVsJTIwJTNEJTIwSGZNb2RlbCglMjJtZXRhLWxsYW1hJTJGTWV0YS1MbGFtYS0zLTcwQi1JbnN0cnVjdCUyMiklMEElMEFyZXRyaWV2ZXJfdG9vbCUyMCUzRCUyMGxvYWRfdG9vbCglMjJtLXJpYyUyRnJldHJpZXZlci10b29sJTIyJTJDJTIwdmVjdG9yZGIlM0R2ZWN0b3JkYiUyQyUyMGFsbF9zb3VyY2VzJTNEYWxsX3NvdXJjZXMpJTBBYWdlbnQlMjAlM0QlMjBUb29sQ2FsbGluZ0FnZW50KHRvb2xzJTNEJTVCcmV0cmlldmVyX3Rvb2wlNUQlMkMlMjBtb2RlbCUzRG1vZGVsJTJDJTIwdmVyYm9zZSUzRDApJTBBJTBBYWdlbnRfb3V0cHV0JTIwJTNEJTIwYWdlbnQucnVuKCUyMlBsZWFzZSUyMHNob3clMjBtZSUyMGElMjBMT1JBJTIwZmluZXR1bmluZyUyMHNjcmlwdCUyMiklMEElMEFwcmludCglMjJGaW5hbCUyMG91dHB1dCUzQSUyMiklMEFwcmludChhZ2VudF9vdXRwdXQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> HfModel, ToolCallingAgent, load_tool

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

<span class="hljs-meta">&gt;&gt;&gt; </span>retriever_tool = load_tool(<span class="hljs-string">&quot;m-ric/retriever-tool&quot;</span>, vectordb=vectordb, all_sources=all_sources)
<span class="hljs-meta">&gt;&gt;&gt; </span>agent = ToolCallingAgent(tools=[retriever_tool], model=model, verbose=<span class="hljs-number">0</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>agent_output = agent.run(<span class="hljs-string">&quot;Please show me a LORA finetuning script&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Final output:&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(agent_output)`,wrap:!1}}),oe=new u({props:{title:"3. 💻 调试 Python 代码",local:"3--调试-python-代码",headingTag:"h2"}}),pe=new U({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBDb2RlQWdlbnQlMEElMEFhZ2VudCUyMCUzRCUyMENvZGVBZ2VudCh0b29scyUzRCU1QiU1RCklMEElMEFjb2RlJTIwJTNEJTIwJTIyJTIyJTIyJTBBbGlzdCUzRCU1QjAlMkMlMjAxJTJDJTIwMiU1RCUwQSUwQWZvciUyMGklMjBpbiUyMHJhbmdlKDQpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQobGlzdChpKSklMEElMjIlMjIlMjIlMEElMEFmaW5hbF9hbnN3ZXIlMjAlM0QlMjBhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIySSUyMGhhdmUlMjBzb21lJTIwY29kZSUyMHRoYXQlMjBjcmVhdGVzJTIwYSUyMGJ1ZyUzQSUyMHBsZWFzZSUyMGRlYnVnJTIwaXQlMjBhbmQlMjByZXR1cm4lMjB0aGUlMjBmaW5hbCUyMGNvZGUlMjIlMkMlMEElMjAlMjAlMjAlMjBjb2RlJTNEY29kZSUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent

agent = CodeAgent(tools=[])

code = <span class="hljs-string">&quot;&quot;&quot;
list=[0, 1, 2]

for i in range(4):
    print(list(i))
&quot;&quot;&quot;</span>

final_answer = agent.run(
    <span class="hljs-string">&quot;I have some code that creates a bug: please debug it and return the final code&quot;</span>,
    code=code,
)`,wrap:!1}}),me=new U({props:{code:"cHJpbnQoZmluYWxfYW5zd2VyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(final_answer)',wrap:!1}}),de=new u({props:{title:"4. 创建你自己的 LLM 引擎（OpenAI）",local:"4-创建你自己的-llm-引擎openai",headingTag:"h2"}}),ue=new U({props:{code:"aW1wb3J0JTIwb3MlMEFmcm9tJTIwb3BlbmFpJTIwaW1wb3J0JTIwT3BlbkFJJTBBZnJvbSUyMHNtb2xhZ2VudHMubW9kZWwlMjBpbXBvcnQlMjBNZXNzYWdlUm9sZSUyQyUyMGdldF9jbGVhbl9tZXNzYWdlX2xpc3QlMEElMEFvcGVuYWlfcm9sZV9jb252ZXJzaW9ucyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyME1lc3NhZ2VSb2xlLlRPT0xfUkVTUE9OU0UlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTdEJTBBJTBBJTBBY2xhc3MlMjBPcGVuQUlNb2RlbCUzQSUwQSUyMCUyMCUyMCUyMGRlZiUyMF9faW5pdF9fKHNlbGYlMkMlMjBtb2RlbF9uYW1lJTNEJTIyZ3B0LTRvLTIwMjQtMDUtMTMlMjIpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2VsZi5tb2RlbF9uYW1lJTIwJTNEJTIwbW9kZWxfbmFtZSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNlbGYuY2xpZW50JTIwJTNEJTIwT3BlbkFJKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFwaV9rZXklM0Rvcy5nZXRlbnYoJTIyT1BFTkFJX0FQSV9LRVklMjIpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUwQSUyMCUyMCUyMCUyMGRlZiUyMF9fY2FsbF9fKHNlbGYlMkMlMjBtZXNzYWdlcyUyQyUyMHN0b3Bfc2VxdWVuY2VzJTNEJTVCJTVEKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMEdldCUyMGNsZWFuJTIwbWVzc2FnZSUyMGxpc3QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtZXNzYWdlcyUyMCUzRCUyMGdldF9jbGVhbl9tZXNzYWdlX2xpc3QobWVzc2FnZXMlMkMlMjByb2xlX2NvbnZlcnNpb25zJTNEb3BlbmFpX3JvbGVfY29udmVyc2lvbnMpJTBBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwR2V0JTIwTExNJTIwb3V0cHV0JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmVzcG9uc2UlMjAlM0QlMjBzZWxmLmNsaWVudC5jaGF0LmNvbXBsZXRpb25zLmNyZWF0ZSglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2RlbCUzRHNlbGYubW9kZWxfbmFtZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEbWVzc2FnZXMlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBzdG9wJTNEc3RvcF9zZXF1ZW5jZXMlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjApJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzcG9uc2UuY2hvaWNlcyU1QjAlNUQubWVzc2FnZS5jb250ZW50JTBBJTBBJTBBb3BlbmFpX2VuZ2luZSUyMCUzRCUyME9wZW5BSU1vZGVsKCklMEFhZ2VudCUyMCUzRCUyMENvZGVBZ2VudChtb2RlbCUzRG9wZW5haV9lbmdpbmUlMkMlMjB0b29scyUzRCU1QiU1RCklMEElMEFjb2RlJTIwJTNEJTIwJTIyJTIyJTIyJTBBbGlzdCUzRCU1QjAlMkMlMjAxJTJDJTIwMiU1RCUwQSUwQWZvciUyMGklMjBpbiUyMHJhbmdlKDQpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQobGlzdChpKSklMEElMjIlMjIlMjIlMEElMEFmaW5hbF9hbnN3ZXIlMjAlM0QlMjBhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIySSUyMGhhdmUlMjBzb21lJTIwY29kZSUyMHRoYXQlMjBjcmVhdGVzJTIwYSUyMGJ1ZyUzQSUyMHBsZWFzZSUyMGRlYnVnJTIwaXQlMjBhbmQlMjByZXR1cm4lMjB0aGUlMjBmaW5hbCUyMGNvZGUlMjIlMkMlMEElMjAlMjAlMjAlMjBjb2RlJTNEY29kZSUyQyUwQSk=",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI
<span class="hljs-keyword">from</span> smolagents.model <span class="hljs-keyword">import</span> MessageRole, get_clean_message_list

openai_role_conversions = {
    MessageRole.TOOL_RESPONSE: <span class="hljs-string">&quot;user&quot;</span>,
}


<span class="hljs-keyword">class</span> <span class="hljs-title class_">OpenAIModel</span>:
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, model_name=<span class="hljs-string">&quot;gpt-4o-2024-05-13&quot;</span></span>):
        self.model_name = model_name
        self.client = OpenAI(
            api_key=os.getenv(<span class="hljs-string">&quot;OPENAI_API_KEY&quot;</span>),
        )

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, messages, stop_sequences=[]</span>):
        <span class="hljs-comment"># Get clean message list</span>
        messages = get_clean_message_list(messages, role_conversions=openai_role_conversions)

        <span class="hljs-comment"># Get LLM output</span>
        response = self.client.chat.completions.create(
            model=self.model_name,
            messages=messages,
            stop=stop_sequences,
        )
        <span class="hljs-keyword">return</span> response.choices[<span class="hljs-number">0</span>].message.content


openai_engine = OpenAIModel()
agent = CodeAgent(model=openai_engine, tools=[])

code = <span class="hljs-string">&quot;&quot;&quot;
list=[0, 1, 2]

for i in range(4):
    print(list(i))
&quot;&quot;&quot;</span>

final_answer = agent.run(
    <span class="hljs-string">&quot;I have some code that creates a bug: please debug it and return the final code&quot;</span>,
    code=code,
)`,wrap:!1}}),be=new U({props:{code:"cHJpbnQoZmluYWxfYW5zd2VyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(final_answer)',wrap:!1}}),fe=new u({props:{title:"➡️ 结论",local:"-结论",headingTag:"h2"}}),we=new Gt({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/zh-CN/agents.md"}}),{c(){j=i("meta"),Ce=n(),Ie=i("p"),ke=n(),p(b.$$.fragment),Re=n(),p(J.$$.fragment),Ze=n(),f=i("p"),f.innerHTML=Ns,Be=n(),g=i("p"),g.innerHTML=Es,Ge=n(),h=i("p"),h.innerHTML=$s,qe=n(),T=i("p"),T.innerHTML=Qs,Ae=n(),w=i("p"),w.innerHTML=zs,_e=n(),I=i("p"),I.textContent=xs,We=n(),v=i("p"),v.innerHTML=Ss,Ve=n(),p(C.$$.fragment),Ne=n(),k=i("pre"),k.textContent=Xs,Ee=n(),p(R.$$.fragment),$e=n(),p(Z.$$.fragment),Qe=n(),B=i("p"),B.textContent=Ys,ze=n(),G=i("p"),G.textContent=Hs,xe=n(),q=i("ul"),q.innerHTML=Fs,Se=n(),p(A.$$.fragment),Xe=n(),_=i("p"),_.innerHTML=Ls,Ye=n(),p(W.$$.fragment),He=n(),V=i("p"),V.innerHTML=Ps,Fe=n(),N=i("p"),N.textContent=Ks,Le=n(),E=i("ul"),E.innerHTML=Ds,Pe=n(),$=i("p"),$.innerHTML=Os,Ke=n(),Q=i("p"),Q.innerHTML=et,De=n(),p(z.$$.fragment),Oe=n(),x=i("p"),x.textContent=st,es=n(),p(S.$$.fragment),ss=n(),X=i("p"),X.textContent=tt,ts=n(),Y=i("p"),Y.textContent=lt,ls=n(),H=i("p"),H.textContent=nt,ns=n(),p(F.$$.fragment),as=n(),L=i("pre"),L.textContent=at,is=n(),p(P.$$.fragment),rs=n(),p(K.$$.fragment),os=n(),D=i("p"),D.innerHTML=it,ps=n(),O=i("p"),O.innerHTML=rt,ys=n(),p(ee.$$.fragment),Ms=n(),p(se.$$.fragment),ms=n(),p(te.$$.fragment),cs=n(),le=i("pre"),le.textContent=ot,ds=n(),ne=i("p"),ne.innerHTML=pt,Us=n(),ae=i("p"),ae.textContent=yt,js=n(),ie=i("p"),ie.textContent=Mt,us=n(),re=i("p"),re.innerHTML=mt,bs=n(),p(oe.$$.fragment),Js=n(),p(pe.$$.fragment),fs=n(),ye=i("p"),ye.textContent=ct,gs=n(),Me=i("p"),Me.textContent=dt,hs=n(),p(me.$$.fragment),Ts=n(),ce=i("pre"),ce.textContent=Ut,ws=n(),p(de.$$.fragment),Is=n(),Ue=i("p"),Ue.innerHTML=jt,vs=n(),je=i("ol"),je.innerHTML=ut,Cs=n(),p(ue.$$.fragment),ks=n(),p(be.$$.fragment),Rs=n(),Je=i("pre"),Je.textContent=bt,Zs=n(),p(fe.$$.fragment),Bs=n(),ge=i("p"),ge.textContent=Jt,Gs=n(),he=i("p"),he.innerHTML=ft,qs=n(),Te=i("p"),Te.textContent=gt,As=n(),p(we.$$.fragment),_s=n(),ve=i("p"),this.h()},l(e){const s=Rt("svelte-u9bgzb",document.head);j=r(s,"META",{name:!0,content:!0}),s.forEach(t),Ce=a(e),Ie=r(e,"P",{}),ht(Ie).forEach(t),ke=a(e),y(b.$$.fragment,e),Re=a(e),y(J.$$.fragment,e),Ze=a(e),f=r(e,"P",{"data-svelte-h":!0}),o(f)!=="svelte-1ouqjzx"&&(f.innerHTML=Ns),Be=a(e),g=r(e,"P",{"data-svelte-h":!0}),o(g)!=="svelte-1aj2n89"&&(g.innerHTML=Es),Ge=a(e),h=r(e,"P",{"data-svelte-h":!0}),o(h)!=="svelte-1krmqaz"&&(h.innerHTML=$s),qe=a(e),T=r(e,"P",{"data-svelte-h":!0}),o(T)!=="svelte-adzud6"&&(T.innerHTML=Qs),Ae=a(e),w=r(e,"P",{"data-svelte-h":!0}),o(w)!=="svelte-4p8oo0"&&(w.innerHTML=zs),_e=a(e),I=r(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-coem00"&&(I.textContent=xs),We=a(e),v=r(e,"P",{"data-svelte-h":!0}),o(v)!=="svelte-v3xboo"&&(v.innerHTML=Ss),Ve=a(e),y(C.$$.fragment,e),Ne=a(e),k=r(e,"PRE",{"data-svelte-h":!0}),o(k)!=="svelte-1wz9bju"&&(k.textContent=Xs),Ee=a(e),y(R.$$.fragment,e),$e=a(e),y(Z.$$.fragment,e),Qe=a(e),B=r(e,"P",{"data-svelte-h":!0}),o(B)!=="svelte-kkdqgb"&&(B.textContent=Ys),ze=a(e),G=r(e,"P",{"data-svelte-h":!0}),o(G)!=="svelte-1gjy54v"&&(G.textContent=Hs),xe=a(e),q=r(e,"UL",{"data-svelte-h":!0}),o(q)!=="svelte-19kqik7"&&(q.innerHTML=Fs),Se=a(e),y(A.$$.fragment,e),Xe=a(e),_=r(e,"P",{"data-svelte-h":!0}),o(_)!=="svelte-1hg95q8"&&(_.innerHTML=Ls),Ye=a(e),y(W.$$.fragment,e),He=a(e),V=r(e,"P",{"data-svelte-h":!0}),o(V)!=="svelte-na4ngx"&&(V.innerHTML=Ps),Fe=a(e),N=r(e,"P",{"data-svelte-h":!0}),o(N)!=="svelte-80vjwa"&&(N.textContent=Ks),Le=a(e),E=r(e,"UL",{"data-svelte-h":!0}),o(E)!=="svelte-1b72t5y"&&(E.innerHTML=Ds),Pe=a(e),$=r(e,"P",{"data-svelte-h":!0}),o($)!=="svelte-kok7hx"&&($.innerHTML=Os),Ke=a(e),Q=r(e,"P",{"data-svelte-h":!0}),o(Q)!=="svelte-1o7very"&&(Q.innerHTML=et),De=a(e),y(z.$$.fragment,e),Oe=a(e),x=r(e,"P",{"data-svelte-h":!0}),o(x)!=="svelte-1maw09u"&&(x.textContent=st),es=a(e),y(S.$$.fragment,e),ss=a(e),X=r(e,"P",{"data-svelte-h":!0}),o(X)!=="svelte-18cve4f"&&(X.textContent=tt),ts=a(e),Y=r(e,"P",{"data-svelte-h":!0}),o(Y)!=="svelte-1uorx1q"&&(Y.textContent=lt),ls=a(e),H=r(e,"P",{"data-svelte-h":!0}),o(H)!=="svelte-152zwsq"&&(H.textContent=nt),ns=a(e),y(F.$$.fragment,e),as=a(e),L=r(e,"PRE",{"data-svelte-h":!0}),o(L)!=="svelte-87x3d8"&&(L.textContent=at),is=a(e),y(P.$$.fragment,e),rs=a(e),y(K.$$.fragment,e),os=a(e),D=r(e,"P",{"data-svelte-h":!0}),o(D)!=="svelte-shnfcu"&&(D.innerHTML=it),ps=a(e),O=r(e,"P",{"data-svelte-h":!0}),o(O)!=="svelte-1f95672"&&(O.innerHTML=rt),ys=a(e),y(ee.$$.fragment,e),Ms=a(e),y(se.$$.fragment,e),ms=a(e),y(te.$$.fragment,e),cs=a(e),le=r(e,"PRE",{"data-svelte-h":!0}),o(le)!=="svelte-l44zt6"&&(le.textContent=ot),ds=a(e),ne=r(e,"P",{"data-svelte-h":!0}),o(ne)!=="svelte-1p0xa06"&&(ne.innerHTML=pt),Us=a(e),ae=r(e,"P",{"data-svelte-h":!0}),o(ae)!=="svelte-lx9k8m"&&(ae.textContent=yt),js=a(e),ie=r(e,"P",{"data-svelte-h":!0}),o(ie)!=="svelte-ukynxq"&&(ie.textContent=Mt),us=a(e),re=r(e,"P",{"data-svelte-h":!0}),o(re)!=="svelte-b42cxp"&&(re.innerHTML=mt),bs=a(e),y(oe.$$.fragment,e),Js=a(e),y(pe.$$.fragment,e),fs=a(e),ye=r(e,"P",{"data-svelte-h":!0}),o(ye)!=="svelte-exzkfa"&&(ye.textContent=ct),gs=a(e),Me=r(e,"P",{"data-svelte-h":!0}),o(Me)!=="svelte-yhuzec"&&(Me.textContent=dt),hs=a(e),y(me.$$.fragment,e),Ts=a(e),ce=r(e,"PRE",{"data-svelte-h":!0}),o(ce)!=="svelte-1t45l4d"&&(ce.textContent=Ut),ws=a(e),y(de.$$.fragment,e),Is=a(e),Ue=r(e,"P",{"data-svelte-h":!0}),o(Ue)!=="svelte-1keb31l"&&(Ue.innerHTML=jt),vs=a(e),je=r(e,"OL",{"data-svelte-h":!0}),o(je)!=="svelte-vma4hg"&&(je.innerHTML=ut),Cs=a(e),y(ue.$$.fragment,e),ks=a(e),y(be.$$.fragment,e),Rs=a(e),Je=r(e,"PRE",{"data-svelte-h":!0}),o(Je)!=="svelte-tgqz6q"&&(Je.textContent=bt),Zs=a(e),y(fe.$$.fragment,e),Bs=a(e),ge=r(e,"P",{"data-svelte-h":!0}),o(ge)!=="svelte-9ugofh"&&(ge.textContent=Jt),Gs=a(e),he=r(e,"P",{"data-svelte-h":!0}),o(he)!=="svelte-1852ggb"&&(he.innerHTML=ft),qs=a(e),Te=r(e,"P",{"data-svelte-h":!0}),o(Te)!=="svelte-w83c4h"&&(Te.textContent=gt),As=a(e),y(we.$$.fragment,e),_s=a(e),ve=r(e,"P",{}),ht(ve).forEach(t),this.h()},h(){Tt(j,"name","hf:doc:metadata"),Tt(j,"content",At)},m(e,s){Zt(document.head,j),l(e,Ce,s),l(e,Ie,s),l(e,ke,s),M(b,e,s),l(e,Re,s),M(J,e,s),l(e,Ze,s),l(e,f,s),l(e,Be,s),l(e,g,s),l(e,Ge,s),l(e,h,s),l(e,qe,s),l(e,T,s),l(e,Ae,s),l(e,w,s),l(e,_e,s),l(e,I,s),l(e,We,s),l(e,v,s),l(e,Ve,s),M(C,e,s),l(e,Ne,s),l(e,k,s),l(e,Ee,s),M(R,e,s),l(e,$e,s),M(Z,e,s),l(e,Qe,s),l(e,B,s),l(e,ze,s),l(e,G,s),l(e,xe,s),l(e,q,s),l(e,Se,s),M(A,e,s),l(e,Xe,s),l(e,_,s),l(e,Ye,s),M(W,e,s),l(e,He,s),l(e,V,s),l(e,Fe,s),l(e,N,s),l(e,Le,s),l(e,E,s),l(e,Pe,s),l(e,$,s),l(e,Ke,s),l(e,Q,s),l(e,De,s),M(z,e,s),l(e,Oe,s),l(e,x,s),l(e,es,s),M(S,e,s),l(e,ss,s),l(e,X,s),l(e,ts,s),l(e,Y,s),l(e,ls,s),l(e,H,s),l(e,ns,s),M(F,e,s),l(e,as,s),l(e,L,s),l(e,is,s),M(P,e,s),l(e,rs,s),M(K,e,s),l(e,os,s),l(e,D,s),l(e,ps,s),l(e,O,s),l(e,ys,s),M(ee,e,s),l(e,Ms,s),M(se,e,s),l(e,ms,s),M(te,e,s),l(e,cs,s),l(e,le,s),l(e,ds,s),l(e,ne,s),l(e,Us,s),l(e,ae,s),l(e,js,s),l(e,ie,s),l(e,us,s),l(e,re,s),l(e,bs,s),M(oe,e,s),l(e,Js,s),M(pe,e,s),l(e,fs,s),l(e,ye,s),l(e,gs,s),l(e,Me,s),l(e,hs,s),M(me,e,s),l(e,Ts,s),l(e,ce,s),l(e,ws,s),M(de,e,s),l(e,Is,s),l(e,Ue,s),l(e,vs,s),l(e,je,s),l(e,Cs,s),M(ue,e,s),l(e,ks,s),M(be,e,s),l(e,Rs,s),l(e,Je,s),l(e,Zs,s),M(fe,e,s),l(e,Bs,s),l(e,ge,s),l(e,Gs,s),l(e,he,s),l(e,qs,s),l(e,Te,s),l(e,As,s),M(we,e,s),l(e,_s,s),l(e,ve,s),Ws=!0},p:It,i(e){Ws||(m(b.$$.fragment,e),m(J.$$.fragment,e),m(C.$$.fragment,e),m(R.$$.fragment,e),m(Z.$$.fragment,e),m(A.$$.fragment,e),m(W.$$.fragment,e),m(z.$$.fragment,e),m(S.$$.fragment,e),m(F.$$.fragment,e),m(P.$$.fragment,e),m(K.$$.fragment,e),m(ee.$$.fragment,e),m(se.$$.fragment,e),m(te.$$.fragment,e),m(oe.$$.fragment,e),m(pe.$$.fragment,e),m(me.$$.fragment,e),m(de.$$.fragment,e),m(ue.$$.fragment,e),m(be.$$.fragment,e),m(fe.$$.fragment,e),m(we.$$.fragment,e),Ws=!0)},o(e){c(b.$$.fragment,e),c(J.$$.fragment,e),c(C.$$.fragment,e),c(R.$$.fragment,e),c(Z.$$.fragment,e),c(A.$$.fragment,e),c(W.$$.fragment,e),c(z.$$.fragment,e),c(S.$$.fragment,e),c(F.$$.fragment,e),c(P.$$.fragment,e),c(K.$$.fragment,e),c(ee.$$.fragment,e),c(se.$$.fragment,e),c(te.$$.fragment,e),c(oe.$$.fragment,e),c(pe.$$.fragment,e),c(me.$$.fragment,e),c(de.$$.fragment,e),c(ue.$$.fragment,e),c(be.$$.fragment,e),c(fe.$$.fragment,e),c(we.$$.fragment,e),Ws=!1},d(e){e&&(t(Ce),t(Ie),t(ke),t(Re),t(Ze),t(f),t(Be),t(g),t(Ge),t(h),t(qe),t(T),t(Ae),t(w),t(_e),t(I),t(We),t(v),t(Ve),t(Ne),t(k),t(Ee),t($e),t(Qe),t(B),t(ze),t(G),t(xe),t(q),t(Se),t(Xe),t(_),t(Ye),t(He),t(V),t(Fe),t(N),t(Le),t(E),t(Pe),t($),t(Ke),t(Q),t(De),t(Oe),t(x),t(es),t(ss),t(X),t(ts),t(Y),t(ls),t(H),t(ns),t(as),t(L),t(is),t(rs),t(os),t(D),t(ps),t(O),t(ys),t(Ms),t(ms),t(cs),t(le),t(ds),t(ne),t(Us),t(ae),t(js),t(ie),t(us),t(re),t(bs),t(Js),t(fs),t(ye),t(gs),t(Me),t(hs),t(Ts),t(ce),t(ws),t(Is),t(Ue),t(vs),t(je),t(Cs),t(ks),t(Rs),t(Je),t(Zs),t(Bs),t(ge),t(Gs),t(he),t(qs),t(Te),t(As),t(_s),t(ve)),t(j),d(b,e),d(J,e),d(C,e),d(R,e),d(Z,e),d(A,e),d(W,e),d(z,e),d(S,e),d(F,e),d(P,e),d(K,e),d(ee,e),d(se,e),d(te,e),d(oe,e),d(pe,e),d(me,e),d(de,e),d(ue,e),d(be,e),d(fe,e),d(we,e)}}}const At='{"title":"使用 Transformers Agents 构建具有工具调用超能力的智能体 🦸","local":"使用-transformers-agents-构建具有工具调用超能力的智能体-","sections":[{"title":"1. 🏞️ 多模态 + 🌐 网络浏览助手","local":"1--多模态---网络浏览助手","sections":[],"depth":2},{"title":"2. 📚💬 带有迭代查询优化和来源选择的 RAG","local":"2--带有迭代查询优化和来源选择的-rag","sections":[{"title":"可选：将你的检索器工具分享到 Hub","local":"可选将你的检索器工具分享到-hub","sections":[],"depth":3},{"title":"运行智能体!","local":"运行智能体","sections":[],"depth":3}],"depth":2},{"title":"3. 💻 调试 Python 代码","local":"3--调试-python-代码","sections":[],"depth":2},{"title":"4. 创建你自己的 LLM 引擎（OpenAI）","local":"4-创建你自己的-llm-引擎openai","sections":[],"depth":2},{"title":"➡️ 结论","local":"-结论","sections":[],"depth":2}],"depth":1}';function _t(Vs){return vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $t extends Ct{constructor(j){super(),kt(this,j,_t,qt,wt,{})}}export{$t as component};
