import{s as Ns,o as As,n as Zt}from"../chunks/scheduler.00b97157.js";import{S as Es,i as qs,e as r,s as o,c as m,h as Ls,a as i,d as s,b as l,f as N,g as d,j as f,k as U,l as h,m as n,n as p,t as g,o as u,p as M}from"../chunks/index.a7c1a7a1.js";import{T as Ws,D as R,E as ns}from"../chunks/ExampleCodeBlock.bc6422ee.js";import{C as Zs,H as S,E as Bs}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4b5f77d2.js";import{C as x}from"../chunks/CodeBlock.7a3aa7b0.js";function Qs(C){let c,I="Smolagents 是一个实验性 API，其可能会随时发生更改。由于 API 或底层模型可能会变化，智能体返回的结果可能会有所不同。";return{c(){c=r("p"),c.textContent=I},l(T){c=i(T,"P",{"data-svelte-h":!0}),f(c)!=="svelte-j62iso"&&(c.textContent=I)},m(T,y){n(T,c,y)},p:Zt,d(T){T&&s(c)}}}function Vs(C){let c,I="Example:",T,y,_;return y=new x({props:{code:"ZW5naW5lJTIwJTNEJTIwVHJhbnNmb3JtZXJzTW9kZWwoJTBBJTIwJTIwJTIwJTIwbW9kZWxfaWQlM0QlMjJRd2VuJTJGUXdlbjMtTmV4dC04MEItQTNCLVRoaW5raW5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlJTNEJTIyY3VkYSUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF9uZXdfdG9rZW5zJTNENTAwMCUyQyUwQSklMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkV4cGxhaW4lMjBxdWFudHVtJTIwbWVjaGFuaWNzJTIwaW4lMjBzaW1wbGUlMjB0ZXJtcy4lMjIlN0QlNUQlMEFyZXNwb25zZSUyMCUzRCUyMGVuZ2luZShtZXNzYWdlcyUyQyUyMHN0b3Bfc2VxdWVuY2VzJTNEJTVCJTIyRU5EJTIyJTVEKSUwQXByaW50KHJlc3BvbnNlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>engine = TransformersModel(
<span class="hljs-meta">... </span>    model_id=<span class="hljs-string">&quot;Qwen/Qwen3-Next-80B-A3B-Thinking&quot;</span>,
<span class="hljs-meta">... </span>    device=<span class="hljs-string">&quot;cuda&quot;</span>,
<span class="hljs-meta">... </span>    max_new_tokens=<span class="hljs-number">5000</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>messages = [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Explain quantum mechanics in simple terms.&quot;</span>}]
<span class="hljs-meta">&gt;&gt;&gt; </span>response = engine(messages, stop_sequences=[<span class="hljs-string">&quot;END&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(response)
<span class="hljs-string">&quot;Quantum mechanics is the branch of physics that studies...&quot;</span>`,wrap:!1}}),{c(){c=r("p"),c.textContent=I,T=o(),m(y.$$.fragment)},l(a){c=i(a,"P",{"data-svelte-h":!0}),f(c)!=="svelte-11lpom8"&&(c.textContent=I),T=l(a),d(y.$$.fragment,a)},m(a,w){n(a,c,w),n(a,T,w),p(y,a,w),_=!0},p:Zt,i(a){_||(g(y.$$.fragment,a),_=!0)},o(a){u(y.$$.fragment,a),_=!1},d(a){a&&(s(c),s(T)),M(y,a)}}}function zs(C){let c,I="Example:",T,y,_;return y=new x({props:{code:"ZW5naW5lJTIwJTNEJTIwSW5mZXJlbmNlQ2xpZW50TW9kZWwoJTBBJTIwJTIwJTIwJTIwbW9kZWxfaWQlM0QlMjJRd2VuJTJGUXdlbjMtTmV4dC04MEItQTNCLVRoaW5raW5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwcHJvdmlkZXIlM0QlMjJoeXBlcmJvbGljJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW4lM0QlMjJ5b3VyX2hmX3Rva2VuX2hlcmUlMjIlMkMlMEElMjAlMjAlMjAlMjBtYXhfdG9rZW5zJTNENTAwMCUyQyUwQSklMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkV4cGxhaW4lMjBxdWFudHVtJTIwbWVjaGFuaWNzJTIwaW4lMjBzaW1wbGUlMjB0ZXJtcy4lMjIlN0QlNUQlMEFyZXNwb25zZSUyMCUzRCUyMGVuZ2luZShtZXNzYWdlcyUyQyUyMHN0b3Bfc2VxdWVuY2VzJTNEJTVCJTIyRU5EJTIyJTVEKSUwQXByaW50KHJlc3BvbnNlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>engine = InferenceClientModel(
<span class="hljs-meta">... </span>    model_id=<span class="hljs-string">&quot;Qwen/Qwen3-Next-80B-A3B-Thinking&quot;</span>,
<span class="hljs-meta">... </span>    provider=<span class="hljs-string">&quot;hyperbolic&quot;</span>,
<span class="hljs-meta">... </span>    token=<span class="hljs-string">&quot;your_hf_token_here&quot;</span>,
<span class="hljs-meta">... </span>    max_tokens=<span class="hljs-number">5000</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>messages = [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Explain quantum mechanics in simple terms.&quot;</span>}]
<span class="hljs-meta">&gt;&gt;&gt; </span>response = engine(messages, stop_sequences=[<span class="hljs-string">&quot;END&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(response)
<span class="hljs-string">&quot;Quantum mechanics is the branch of physics that studies...&quot;</span>`,wrap:!1}}),{c(){c=r("p"),c.textContent=I,T=o(),m(y.$$.fragment)},l(a){c=i(a,"P",{"data-svelte-h":!0}),f(c)!=="svelte-11lpom8"&&(c.textContent=I),T=l(a),d(y.$$.fragment,a)},m(a,w){n(a,c,w),n(a,T,w),p(y,a,w),_=!0},p:Zt,i(a){_||(g(y.$$.fragment,a),_=!0)},o(a){u(y.$$.fragment,a),_=!1},d(a){a&&(s(c),s(T)),M(y,a)}}}function Xs(C){let c,I="Example:",T,y,_;return y=new x({props:{code:"ZW5naW5lJTIwJTNEJTIwTUxYTW9kZWwoJTBBJTIwJTIwJTIwJTIwbW9kZWxfaWQlM0QlMjJtbHgtY29tbXVuaXR5JTJGUXdlbjIuNS1Db2Rlci0zMkItSW5zdHJ1Y3QtNGJpdCUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDAwMCUyQyUwQSklMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkV4cGxhaW4lMjBxdWFudHVtJTIwbWVjaGFuaWNzJTIwaW4lMjBzaW1wbGUlMjB0ZXJtcy4lMjIlMEElMjAlMjAlMjAlMjAlN0QlMEElNUQlMEFyZXNwb25zZSUyMCUzRCUyMGVuZ2luZShtZXNzYWdlcyUyQyUyMHN0b3Bfc2VxdWVuY2VzJTNEJTVCJTIyRU5EJTIyJTVEKSUwQXByaW50KHJlc3BvbnNlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>engine = MLXModel(
<span class="hljs-meta">... </span>    model_id=<span class="hljs-string">&quot;mlx-community/Qwen2.5-Coder-32B-Instruct-4bit&quot;</span>,
<span class="hljs-meta">... </span>    max_tokens=<span class="hljs-number">10000</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>messages = [
<span class="hljs-meta">... </span>    {
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Explain quantum mechanics in simple terms.&quot;</span>
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>response = engine(messages, stop_sequences=[<span class="hljs-string">&quot;END&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(response)
<span class="hljs-string">&quot;Quantum mechanics is the branch of physics that studies...&quot;</span>`,wrap:!1}}),{c(){c=r("p"),c.textContent=I,T=o(),m(y.$$.fragment)},l(a){c=i(a,"P",{"data-svelte-h":!0}),f(c)!=="svelte-11lpom8"&&(c.textContent=I),T=l(a),d(y.$$.fragment,a)},m(a,w){n(a,c,w),n(a,T,w),p(y,a,w),_=!0},p:Zt,i(a){_||(g(y.$$.fragment,a),_=!0)},o(a){u(y.$$.fragment,a),_=!1},d(a){a&&(s(c),s(T)),M(y,a)}}}function Hs(C){let c,I,T,y,_,a,w,Ge,L,Pe,G,os='要了解有关智能体和工具的更多信息，请务必阅读<a href="../index">入门指南</a>。此页面包含底层类的 API 文档。',Fe,P,Oe,F,ls="您可以自由创建和使用自己的模型为智能体提供支持。",De,O,as="您可以使用任何 <code>model</code> 可调用对象作为智能体的模型，只要满足以下条件：",Ye,D,rs='<li>它遵循<a href="./chat_templating">消息格式</a>（<code>List[Dict[str, str]]</code>），将其作为输入 <code>messages</code>，并返回一个 <code>str</code>。</li> <li>它在生成的序列到达 <code>stop_sequences</code> 参数中指定的内容之前停止生成输出。</li>',Ke,Y,is='要定义您的 LLM，可以创建一个 <code>custom_model</code> 方法，该方法接受一个 <a href="./chat_templating">messages</a> 列表，并返回一个包含 <code>.content</code> 属性的对象，其中包含生成的文本。此可调用对象还需要接受一个 <code>stop_sequences</code> 参数，用于指示何时停止生成。',et,K,tt,ee,cs='此外，<code>custom_model</code> 还可以接受一个 <code>grammar</code> 参数。如果在智能体初始化时指定了 <code>grammar</code>，则此参数将在调用模型时传递，以便进行<a href="https://huggingface.co/docs/text-generation-inference/conceptual/guidance" rel="nofollow">约束生成</a>，从而强制生成格式正确的智能体输出。',st,te,nt,se,ms="为了方便起见，我们添加了一个 <code>TransformersModel</code>，该模型通过为初始化时指定的 <code>model_id</code> 构建一个本地 <code>transformers</code> pipeline 来实现上述功能。",ot,ne,lt,oe,at,W,ds="<p>您必须在机器上安装 <code>transformers</code> 和 <code>torch</code>。如果尚未安装，请运行 <code>pip install &#39;smolagents[transformers]&#39;</code>。</p>",rt,J,le,Bt,qe,ps="A class that uses Hugging Face’s Transformers library for language model interaction.",Qt,Le,gs="This model allows you to load and use Hugging Face’s models locally using the Transformers library. It supports features like stop sequences and grammar customization.",Vt,ae,us="<p>You must have <code>transformers</code> and <code>torch</code> installed on your machine. Please run <code>pip install &#39;smolagents[transformers]&#39;</code> if it’s not the case.</p>",zt,Z,it,re,ct,ie,Ms='<code>InferenceClientModel</code> 封装了 huggingface_hub 的 <a href="https://huggingface.co/docs/huggingface_hub/main/en/guides/inference" rel="nofollow">InferenceClient</a>，用于执行 LLM。它支持 HF 的 <a href="https://huggingface.co/docs/api-inference/index" rel="nofollow">Inference API</a> 以及 Hub 上所有可用的<a href="https://huggingface.co/blog/inference-providers" rel="nofollow">Inference Providers</a>。',mt,ce,dt,me,pt,b,de,Xt,We,hs="A class to interact with Hugging Face’s Inference Providers for language model interaction.",Ht,Ze,fs="This model allows you to communicate with Hugging Face’s models using Inference Providers. It can be used in both serverless mode, with a dedicated endpoint, or even with a local URL, supporting features like stop sequences and grammar customization.",Rt,Be,ys="Providers include Cerebras, Cohere, Fal, Fireworks, HF-Inference, Hyperbolic, Nebius, Novita, Replicate, SambaNova, Together, and more.",St,B,Gt,Q,pe,Pt,Qe,Ts="Create the Hugging Face client.",gt,ge,ut,ue,_s='<code>LiteLLMModel</code> 利用 <a href="https://www.litellm.ai/" rel="nofollow">LiteLLM</a> 支持来自不同提供商的 100+ 个 LLM。您可以在模型初始化时传递 <code>kwargs</code>，这些参数将在每次使用模型时被使用，例如下面的示例中传递了 <code>temperature</code>。',Mt,Me,ht,k,he,Ft,Ve,ws='Model to use <a href="https://docs.litellm.ai/docs/#litellm-python-sdk" rel="nofollow">LiteLLM Python SDK</a> to access hundreds of LLMs.',Ot,V,fe,Dt,ze,bs="Create the LiteLLM client.",ft,ye,yt,Te,Is=`此类允许您调用任何 OpenAIServer 兼容模型。
以下是设置方法（您可以自定义 <code>api_base</code> URL 指向其他服务器）：`,Tt,_e,_t,A,we,Yt,Xe,Js="This model connects to an OpenAI-compatible API server.",wt,be,bt,Ie,$s="<code>AzureOpenAIModel</code> 允许您连接到任何 Azure OpenAI 部署。",It,Je,Us="下面是设置示例，请注意，如果已经设置了相应的环境变量，您可以省略 <code>azure_endpoint</code>、<code>api_key</code> 和 <code>api_version</code> 参数——环境变量包括 <code>AZURE_OPENAI_ENDPOINT</code>、<code>AZURE_OPENAI_API_KEY</code> 和 <code>OPENAI_API_VERSION</code>。",Jt,$e,vs='请注意，<code>OPENAI_API_VERSION</code> 没有 <code>AZURE_</code> 前缀，这是由于底层 <a href="https://github.com/openai/openai-python" rel="nofollow">openai</a> 包的设计所致。',$t,Ue,Ut,E,ve,Kt,He,js="This model connects to an Azure OpenAI deployment.",vt,je,jt,xe,xt,ke,kt,z,xs="<p>您必须在机器上安装 <code>mlx-lm</code>。如果尚未安装，请运行 <code>pip install &#39;smolagents[mlx-lm]&#39;</code>。</p>",Ct,v,Ce,es,Re,ks="A class to interact with models loaded using MLX on Apple silicon.",ts,Ne,Cs="<p>You must have <code>mlx-lm</code> installed on your machine. Please run <code>pip install &#39;smolagents[mlx-lm]&#39;</code> if it’s not the case.</p>",ss,X,Nt,Ae,At,Se,Et;return _=new Zs({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),w=new S({props:{title:"模型",local:"模型",headingTag:"h1"}}),L=new Ws({props:{warning:!0,$$slots:{default:[Qs]},$$scope:{ctx:C}}}),P=new S({props:{title:"模型",local:"模型",headingTag:"h2"}}),K=new x({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTJDJTIwSW5mZXJlbmNlQ2xpZW50JTBBJTBBbG9naW4oJTIyJTNDWU9VUl9IVUdHSU5HRkFDRUhVQl9BUElfVE9LRU4lM0UlMjIpJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJtZXRhLWxsYW1hJTJGTGxhbWEtMy4zLTcwQi1JbnN0cnVjdCUyMiUwQSUwQWNsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudChtb2RlbCUzRG1vZGVsX2lkKSUwQSUwQWRlZiUyMGN1c3RvbV9tb2RlbChtZXNzYWdlcyUyQyUyMHN0b3Bfc2VxdWVuY2VzJTNEJTVCJTIyVGFzayUyMiU1RCklM0ElMEElMjAlMjAlMjAlMjByZXNwb25zZSUyMCUzRCUyMGNsaWVudC5jaGF0X2NvbXBsZXRpb24obWVzc2FnZXMlMkMlMjBzdG9wJTNEc3RvcF9zZXF1ZW5jZXMlMkMlMjBtYXhfdG9rZW5zJTNEMTAwMCklMEElMjAlMjAlMjAlMjBhbnN3ZXIlMjAlM0QlMjByZXNwb25zZS5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYW5zd2Vy",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login, InferenceClient

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

model_id = <span class="hljs-string">&quot;meta-llama/Llama-3.3-70B-Instruct&quot;</span>

client = InferenceClient(model=model_id)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">custom_model</span>(<span class="hljs-params">messages, stop_sequences=[<span class="hljs-string">&quot;Task&quot;</span>]</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
    <span class="hljs-keyword">return</span> answer`,wrap:!1}}),te=new S({props:{title:"TransformersModel",local:"smolagents.TransformersModel",headingTag:"h3"}}),ne=new x({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBUcmFuc2Zvcm1lcnNNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwVHJhbnNmb3JtZXJzTW9kZWwobW9kZWxfaWQlM0QlMjJIdWdnaW5nRmFjZVRCJTJGU21vbExNLTEzNU0tSW5zdHJ1Y3QlMjIpJTBBJTBBcHJpbnQobW9kZWwoJTVCJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyT2shJTIyJTdEJTVEJTdEJTVEJTJDJTIwc3RvcF9zZXF1ZW5jZXMlM0QlNUIlMjJncmVhdCUyMiU1RCkp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> TransformersModel

model = TransformersModel(model_id=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM-135M-Instruct&quot;</span>)

<span class="hljs-built_in">print</span>(model([{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [{<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;Ok!&quot;</span>}]}], stop_sequences=[<span class="hljs-string">&quot;great&quot;</span>]))`,wrap:!1}}),oe=new x({props:{code:"V2hhdCUyMGE=",highlighted:"&gt;&gt;&gt; What a",wrap:!1}}),le=new R({props:{name:"class smolagents.TransformersModel",anchor:"smolagents.TransformersModel",parameters:[{name:"model_id",val:": str | None = None"},{name:"device_map",val:": str | None = None"},{name:"torch_dtype",val:": str | None = None"},{name:"trust_remote_code",val:": bool = False"},{name:"model_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"max_new_tokens",val:": int = 4096"},{name:"max_tokens",val:": int | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"smolagents.TransformersModel.model_id",description:`<strong>model_id</strong> (<code>str</code>) &#x2014;
The Hugging Face model ID to be used for inference. This can be a path or model identifier from the Hugging Face model hub.
For example, <code>&quot;Qwen/Qwen3-Next-80B-A3B-Thinking&quot;</code>.`,name:"model_id"},{anchor:"smolagents.TransformersModel.device_map",description:`<strong>device_map</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The device_map to initialize your model with.`,name:"device_map"},{anchor:"smolagents.TransformersModel.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The torch_dtype to initialize your model with.`,name:"torch_dtype"},{anchor:"smolagents.TransformersModel.trust_remote_code",description:`<strong>trust_remote_code</strong> (bool, default <code>False</code>) &#x2014;
Some models on the Hub require running remote code: for this model, you would have to set this flag to True.`,name:"trust_remote_code"},{anchor:"smolagents.TransformersModel.model_kwargs",description:`<strong>model_kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments to pass to <code>AutoModel.from_pretrained</code> (like revision, model_args, config, etc.).`,name:"model_kwargs"},{anchor:"smolagents.TransformersModel.max_new_tokens",description:`<strong>max_new_tokens</strong> (<code>int</code>, default <code>4096</code>) &#x2014;
Maximum number of new tokens to generate, ignoring the number of tokens in the prompt.`,name:"max_new_tokens"},{anchor:"smolagents.TransformersModel.max_tokens",description:`<strong>max_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Alias for <code>max_new_tokens</code>. If provided, this value takes precedence.`,name:"max_tokens"},{anchor:"smolagents.TransformersModel.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments to forward to the underlying Transformers model generate call, such as <code>device</code>.`,name:"*kwargs"}],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L793",raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><code>ValueError</code> —
If the model name is not provided.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code></p>
`}}),Z=new ns({props:{anchor:"smolagents.TransformersModel.example",$$slots:{default:[Vs]},$$scope:{ctx:C}}}),re=new S({props:{title:"InferenceClientModel",local:"smolagents.InferenceClientModel",headingTag:"h3"}}),ce=new x({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBJbmZlcmVuY2VDbGllbnRNb2RlbCUwQSUwQW1lc3NhZ2VzJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIySGVsbG8lMkMlMjBob3clMjBhcmUlMjB5b3UlM0YlMjIlN0QlNUQlN0QlMEElNUQlMEElMEFtb2RlbCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudE1vZGVsKCklMEFwcmludChtb2RlbChtZXNzYWdlcykp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> InferenceClientModel

messages = [
  {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [{<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;Hello, how are you?&quot;</span>}]}
]

model = InferenceClientModel()
<span class="hljs-built_in">print</span>(model(messages))`,wrap:!1}}),me=new x({props:{code:"T2YlMjBjb3Vyc2UhJTIwSWYlMjB5b3UlMjBjaGFuZ2UlMjB5b3VyJTIwbWluZCUyQyUyMGZlZWwlMjBmcmVlJTIwdG8lMjByZWFjaCUyMG91dC4lMjBUYWtlJTIwY2FyZSE=",highlighted:"&gt;&gt;&gt; Of course! If you change your mind, feel free to reach out. Take care!",wrap:!1}}),de=new R({props:{name:"class smolagents.InferenceClientModel",anchor:"smolagents.InferenceClientModel",parameters:[{name:"model_id",val:": str = 'Qwen/Qwen3-Next-80B-A3B-Thinking'"},{name:"provider",val:": str | None = None"},{name:"token",val:": str | None = None"},{name:"timeout",val:": int = 120"},{name:"client_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"custom_role_conversions",val:": dict[str, str] | None = None"},{name:"api_key",val:": str | None = None"},{name:"bill_to",val:": str | None = None"},{name:"base_url",val:": str | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"smolagents.InferenceClientModel.model_id",description:`<strong>model_id</strong> (<code>str</code>, <em>optional</em>, default <code>&quot;Qwen/Qwen3-Next-80B-A3B-Thinking&quot;</code>) &#x2014;
The Hugging Face model ID to be used for inference.
This can be a model identifier from the Hugging Face model hub or a URL to a deployed Inference Endpoint.
Currently, it defaults to <code>&quot;Qwen/Qwen3-Next-80B-A3B-Thinking&quot;</code>, but this may change in the future.`,name:"model_id"},{anchor:"smolagents.InferenceClientModel.provider",description:`<strong>provider</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of the provider to use for inference. A list of supported providers can be found in the <a href="https://huggingface.co/docs/inference-providers/index#partners" rel="nofollow">Inference Providers documentation</a>.
Defaults to &#x201C;auto&#x201D; i.e. the first of the providers available for the model, sorted by the user&#x2019;s order <a href="https://hf.co/settings/inference-providers" rel="nofollow">here</a>.
If <code>base_url</code> is passed, then <code>provider</code> is not used.`,name:"provider"},{anchor:"smolagents.InferenceClientModel.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Token used by the Hugging Face API for authentication. This token need to be authorized &#x2018;Make calls to the serverless Inference Providers&#x2019;.
If the model is gated (like Llama-3 models), the token also needs &#x2018;Read access to contents of all public gated repos you can access&#x2019;.
If not provided, the class will try to use environment variable &#x2018;HF_TOKEN&#x2019;, else use the token stored in the Hugging Face CLI configuration.`,name:"token"},{anchor:"smolagents.InferenceClientModel.timeout",description:`<strong>timeout</strong> (<code>int</code>, <em>optional</em>, defaults to 120) &#x2014;
Timeout for the API request, in seconds.`,name:"timeout"},{anchor:"smolagents.InferenceClientModel.client_kwargs",description:`<strong>client_kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments to pass to the Hugging Face InferenceClient.`,name:"client_kwargs"},{anchor:"smolagents.InferenceClientModel.custom_role_conversions",description:`<strong>custom_role_conversions</strong> (<code>dict[str, str]</code>, <em>optional</em>) &#x2014;
Custom role conversion mapping to convert message roles in others.
Useful for specific models that do not support specific message roles like &#x201C;system&#x201D;.`,name:"custom_role_conversions"},{anchor:"smolagents.InferenceClientModel.api_key",description:`<strong>api_key</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Token to use for authentication. This is a duplicated argument from <code>token</code> to make <a href="/docs/smolagents/main/zh/reference/models#smolagents.InferenceClientModel">InferenceClientModel</a>
follow the same pattern as <code>openai.OpenAI</code> client. Cannot be used if <code>token</code> is set. Defaults to None.`,name:"api_key"},{anchor:"smolagents.InferenceClientModel.bill_to",description:`<strong>bill_to</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The billing account to use for the requests. By default the requests are billed on the user&#x2019;s account. Requests can only be billed to
an organization the user is a member of, and which has subscribed to Enterprise Hub.`,name:"bill_to"},{anchor:"smolagents.InferenceClientModel.base_url",description:`<strong>base_url</strong> (<code>str</code>, <code>optional</code>) &#x2014;
Base URL to run inference. This is a duplicated argument from <code>model</code> to make <a href="/docs/smolagents/main/zh/reference/models#smolagents.InferenceClientModel">InferenceClientModel</a>
follow the same pattern as <code>openai.OpenAI</code> client. Cannot be used if <code>model</code> is set. Defaults to None.`,name:"base_url"},{anchor:"smolagents.InferenceClientModel.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments to forward to the underlying Hugging Face InferenceClient completion call.`,name:"*kwargs"}],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L1382",raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><code>ValueError</code> —
If the model name is not provided.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code></p>
`}}),B=new ns({props:{anchor:"smolagents.InferenceClientModel.example",$$slots:{default:[zs]},$$scope:{ctx:C}}}),pe=new R({props:{name:"create_client",anchor:"smolagents.InferenceClientModel.create_client",parameters:[],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L1473"}}),ge=new S({props:{title:"LiteLLMModel",local:"smolagents.LiteLLMModel",headingTag:"h3"}}),Me=new x({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBMaXRlTExNTW9kZWwlMEElMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMkhlbGxvJTJDJTIwaG93JTIwYXJlJTIweW91JTNGJTIyJTdEJTVEJTdEJTBBJTVEJTBBJTBBbW9kZWwlMjAlM0QlMjBMaXRlTExNTW9kZWwobW9kZWxfaWQlM0QlMjJhbnRocm9waWMlMkZjbGF1ZGUtMy01LXNvbm5ldC1sYXRlc3QlMjIlMkMlMjB0ZW1wZXJhdHVyZSUzRDAuMiUyQyUyMG1heF90b2tlbnMlM0QxMCklMEFwcmludChtb2RlbChtZXNzYWdlcykp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> LiteLLMModel

messages = [
  {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: [{<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;Hello, how are you?&quot;</span>}]}
]

model = LiteLLMModel(model_id=<span class="hljs-string">&quot;anthropic/claude-3-5-sonnet-latest&quot;</span>, temperature=<span class="hljs-number">0.2</span>, max_tokens=<span class="hljs-number">10</span>)
<span class="hljs-built_in">print</span>(model(messages))`,wrap:!1}}),he=new R({props:{name:"class smolagents.LiteLLMModel",anchor:"smolagents.LiteLLMModel",parameters:[{name:"model_id",val:": str | None = None"},{name:"api_base",val:": str | None = None"},{name:"api_key",val:": str | None = None"},{name:"custom_role_conversions",val:": dict[str, str] | None = None"},{name:"flatten_messages_as_text",val:": bool | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"smolagents.LiteLLMModel.model_id",description:`<strong>model_id</strong> (<code>str</code>) &#x2014;
The model identifier to use on the server (e.g. &#x201C;gpt-3.5-turbo&#x201D;).`,name:"model_id"},{anchor:"smolagents.LiteLLMModel.api_base",description:`<strong>api_base</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The base URL of the provider API to call the model.`,name:"api_base"},{anchor:"smolagents.LiteLLMModel.api_key",description:`<strong>api_key</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The API key to use for authentication.`,name:"api_key"},{anchor:"smolagents.LiteLLMModel.custom_role_conversions",description:`<strong>custom_role_conversions</strong> (<code>dict[str, str]</code>, <em>optional</em>) &#x2014;
Custom role conversion mapping to convert message roles in others.
Useful for specific models that do not support specific message roles like &#x201C;system&#x201D;.`,name:"custom_role_conversions"},{anchor:"smolagents.LiteLLMModel.flatten_messages_as_text",description:`<strong>flatten_messages_as_text</strong> (<code>bool</code>, <em>optional</em>) &#x2014; Whether to flatten messages as text.
Defaults to <code>True</code> for models that start with &#x201C;ollama&#x201D;, &#x201C;groq&#x201D;, &#x201C;cerebras&#x201D;.`,name:"flatten_messages_as_text"},{anchor:"smolagents.LiteLLMModel.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments to forward to the underlying LiteLLM completion call.`,name:"*kwargs"}],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L1131"}}),fe=new R({props:{name:"create_client",anchor:"smolagents.LiteLLMModel.create_client",parameters:[],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L1181"}}),ye=new S({props:{title:"OpenAIModel",local:"smolagents.OpenAIModel",headingTag:"h3"}}),_e=new x({props:{code:"aW1wb3J0JTIwb3MlMEFmcm9tJTIwc21vbGFnZW50cyUyMGltcG9ydCUyME9wZW5BSU1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBPcGVuQUlNb2RlbCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUzRCUyMmdwdC00byUyMiUyQyUwQSUyMCUyMCUyMCUyMGFwaV9iYXNlJTNEJTIyaHR0cHMlM0ElMkYlMkZhcGkub3BlbmFpLmNvbSUyRnYxJTIyJTJDJTBBJTIwJTIwJTIwJTIwYXBpX2tleSUzRG9zLmVudmlyb24lNUIlMjJPUEVOQUlfQVBJX0tFWSUyMiU1RCUyQyUwQSk=",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> OpenAIModel

model = OpenAIModel(
    model_id=<span class="hljs-string">&quot;gpt-4o&quot;</span>,
    api_base=<span class="hljs-string">&quot;https://api.openai.com/v1&quot;</span>,
    api_key=os.environ[<span class="hljs-string">&quot;OPENAI_API_KEY&quot;</span>],
)`,wrap:!1}}),we=new R({props:{name:"class smolagents.OpenAIModel",anchor:"smolagents.OpenAIModel",parameters:[{name:"model_id",val:": str"},{name:"api_base",val:": str | None = None"},{name:"api_key",val:": str | None = None"},{name:"organization",val:": str | None = None"},{name:"project",val:": str | None = None"},{name:"client_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"custom_role_conversions",val:": dict[str, str] | None = None"},{name:"flatten_messages_as_text",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"smolagents.OpenAIModel.model_id",description:`<strong>model_id</strong> (<code>str</code>) &#x2014;
The model identifier to use on the server (e.g. &#x201C;gpt-5&#x201D;).`,name:"model_id"},{anchor:"smolagents.OpenAIModel.api_base",description:`<strong>api_base</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The base URL of the OpenAI-compatible API server.`,name:"api_base"},{anchor:"smolagents.OpenAIModel.api_key",description:`<strong>api_key</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The API key to use for authentication.`,name:"api_key"},{anchor:"smolagents.OpenAIModel.organization",description:`<strong>organization</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The organization to use for the API request.`,name:"organization"},{anchor:"smolagents.OpenAIModel.project",description:`<strong>project</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The project to use for the API request.`,name:"project"},{anchor:"smolagents.OpenAIModel.client_kwargs",description:`<strong>client_kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments to pass to the OpenAI client (like organization, project, max_retries etc.).`,name:"client_kwargs"},{anchor:"smolagents.OpenAIModel.custom_role_conversions",description:`<strong>custom_role_conversions</strong> (<code>dict[str, str]</code>, <em>optional</em>) &#x2014;
Custom role conversion mapping to convert message roles in others.
Useful for specific models that do not support specific message roles like &#x201C;system&#x201D;.`,name:"custom_role_conversions"},{anchor:"smolagents.OpenAIModel.flatten_messages_as_text",description:`<strong>flatten_messages_as_text</strong> (<code>bool</code>, default <code>False</code>) &#x2014;
Whether to flatten messages as text.`,name:"flatten_messages_as_text"},{anchor:"smolagents.OpenAIModel.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments to forward to the underlying OpenAI API completion call, for instance <code>temperature</code>.`,name:"*kwargs"}],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L1572"}}),be=new S({props:{title:"AzureOpenAIModel",local:"smolagents.AzureOpenAIModel",headingTag:"h3"}}),Ue=new x({props:{code:"aW1wb3J0JTIwb3MlMEElMEFmcm9tJTIwc21vbGFnZW50cyUyMGltcG9ydCUyMEF6dXJlT3BlbkFJTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMEF6dXJlT3BlbkFJTW9kZWwoJTBBJTIwJTIwJTIwJTIwbW9kZWxfaWQlMjAlM0QlMjBvcy5lbnZpcm9uLmdldCglMjJBWlVSRV9PUEVOQUlfTU9ERUwlMjIpJTJDJTBBJTIwJTIwJTIwJTIwYXp1cmVfZW5kcG9pbnQlM0Rvcy5lbnZpcm9uLmdldCglMjJBWlVSRV9PUEVOQUlfRU5EUE9JTlQlMjIpJTJDJTBBJTIwJTIwJTIwJTIwYXBpX2tleSUzRG9zLmVudmlyb24uZ2V0KCUyMkFaVVJFX09QRU5BSV9BUElfS0VZJTIyKSUyQyUwQSUyMCUyMCUyMCUyMGFwaV92ZXJzaW9uJTNEb3MuZW52aXJvbi5nZXQoJTIyT1BFTkFJX0FQSV9WRVJTSU9OJTIyKSUyMCUyMCUyMCUyMCUwQSk=",highlighted:`<span class="hljs-keyword">import</span> os

<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> AzureOpenAIModel

model = AzureOpenAIModel(
    model_id = os.environ.get(<span class="hljs-string">&quot;AZURE_OPENAI_MODEL&quot;</span>),
    azure_endpoint=os.environ.get(<span class="hljs-string">&quot;AZURE_OPENAI_ENDPOINT&quot;</span>),
    api_key=os.environ.get(<span class="hljs-string">&quot;AZURE_OPENAI_API_KEY&quot;</span>),
    api_version=os.environ.get(<span class="hljs-string">&quot;OPENAI_API_VERSION&quot;</span>)    
)`,wrap:!1}}),ve=new R({props:{name:"class smolagents.AzureOpenAIModel",anchor:"smolagents.AzureOpenAIModel",parameters:[{name:"model_id",val:": str"},{name:"azure_endpoint",val:": str | None = None"},{name:"api_key",val:": str | None = None"},{name:"api_version",val:": str | None = None"},{name:"client_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"custom_role_conversions",val:": dict[str, str] | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"smolagents.AzureOpenAIModel.model_id",description:`<strong>model_id</strong> (<code>str</code>) &#x2014;
The model deployment name to use when connecting (e.g. &#x201C;gpt-4o-mini&#x201D;).`,name:"model_id"},{anchor:"smolagents.AzureOpenAIModel.azure_endpoint",description:`<strong>azure_endpoint</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The Azure endpoint, including the resource, e.g. <code>https://example-resource.azure.openai.com/</code>. If not provided, it will be inferred from the <code>AZURE_OPENAI_ENDPOINT</code> environment variable.`,name:"azure_endpoint"},{anchor:"smolagents.AzureOpenAIModel.api_key",description:`<strong>api_key</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The API key to use for authentication. If not provided, it will be inferred from the <code>AZURE_OPENAI_API_KEY</code> environment variable.`,name:"api_key"},{anchor:"smolagents.AzureOpenAIModel.api_version",description:`<strong>api_version</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The API version to use. If not provided, it will be inferred from the <code>OPENAI_API_VERSION</code> environment variable.`,name:"api_version"},{anchor:"smolagents.AzureOpenAIModel.client_kwargs",description:`<strong>client_kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments to pass to the AzureOpenAI client (like organization, project, max_retries etc.).`,name:"client_kwargs"},{anchor:"smolagents.AzureOpenAIModel.custom_role_conversions",description:`<strong>custom_role_conversions</strong> (<code>dict[str, str]</code>, <em>optional</em>) &#x2014;
Custom role conversion mapping to convert message roles in others.
Useful for specific models that do not support specific message roles like &#x201C;system&#x201D;.`,name:"custom_role_conversions"},{anchor:"smolagents.AzureOpenAIModel.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments to forward to the underlying Azure OpenAI API completion call.`,name:"*kwargs"}],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L1725"}}),je=new S({props:{title:"MLXModel",local:"smolagents.MLXModel",headingTag:"h3"}}),xe=new x({props:{code:"ZnJvbSUyMHNtb2xhZ2VudHMlMjBpbXBvcnQlMjBNTFhNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwTUxYTW9kZWwobW9kZWxfaWQlM0QlMjJIdWdnaW5nRmFjZVRCJTJGU21vbExNLTEzNU0tSW5zdHJ1Y3QlMjIpJTBBJTBBcHJpbnQobW9kZWwoJTVCJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIyT2shJTIyJTdEJTVEJTJDJTIwc3RvcF9zZXF1ZW5jZXMlM0QlNUIlMjJncmVhdCUyMiU1RCkp",highlighted:`<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> MLXModel

model = MLXModel(model_id=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM-135M-Instruct&quot;</span>)

<span class="hljs-built_in">print</span>(model([{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Ok!&quot;</span>}], stop_sequences=[<span class="hljs-string">&quot;great&quot;</span>]))`,wrap:!1}}),ke=new x({props:{code:"V2hhdCUyMGE=",highlighted:"&gt;&gt;&gt; What a",wrap:!1}}),Ce=new R({props:{name:"class smolagents.MLXModel",anchor:"smolagents.MLXModel",parameters:[{name:"model_id",val:": str"},{name:"trust_remote_code",val:": bool = False"},{name:"load_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"apply_chat_template_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"smolagents.MLXModel.model_id",description:`<strong>model_id</strong> (str) &#x2014;
The Hugging Face model ID to be used for inference. This can be a path or model identifier from the Hugging Face model hub.`,name:"model_id"},{anchor:"smolagents.MLXModel.tool_name_key",description:`<strong>tool_name_key</strong> (str) &#x2014;
The key, which can usually be found in the model&#x2019;s chat template, for retrieving a tool name.`,name:"tool_name_key"},{anchor:"smolagents.MLXModel.tool_arguments_key",description:`<strong>tool_arguments_key</strong> (str) &#x2014;
The key, which can usually be found in the model&#x2019;s chat template, for retrieving tool arguments.`,name:"tool_arguments_key"},{anchor:"smolagents.MLXModel.trust_remote_code",description:`<strong>trust_remote_code</strong> (bool, default <code>False</code>) &#x2014;
Some models on the Hub require running remote code: for this model, you would have to set this flag to True.`,name:"trust_remote_code"},{anchor:"smolagents.MLXModel.load_kwargs",description:`<strong>load_kwargs</strong> (dict[str, Any], <em>optional</em>) &#x2014;
Additional keyword arguments to pass to the <code>mlx.lm.load</code> method when loading the model and tokenizer.`,name:"load_kwargs"},{anchor:"smolagents.MLXModel.apply_chat_template_kwargs",description:`<strong>apply_chat_template_kwargs</strong> (dict, <em>optional</em>) &#x2014;
Additional keyword arguments to pass to the <code>apply_chat_template</code> method of the tokenizer.`,name:"apply_chat_template_kwargs"},{anchor:"smolagents.MLXModel.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional keyword arguments to forward to the underlying MLX model stream_generate call, for instance <code>max_tokens</code>.`,name:"*kwargs"}],source:"https://github.com/huggingface/smolagents/blob/main/src/smolagents/models.py#L684"}}),X=new ns({props:{anchor:"smolagents.MLXModel.example",$$slots:{default:[Xs]},$$scope:{ctx:C}}}),Ae=new Bs({props:{source:"https://github.com/huggingface/smolagents/blob/main/docs/source/zh/reference/models.md"}}),{c(){c=r("meta"),I=o(),T=r("p"),y=o(),m(_.$$.fragment),a=o(),m(w.$$.fragment),Ge=o(),m(L.$$.fragment),Pe=o(),G=r("p"),G.innerHTML=os,Fe=o(),m(P.$$.fragment),Oe=o(),F=r("p"),F.textContent=ls,De=o(),O=r("p"),O.innerHTML=as,Ye=o(),D=r("ol"),D.innerHTML=rs,Ke=o(),Y=r("p"),Y.innerHTML=is,et=o(),m(K.$$.fragment),tt=o(),ee=r("p"),ee.innerHTML=cs,st=o(),m(te.$$.fragment),nt=o(),se=r("p"),se.innerHTML=ms,ot=o(),m(ne.$$.fragment),lt=o(),m(oe.$$.fragment),at=o(),W=r("blockquote"),W.innerHTML=ds,rt=o(),J=r("div"),m(le.$$.fragment),Bt=o(),qe=r("p"),qe.textContent=ps,Qt=o(),Le=r("p"),Le.textContent=gs,Vt=o(),ae=r("blockquote"),ae.innerHTML=us,zt=o(),m(Z.$$.fragment),it=o(),m(re.$$.fragment),ct=o(),ie=r("p"),ie.innerHTML=Ms,mt=o(),m(ce.$$.fragment),dt=o(),m(me.$$.fragment),pt=o(),b=r("div"),m(de.$$.fragment),Xt=o(),We=r("p"),We.textContent=hs,Ht=o(),Ze=r("p"),Ze.textContent=fs,Rt=o(),Be=r("p"),Be.textContent=ys,St=o(),m(B.$$.fragment),Gt=o(),Q=r("div"),m(pe.$$.fragment),Pt=o(),Qe=r("p"),Qe.textContent=Ts,gt=o(),m(ge.$$.fragment),ut=o(),ue=r("p"),ue.innerHTML=_s,Mt=o(),m(Me.$$.fragment),ht=o(),k=r("div"),m(he.$$.fragment),Ft=o(),Ve=r("p"),Ve.innerHTML=ws,Ot=o(),V=r("div"),m(fe.$$.fragment),Dt=o(),ze=r("p"),ze.textContent=bs,ft=o(),m(ye.$$.fragment),yt=o(),Te=r("p"),Te.innerHTML=Is,Tt=o(),m(_e.$$.fragment),_t=o(),A=r("div"),m(we.$$.fragment),Yt=o(),Xe=r("p"),Xe.textContent=Js,wt=o(),m(be.$$.fragment),bt=o(),Ie=r("p"),Ie.innerHTML=$s,It=o(),Je=r("p"),Je.innerHTML=Us,Jt=o(),$e=r("p"),$e.innerHTML=vs,$t=o(),m(Ue.$$.fragment),Ut=o(),E=r("div"),m(ve.$$.fragment),Kt=o(),He=r("p"),He.textContent=js,vt=o(),m(je.$$.fragment),jt=o(),m(xe.$$.fragment),xt=o(),m(ke.$$.fragment),kt=o(),z=r("blockquote"),z.innerHTML=xs,Ct=o(),v=r("div"),m(Ce.$$.fragment),es=o(),Re=r("p"),Re.textContent=ks,ts=o(),Ne=r("blockquote"),Ne.innerHTML=Cs,ss=o(),m(X.$$.fragment),Nt=o(),m(Ae.$$.fragment),At=o(),Se=r("p"),this.h()},l(e){const t=Ls("svelte-u9bgzb",document.head);c=i(t,"META",{name:!0,content:!0}),t.forEach(s),I=l(e),T=i(e,"P",{}),N(T).forEach(s),y=l(e),d(_.$$.fragment,e),a=l(e),d(w.$$.fragment,e),Ge=l(e),d(L.$$.fragment,e),Pe=l(e),G=i(e,"P",{"data-svelte-h":!0}),f(G)!=="svelte-11nub39"&&(G.innerHTML=os),Fe=l(e),d(P.$$.fragment,e),Oe=l(e),F=i(e,"P",{"data-svelte-h":!0}),f(F)!=="svelte-15ti981"&&(F.textContent=ls),De=l(e),O=i(e,"P",{"data-svelte-h":!0}),f(O)!=="svelte-y6kvhr"&&(O.innerHTML=as),Ye=l(e),D=i(e,"OL",{"data-svelte-h":!0}),f(D)!=="svelte-14peu6x"&&(D.innerHTML=rs),Ke=l(e),Y=i(e,"P",{"data-svelte-h":!0}),f(Y)!=="svelte-mamej0"&&(Y.innerHTML=is),et=l(e),d(K.$$.fragment,e),tt=l(e),ee=i(e,"P",{"data-svelte-h":!0}),f(ee)!=="svelte-c0mv9r"&&(ee.innerHTML=cs),st=l(e),d(te.$$.fragment,e),nt=l(e),se=i(e,"P",{"data-svelte-h":!0}),f(se)!=="svelte-tirv5b"&&(se.innerHTML=ms),ot=l(e),d(ne.$$.fragment,e),lt=l(e),d(oe.$$.fragment,e),at=l(e),W=i(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),f(W)!=="svelte-ouuan6"&&(W.innerHTML=ds),rt=l(e),J=i(e,"DIV",{class:!0});var j=N(J);d(le.$$.fragment,j),Bt=l(j),qe=i(j,"P",{"data-svelte-h":!0}),f(qe)!=="svelte-1ex1ahr"&&(qe.textContent=ps),Qt=l(j),Le=i(j,"P",{"data-svelte-h":!0}),f(Le)!=="svelte-1140acn"&&(Le.textContent=gs),Vt=l(j),ae=i(j,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),f(ae)!=="svelte-103z9yw"&&(ae.innerHTML=us),zt=l(j),d(Z.$$.fragment,j),j.forEach(s),it=l(e),d(re.$$.fragment,e),ct=l(e),ie=i(e,"P",{"data-svelte-h":!0}),f(ie)!=="svelte-dz1cyo"&&(ie.innerHTML=Ms),mt=l(e),d(ce.$$.fragment,e),dt=l(e),d(me.$$.fragment,e),pt=l(e),b=i(e,"DIV",{class:!0});var $=N(b);d(de.$$.fragment,$),Xt=l($),We=i($,"P",{"data-svelte-h":!0}),f(We)!=="svelte-axkcn3"&&(We.textContent=hs),Ht=l($),Ze=i($,"P",{"data-svelte-h":!0}),f(Ze)!=="svelte-bducrc"&&(Ze.textContent=fs),Rt=l($),Be=i($,"P",{"data-svelte-h":!0}),f(Be)!=="svelte-12eu297"&&(Be.textContent=ys),St=l($),d(B.$$.fragment,$),Gt=l($),Q=i($,"DIV",{class:!0});var Ee=N(Q);d(pe.$$.fragment,Ee),Pt=l(Ee),Qe=i(Ee,"P",{"data-svelte-h":!0}),f(Qe)!=="svelte-ym2f5u"&&(Qe.textContent=Ts),Ee.forEach(s),$.forEach(s),gt=l(e),d(ge.$$.fragment,e),ut=l(e),ue=i(e,"P",{"data-svelte-h":!0}),f(ue)!=="svelte-131mixa"&&(ue.innerHTML=_s),Mt=l(e),d(Me.$$.fragment,e),ht=l(e),k=i(e,"DIV",{class:!0});var q=N(k);d(he.$$.fragment,q),Ft=l(q),Ve=i(q,"P",{"data-svelte-h":!0}),f(Ve)!=="svelte-5g97zk"&&(Ve.innerHTML=ws),Ot=l(q),V=i(q,"DIV",{class:!0});var qt=N(V);d(fe.$$.fragment,qt),Dt=l(qt),ze=i(qt,"P",{"data-svelte-h":!0}),f(ze)!=="svelte-12r14rd"&&(ze.textContent=bs),qt.forEach(s),q.forEach(s),ft=l(e),d(ye.$$.fragment,e),yt=l(e),Te=i(e,"P",{"data-svelte-h":!0}),f(Te)!=="svelte-k9txw"&&(Te.innerHTML=Is),Tt=l(e),d(_e.$$.fragment,e),_t=l(e),A=i(e,"DIV",{class:!0});var Lt=N(A);d(we.$$.fragment,Lt),Yt=l(Lt),Xe=i(Lt,"P",{"data-svelte-h":!0}),f(Xe)!=="svelte-1bc1pfc"&&(Xe.textContent=Js),Lt.forEach(s),wt=l(e),d(be.$$.fragment,e),bt=l(e),Ie=i(e,"P",{"data-svelte-h":!0}),f(Ie)!=="svelte-1yqk7xi"&&(Ie.innerHTML=$s),It=l(e),Je=i(e,"P",{"data-svelte-h":!0}),f(Je)!=="svelte-yktcaa"&&(Je.innerHTML=Us),Jt=l(e),$e=i(e,"P",{"data-svelte-h":!0}),f($e)!=="svelte-14bqt2g"&&($e.innerHTML=vs),$t=l(e),d(Ue.$$.fragment,e),Ut=l(e),E=i(e,"DIV",{class:!0});var Wt=N(E);d(ve.$$.fragment,Wt),Kt=l(Wt),He=i(Wt,"P",{"data-svelte-h":!0}),f(He)!=="svelte-1fspdqk"&&(He.textContent=js),Wt.forEach(s),vt=l(e),d(je.$$.fragment,e),jt=l(e),d(xe.$$.fragment,e),xt=l(e),d(ke.$$.fragment,e),kt=l(e),z=i(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),f(z)!=="svelte-ivd2cr"&&(z.innerHTML=xs),Ct=l(e),v=i(e,"DIV",{class:!0});var H=N(v);d(Ce.$$.fragment,H),es=l(H),Re=i(H,"P",{"data-svelte-h":!0}),f(Re)!=="svelte-t9ku5w"&&(Re.textContent=ks),ts=l(H),Ne=i(H,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),f(Ne)!=="svelte-covr82"&&(Ne.innerHTML=Cs),ss=l(H),d(X.$$.fragment,H),H.forEach(s),Nt=l(e),d(Ae.$$.fragment,e),At=l(e),Se=i(e,"P",{}),N(Se).forEach(s),this.h()},h(){U(c,"name","hf:doc:metadata"),U(c,"content",Rs),U(W,"class","tip"),U(ae,"class","tip"),U(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(z,"class","tip"),U(Ne,"class","tip"),U(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){h(document.head,c),n(e,I,t),n(e,T,t),n(e,y,t),p(_,e,t),n(e,a,t),p(w,e,t),n(e,Ge,t),p(L,e,t),n(e,Pe,t),n(e,G,t),n(e,Fe,t),p(P,e,t),n(e,Oe,t),n(e,F,t),n(e,De,t),n(e,O,t),n(e,Ye,t),n(e,D,t),n(e,Ke,t),n(e,Y,t),n(e,et,t),p(K,e,t),n(e,tt,t),n(e,ee,t),n(e,st,t),p(te,e,t),n(e,nt,t),n(e,se,t),n(e,ot,t),p(ne,e,t),n(e,lt,t),p(oe,e,t),n(e,at,t),n(e,W,t),n(e,rt,t),n(e,J,t),p(le,J,null),h(J,Bt),h(J,qe),h(J,Qt),h(J,Le),h(J,Vt),h(J,ae),h(J,zt),p(Z,J,null),n(e,it,t),p(re,e,t),n(e,ct,t),n(e,ie,t),n(e,mt,t),p(ce,e,t),n(e,dt,t),p(me,e,t),n(e,pt,t),n(e,b,t),p(de,b,null),h(b,Xt),h(b,We),h(b,Ht),h(b,Ze),h(b,Rt),h(b,Be),h(b,St),p(B,b,null),h(b,Gt),h(b,Q),p(pe,Q,null),h(Q,Pt),h(Q,Qe),n(e,gt,t),p(ge,e,t),n(e,ut,t),n(e,ue,t),n(e,Mt,t),p(Me,e,t),n(e,ht,t),n(e,k,t),p(he,k,null),h(k,Ft),h(k,Ve),h(k,Ot),h(k,V),p(fe,V,null),h(V,Dt),h(V,ze),n(e,ft,t),p(ye,e,t),n(e,yt,t),n(e,Te,t),n(e,Tt,t),p(_e,e,t),n(e,_t,t),n(e,A,t),p(we,A,null),h(A,Yt),h(A,Xe),n(e,wt,t),p(be,e,t),n(e,bt,t),n(e,Ie,t),n(e,It,t),n(e,Je,t),n(e,Jt,t),n(e,$e,t),n(e,$t,t),p(Ue,e,t),n(e,Ut,t),n(e,E,t),p(ve,E,null),h(E,Kt),h(E,He),n(e,vt,t),p(je,e,t),n(e,jt,t),p(xe,e,t),n(e,xt,t),p(ke,e,t),n(e,kt,t),n(e,z,t),n(e,Ct,t),n(e,v,t),p(Ce,v,null),h(v,es),h(v,Re),h(v,ts),h(v,Ne),h(v,ss),p(X,v,null),n(e,Nt,t),p(Ae,e,t),n(e,At,t),n(e,Se,t),Et=!0},p(e,[t]){const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),L.$set(j);const $={};t&2&&($.$$scope={dirty:t,ctx:e}),Z.$set($);const Ee={};t&2&&(Ee.$$scope={dirty:t,ctx:e}),B.$set(Ee);const q={};t&2&&(q.$$scope={dirty:t,ctx:e}),X.$set(q)},i(e){Et||(g(_.$$.fragment,e),g(w.$$.fragment,e),g(L.$$.fragment,e),g(P.$$.fragment,e),g(K.$$.fragment,e),g(te.$$.fragment,e),g(ne.$$.fragment,e),g(oe.$$.fragment,e),g(le.$$.fragment,e),g(Z.$$.fragment,e),g(re.$$.fragment,e),g(ce.$$.fragment,e),g(me.$$.fragment,e),g(de.$$.fragment,e),g(B.$$.fragment,e),g(pe.$$.fragment,e),g(ge.$$.fragment,e),g(Me.$$.fragment,e),g(he.$$.fragment,e),g(fe.$$.fragment,e),g(ye.$$.fragment,e),g(_e.$$.fragment,e),g(we.$$.fragment,e),g(be.$$.fragment,e),g(Ue.$$.fragment,e),g(ve.$$.fragment,e),g(je.$$.fragment,e),g(xe.$$.fragment,e),g(ke.$$.fragment,e),g(Ce.$$.fragment,e),g(X.$$.fragment,e),g(Ae.$$.fragment,e),Et=!0)},o(e){u(_.$$.fragment,e),u(w.$$.fragment,e),u(L.$$.fragment,e),u(P.$$.fragment,e),u(K.$$.fragment,e),u(te.$$.fragment,e),u(ne.$$.fragment,e),u(oe.$$.fragment,e),u(le.$$.fragment,e),u(Z.$$.fragment,e),u(re.$$.fragment,e),u(ce.$$.fragment,e),u(me.$$.fragment,e),u(de.$$.fragment,e),u(B.$$.fragment,e),u(pe.$$.fragment,e),u(ge.$$.fragment,e),u(Me.$$.fragment,e),u(he.$$.fragment,e),u(fe.$$.fragment,e),u(ye.$$.fragment,e),u(_e.$$.fragment,e),u(we.$$.fragment,e),u(be.$$.fragment,e),u(Ue.$$.fragment,e),u(ve.$$.fragment,e),u(je.$$.fragment,e),u(xe.$$.fragment,e),u(ke.$$.fragment,e),u(Ce.$$.fragment,e),u(X.$$.fragment,e),u(Ae.$$.fragment,e),Et=!1},d(e){e&&(s(I),s(T),s(y),s(a),s(Ge),s(Pe),s(G),s(Fe),s(Oe),s(F),s(De),s(O),s(Ye),s(D),s(Ke),s(Y),s(et),s(tt),s(ee),s(st),s(nt),s(se),s(ot),s(lt),s(at),s(W),s(rt),s(J),s(it),s(ct),s(ie),s(mt),s(dt),s(pt),s(b),s(gt),s(ut),s(ue),s(Mt),s(ht),s(k),s(ft),s(yt),s(Te),s(Tt),s(_t),s(A),s(wt),s(bt),s(Ie),s(It),s(Je),s(Jt),s($e),s($t),s(Ut),s(E),s(vt),s(jt),s(xt),s(kt),s(z),s(Ct),s(v),s(Nt),s(At),s(Se)),s(c),M(_,e),M(w,e),M(L,e),M(P,e),M(K,e),M(te,e),M(ne,e),M(oe,e),M(le),M(Z),M(re,e),M(ce,e),M(me,e),M(de),M(B),M(pe),M(ge,e),M(Me,e),M(he),M(fe),M(ye,e),M(_e,e),M(we),M(be,e),M(Ue,e),M(ve),M(je,e),M(xe,e),M(ke,e),M(Ce),M(X),M(Ae,e)}}}const Rs='{"title":"模型","local":"模型","sections":[{"title":"模型","local":"模型","sections":[{"title":"TransformersModel","local":"smolagents.TransformersModel","sections":[],"depth":3},{"title":"InferenceClientModel","local":"smolagents.InferenceClientModel","sections":[],"depth":3},{"title":"LiteLLMModel","local":"smolagents.LiteLLMModel","sections":[],"depth":3},{"title":"OpenAIModel","local":"smolagents.OpenAIModel","sections":[],"depth":3},{"title":"AzureOpenAIModel","local":"smolagents.AzureOpenAIModel","sections":[],"depth":3},{"title":"MLXModel","local":"smolagents.MLXModel","sections":[],"depth":3}],"depth":2}],"depth":1}';function Ss(C){return As(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ys extends Es{constructor(c){super(),qs(this,c,Ss,Hs,Ns,{})}}export{Ys as component};
