import{s as Us,n as ps,o as ws}from"../chunks/scheduler.f6319a2a.js";import{S as Js,i as js,g as a,s as M,r as p,A as os,h as y,f as t,c as n,j as as,u as w,x as U,k as ys,y as is,a as e,v as J,d as j,t as o,w as i}from"../chunks/index.85aa684c.js";import{C as T}from"../chunks/CodeBlock.3400fc53.js";import{D as Ts}from"../chunks/DocNotebookDropdown.3fc3604b.js";import{H as Ql,E as Cs}from"../chunks/getInferenceSnippets.743412b2.js";function cs(_l){let C,ll,K,sl,c,tl,r,el,d,Hl="此notebook将构建一个 <strong>multi-agent 网络浏览器：一个有多个代理协作，使用网络进行搜索解决问题的代理系统</strong>",Ml,I,Rl="<code>ManagedAgent</code> 对象将封装这些管理网络搜索的agent，形成一个简单的层次结构：",nl,m,al,h,Xl="我们来一起构建这个系统。运行下列代码以安装依赖包：",yl,u,Ul,b,xl="我们需要登录Hugging Face Hub以调用HF的Inference API：",pl,g,wl,B,Ll=`⚡️ HF的Inference API 可以快速轻松地运行任何开源模型，因此我们的agent将使用HF的Inference API
中的<code>InferenceClientModel</code>类来调用
<a href="https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct" rel="nofollow">Qwen/Qwen2.5-Coder-32B-Instruct</a>模型。`,Jl,f,Nl='<em>Note:</em> 基于多参数和部署模型的 Inference API 可能在没有预先通知的情况下更新或替换模型。了解更多信息，请参阅<a href="https://huggingface.co/docs/api-inference/supported-models" rel="nofollow">这里</a>。',jl,A,ol,Z,il,G,Yl=`虽然我们可以使用已经存在的
<code>WebSearchTool</code>
工具作为谷歌搜索的平替进行网页浏览，然后我们也需要能够查看<code>WebSearchTool</code>找到的页面。为此，我
们可以直接导入库的内置
<code>VisitWebpageTool</code>。但是我们将重新构建它以了解其工作原理。`,Tl,k,zl="我们将使用<code>markdownify</code> 来从头构建我们的<code>VisitWebpageTool</code>工具。",Cl,S,cl,W,Fl="现在我们初始化这个工具并测试它！",rl,v,dl,V,Il,E,ql="现在我们有了所有工具<code>search</code>和<code>visit_webpage</code>，我们可以使用它们来创建web agent。",ml,$,Dl="我们该选取什么样的配置来构建这个agent呢？",hl,Q,Pl="<li>网页浏览是一个单线程任务，不需要并行工具调用，因此JSON工具调用对于这个任务非常有效。因此我们选择<code>ToolCallingAgent</code>。</li> <li>有时候网页搜索需要探索许多页面才能找到正确答案，所以我们更喜欢将 <code>max_steps</code> 增加到10。</li>",ul,_,bl,H,Kl="请注意，我们为这个代理赋予了 name（名称）和 description（描述）属性，这些是必需属性，以便让管理代理能够调用此代理。",gl,R,Ol="然后，我们创建一个管理代理，在初始化时，将受管代理作为 managed_agents 参数传递给它。",Bl,X,ls="由于这个代理的任务是进行规划和思考，高级推理能力会很有帮助，因此 CodeAgent（代码代理）将是最佳选择。",fl,x,ss="此外，我们要提出一个涉及当前年份并需要进行额外数据计算的问题：所以让我们添加 additional_authorized_imports=[“time”, “numpy”, “pandas”]，以防代理需要用到这些包。",Al,L,Zl,N,ts="可以了！现在让我们运行我们的系统！我们选择一个需要一些计算和研究的问题：",Gl,Y,kl,z,es="我们用这个report 来回答这个问题：",Sl,F,Wl,q,Ms='如果<a href="https://gwern.net/scaling-hypothesis" rel="nofollow">scaling hypothesis</a>持续成立的话，我们需要一些庞大的动力配置。我们的agent成功地协作解决了这个任务！✅',vl,D,ns="💡 你可以轻松地将这个编排扩展到更多的agent：一个执行代码，一个进行网页搜索，一个处理文件加载⋯⋯",Vl,P,El,O,$l;return c=new Ql({props:{title:"编排 multi-agent 系统 🤖🤝🤖",local:"编排-multi-agent-系统-",headingTag:"h1"}}),r=new Ts({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/smolagents_doc/zh/multiagents.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/smolagents_doc/zh/pytorch/multiagents.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/smolagents_doc/zh/tensorflow/multiagents.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/smolagents_doc/zh/multiagents.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/smolagents_doc/zh/pytorch/multiagents.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/smolagents_doc/zh/tensorflow/multiagents.ipynb"}]}}),m=new T({props:{code:"JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTJCLS0tLS0tLS0tLS0tLS0tLSUyQiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyME1hbmFnZXIlMjBhZ2VudCUyMCUyMCU3QyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyQi0tLS0tLS0tLS0tLS0tLS0lMkIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0MlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBfX19fX19fX19fX19fX18lN0NfX19fX19fX19fX19fXyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUwQSUyMCUyMENvZGUlMjBpbnRlcnByZXRlciUyMCUyMCUyMCUyQi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tJTJCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwdG9vbCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMCUyMCUyMCU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CUyMCUyMCU3QyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMFZpc2l0JTIwd2VicGFnZSUyMHRvb2wlMjAlN0MlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMkItLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSUyQg==",highlighted:`              +----------------+
              |<span class="hljs-string"> Manager agent  </span>|
              +----------------+
                       |<span class="hljs-string">
        _______________</span>|______________
       |<span class="hljs-string">                              </span>|
  Code interpreter   +--------------------------------+
       tool          |<span class="hljs-string">         Managed agent          </span>|
                     |<span class="hljs-string">      +------------------+      </span>|
                     |<span class="hljs-string">      </span>|<span class="hljs-string"> Web Search agent </span>|<span class="hljs-string">      </span>|
                     |<span class="hljs-string">      +------------------+      </span>|
                     |<span class="hljs-string">         </span>|<span class="hljs-string">            </span>|<span class="hljs-string">         </span>|
                     |<span class="hljs-string">  Web Search tool     </span>|<span class="hljs-string">         </span>|
                     |<span class="hljs-string">             Visit webpage tool </span>|
                     +--------------------------------+`,wrap:!1}}),u=new T({props:{code:"IXBpcCUyMGluc3RhbGwlMjBzbW9sYWdlbnRzJTVCdG9vbGtpdCU1RCUyMC0tdXBncmFkZSUyMC1x",highlighted:'!pip install smolagents<span class="hljs-selector-attr">[toolkit]</span> <span class="hljs-attr">--upgrade</span> -<span class="hljs-selector-tag">q</span>',wrap:!1}}),g=new T({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTBBJTBBbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> <span class="hljs-keyword">login</span>

<span class="hljs-keyword">login</span>()`,wrap:!1}}),A=new T({props:{code:"bW9kZWxfaWQlMjAlM0QlMjAlMjJRd2VuJTJGUXdlbjIuNS1Db2Rlci0zMkItSW5zdHJ1Y3QlMjI=",highlighted:'model_id = <span class="hljs-string">&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</span>',wrap:!1}}),Z=new Ql({props:{title:"🔍 创建网络搜索工具",local:"-创建网络搜索工具",headingTag:"h2"}}),S=new T({props:{code:"aW1wb3J0JTIwcmUlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBtYXJrZG93bmlmeSUyMGltcG9ydCUyMG1hcmtkb3duaWZ5JTBBZnJvbSUyMHJlcXVlc3RzLmV4Y2VwdGlvbnMlMjBpbXBvcnQlMjBSZXF1ZXN0RXhjZXB0aW9uJTBBZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjB0b29sJTBBJTBBJTBBJTQwdG9vbCUwQWRlZiUyMHZpc2l0X3dlYnBhZ2UodXJsJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJWaXNpdHMlMjBhJTIwd2VicGFnZSUyMGF0JTIwdGhlJTIwZ2l2ZW4lMjBVUkwlMjBhbmQlMjByZXR1cm5zJTIwaXRzJTIwY29udGVudCUyMGFzJTIwYSUyMG1hcmtkb3duJTIwc3RyaW5nLiUwQSUwQSUyMCUyMCUyMCUyMEFyZ3MlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB1cmwlM0ElMjBUaGUlMjBVUkwlMjBvZiUyMHRoZSUyMHdlYnBhZ2UlMjB0byUyMHZpc2l0LiUwQSUwQSUyMCUyMCUyMCUyMFJldHVybnMlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBUaGUlMjBjb250ZW50JTIwb2YlMjB0aGUlMjB3ZWJwYWdlJTIwY29udmVydGVkJTIwdG8lMjBNYXJrZG93biUyQyUyM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VzdEV4Y2VwdGlvbiUyMGFzJTIwZSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMGYlMjJFcnJvciUyMGZldGNoaW5nJTIwdGhlJTIwd2VicGFnZSUzQSUyMCU3QnN0cihlKSU3RCUyMiUwQSUyMCUyMCUyMCUyMGV4Y2VwdCUyMEV4Y2VwdGlvbiUyMGFzJTIwZSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMGYlMjJBbiUyMHVuZXhwZWN0ZWQlMjBlcnJvciUyMG9jY3VycmVkJTNBJTIwJTdCc3RyKGUpJTdEJTIy",highlighted:`<span class="hljs-keyword">import</span> re
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> markdownify <span class="hljs-keyword">import</span> markdownify
<span class="hljs-keyword">from</span> requests.exceptions <span class="hljs-keyword">import</span> RequestException
<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> tool


<span class="hljs-meta">@tool</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">visit_webpage</span>(<span class="hljs-params">url: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Visits a webpage at the given URL and returns its content as a markdown string.

    Args:
        url: The URL of the webpage to visit.

    Returns:
        The content of the webpage converted to Markdown, or an error message if the request fails.
    &quot;&quot;&quot;</span>
    <span class="hljs-keyword">try</span>:
        <span class="hljs-comment"># Send a GET request to the URL</span>
        response = requests.get(url)
        response.raise_for_status()  <span class="hljs-comment"># Raise an exception for bad status codes</span>

        <span class="hljs-comment"># Convert the HTML content to Markdown</span>
        markdown_content = markdownify(response.text).strip()

        <span class="hljs-comment"># Remove multiple line breaks</span>
        markdown_content = re.sub(<span class="hljs-string">r&quot;\\n{3,}&quot;</span>, <span class="hljs-string">&quot;\\n\\n&quot;</span>, markdown_content)

        <span class="hljs-keyword">return</span> markdown_content

    <span class="hljs-keyword">except</span> RequestException <span class="hljs-keyword">as</span> e:
        <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Error fetching the webpage: <span class="hljs-subst">{<span class="hljs-built_in">str</span>(e)}</span>&quot;</span>
    <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
        <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;An unexpected error occurred: <span class="hljs-subst">{<span class="hljs-built_in">str</span>(e)}</span>&quot;</span>`,wrap:!1}}),v=new T({props:{code:"cHJpbnQodmlzaXRfd2VicGFnZSglMjJodHRwcyUzQSUyRiUyRmVuLndpa2lwZWRpYS5vcmclMkZ3aWtpJTJGSHVnZ2luZ19GYWNlJTIyKSU1QiUzQTUwMCU1RCk=",highlighted:'<span class="hljs-built_in">print</span>(visit_webpage(<span class="hljs-string">&quot;https://en.wikipedia.org/wiki/Hugging_Face&quot;</span>)[:<span class="hljs-number">500</span>])',wrap:!1}}),V=new Ql({props:{title:"构建我们的 multi-agent 系统 🤖🤝🤖",local:"构建我们的-multi-agent-系统-",headingTag:"h2"}}),_=new T({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjAoJTBBJTIwJTIwJTIwJTIwQ29kZUFnZW50JTJDJTBBJTIwJTIwJTIwJTIwVG9vbENhbGxpbmdBZ2VudCUyQyUwQSUyMCUyMCUyMCUyMEluZmVyZW5jZUNsaWVudE1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwTWFuYWdlZEFnZW50JTJDJTBBJTIwJTIwJTIwJTIwV2ViU2VhcmNoVG9vbCUyQyUwQSUyMCUyMCUyMCUyMExpdGVMTE1Nb2RlbCUyQyUwQSklMEElMEFtb2RlbCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudE1vZGVsKG1vZGVsX2lkJTNEbW9kZWxfaWQpJTBBJTBBd2ViX2FnZW50JTIwJTNEJTIwVG9vbENhbGxpbmdBZ2VudCglMEElMjAlMjAlMjAlMjB0b29scyUzRCU1QldlYlNlYXJjaFRvb2woKSUyQyUyMHZpc2l0X3dlYnBhZ2UlNUQlMkMlMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwbWF4X3N0ZXBzJTNEMTAlMkMlMEElMjAlMjAlMjAlMjBuYW1lJTNEJTIyc2VhcmNoJTIyJTJDJTBBJTIwJTIwJTIwJTIwZGVzY3JpcHRpb24lM0QlMjJSdW5zJTIwd2ViJTIwc2VhcmNoZXMlMjBmb3IlMjB5b3UuJTIwR2l2ZSUyMGl0JTIweW91ciUyMHF1ZXJ5JTIwYXMlMjBhbiUyMGFyZ3VtZW50LiUyMiUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> (
    CodeAgent,
    ToolCallingAgent,
    InferenceClientModel,
    ManagedAgent,
    WebSearchTool,
    LiteLLMModel,
)

model = InferenceClientModel(model_id=model_id)

web_agent = ToolCallingAgent(
    tools=[WebSearchTool(), visit_webpage],
    model=model,
    max_steps=<span class="hljs-number">10</span>,
    name=<span class="hljs-string">&quot;search&quot;</span>,
    description=<span class="hljs-string">&quot;Runs web searches for you. Give it your query as an argument.&quot;</span>,
)`,wrap:!1}}),L=new T({props:{code:"bWFuYWdlcl9hZ2VudCUyMCUzRCUyMENvZGVBZ2VudCglMEElMjAlMjAlMjAlMjB0b29scyUzRCU1QiU1RCUyQyUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBtYW5hZ2VkX2FnZW50cyUzRCU1QndlYl9hZ2VudCU1RCUyQyUwQSUyMCUyMCUyMCUyMGFkZGl0aW9uYWxfYXV0aG9yaXplZF9pbXBvcnRzJTNEJTVCJTIydGltZSUyMiUyQyUyMCUyMm51bXB5JTIyJTJDJTIwJTIycGFuZGFzJTIyJTVEJTJDJTBBKQ==",highlighted:`manager_agent = CodeAgent(
    tools=[],
    model=model,
    managed_agents=[web_agent],
    additional_authorized_imports=[<span class="hljs-string">&quot;time&quot;</span>, <span class="hljs-string">&quot;numpy&quot;</span>, <span class="hljs-string">&quot;pandas&quot;</span>],
)`,wrap:!1}}),Y=new T({props:{code:"YW5zd2VyJTIwJTNEJTIwbWFuYWdlcl9hZ2VudC5ydW4oJTIySWYlMjBMTE0lMjB0cmFpbmluZyUyMGNvbnRpbnVlcyUyMHRvJTIwc2NhbGUlMjB1cCUyMGF0JTIwdGhlJTIwY3VycmVudCUyMHJoeXRobSUyMHVudGlsJTIwMjAzMCUyQyUyMHdoYXQlMjB3b3VsZCUyMGJlJTIwdGhlJTIwZWxlY3RyaWMlMjBwb3dlciUyMGluJTIwR1clMjByZXF1aXJlZCUyMHRvJTIwcG93ZXIlMjB0aGUlMjBiaWdnZXN0JTIwdHJhaW5pbmclMjBydW5zJTIwYnklMjAyMDMwJTNGJTIwV2hhdCUyMHdvdWxkJTIwdGhhdCUyMGNvcnJlc3BvbmQlMjB0byUyQyUyMGNvbXBhcmVkJTIwdG8lMjBzb21lJTIwY291bnRyaWVzJTNGJTIwUGxlYXNlJTIwcHJvdmlkZSUyMGElMjBzb3VyY2UlMjBmb3IlMjBhbnklMjBudW1iZXJzJTIwdXNlZC4lMjIp",highlighted:'answer = manager_agent.run(<span class="hljs-string">&quot;If LLM training continues to scale up at the current rhythm until 2030, what would be the electric power in GW required to power the biggest training runs by 2030? What would that correspond to, compared to some countries? Please provide a source for any numbers used.&quot;</span>)',wrap:!1}}),F=new T({props:{code:"QmFzZWQlMjBvbiUyMGN1cnJlbnQlMjBncm93dGglMjBwcm9qZWN0aW9ucyUyMGFuZCUyMGVuZXJneSUyMGNvbnN1bXB0aW9uJTIwZXN0aW1hdGVzJTJDJTIwaWYlMjBMTE0lMjB0cmFpbmluZ3MlMjBjb250aW51ZSUyMHRvJTIwc2NhbGUlMjB1cCUyMGF0JTIwdGhlJTBBY3VycmVudCUyMHJoeXRobSUyMHVudGlsJTIwMjAzMCUzQSUwQSUwQTEuJTIwVGhlJTIwZWxlY3RyaWMlMj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vbWVzJTIwZnJvbSUyMEFXUyUyMENFTyUyME1hdHQlMjBHYXJtYW4uJTBBJTIwJTIwJTIwLSUyMFRoZSUyMGdyb3d0aCUyMHByb2plY3Rpb24lMjB1c2VkJTIwYSUyMENBR1IlMjBvZiUyMDc5LjgwJTI1JTIwZnJvbSUyMG1hcmtldCUyMHJlc2VhcmNoJTIwYnklMjBTcHJpbmdzLiUwQSUyMCUyMCUyMC0lMjBDb3VudHJ5JTIwZWxlY3RyaWNpdHklMjBjb25zdW1wdGlvbiUyMGRhdGElMjBpcyUyMGZyb20lMjB0aGUlMjBVLlMuJTIwRW5lcmd5JTIwSW5mb3JtYXRpb24lMjBBZG1pbmlzdHJhdGlvbiUyQyUyMHByaW1hcmlseSUyMGZvciUyMHRoZSUyMHllYXIlMEEyMDIxLg==",highlighted:`Based <span class="hljs-keyword">on</span> current growth projections <span class="hljs-keyword">and</span> energy consumption estimates, <span class="hljs-keyword">if</span> LLM trainings <span class="hljs-keyword">continue</span> <span class="hljs-keyword">to</span> scale up <span class="hljs-keyword">at</span> <span class="hljs-keyword">the</span>
current rhythm <span class="hljs-keyword">until</span> <span class="hljs-number">2030</span>:

<span class="hljs-number">1.</span> The electric power required <span class="hljs-keyword">to</span> power <span class="hljs-keyword">the</span> biggest training runs <span class="hljs-keyword">by</span> <span class="hljs-number">2030</span> would be approximately <span class="hljs-number">303.74</span> GW, which
translates <span class="hljs-keyword">to</span> <span class="hljs-keyword">about</span> <span class="hljs-number">2</span>,<span class="hljs-number">660</span>,<span class="hljs-number">762</span> GWh/<span class="hljs-built_in">year</span>.

<span class="hljs-number">1.</span> Comparing this <span class="hljs-keyword">to</span> countries&#x27; electricity consumption:
   - It would be equivalent <span class="hljs-keyword">to</span> <span class="hljs-keyword">about</span> <span class="hljs-number">34</span>% <span class="hljs-keyword">of</span> China&#x27;s total electricity consumption.
   - It would exceed <span class="hljs-keyword">the</span> total electricity consumption <span class="hljs-keyword">of</span> India (<span class="hljs-number">184</span>%), Russia (<span class="hljs-number">267</span>%), <span class="hljs-keyword">and</span> Japan (<span class="hljs-number">291</span>%).
   - It would be nearly <span class="hljs-number">9</span> <span class="hljs-keyword">times</span> <span class="hljs-keyword">the</span> electricity consumption <span class="hljs-keyword">of</span> countries like Italy <span class="hljs-keyword">or</span> Mexico.

<span class="hljs-number">2.</span> Source <span class="hljs-keyword">of</span> numbers:
   - The initial estimate <span class="hljs-keyword">of</span> <span class="hljs-number">5</span> GW <span class="hljs-keyword">for</span> future LLM training comes <span class="hljs-keyword">from</span> AWS CEO Matt Garman.
   - The growth projection used a CAGR <span class="hljs-keyword">of</span> <span class="hljs-number">79.80</span>% <span class="hljs-keyword">from</span> market research <span class="hljs-keyword">by</span> Springs.
   - Country electricity consumption data <span class="hljs-keyword">is</span> <span class="hljs-keyword">from</span> <span class="hljs-keyword">the</span> U.S. Energy Information Administration, primarily <span class="hljs-keyword">for</span> <span class="hljs-keyword">the</span> <span class="hljs-built_in">year</span>
<span class="hljs-number">2021.</span>`,wrap:!1}}),P=new Cs({props:{source:"https://github.com/huggingface/smolagents/blob/main/docs/source/zh/examples/multiagents.md"}}),{c(){C=a("meta"),ll=M(),K=a("p"),sl=M(),p(c.$$.fragment),tl=M(),p(r.$$.fragment),el=M(),d=a("p"),d.innerHTML=Hl,Ml=M(),I=a("p"),I.innerHTML=Rl,nl=M(),p(m.$$.fragment),al=M(),h=a("p"),h.textContent=Xl,yl=M(),p(u.$$.fragment),Ul=M(),b=a("p"),b.textContent=xl,pl=M(),p(g.$$.fragment),wl=M(),B=a("p"),B.innerHTML=Ll,Jl=M(),f=a("p"),f.innerHTML=Nl,jl=M(),p(A.$$.fragment),ol=M(),p(Z.$$.fragment),il=M(),G=a("p"),G.innerHTML=Yl,Tl=M(),k=a("p"),k.innerHTML=zl,Cl=M(),p(S.$$.fragment),cl=M(),W=a("p"),W.textContent=Fl,rl=M(),p(v.$$.fragment),dl=M(),p(V.$$.fragment),Il=M(),E=a("p"),E.innerHTML=ql,ml=M(),$=a("p"),$.textContent=Dl,hl=M(),Q=a("ul"),Q.innerHTML=Pl,ul=M(),p(_.$$.fragment),bl=M(),H=a("p"),H.textContent=Kl,gl=M(),R=a("p"),R.textContent=Ol,Bl=M(),X=a("p"),X.textContent=ls,fl=M(),x=a("p"),x.textContent=ss,Al=M(),p(L.$$.fragment),Zl=M(),N=a("p"),N.textContent=ts,Gl=M(),p(Y.$$.fragment),kl=M(),z=a("p"),z.textContent=es,Sl=M(),p(F.$$.fragment),Wl=M(),q=a("p"),q.innerHTML=Ms,vl=M(),D=a("p"),D.textContent=ns,Vl=M(),p(P.$$.fragment),El=M(),O=a("p"),this.h()},l(l){const s=os("svelte-u9bgzb",document.head);C=y(s,"META",{name:!0,content:!0}),s.forEach(t),ll=n(l),K=y(l,"P",{}),as(K).forEach(t),sl=n(l),w(c.$$.fragment,l),tl=n(l),w(r.$$.fragment,l),el=n(l),d=y(l,"P",{"data-svelte-h":!0}),U(d)!=="svelte-amh8hc"&&(d.innerHTML=Hl),Ml=n(l),I=y(l,"P",{"data-svelte-h":!0}),U(I)!=="svelte-3jtog5"&&(I.innerHTML=Rl),nl=n(l),w(m.$$.fragment,l),al=n(l),h=y(l,"P",{"data-svelte-h":!0}),U(h)!=="svelte-158mc1z"&&(h.textContent=Xl),yl=n(l),w(u.$$.fragment,l),Ul=n(l),b=y(l,"P",{"data-svelte-h":!0}),U(b)!=="svelte-s0io30"&&(b.textContent=xl),pl=n(l),w(g.$$.fragment,l),wl=n(l),B=y(l,"P",{"data-svelte-h":!0}),U(B)!=="svelte-1o3zzdj"&&(B.innerHTML=Ll),Jl=n(l),f=y(l,"P",{"data-svelte-h":!0}),U(f)!=="svelte-1jij1lg"&&(f.innerHTML=Nl),jl=n(l),w(A.$$.fragment,l),ol=n(l),w(Z.$$.fragment,l),il=n(l),G=y(l,"P",{"data-svelte-h":!0}),U(G)!=="svelte-k6zb4p"&&(G.innerHTML=Yl),Tl=n(l),k=y(l,"P",{"data-svelte-h":!0}),U(k)!=="svelte-y90h5t"&&(k.innerHTML=zl),Cl=n(l),w(S.$$.fragment,l),cl=n(l),W=y(l,"P",{"data-svelte-h":!0}),U(W)!=="svelte-1n6x7jk"&&(W.textContent=Fl),rl=n(l),w(v.$$.fragment,l),dl=n(l),w(V.$$.fragment,l),Il=n(l),E=y(l,"P",{"data-svelte-h":!0}),U(E)!=="svelte-1rg4l0k"&&(E.innerHTML=ql),ml=n(l),$=y(l,"P",{"data-svelte-h":!0}),U($)!=="svelte-1jtsocj"&&($.textContent=Dl),hl=n(l),Q=y(l,"UL",{"data-svelte-h":!0}),U(Q)!=="svelte-996ypc"&&(Q.innerHTML=Pl),ul=n(l),w(_.$$.fragment,l),bl=n(l),H=y(l,"P",{"data-svelte-h":!0}),U(H)!=="svelte-zr8ob4"&&(H.textContent=Kl),gl=n(l),R=y(l,"P",{"data-svelte-h":!0}),U(R)!=="svelte-grh88z"&&(R.textContent=Ol),Bl=n(l),X=y(l,"P",{"data-svelte-h":!0}),U(X)!=="svelte-648qpi"&&(X.textContent=ls),fl=n(l),x=y(l,"P",{"data-svelte-h":!0}),U(x)!=="svelte-p7yvhi"&&(x.textContent=ss),Al=n(l),w(L.$$.fragment,l),Zl=n(l),N=y(l,"P",{"data-svelte-h":!0}),U(N)!=="svelte-1rgnks8"&&(N.textContent=ts),Gl=n(l),w(Y.$$.fragment,l),kl=n(l),z=y(l,"P",{"data-svelte-h":!0}),U(z)!=="svelte-6e0l98"&&(z.textContent=es),Sl=n(l),w(F.$$.fragment,l),Wl=n(l),q=y(l,"P",{"data-svelte-h":!0}),U(q)!=="svelte-1nr8ehj"&&(q.innerHTML=Ms),vl=n(l),D=y(l,"P",{"data-svelte-h":!0}),U(D)!=="svelte-1g0vlkz"&&(D.textContent=ns),Vl=n(l),w(P.$$.fragment,l),El=n(l),O=y(l,"P",{}),as(O).forEach(t),this.h()},h(){ys(C,"name","hf:doc:metadata"),ys(C,"content",rs)},m(l,s){is(document.head,C),e(l,ll,s),e(l,K,s),e(l,sl,s),J(c,l,s),e(l,tl,s),J(r,l,s),e(l,el,s),e(l,d,s),e(l,Ml,s),e(l,I,s),e(l,nl,s),J(m,l,s),e(l,al,s),e(l,h,s),e(l,yl,s),J(u,l,s),e(l,Ul,s),e(l,b,s),e(l,pl,s),J(g,l,s),e(l,wl,s),e(l,B,s),e(l,Jl,s),e(l,f,s),e(l,jl,s),J(A,l,s),e(l,ol,s),J(Z,l,s),e(l,il,s),e(l,G,s),e(l,Tl,s),e(l,k,s),e(l,Cl,s),J(S,l,s),e(l,cl,s),e(l,W,s),e(l,rl,s),J(v,l,s),e(l,dl,s),J(V,l,s),e(l,Il,s),e(l,E,s),e(l,ml,s),e(l,$,s),e(l,hl,s),e(l,Q,s),e(l,ul,s),J(_,l,s),e(l,bl,s),e(l,H,s),e(l,gl,s),e(l,R,s),e(l,Bl,s),e(l,X,s),e(l,fl,s),e(l,x,s),e(l,Al,s),J(L,l,s),e(l,Zl,s),e(l,N,s),e(l,Gl,s),J(Y,l,s),e(l,kl,s),e(l,z,s),e(l,Sl,s),J(F,l,s),e(l,Wl,s),e(l,q,s),e(l,vl,s),e(l,D,s),e(l,Vl,s),J(P,l,s),e(l,El,s),e(l,O,s),$l=!0},p:ps,i(l){$l||(j(c.$$.fragment,l),j(r.$$.fragment,l),j(m.$$.fragment,l),j(u.$$.fragment,l),j(g.$$.fragment,l),j(A.$$.fragment,l),j(Z.$$.fragment,l),j(S.$$.fragment,l),j(v.$$.fragment,l),j(V.$$.fragment,l),j(_.$$.fragment,l),j(L.$$.fragment,l),j(Y.$$.fragment,l),j(F.$$.fragment,l),j(P.$$.fragment,l),$l=!0)},o(l){o(c.$$.fragment,l),o(r.$$.fragment,l),o(m.$$.fragment,l),o(u.$$.fragment,l),o(g.$$.fragment,l),o(A.$$.fragment,l),o(Z.$$.fragment,l),o(S.$$.fragment,l),o(v.$$.fragment,l),o(V.$$.fragment,l),o(_.$$.fragment,l),o(L.$$.fragment,l),o(Y.$$.fragment,l),o(F.$$.fragment,l),o(P.$$.fragment,l),$l=!1},d(l){l&&(t(ll),t(K),t(sl),t(tl),t(el),t(d),t(Ml),t(I),t(nl),t(al),t(h),t(yl),t(Ul),t(b),t(pl),t(wl),t(B),t(Jl),t(f),t(jl),t(ol),t(il),t(G),t(Tl),t(k),t(Cl),t(cl),t(W),t(rl),t(dl),t(Il),t(E),t(ml),t($),t(hl),t(Q),t(ul),t(bl),t(H),t(gl),t(R),t(Bl),t(X),t(fl),t(x),t(Al),t(Zl),t(N),t(Gl),t(kl),t(z),t(Sl),t(Wl),t(q),t(vl),t(D),t(Vl),t(El),t(O)),t(C),i(c,l),i(r,l),i(m,l),i(u,l),i(g,l),i(A,l),i(Z,l),i(S,l),i(v,l),i(V,l),i(_,l),i(L,l),i(Y,l),i(F,l),i(P,l)}}}const rs='{"title":"编排 multi-agent 系统 🤖🤝🤖","local":"编排-multi-agent-系统-","sections":[{"title":"🔍 创建网络搜索工具","local":"-创建网络搜索工具","sections":[],"depth":2},{"title":"构建我们的 multi-agent 系统 🤖🤝🤖","local":"构建我们的-multi-agent-系统-","sections":[],"depth":2}],"depth":1}';function ds(_l){return ws(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gs extends Js{constructor(C){super(),js(this,C,ds,cs,Us,{})}}export{gs as component};
