import{s as rs,o as ps,n as Ie}from"../chunks/scheduler.01eeda35.js";import{S as ms,i as Ms,g as r,s as a,r as c,A as cs,h as p,f as s,c as o,j as as,u as y,x as m,k as os,y as ys,a as l,v as d,d as u,t as h,w}from"../chunks/index.6dd51b66.js";import{T as It}from"../chunks/Tip.de9bae2b.js";import{C as b}from"../chunks/CodeBlock.864da1b0.js";import{D as ds}from"../chunks/DocNotebookDropdown.54e76c6c.js";import{H as B,E as us}from"../chunks/EditOnGithub.7faefd25.js";import{H as hs,a as is}from"../chunks/HfOption.f7f04550.js";function ws(J){let n,T='Agents and tools are being spun out into the standalone <a href="https://huggingface.co/docs/smolagents/index" rel="nofollow">smolagents</a> library. These docs will be deprecated in the future!';return{c(){n=r("p"),n.innerHTML=T},l(i){n=p(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-7z04h0"&&(n.innerHTML=T)},m(i,g){l(i,n,g)},p:Ie,d(i){i&&s(n)}}}function Ts(J){let n,T;return n=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMHBpcGVsaW5lJTJDJTIwVHJhbnNmb3JtZXJzRW5naW5lJTJDJTIwQ29kZUFnZW50JTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIybWV0YS1sbGFtYSUyRkxsYW1hLTMuMS04Qi1JbnN0cnVjdCUyMiklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJtZXRhLWxsYW1hJTJGTGxhbWEtMy4xLThCLUluc3RydWN0JTIyKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lJTIwJTNEJTIwcGlwZWxpbmUoJTIydGV4dC1nZW5lcmF0aW9uJTIyJTJDJTIwbW9kZWwlM0Rtb2RlbCUyQyUyMHRva2VuaXplciUzRHRva2VuaXplciklMEFsbG1fZW5naW5lJTIwJTNEJTIwVHJhbnNmb3JtZXJzRW5naW5lKHBpcGVsaW5lKSUwQWFnZW50JTIwJTNEJTIwQ29kZUFnZW50KHRvb2xzJTNEJTVCJTVEJTJDJTIwbGxtX2VuZ2luZSUzRGxsbV9lbmdpbmUpJTBBYWdlbnQucnVuKCUwQSUyMCUyMCUyMCUyMCUyMldoYXQlMjBjYXVzZXMlMjBicmVhZCUyMHRvJTIwcmlzZSUzRiUyMiUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, pipeline, TransformersEngine, CodeAgent

tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;meta-llama/Llama-3.1-8B-Instruct&quot;</span>)
model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;meta-llama/Llama-3.1-8B-Instruct&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = pipeline(<span class="hljs-string">&quot;text-generation&quot;</span>, model=model, tokenizer=tokenizer)
llm_engine = TransformersEngine(pipeline)
agent = CodeAgent(tools=[], llm_engine=llm_engine)
agent.run(
    <span class="hljs-string">&quot;What causes bread to rise?&quot;</span>,
)`,wrap:!1}}),{c(){c(n.$$.fragment)},l(i){y(n.$$.fragment,i)},m(i,g){d(n,i,g),T=!0},p:Ie,i(i){T||(u(n.$$.fragment,i),T=!0)},o(i){h(n.$$.fragment,i),T=!1},d(i){w(n,i)}}}function gs(J){let n,T;return n=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVBZ2VudCUyQyUyMEhmQXBpRW5naW5lJTBBJTBBbGxtX2VuZ2luZSUyMCUzRCUyMEhmQXBpRW5naW5lKG1vZGVsJTNEJTIybWV0YS1sbGFtYSUyRk1ldGEtTGxhbWEtMy03MEItSW5zdHJ1Y3QlMjIpJTBBYWdlbnQlMjAlM0QlMjBDb2RlQWdlbnQodG9vbHMlM0QlNUIlNUQlMkMlMjBsbG1fZW5naW5lJTNEbGxtX2VuZ2luZSklMEFhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIyQ291bGQlMjB5b3UlMjB0cmFuc2xhdGUlMjB0aGlzJTIwc2VudGVuY2UlMjBmcm9tJTIwRnJlbmNoJTJDJTIwc2F5JTIwaXQlMjBvdXQlMjBsb3VkJTIwYW5kJTIwcmV0dXJuJTIwdGhlJTIwYXVkaW8uJTIyJTJDJTBBJTIwJTIwJTIwJTIwc2VudGVuY2UlM0QlMjJPJUMzJUI5JTIwZXN0JTIwbGElMjBib3VsYW5nZXJpZSUyMGxhJTIwcGx1cyUyMHByb2NoZSUzRiUyMiUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeAgent, HfApiEngine

llm_engine = HfApiEngine(model=<span class="hljs-string">&quot;meta-llama/Meta-Llama-3-70B-Instruct&quot;</span>)
agent = CodeAgent(tools=[], llm_engine=llm_engine)
agent.run(
    <span class="hljs-string">&quot;Could you translate this sentence from French, say it out loud and return the audio.&quot;</span>,
    sentence=<span class="hljs-string">&quot;Où est la boulangerie la plus proche?&quot;</span>,
)`,wrap:!1}}),{c(){c(n.$$.fragment)},l(i){y(n.$$.fragment,i)},m(i,g){d(n,i,g),T=!0},p:Ie,i(i){T||(u(n.$$.fragment,i),T=!0)},o(i){h(n.$$.fragment,i),T=!1},d(i){w(n,i)}}}function Js(J){let n,T,i,g;return n=new is({props:{id:"engine",option:"TransformersEngine",$$slots:{default:[Ts]},$$scope:{ctx:J}}}),i=new is({props:{id:"engine",option:"HfApiEngine",$$slots:{default:[gs]},$$scope:{ctx:J}}}),{c(){c(n.$$.fragment),T=a(),c(i.$$.fragment)},l(M){y(n.$$.fragment,M),T=o(M),y(i.$$.fragment,M)},m(M,f){d(n,M,f),l(M,T,f),d(i,M,f),g=!0},p(M,f){const U={};f&2&&(U.$$scope={dirty:f,ctx:M}),n.$set(U);const W={};f&2&&(W.$$scope={dirty:f,ctx:M}),i.$set(W)},i(M){g||(u(n.$$.fragment,M),u(i.$$.fragment,M),g=!0)},o(M){h(n.$$.fragment,M),h(i.$$.fragment,M),g=!1},d(M){M&&s(T),w(n,M),w(i,M)}}}function fs(J){let n,T="If you’re writing a custom system prompt, make sure to include <code>&lt;&lt;tool_descriptions&gt;&gt;</code> in the template so the agent is aware of the available tools.";return{c(){n=r("p"),n.innerHTML=T},l(i){n=p(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-l0xtfu"&&(n.innerHTML=T)},m(i,g){l(i,n,g)},p:Ie,d(i){i&&s(n)}}}function bs(J){let n,T="A LLM can generate any arbitrary code that can be executed, so don’t add any unsafe imports!";return{c(){n=r("p"),n.textContent=T},l(i){n=p(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-ug0oul"&&(n.textContent=T)},m(i,g){l(i,n,g)},p:Ie,d(i){i&&s(n)}}}function Us(J){let n,T,i,g,M,f,U,W,$,Ze,C,Zt="An agent is a system where a large language model (LLM) can execute more complex tasks through <em>planning</em> and using <em>tools</em>.",Be,G,Bt='<li><p>Planning helps a LLM reason its way through a task by breaking it down into smaller subtasks. For example, <a href="/docs/transformers/main/en/main_classes/agent#transformers.CodeAgent">CodeAgent</a> plans a series of actions to take and then generates Python code to execute all the actions at once.</p> <p>Another planning method is by self-reflection and refinement of its previous actions to improve its performance. The <a href="/docs/transformers/main/en/main_classes/agent#transformers.ReactJsonAgent">ReactJsonAgent</a> is an example of this type of planning, and it’s based on the <a href="https://hf.co/papers/2210.03629" rel="nofollow">ReAct</a> framework. This agent plans and executes actions one at a time based on the feedback it receives from each action.</p></li> <li><p>Tools give a LLM access to external functions or APIs that it can use to help it complete a task. For example, <a href="https://github.com/freddyaboulton/gradio-tools" rel="nofollow">gradio-tools</a> gives a LLM access to any of the <a href="https://www.gradio.app/" rel="nofollow">Gradio</a> apps available on Hugging Face <a href="https://hf.co/spaces" rel="nofollow">Spaces</a>. These apps can be used for a wide range of tasks such as image generation, video generation, audio transcription, and more.</p></li>',We,v,Wt="To use agents in Transformers, make sure you have the extra <code>agents</code> dependencies installed.",$e,k,Ce,R,$t='Create an agent instance (refer to the <a href="./main_classes/agent#agents">Agents</a> API for supported agents in Transformers) and a list of tools available for it to use, then <a href="/docs/transformers/main/en/main_classes/agent#transformers.ReactAgent.run">run()</a> the agent on your task. The example below demonstrates how a ReAct agent reasons through a task.',Ge,_,ve,H,ke,V,Ct="This guide will walk you through in more detail how to initialize an agent.",Re,Q,_e,x,Gt="An agent uses a LLM to plan and execute a task; it is the engine that powers the agent. To choose and build your own LLM engine, you need a method that:",He,F,vt='<li>the input uses the <a href="./chat_templating">chat template</a> format, <code>List[Dict[str, str]]</code>, and it returns a string</li> <li>the LLM stops generating outputs when it encounters the sequences in <code>stop_sequences</code></li>',Ve,Y,Qe,N,kt='Next, initialize an engine to load a model. To run an agent locally, create a <a href="/docs/transformers/main/en/main_classes/agent#transformers.TransformersEngine">TransformersEngine</a> to load a preinitialized <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline">Pipeline</a>.',xe,X,Rt='However, you could also leverage Hugging Face’s powerful inference infrastructure, <a href="https://hf.co/docs/api-inference/index" rel="nofollow">Inference API</a> or <a href="https://hf.co/docs/inference-endpoints/index" rel="nofollow">Inference Endpoints</a>, to run your model. This is useful for loading larger models that are typically required for agentic behavior. In this case, load the <a href="/docs/transformers/main/en/main_classes/agent#transformers.HfApiEngine">HfApiEngine</a> to run the agent.',Fe,E,_t="The agent requires a list of tools it can use to complete a task. If you aren’t using any additional tools, pass an empty list. The default tools provided by Transformers are loaded automatically, but you can optionally set <code>add_base_tools=True</code> to explicitly enable them.",Ye,j,Ne,S,Ht='The agent supports <a href="https://hf.co/docs/text-generation-inference/conceptual/guidance" rel="nofollow">constrained generation</a> for generating outputs according to a specific structure with the <code>grammar</code> parameter. The <code>grammar</code> parameter should be specified in the <code>llm_engine</code> method or you can set it when initializing an agent.',Xe,A,Vt='Lastly, an agent accepts additional inputs such as text and audio. In the <a href="/docs/transformers/main/en/main_classes/agent#transformers.HfApiEngine">HfApiEngine</a> example above, the agent accepted a sentence to translate. But you could also pass a path to a local or remote file for the agent to access. The example below demonstrates how to pass a path to an audio file.',Ee,z,Se,L,Ae,q,Qt="A system prompt describes how an agent should behave, a description of the available tools, and the expected output format.",ze,P,xt='Tools are defined by the <code>&lt;&lt;tool_descriptions&gt;&gt;</code> token which is dynamically replaced during runtime with the actual tool. The tool description is derived from the tool name, description, inputs, output type, and a Jinja2 template. Refer to the <a href="./tools">Tools</a> guide for more information about how to describe tools.',Le,D,Ft='The example below is the system prompt for <a href="/docs/transformers/main/en/main_classes/agent#transformers.ReactCodeAgent">ReactCodeAgent</a>.',qe,K,Pe,O,Yt="The system prompt can be tailored to the intended task. For example, you can add a better explanation of the output format or you can overwrite the system prompt template entirely with your own custom system prompt as shown below.",De,I,Ke,ee,Oe,te,et,se,Nt="For safety, only the tools you provide (and the default Transformers tools) and the <code>print</code> function are executed. The interpreter doesn’t allow importing modules that aren’t on a safe list.",tt,le,Xt="To import modules that aren’t on the list, add them as a list to the <code>additional_authorized_imports</code> parameter when initializing an agent.",st,ne,lt,ae,Et="Code execution stops if a tool isn’t on the safe list, it isn’t authorized, or if the code generated by the agent returns a Python error.",nt,Z,at,oe,ot,ie,St='<a href="https://hf.co/papers/2308.08155" rel="nofollow">Multi-agent</a> refers to multiple agents working together to solve a task. Performance is typically better because each agent is specialized for a particular subtask.',it,re,At='Multi-agents are created through a <a href="/docs/transformers/main/en/main_classes/agent#transformers.ManagedAgent">ManagedAgent</a> class, where a <em>manager agent</em> oversees how other agents work together. The manager agent requires an agent and their name and description. These are added to the manager agents system prompt which lets it know how to call and use them.',rt,pe,zt='The multi-agent example below creates a web search agent that is managed by another <a href="/docs/transformers/main/en/main_classes/agent#transformers.ReactCodeAgent">ReactCodeAgent</a>.',pt,me,mt,Me,Mt,ce,Lt='<a href="https://www.gradio.app/" rel="nofollow">Gradio</a> is a library for quickly creating and sharing machine learning apps. The <a href="https://www.gradio.app/docs/gradio/chatbot" rel="nofollow">gradio.Chatbot</a> supports chatting with a Transformers agent with the <a href="/docs/transformers/main/en/main_classes/agent#transformers.stream_to_gradio">stream_to_gradio()</a> function.',ct,ye,qt='Load a tool and LLM with an agent, and then create a Gradio app. The key is to use <a href="/docs/transformers/main/en/main_classes/agent#transformers.stream_to_gradio">stream_to_gradio()</a> to stream the agents messages and display how it’s reasoning through a task.',yt,de,dt,ue,ut,he,Pt="For a better idea of what is happening when you call an agent, it is always a good idea to check the system prompt template first.",ht,we,wt,Te,Dt='If the agent is behaving unexpectedly, remember to explain the task you want to perform as clearly as possible. Every <a href="/docs/transformers/main/en/main_classes/agent#transformers.Agent.run">run()</a> is different and minor variations in your system prompt may yield completely different results.',Tt,ge,Kt="To find out what happened after a run, check the following agent attributes.",gt,Je,Ot="<li><code>agent.logs</code> stores the finegrained agent logs. At every step of the agents run, everything is stored in a dictionary and appended to <code>agent.logs</code>.</li> <li><code>agent.write_inner_memory_from_logs</code> only stores a high-level overview of the agents run. For example, at each step, it stores the LLM output as a message and the tool call output as a separate message. Not every detail from a step is transcripted by <code>write_inner_memory_from_logs</code>.</li>",Jt,fe,ft,be,es='Learn more about ReAct agents in the <a href="https://hf.co/blog/open-source-llms-as-agents" rel="nofollow">Open-source LLMs as LangChain Agents</a> blog post.',bt,Ue,Ut,je,jt;return M=new It({props:{warning:!0,$$slots:{default:[ws]},$$scope:{ctx:J}}}),U=new B({props:{title:"Agents",local:"agents",headingTag:"h1"}}),$=new ds({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/agents.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/agents.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/agents.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/agents.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/agents.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/agents.ipynb"}]}}),k=new b({props:{code:"IXBpcCUyMGluc3RhbGwlMjB0cmFuc2Zvcm1lcnMlNUJhZ2VudHMlNUQ=",highlighted:"!pip install transformers[agents]",wrap:!1}}),_=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0Q29kZUFnZW50JTBBJTBBYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCh0b29scyUzRCU1QiU1RCklMEFhZ2VudC5ydW4oJTBBJTIwJTIwJTIwJTIwJTIySG93JTIwbWFueSUyMG1vcmUlMjBibG9ja3MlMjAoYWxzbyUyMGRlbm90ZWQlMjBhcyUyMGxheWVycyklMjBpbiUyMEJFUlQlMjBiYXNlJTIwZW5jb2RlciUyMHRoYW4lMjB0aGUlMjBlbmNvZGVyJTIwZnJvbSUyMHRoZSUyMGFyY2hpdGVjdHVyZSUyMHByb3Bvc2VkJTIwaW4lMjBBdHRlbnRpb24lMjBpcyUyMEFsbCUyMFlvdSUyME5lZWQlM0YlMjIlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactCodeAgent

agent = ReactCodeAgent(tools=[])
agent.run(
    <span class="hljs-string">&quot;How many more blocks (also denoted as layers) in BERT base encoder than the encoder from the architecture proposed in Attention is All You Need?&quot;</span>,
)`,wrap:!1}}),H=new b({props:{code:"JTBBJTBBRmluYWwlMjBhbnN3ZXIlM0E=",highlighted:`======== New task ========
How many more blocks (also denoted as layers) <span class="hljs-keyword">in</span> BERT base encoder than the encoder from the architecture proposed <span class="hljs-keyword">in</span> Attention is All You Need?
==== Agent is executing the code below:
bert_layers = 12  <span class="hljs-comment"># BERT base encoder has 12 layers</span>
attention_layers = 6  <span class="hljs-comment"># Encoder in Attention is All You Need has 6 layers</span>
layer_diff = bert_layers - attention_layers
<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;The difference in layers between BERT base encoder and Attention is All You Need is&quot;</span>, layer_diff)
====
Print outputs:
The difference <span class="hljs-keyword">in</span> layers between BERT base encoder and Attention is All You Need is 6

==== Agent is executing the code below:
final_answer(<span class="hljs-string">&quot;BERT base encoder has {} more layers than the encoder from Attention is All You Need.&quot;</span>.format(layer_diff))
====
Print outputs:

&gt;&gt;&gt; Final answer:
BERT base encoder has 6 more layers than the encoder from Attention is All You Need.`,wrap:!1}}),Q=new B({props:{title:"LLM",local:"llm",headingTag:"h2"}}),Y=new b({props:{code:"ZGVmJTIwbGxtX2VuZ2luZShtZXNzYWdlcyUyQyUyMHN0b3Bfc2VxdWVuY2VzJTNEJTVCJTIyVGFzayUyMiU1RCklMjAtJTNFJTIwc3RyJTNBJTBBJTIwJTIwJTIwJTIwcmVzcG9uc2UlMjAlM0QlMjBjbGllbnQuY2hhdF9jb21wbGV0aW9uKG1lc3NhZ2VzJTJDJTIwc3RvcCUzRHN0b3Bfc2VxdWVuY2VzJTJDJTIwbWF4X3Rva2VucyUzRDEwMDApJTBBJTIwJTIwJTIwJTIwYW5zd2VyJTIwJTNEJTIwcmVzcG9uc2UuY2hvaWNlcyU1QjAlNUQubWVzc2FnZS5jb250ZW50JTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYW5zd2Vy",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">llm_engine</span>(<span class="hljs-params">messages, stop_sequences=[<span class="hljs-string">&quot;Task&quot;</span>]</span>) -&gt; <span class="hljs-built_in">str</span>:
    response = client.chat_completion(messages, stop=stop_sequences, max_tokens=<span class="hljs-number">1000</span>)
    answer = response.choices[<span class="hljs-number">0</span>].message.content
    <span class="hljs-keyword">return</span> answer`,wrap:!1}}),j=new hs({props:{id:"engine",options:["TransformersEngine","HfApiEngine"],$$slots:{default:[Js]},$$scope:{ctx:J}}}),z=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0Q29kZUFnZW50JTBBJTBBYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCh0b29scyUzRCU1QiU1RCUyQyUyMGxsbV9lbmdpbmUlM0RsbG1fZW5naW5lKSUwQWFnZW50LnJ1biglMjJXaHklMjBkb2Vzbid0JTIwaGUlMjBrbm93JTIwbWFueSUyMHBlb3BsZSUyMGluJTIwTmV3JTIwWW9yayUzRiUyMiUyQyUyMGF1ZGlvJTNEJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGdHJhbnNmb3JtZXJzJTJGcmVjb3JkaW5nLm1wMyUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactCodeAgent

agent = ReactCodeAgent(tools=[], llm_engine=llm_engine)
agent.run(<span class="hljs-string">&quot;Why doesn&#x27;t he know many people in New York?&quot;</span>, audio=<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/recording.mp3&quot;</span>)`,wrap:!1}}),L=new B({props:{title:"System prompt",local:"system-prompt",headingTag:"h2"}}),K=new b({props:{code:"WW91JTIwd2lsbCUyMGJlJTIwZ2l2ZW4lMjBhJTIwdGFzayUyMHRvJTIwc29sdmUlMjBhcyUyMGJlc3QlMjB5b3UlMjBjYW4uJTBBWW91JTIwaGF2ZSUyMGFjY2VzcyUyMHRvJTIwdGhlJTIwZm9sbG93aW5nJTIwdG9vbHMlM0ElMEElM0MlM0N0b29sX2Rlc2NyaXB0aW9ucyUzRSU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29kZSUzQSclMjBzZXF1ZW5jZSUyMHRvJTIwbW92ZSUyMGZvcndhcmQuJTBBJTBBUmVtZW1iZXIlMjB0byUyMG5vdCUyMHBlcmZvcm0lMjB0b28lMjBtYW55JTIwb3BlcmF0aW9ucyUyMGluJTIwYSUyMHNpbmdsZSUyMGNvZGUlMjBibG9jayElMjBZb3UlMjBzaG91bGQlMjBzcGxpdCUyMHRoZSUyMHRhc2slMjBpbnRvJTIwaW50ZXJtZWRpYXRlJTIwY29kZSUyMGJsb2Nrcy4lMEFQcmludCUyMHJlc3VsdHMlMjBhdCUyMHRoZSUyMGVuZCUyMG9mJTIwZWFjaCUyMHN0ZXAlMjB0byUyMHNhdmUlMjB0aGUlMjBpbnRlcm1lZGlhdGUlMjByZXN1bHRzLiUyMFRoZW4lMjB1c2UlMjBmaW5hbF9hbnN3ZXIoKSUyMHRvJTIwcmV0dXJuJTIwdGhlJTIwZmluYWwlMjByZXN1bHQuJTBBJTBBUmVtZW1iZXIlMjB0byUyMG1ha2UlMjBzdXJlJTIwdGhhdCUyMHZhcmlhYmxlcyUyMHlvdSUyMHVzZSUyMGFyZSUyMGFsbCUyMGRlZmluZWQuJTBBJTBBTm93JTIwQmVnaW4h",highlighted:`You will be given a task to solve <span class="hljs-keyword">as</span> best you can.
You have access to the following tools:
&lt;&lt;tool_descriptions&gt;&gt;

To solve the task, you must plan forward to proceed <span class="hljs-keyword">in</span> a series of steps, <span class="hljs-keyword">in</span> a cycle of <span class="hljs-string">&#x27;Thought:&#x27;</span>, <span class="hljs-string">&#x27;Code:&#x27;</span>, <span class="hljs-keyword">and</span> <span class="hljs-string">&#x27;Observation:&#x27;</span> sequences.

At each step, <span class="hljs-keyword">in</span> the <span class="hljs-string">&#x27;Thought:&#x27;</span> sequence, you should first explain your reasoning towards solving the task, then the tools that you want to use.
Then <span class="hljs-keyword">in</span> the <span class="hljs-string">&#x27;Code:&#x27;</span> sequence, you should write the code <span class="hljs-keyword">in</span> simple Python. The code sequence must end <span class="hljs-keyword">with</span> <span class="hljs-string">&#x27;/End code&#x27;</span> sequence.
During each intermediate step, you can use <span class="hljs-string">&#x27;print()&#x27;</span> to save whatever important information you will then need.
These <span class="hljs-built_in">print</span> outputs will then be available <span class="hljs-keyword">in</span> the <span class="hljs-string">&#x27;Observation:&#x27;</span> field, <span class="hljs-keyword">for</span> using this information <span class="hljs-keyword">as</span> <span class="hljs-built_in">input</span> <span class="hljs-keyword">for</span> the <span class="hljs-built_in">next</span> step.

In the end you have to <span class="hljs-keyword">return</span> a final answer using the \`final_answer\` tool.

Here are a few examples using notional tools:
---
{examples}

Above example were using notional tools that might <span class="hljs-keyword">not</span> exist <span class="hljs-keyword">for</span> you. You only have access to those tools:
&lt;&lt;tool_names&gt;&gt;
You also can perform computations <span class="hljs-keyword">in</span> the python code you generate.

Always provide a <span class="hljs-string">&#x27;Thought:&#x27;</span> <span class="hljs-keyword">and</span> a <span class="hljs-string">&#x27;Code:\\n\`\`\`py&#x27;</span> sequence ending <span class="hljs-keyword">with</span> <span class="hljs-string">&#x27;\`\`\`&lt;end_code&gt;&#x27;</span> sequence. You MUST provide at least the <span class="hljs-string">&#x27;Code:&#x27;</span> sequence to move forward.

Remember to <span class="hljs-keyword">not</span> perform too many operations <span class="hljs-keyword">in</span> a single code block! You should split the task into intermediate code blocks.
Print results at the end of each step to save the intermediate results. Then use final_answer() to <span class="hljs-keyword">return</span> the final result.

Remember to make sure that variables you use are <span class="hljs-built_in">all</span> defined.

Now Begin!`,wrap:!1}}),I=new It({props:{warning:!0,$$slots:{default:[fs]},$$scope:{ctx:J}}}),ee=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0SnNvbkFnZW50JTBBZnJvbSUyMHRyYW5zZm9ybWVycy5hZ2VudHMlMjBpbXBvcnQlMjBQeXRob25JbnRlcnByZXRlclRvb2wlMEElMEFhZ2VudCUyMCUzRCUyMFJlYWN0SnNvbkFnZW50KHRvb2xzJTNEJTVCUHl0aG9uSW50ZXJwcmV0ZXJUb29sKCklNUQlMkMlMjBzeXN0ZW1fcHJvbXB0JTNEJTIyJTdCeW91cl9jdXN0b21fcHJvbXB0JTdEJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactJsonAgent
<span class="hljs-keyword">from</span> transformers.agents <span class="hljs-keyword">import</span> PythonInterpreterTool

agent = ReactJsonAgent(tools=[PythonInterpreterTool()], system_prompt=<span class="hljs-string">&quot;{your_custom_prompt}&quot;</span>)`,wrap:!1}}),te=new B({props:{title:"Code execution",local:"code-execution",headingTag:"h2"}}),ne=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWN0Q29kZUFnZW50JTBBJTBBYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCh0b29scyUzRCU1QiU1RCUyQyUyMGFkZGl0aW9uYWxfYXV0aG9yaXplZF9pbXBvcnRzJTNEJTVCJ3JlcXVlc3RzJyUyQyUyMCdiczQnJTVEKSUwQWFnZW50LnJ1biglMjJDb3VsZCUyMHlvdSUyMGdldCUyMG1lJTIwdGhlJTIwdGl0bGUlMjBvZiUyMHRoZSUyMHBhZ2UlMjBhdCUyMHVybCUyMCdodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGYmxvZyclM0YlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReactCodeAgent

agent = ReactCodeAgent(tools=[], additional_authorized_imports=[<span class="hljs-string">&#x27;requests&#x27;</span>, <span class="hljs-string">&#x27;bs4&#x27;</span>])
agent.run(<span class="hljs-string">&quot;Could you get me the title of the page at url &#x27;https://huggingface.co/blog&#x27;?&quot;</span>)`,wrap:!1}}),Z=new It({props:{warning:!0,$$slots:{default:[bs]},$$scope:{ctx:J}}}),oe=new B({props:{title:"Multi-agent",local:"multi-agent",headingTag:"h2"}}),me=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5hZ2VudHMlMjBpbXBvcnQlMjBSZWFjdENvZGVBZ2VudCUyQyUyMEhmQXBpRW5naW5lJTJDJTIwRHVja0R1Y2tHb1NlYXJjaFRvb2wlMkMlMjBNYW5hZ2VkQWdlbnQlMEElMEFsbG1fZW5naW5lJTIwJTNEJTIwSGZBcGlFbmdpbmUoKSUwQXdlYl9hZ2VudCUyMCUzRCUyMFJlYWN0Q29kZUFnZW50KHRvb2xzJTNEJTVCRHVja0R1Y2tHb1NlYXJjaFRvb2woKSU1RCUyQyUyMGxsbV9lbmdpbmUlM0RsbG1fZW5naW5lKSUwQW1hbmFnZWRfd2ViX2FnZW50JTIwJTNEJTIwTWFuYWdlZEFnZW50KCUwQSUyMCUyMCUyMCUyMGFnZW50JTNEd2ViX2FnZW50JTJDJTBBJTIwJTIwJTIwJTIwbmFtZSUzRCUyMndlYl9zZWFyY2glMjIlMkMlMEElMjAlMjAlMjAlMjBkZXNjcmlwdGlvbiUzRCUyMlJ1bnMlMjB3ZWIlMjBzZWFyY2hlcyUyMGZvciUyMHlvdS4lMjBHaXZlJTIwaXQlMjB5b3VyJTIwcXVlcnklMjBhcyUyMGFuJTIwYXJndW1lbnQuJTIyJTBBKSUwQW1hbmFnZXJfYWdlbnQlMjAlM0QlMjBSZWFjdENvZGVBZ2VudCglMEElMjAlMjAlMjAlMjB0b29scyUzRCU1QiU1RCUyQyUyMGxsbV9lbmdpbmUlM0RsbG1fZW5naW5lJTJDJTIwbWFuYWdlZF9hZ2VudHMlM0QlNUJtYW5hZ2VkX3dlYl9hZ2VudCU1RCUwQSklMEFtYW5hZ2VyX2FnZW50LnJ1biglMjJXaG8lMjBpcyUyMHRoZSUyMENFTyUyMG9mJTIwSHVnZ2luZyUyMEZhY2UlM0YlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers.agents <span class="hljs-keyword">import</span> ReactCodeAgent, HfApiEngine, DuckDuckGoSearchTool, ManagedAgent

llm_engine = HfApiEngine()
web_agent = ReactCodeAgent(tools=[DuckDuckGoSearchTool()], llm_engine=llm_engine)
managed_web_agent = ManagedAgent(
    agent=web_agent,
    name=<span class="hljs-string">&quot;web_search&quot;</span>,
    description=<span class="hljs-string">&quot;Runs web searches for you. Give it your query as an argument.&quot;</span>
)
manager_agent = ReactCodeAgent(
    tools=[], llm_engine=llm_engine, managed_agents=[managed_web_agent]
)
manager_agent.run(<span class="hljs-string">&quot;Who is the CEO of Hugging Face?&quot;</span>)`,wrap:!1}}),Me=new B({props:{title:"Gradio integration",local:"gradio-integration",headingTag:"h2"}}),de=new b({props:{code:"aW1wb3J0JTIwZ3JhZGlvJTIwYXMlMjBnciUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjAoJTBBJTIwJTIwJTIwJTIwbG9hZF90b29sJTJDJTBBJTIwJTIwJTIwJTIwUmVhY3RDb2RlQWdlbnQlMkMlMEElMjAlMjAlMjAlMjBIZkFwaUVuZ2luZSUyQyUwQSUyMCUyMCUyMCUyMHN0cmVhbV90b19ncmFkaW8lMkMlMEEpJTBBJTBBJTIzJTIwSW1wb3J0JTIwdG9vbCUyMGZyb20lMjBIdWIlMEFpbWFnZV9nZW5lcmF0aW9uX3Rvb2wlMjAlM0QlMjBsb2FkX3Rvb2woJTIybS1yaWMlMkZ0ZXh0LXRvLWltYWdlJTIyKSUwQWxsbV9lbmdpbmUlMjAlM0QlMjBIZkFwaUVuZ2luZSglMjJtZXRhLWxsYW1hJTJGTWV0YS1MbGFtYS0zLTcwQi1JbnN0cnVjdCUyMiklMEElMEElMjMlMjBJbml0aWFsaXplJTIwdGhlJTIwYWdlbnQlMjB3aXRoJTIwdGhlJTIwaW1hZ2UlMjBnZW5lcmF0aW9uJTIwdG9vbCUwQWFnZW50JTIwJTNEJTIwUmVhY3RDb2RlQWdlbnQodG9vbHMlM0QlNUJpbWFnZV9nZW5lcmF0aW9uX3Rvb2wlNUQlMkMlMjBsbG1fZW5naW5lJTNEbGxtX2VuZ2luZSklMEElME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BzdWJtaXQlMjAlM0QlMjBnci5CdXR0b24oJTIyUnVuJTIwaWxsdXN0cmF0b3IlMjBhZ2VudCElMjIpJTBBJTIwJTIwJTIwJTIwY2hhdGJvdCUyMCUzRCUyMGdyLkNoYXRib3QoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGFiZWwlM0QlMjJBZ2VudCUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHR5cGUlM0QlMjJtZXNzYWdlcyUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGF2YXRhcl9pbWFnZXMlM0QoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwTm9uZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGZW0tY29udGVudC56b2JqLm5ldCUyRnNvdXJjZSUyRnR3aXR0ZXIlMkY1MyUyRnJvYm90LWZhY2VfMWY5MTYucG5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUyQyUwQSUyMCUyMCUyMCUyMCklMEElMjAlMjAlMjAlMjBzdWJtaXQuY2xpY2soaW50ZXJhY3Rfd2l0aF9hZ2VudCUyQyUyMCU1QnRleHRfaW5wdXQlNUQlMkMlMjAlNUJjaGF0Ym90JTVEKSUwQSUwQWlmJTIwX19uYW1lX18lMjAlM0QlM0QlMjAlMjJfX21haW5fXyUyMiUzQSUwQSUyMCUyMCUyMCUyMGRlbW8ubGF1bmNoKCk=",highlighted:`<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    load_tool,
    ReactCodeAgent,
    HfApiEngine,
    stream_to_gradio,
)

<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>)
llm_engine = HfApiEngine(<span class="hljs-string">&quot;meta-llama/Meta-Llama-3-70B-Instruct&quot;</span>)

<span class="hljs-comment"># Initialize the agent with the image generation tool</span>
agent = ReactCodeAgent(tools=[image_generation_tool], llm_engine=llm_engine)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">interact_with_agent</span>(<span class="hljs-params">task</span>):
    messages = []
    messages.append(gr.ChatMessage(role=<span class="hljs-string">&quot;user&quot;</span>, content=task))
    <span class="hljs-keyword">yield</span> messages
    <span class="hljs-keyword">for</span> msg <span class="hljs-keyword">in</span> stream_to_gradio(agent, task):
        messages.append(msg)
        <span class="hljs-keyword">yield</span> messages + [
            gr.ChatMessage(role=<span class="hljs-string">&quot;assistant&quot;</span>, content=<span class="hljs-string">&quot;⏳ Task not finished yet!&quot;</span>)
        ]
    <span class="hljs-keyword">yield</span> messages

<span class="hljs-keyword">with</span> gr.Blocks() <span class="hljs-keyword">as</span> demo:
    text_input = gr.Textbox(lines=<span class="hljs-number">1</span>, label=<span class="hljs-string">&quot;Chat Message&quot;</span>, value=<span class="hljs-string">&quot;Make me a picture of the Statue of Liberty.&quot;</span>)
    submit = gr.Button(<span class="hljs-string">&quot;Run illustrator agent!&quot;</span>)
    chatbot = gr.Chatbot(
        label=<span class="hljs-string">&quot;Agent&quot;</span>,
        <span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;messages&quot;</span>,
        avatar_images=(
            <span class="hljs-literal">None</span>,
            <span class="hljs-string">&quot;https://em-content.zobj.net/source/twitter/53/robot-face_1f916.png&quot;</span>,
        ),
    )
    submit.click(interact_with_agent, [text_input], [chatbot])

<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&quot;__main__&quot;</span>:
    demo.launch()`,wrap:!1}}),ue=new B({props:{title:"Troubleshoot",local:"troubleshoot",headingTag:"h2"}}),we=new b({props:{code:"cHJpbnQoYWdlbnQuc3lzdGVtX3Byb21wdF90ZW1wbGF0ZSk=",highlighted:'<span class="hljs-built_in">print</span>(agent.system_prompt_template)',wrap:!1}}),fe=new B({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Ue=new us({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/agents.md"}}),{c(){n=r("meta"),T=a(),i=r("p"),g=a(),c(M.$$.fragment),f=a(),c(U.$$.fragment),W=a(),c($.$$.fragment),Ze=a(),C=r("p"),C.innerHTML=Zt,Be=a(),G=r("ul"),G.innerHTML=Bt,We=a(),v=r("p"),v.innerHTML=Wt,$e=a(),c(k.$$.fragment),Ce=a(),R=r("p"),R.innerHTML=$t,Ge=a(),c(_.$$.fragment),ve=a(),c(H.$$.fragment),ke=a(),V=r("p"),V.textContent=Ct,Re=a(),c(Q.$$.fragment),_e=a(),x=r("p"),x.textContent=Gt,He=a(),F=r("ol"),F.innerHTML=vt,Ve=a(),c(Y.$$.fragment),Qe=a(),N=r("p"),N.innerHTML=kt,xe=a(),X=r("p"),X.innerHTML=Rt,Fe=a(),E=r("p"),E.innerHTML=_t,Ye=a(),c(j.$$.fragment),Ne=a(),S=r("p"),S.innerHTML=Ht,Xe=a(),A=r("p"),A.innerHTML=Vt,Ee=a(),c(z.$$.fragment),Se=a(),c(L.$$.fragment),Ae=a(),q=r("p"),q.textContent=Qt,ze=a(),P=r("p"),P.innerHTML=xt,Le=a(),D=r("p"),D.innerHTML=Ft,qe=a(),c(K.$$.fragment),Pe=a(),O=r("p"),O.textContent=Yt,De=a(),c(I.$$.fragment),Ke=a(),c(ee.$$.fragment),Oe=a(),c(te.$$.fragment),et=a(),se=r("p"),se.innerHTML=Nt,tt=a(),le=r("p"),le.innerHTML=Xt,st=a(),c(ne.$$.fragment),lt=a(),ae=r("p"),ae.textContent=Et,nt=a(),c(Z.$$.fragment),at=a(),c(oe.$$.fragment),ot=a(),ie=r("p"),ie.innerHTML=St,it=a(),re=r("p"),re.innerHTML=At,rt=a(),pe=r("p"),pe.innerHTML=zt,pt=a(),c(me.$$.fragment),mt=a(),c(Me.$$.fragment),Mt=a(),ce=r("p"),ce.innerHTML=Lt,ct=a(),ye=r("p"),ye.innerHTML=qt,yt=a(),c(de.$$.fragment),dt=a(),c(ue.$$.fragment),ut=a(),he=r("p"),he.textContent=Pt,ht=a(),c(we.$$.fragment),wt=a(),Te=r("p"),Te.innerHTML=Dt,Tt=a(),ge=r("p"),ge.textContent=Kt,gt=a(),Je=r("ul"),Je.innerHTML=Ot,Jt=a(),c(fe.$$.fragment),ft=a(),be=r("p"),be.innerHTML=es,bt=a(),c(Ue.$$.fragment),Ut=a(),je=r("p"),this.h()},l(e){const t=cs("svelte-u9bgzb",document.head);n=p(t,"META",{name:!0,content:!0}),t.forEach(s),T=o(e),i=p(e,"P",{}),as(i).forEach(s),g=o(e),y(M.$$.fragment,e),f=o(e),y(U.$$.fragment,e),W=o(e),y($.$$.fragment,e),Ze=o(e),C=p(e,"P",{"data-svelte-h":!0}),m(C)!=="svelte-12g5d3e"&&(C.innerHTML=Zt),Be=o(e),G=p(e,"UL",{"data-svelte-h":!0}),m(G)!=="svelte-4d2vsc"&&(G.innerHTML=Bt),We=o(e),v=p(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1pgqage"&&(v.innerHTML=Wt),$e=o(e),y(k.$$.fragment,e),Ce=o(e),R=p(e,"P",{"data-svelte-h":!0}),m(R)!=="svelte-1kumzvn"&&(R.innerHTML=$t),Ge=o(e),y(_.$$.fragment,e),ve=o(e),y(H.$$.fragment,e),ke=o(e),V=p(e,"P",{"data-svelte-h":!0}),m(V)!=="svelte-slp997"&&(V.textContent=Ct),Re=o(e),y(Q.$$.fragment,e),_e=o(e),x=p(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-kwq5sb"&&(x.textContent=Gt),He=o(e),F=p(e,"OL",{"data-svelte-h":!0}),m(F)!=="svelte-djsytv"&&(F.innerHTML=vt),Ve=o(e),y(Y.$$.fragment,e),Qe=o(e),N=p(e,"P",{"data-svelte-h":!0}),m(N)!=="svelte-8l4xh7"&&(N.innerHTML=kt),xe=o(e),X=p(e,"P",{"data-svelte-h":!0}),m(X)!=="svelte-q86mv4"&&(X.innerHTML=Rt),Fe=o(e),E=p(e,"P",{"data-svelte-h":!0}),m(E)!=="svelte-1ro6pd"&&(E.innerHTML=_t),Ye=o(e),y(j.$$.fragment,e),Ne=o(e),S=p(e,"P",{"data-svelte-h":!0}),m(S)!=="svelte-vls8ox"&&(S.innerHTML=Ht),Xe=o(e),A=p(e,"P",{"data-svelte-h":!0}),m(A)!=="svelte-tjlch4"&&(A.innerHTML=Vt),Ee=o(e),y(z.$$.fragment,e),Se=o(e),y(L.$$.fragment,e),Ae=o(e),q=p(e,"P",{"data-svelte-h":!0}),m(q)!=="svelte-mxj1mp"&&(q.textContent=Qt),ze=o(e),P=p(e,"P",{"data-svelte-h":!0}),m(P)!=="svelte-olex0k"&&(P.innerHTML=xt),Le=o(e),D=p(e,"P",{"data-svelte-h":!0}),m(D)!=="svelte-1ccs8rv"&&(D.innerHTML=Ft),qe=o(e),y(K.$$.fragment,e),Pe=o(e),O=p(e,"P",{"data-svelte-h":!0}),m(O)!=="svelte-4jh3w4"&&(O.textContent=Yt),De=o(e),y(I.$$.fragment,e),Ke=o(e),y(ee.$$.fragment,e),Oe=o(e),y(te.$$.fragment,e),et=o(e),se=p(e,"P",{"data-svelte-h":!0}),m(se)!=="svelte-1dtk242"&&(se.innerHTML=Nt),tt=o(e),le=p(e,"P",{"data-svelte-h":!0}),m(le)!=="svelte-1c01mws"&&(le.innerHTML=Xt),st=o(e),y(ne.$$.fragment,e),lt=o(e),ae=p(e,"P",{"data-svelte-h":!0}),m(ae)!=="svelte-kagpuv"&&(ae.textContent=Et),nt=o(e),y(Z.$$.fragment,e),at=o(e),y(oe.$$.fragment,e),ot=o(e),ie=p(e,"P",{"data-svelte-h":!0}),m(ie)!=="svelte-1ot2sat"&&(ie.innerHTML=St),it=o(e),re=p(e,"P",{"data-svelte-h":!0}),m(re)!=="svelte-1o2vfcp"&&(re.innerHTML=At),rt=o(e),pe=p(e,"P",{"data-svelte-h":!0}),m(pe)!=="svelte-orshty"&&(pe.innerHTML=zt),pt=o(e),y(me.$$.fragment,e),mt=o(e),y(Me.$$.fragment,e),Mt=o(e),ce=p(e,"P",{"data-svelte-h":!0}),m(ce)!=="svelte-8o9cqa"&&(ce.innerHTML=Lt),ct=o(e),ye=p(e,"P",{"data-svelte-h":!0}),m(ye)!=="svelte-1yfwsu5"&&(ye.innerHTML=qt),yt=o(e),y(de.$$.fragment,e),dt=o(e),y(ue.$$.fragment,e),ut=o(e),he=p(e,"P",{"data-svelte-h":!0}),m(he)!=="svelte-1lec8j9"&&(he.textContent=Pt),ht=o(e),y(we.$$.fragment,e),wt=o(e),Te=p(e,"P",{"data-svelte-h":!0}),m(Te)!=="svelte-1t9n1ao"&&(Te.innerHTML=Dt),Tt=o(e),ge=p(e,"P",{"data-svelte-h":!0}),m(ge)!=="svelte-13gjoub"&&(ge.textContent=Kt),gt=o(e),Je=p(e,"UL",{"data-svelte-h":!0}),m(Je)!=="svelte-1mtavqt"&&(Je.innerHTML=Ot),Jt=o(e),y(fe.$$.fragment,e),ft=o(e),be=p(e,"P",{"data-svelte-h":!0}),m(be)!=="svelte-f9abqj"&&(be.innerHTML=es),bt=o(e),y(Ue.$$.fragment,e),Ut=o(e),je=p(e,"P",{}),as(je).forEach(s),this.h()},h(){os(n,"name","hf:doc:metadata"),os(n,"content",js)},m(e,t){ys(document.head,n),l(e,T,t),l(e,i,t),l(e,g,t),d(M,e,t),l(e,f,t),d(U,e,t),l(e,W,t),d($,e,t),l(e,Ze,t),l(e,C,t),l(e,Be,t),l(e,G,t),l(e,We,t),l(e,v,t),l(e,$e,t),d(k,e,t),l(e,Ce,t),l(e,R,t),l(e,Ge,t),d(_,e,t),l(e,ve,t),d(H,e,t),l(e,ke,t),l(e,V,t),l(e,Re,t),d(Q,e,t),l(e,_e,t),l(e,x,t),l(e,He,t),l(e,F,t),l(e,Ve,t),d(Y,e,t),l(e,Qe,t),l(e,N,t),l(e,xe,t),l(e,X,t),l(e,Fe,t),l(e,E,t),l(e,Ye,t),d(j,e,t),l(e,Ne,t),l(e,S,t),l(e,Xe,t),l(e,A,t),l(e,Ee,t),d(z,e,t),l(e,Se,t),d(L,e,t),l(e,Ae,t),l(e,q,t),l(e,ze,t),l(e,P,t),l(e,Le,t),l(e,D,t),l(e,qe,t),d(K,e,t),l(e,Pe,t),l(e,O,t),l(e,De,t),d(I,e,t),l(e,Ke,t),d(ee,e,t),l(e,Oe,t),d(te,e,t),l(e,et,t),l(e,se,t),l(e,tt,t),l(e,le,t),l(e,st,t),d(ne,e,t),l(e,lt,t),l(e,ae,t),l(e,nt,t),d(Z,e,t),l(e,at,t),d(oe,e,t),l(e,ot,t),l(e,ie,t),l(e,it,t),l(e,re,t),l(e,rt,t),l(e,pe,t),l(e,pt,t),d(me,e,t),l(e,mt,t),d(Me,e,t),l(e,Mt,t),l(e,ce,t),l(e,ct,t),l(e,ye,t),l(e,yt,t),d(de,e,t),l(e,dt,t),d(ue,e,t),l(e,ut,t),l(e,he,t),l(e,ht,t),d(we,e,t),l(e,wt,t),l(e,Te,t),l(e,Tt,t),l(e,ge,t),l(e,gt,t),l(e,Je,t),l(e,Jt,t),d(fe,e,t),l(e,ft,t),l(e,be,t),l(e,bt,t),d(Ue,e,t),l(e,Ut,t),l(e,je,t),jt=!0},p(e,[t]){const ts={};t&2&&(ts.$$scope={dirty:t,ctx:e}),M.$set(ts);const ss={};t&2&&(ss.$$scope={dirty:t,ctx:e}),j.$set(ss);const ls={};t&2&&(ls.$$scope={dirty:t,ctx:e}),I.$set(ls);const ns={};t&2&&(ns.$$scope={dirty:t,ctx:e}),Z.$set(ns)},i(e){jt||(u(M.$$.fragment,e),u(U.$$.fragment,e),u($.$$.fragment,e),u(k.$$.fragment,e),u(_.$$.fragment,e),u(H.$$.fragment,e),u(Q.$$.fragment,e),u(Y.$$.fragment,e),u(j.$$.fragment,e),u(z.$$.fragment,e),u(L.$$.fragment,e),u(K.$$.fragment,e),u(I.$$.fragment,e),u(ee.$$.fragment,e),u(te.$$.fragment,e),u(ne.$$.fragment,e),u(Z.$$.fragment,e),u(oe.$$.fragment,e),u(me.$$.fragment,e),u(Me.$$.fragment,e),u(de.$$.fragment,e),u(ue.$$.fragment,e),u(we.$$.fragment,e),u(fe.$$.fragment,e),u(Ue.$$.fragment,e),jt=!0)},o(e){h(M.$$.fragment,e),h(U.$$.fragment,e),h($.$$.fragment,e),h(k.$$.fragment,e),h(_.$$.fragment,e),h(H.$$.fragment,e),h(Q.$$.fragment,e),h(Y.$$.fragment,e),h(j.$$.fragment,e),h(z.$$.fragment,e),h(L.$$.fragment,e),h(K.$$.fragment,e),h(I.$$.fragment,e),h(ee.$$.fragment,e),h(te.$$.fragment,e),h(ne.$$.fragment,e),h(Z.$$.fragment,e),h(oe.$$.fragment,e),h(me.$$.fragment,e),h(Me.$$.fragment,e),h(de.$$.fragment,e),h(ue.$$.fragment,e),h(we.$$.fragment,e),h(fe.$$.fragment,e),h(Ue.$$.fragment,e),jt=!1},d(e){e&&(s(T),s(i),s(g),s(f),s(W),s(Ze),s(C),s(Be),s(G),s(We),s(v),s($e),s(Ce),s(R),s(Ge),s(ve),s(ke),s(V),s(Re),s(_e),s(x),s(He),s(F),s(Ve),s(Qe),s(N),s(xe),s(X),s(Fe),s(E),s(Ye),s(Ne),s(S),s(Xe),s(A),s(Ee),s(Se),s(Ae),s(q),s(ze),s(P),s(Le),s(D),s(qe),s(Pe),s(O),s(De),s(Ke),s(Oe),s(et),s(se),s(tt),s(le),s(st),s(lt),s(ae),s(nt),s(at),s(ot),s(ie),s(it),s(re),s(rt),s(pe),s(pt),s(mt),s(Mt),s(ce),s(ct),s(ye),s(yt),s(dt),s(ut),s(he),s(ht),s(wt),s(Te),s(Tt),s(ge),s(gt),s(Je),s(Jt),s(ft),s(be),s(bt),s(Ut),s(je)),s(n),w(M,e),w(U,e),w($,e),w(k,e),w(_,e),w(H,e),w(Q,e),w(Y,e),w(j,e),w(z,e),w(L,e),w(K,e),w(I,e),w(ee,e),w(te,e),w(ne,e),w(Z,e),w(oe,e),w(me,e),w(Me,e),w(de,e),w(ue,e),w(we,e),w(fe,e),w(Ue,e)}}}const js='{"title":"Agents","local":"agents","sections":[{"title":"LLM","local":"llm","sections":[],"depth":2},{"title":"System prompt","local":"system-prompt","sections":[],"depth":2},{"title":"Code execution","local":"code-execution","sections":[],"depth":2},{"title":"Multi-agent","local":"multi-agent","sections":[],"depth":2},{"title":"Gradio integration","local":"gradio-integration","sections":[],"depth":2},{"title":"Troubleshoot","local":"troubleshoot","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2}],"depth":1}';function Is(J){return ps(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ks extends ms{constructor(n){super(),Ms(this,n,Is,Us,rs,{})}}export{ks as component};
