import{s as bl,o as Al,n as B}from"../chunks/scheduler.ddeee2a5.js";import{S as $l,i as Ql,e as m,s as U,c as r,h as Zl,a as f,d as o,b as u,f as Bl,g as c,j as C,k as js,l as ql,m as J,n as j,t as i,o as T,p as y}from"../chunks/index.10b70568.js";import{C as El}from"../chunks/CopyLLMTxtMenu.68696f97.js";import{C as d}from"../chunks/CodeBlock.7ca4c11d.js";import{H as W,E as Nl}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d66d689f.js";import{H as V,a as g}from"../chunks/HfOption.1e773499.js";function vl(w){let t,n;return t=new d({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wZW5haQ==",highlighted:"pip install openai",wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function kl(w){let t,n;return t=new d({props:{code:"bnBtJTIwaW5zdGFsbCUyMG9wZW5haQ==",highlighted:"npm install openai",wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function Gl(w){let t,n,s,M;return t=new g({props:{id:"install",option:"python",$$slots:{default:[vl]},$$scope:{ctx:w}}}),s=new g({props:{id:"install",option:"javascript",$$slots:{default:[kl]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$scope={dirty:p,ctx:a}),s.$set(h)},i(a){M||(i(t.$$.fragment,a),i(s.$$.fragment,a),M=!0)},o(a){T(t.$$.fragment,a),T(s.$$.fragment,a),M=!1},d(a){a&&o(n),y(t,a),y(s,a)}}}function Sl(w){let t,n;return t=new d({props:{code:"aW1wb3J0JTIwb3MlMEFmcm9tJTIwb3BlbmFpJTIwaW1wb3J0JTIwT3BlbkFJJTBBJTBBY2xpZW50JTIwJTNEJTIwT3BlbkFJKCUwQSUyMCUyMCUyMCUyMGJhc2VfdXJsJTNEJTIyaHR0cHMlM0ElMkYlMkZyb3V0ZXIuaHVnZ2luZ2ZhY2UuY28lMkZ2MSUyMiUyQyUwQSUyMCUyMCUyMCUyMGFwaV9rZXklM0Rvcy5nZXRlbnYoJTIySEZfVE9LRU4lMjIpJTJDJTBBKSUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LmNoYXQuY29tcGxldGlvbnMuY3JlYXRlKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEJTIyb3BlbmFpJTJGZ3B0LW9zcy0xMjBiJTNBY2VyZWJyYXMlMjIlMkMlMEElMjAlMjAlMjAlMjBtZXNzYWdlcyUzRCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMlRlbGwlMjBtZSUyMGElMjBmdW4lMjBmYWN0JTIwYWJvdXQlMjB0aGUlMjBFaWZmZWwlMjBUb3dlci4lMjIlN0QlNUQlMkMlMEEpJTBBJTBBcHJpbnQocmVzcG9uc2UuY2hvaWNlcyU1QjAlNUQubWVzc2FnZS5jb250ZW50KQ==",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

client = OpenAI(
    base_url=<span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
    api_key=os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>),
)

response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;openai/gpt-oss-120b:cerebras&quot;</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;Tell me a fun fact about the Eiffel Tower.&quot;</span>}],
)

<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function Wl(w){let t,n;return t=new d({props:{code:"aW1wb3J0JTIwT3BlbkFJJTIwZnJvbSUyMCUyMm9wZW5haSUyMiUzQiUwQSUwQWNvbnN0JTIwb3BlbmFpJTIwJTNEJTIwbmV3JTIwT3BlbkFJKCU3QiUwQSUyMCUyMGJhc2VVUkwlM0ElMjAlMjJodHRwcyUzQSUyRiUyRnJvdXRlci5odWdnaW5nZmFjZS5jbyUyRnYxJTIyJTJDJTBBJTIwJTIwYXBpS2V5JTNBJTIwcHJvY2Vzcy5lbnYuSEZfVE9LRU4lMkMlMEElN0QpJTNCJTBBJTBBY29uc3QlMjByZXNwb25zZSUyMCUzRCUyMGF3YWl0JTIwb3BlbmFpLmNoYXQuY29tcGxldGlvbnMuY3JlYXRlKCU3QiUwQSUyMCUyMG1vZGVsJTNBJTIwJTIyb3BlbmFpJTJGZ3B0LW9zcy0xMjBiJTNBY2VyZWJyYXMlMjIlMkMlMEElMjAlMjBtZXNzYWdlcyUzQSUyMCU1QiU3QiUyMHJvbGUlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwY29udGVudCUzQSUyMCUyMlRlbGwlMjBtZSUyMGElMjBmdW4lMjBmYWN0JTIwYWJvdXQlMjB0aGUlMjBFaWZmZWwlMjBUb3dlci4lMjIlMjAlN0QlNUQlMkMlMEElN0QpJTNCJTBBJTBBY29uc29sZS5sb2cocmVzcG9uc2UuY2hvaWNlcyU1QjAlNUQubWVzc2FnZS5jb250ZW50KSUzQg==",highlighted:`<span class="hljs-keyword">import</span> <span class="hljs-title class_">OpenAI</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;

<span class="hljs-keyword">const</span> openai = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
  <span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
  <span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});

<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> openai.<span class="hljs-property">chat</span>.<span class="hljs-property">completions</span>.<span class="hljs-title function_">create</span>({
  <span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:cerebras&quot;</span>,
  <span class="hljs-attr">messages</span>: [{ <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">&quot;Tell me a fun fact about the Eiffel Tower.&quot;</span> }],
});

<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(response.<span class="hljs-property">choices</span>[<span class="hljs-number">0</span>].<span class="hljs-property">message</span>.<span class="hljs-property">content</span>);`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function Vl(w){let t,n,s,M;return t=new g({props:{id:"simple",option:"python",$$slots:{default:[Sl]},$$scope:{ctx:w}}}),s=new g({props:{id:"simple",option:"javascript",$$slots:{default:[Wl]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$scope={dirty:p,ctx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UyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJlcXVpcmVkJTIyJTNBJTIwJTVCJTIybG9jYXRpb24lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0QlMEElNUQlMEElMEFyZXNwb25zZSUyMCUzRCUyMGNsaWVudC5jaGF0LmNvbXBsZXRpb25zLmNyZWF0ZSglMEElMjAlMjAlMjAlMjBtb2RlbCUzRCUyMm9wZW5haSUyRmdwdC1vc3MtMTIwYiUzQWNlcmVicmFzJTIyJTJDJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlM0QlNUIlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJXaGF0JTIwaXMlMjB0aGUlMjB3ZWF0aGVyJTIwaW4lMjBQYXJpcyUyMGluJTIwQ2Vsc2l1cyUzRiUyMiU3RCU1RCUyQyUwQSUyMCUyMCUyMCUyMHRvb2xzJTNEdG9vbHMlMkMlMEElMjAlMjAlMjAlMjB0b29sX2Nob2ljZSUzRCUyMmF1dG8lMjIlMkMlMEEpJTBBJTBBJTIzJTIwVGhlJTIwcmVzcG9uc2UlMjB3aWxsJTIwY29udGFpbiUyMHRoZSUyMHRvb2xfY2FsbHMlMjBvYmplY3QlMjBpZiUyMHRoZSUyMG1vZGVsJTIwZGVjaWRlcyUyMHRvJTIwdXNlJTIwdGhlJTIwdG9vbCUwQXByaW50KHJlc3BvbnNlLmNob2ljZXMlNUIwJTVELm1lc3NhZ2Up",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

client = OpenAI(
    base_url=<span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
    api_key=os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>),
)

tools = [
    {
        <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;function&quot;</span>,
        <span class="hljs-string">&quot;function&quot;</span>: {
            <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;get_current_weather&quot;</span>,
            <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;Get the current weather in a given location&quot;</span>,
            <span class="hljs-string">&quot;parameters&quot;</span>: {
                <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;object&quot;</span>,
                <span class="hljs-string">&quot;properties&quot;</span>: {
                    <span class="hljs-string">&quot;location&quot;</span>: {
                        <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
                        <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;The city and state, e.g. San Francisco, CA&quot;</span>,
                    },
                    <span class="hljs-string">&quot;unit&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-string">&quot;enum&quot;</span>: [<span class="hljs-string">&quot;celsius&quot;</span>, <span class="hljs-string">&quot;fahrenheit&quot;</span>]},
                },
                <span class="hljs-string">&quot;required&quot;</span>: [<span class="hljs-string">&quot;location&quot;</span>],
            },
        },
    }
]

response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;openai/gpt-oss-120b:cerebras&quot;</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;What is the weather in Paris in Celsius?&quot;</span>}],
    tools=tools,
    tool_choice=<span class="hljs-string">&quot;auto&quot;</span>,
)

<span class="hljs-comment"># The response will contain the tool_calls object if the model decides to use the tool</span>
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message)`,wrap:!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XIlMjBpbiUyMFBhcmlzJTIwaW4lMjBDZWxzaXVzJTNGJTIyJTIwJTdEJTVEJTJDJTBBJTIwJTIwdG9vbHMlMkMlMEElMjAlMjB0b29sX2Nob2ljZSUzQSUyMCUyMmF1dG8lMjIlMkMlMEElN0QpJTNCJTBBJTBBJTJGJTJGJTIwVGhlJTIwcmVzcG9uc2UlMjB3aWxsJTIwY29udGFpbiUyMHRoZSUyMHRvb2xfY2FsbHMlMjBvYmplY3QlMjBpZiUyMHRoZSUyMG1vZGVsJTIwZGVjaWRlcyUyMHRvJTIwdXNlJTIwdGhlJTIwdG9vbCUwQWNvbnNvbGUubG9nKHJlc3BvbnNlLmNob2ljZXMlNUIwJTVELm1lc3NhZ2UpJTNC",highlighted:`<span class="hljs-keyword">import</span> <span class="hljs-title class_">OpenAI</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;

<span class="hljs-keyword">const</span> openai = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
  <span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
  <span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});

<span class="hljs-keyword">const</span> tools = [
  {
    <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;function&quot;</span>,
    <span class="hljs-attr">function</span>: {
      <span class="hljs-attr">name</span>: <span class="hljs-string">&quot;get_current_weather&quot;</span>,
      <span class="hljs-attr">description</span>: <span class="hljs-string">&quot;Get the current weather in a given location&quot;</span>,
      <span class="hljs-attr">parameters</span>: {
        <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;object&quot;</span>,
        <span class="hljs-attr">properties</span>: {
          <span class="hljs-attr">location</span>: {
            <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;string&quot;</span>,
            <span class="hljs-attr">description</span>: <span class="hljs-string">&quot;The city and state, e.g. San Francisco, CA&quot;</span>,
          },
          <span class="hljs-attr">unit</span>: { <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">enum</span>: [<span class="hljs-string">&quot;celsius&quot;</span>, <span class="hljs-string">&quot;fahrenheit&quot;</span>] },
        },
        <span class="hljs-attr">required</span>: [<span class="hljs-string">&quot;location&quot;</span>],
      },
    },
  },
];

<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> openai.<span class="hljs-property">chat</span>.<span class="hljs-property">completions</span>.<span class="hljs-title function_">create</span>({
  <span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:cerebras&quot;</span>,
  <span class="hljs-attr">messages</span>: [{ <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">&quot;What is the weather in Paris in Celsius?&quot;</span> }],
  tools,
  <span class="hljs-attr">tool_choice</span>: <span class="hljs-string">&quot;auto&quot;</span>,
});

<span class="hljs-comment">// The response will contain the tool_calls object if the model decides to use the tool</span>
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(response.<span class="hljs-property">choices</span>[<span class="hljs-number">0</span>].<span class="hljs-property">message</span>);`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function _l(w){let t,n,s,M;return t=new g({props:{id:"tool-call",option:"python",$$slots:{default:[Yl]},$$scope:{ctx:w}}}),s=new g({props:{id:"tool-call",option:"javascript",$$slots:{default:[Rl]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$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UyMGJlJTIwZWFzaWx5JTIwcGFyc2VkJTBBb3V0cHV0X2pzb25fc3RyaW5nJTIwJTNEJTIwcmVzcG9uc2UuY2hvaWNlcyU1QjAlNUQubWVzc2FnZS5jb250ZW50JTBBcGFyc2VkX291dHB1dCUyMCUzRCUyMGpzb24ubG9hZHMob3V0cHV0X2pzb25fc3RyaW5nKSUwQSUwQXByaW50KHBhcnNlZF9vdXRwdXQp",highlighted:`<span class="hljs-keyword">import</span> json
<span class="hljs-keyword">import</span> os

<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI


client = OpenAI(
    base_url=<span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
    api_key=os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>),
)

<span class="hljs-comment"># Force the model to output a JSON object</span>
response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
    messages=[
        {
            <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>,
            <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;You are a helpful assistant designed to output JSON.&quot;</span>,
        },
        {
            <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;Extract the name, city, and profession from the following sentence: &#x27;Amélie is a chef who lives in Paris.&#x27;&quot;</span>,
        },
    ],
    response_format={
        <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;json_schema&quot;</span>,
        <span class="hljs-string">&quot;json_schema&quot;</span>: {
            <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;person&quot;</span>,
            <span class="hljs-string">&quot;schema&quot;</span>: {
                <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;object&quot;</span>,
                <span class="hljs-string">&quot;properties&quot;</span>: {
                    <span class="hljs-string">&quot;name&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>},
                    <span class="hljs-string">&quot;city&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>},
                    <span class="hljs-string">&quot;profession&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>},
                },
                <span class="hljs-string">&quot;required&quot;</span>: [<span class="hljs-string">&quot;name&quot;</span>, <span class="hljs-string">&quot;city&quot;</span>, <span class="hljs-string">&quot;profession&quot;</span>],
            },
        },
    },
)

<span class="hljs-comment"># The output is a valid JSON string that can be easily parsed</span>
output_json_string = response.choices[<span class="hljs-number">0</span>].message.content
parsed_output = json.loads(output_json_string)

<span class="hljs-built_in">print</span>(parsed_output)`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function zl(w){let t,n;return t=new d({props:{code:"aW1wb3J0JTIwT3BlbkFJJTIwZnJvbSUyMCUyMm9wZW5haSUyMiUzQiUwQSUwQWNvbnN0JTIwb3BlbmFpJTIwJTNEJTIwbmV3JTIwT3BlbkFJKCU3QiUwQSUyMCUyMGJhc2VVUkwlM0ElMjAlMjJodHRwcyUzQSUyRiUyRnJvdXRlci5odWdnaW5nZmFjZS5jbyUyRnYxJTIyJTJDJTBBJTIwJTIwYXBpS2V5JTNBJTIwcHJvY2Vzcy5lbnYuSEZfVE9LRU4lMkMlMEElN0QpJTNCJTBBJTBBJTJGJTJGJTIwRm9yY2UlMjB0aGUlMjBtb2RlbCUyMHRvJTIwb3V0cHV0JTIwYSUyMEpTT04lMjBvYmplY3QlMEFjb25zdCUyMHJlc3BvbnNlJTIwJTNEJTIwYXdhaXQlMjBvcGVuYWkuY2hhdC5jb21wbGV0aW9ucy5jcmVhdGUoJTdCJTBBJTIwJTIwbW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">OpenAI</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;

<span class="hljs-keyword">const</span> openai = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
  <span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
  <span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});

<span class="hljs-comment">// Force the model to output a JSON object</span>
<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> openai.<span class="hljs-property">chat</span>.<span class="hljs-property">completions</span>.<span class="hljs-title function_">create</span>({
  <span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
  <span class="hljs-attr">messages</span>: [
    {
      <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;system&quot;</span>,
      <span class="hljs-attr">content</span>: <span class="hljs-string">&quot;You are a helpful assistant designed to output JSON.&quot;</span>,
    },
    {
      <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>,
      <span class="hljs-attr">content</span>:
        <span class="hljs-string">&quot;Extract the name, city, and profession from the following sentence: &#x27;Amélie is a chef who lives in Paris.&#x27;&quot;</span>,
    },
  ],
  <span class="hljs-attr">response_format</span>: {
    <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;json_schema&quot;</span>,
    <span class="hljs-attr">json_schema</span>: {
      <span class="hljs-attr">name</span>: <span class="hljs-string">&quot;person&quot;</span>,
      <span class="hljs-attr">schema</span>: {
        <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;object&quot;</span>,
        <span class="hljs-attr">properties</span>: {
          <span class="hljs-attr">name</span>: { <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;string&quot;</span> },
          <span class="hljs-attr">city</span>: { <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;string&quot;</span> },
          <span class="hljs-attr">profession</span>: { <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;string&quot;</span> },
        },
        <span class="hljs-attr">required</span>: [<span class="hljs-string">&quot;name&quot;</span>, <span class="hljs-string">&quot;city&quot;</span>, <span class="hljs-string">&quot;profession&quot;</span>],
      },
    },
  },
});

<span class="hljs-comment">// The output is a valid JSON string that can be easily parsed</span>
<span class="hljs-keyword">const</span> parsedOutput = <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">parse</span>(response.<span class="hljs-property">choices</span>[<span class="hljs-number">0</span>].<span class="hljs-property">message</span>.<span class="hljs-property">content</span>);
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(parsedOutput);`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function Hl(w){let t,n,s,M;return t=new g({props:{id:"structured",option:"python",$$slots:{default:[Xl]},$$scope:{ctx:w}}}),s=new g({props:{id:"structured",option:"javascript",$$slots:{default:[zl]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$scope={dirty:p,ctx:a}),s.$set(h)},i(a){M||(i(t.$$.fragment,a),i(s.$$.fragment,a),M=!0)},o(a){T(t.$$.fragment,a),T(s.$$.fragment,a),M=!1},d(a){a&&o(n),y(t,a),y(s,a)}}}function Fl(w){let t,n;return t=new d({props:{code:"aW1wb3J0JTIwb3MlMEFmcm9tJTIwb3BlbmFpJTIwaW1wb3J0JTIwT3BlbkFJJTBBJTBBJTBBY2xpZW50JTIwJTNEJTIwT3BlbkFJKCUwQSUyMCUyMCUyMCUyMGJhc2VfdXJsJTNEJTIyaHR0cHMlM0ElMkYlMkZyb3V0ZXIuaHVnZ2luZ2ZhY2UuY28lMkZ2MSUyMiUyQyUwQSUyMCUyMCUyMCUyMGFwaV9rZXklM0Rvcy5nZXRlbnYoJTIySEZfVE9LRU4lMjIpJTJDJTBBKSUwQSUwQSUyMyUyMFNldCUyMHN0cmVhbSUzRFRydWUlMjB0byUyMHJlY2VpdmUlMjBhJTIwc3RyZWFtJTIwb2YlMjBzZW1hbnRpYyUyMGV2ZW50cyUwQXN0cmVhbSUyMCUzRCUyMGNsaWVudC5yZXNwb25zZXMuY3JlYXRlKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEJTIyb3BlbmFpJTJGZ3B0LW9zcy0xMjBiJTNBZmlyZXdvcmtzLWFpJTIyJTJDJTBBJTIwJTIwJTIwJTIwaW5wdXQlM0QlMjJUZWxsJTIwbWUlMjBhJTIwc2hvcnQlMjBzdG9yeSUyMGFib3V0JTIwYSUyMHJvYm90JTIwd2hvJTIwZGlzY292ZXJzJTIwbXVzaWMuJTIyJTJDJTBBJTIwJTIwJTIwJTIwc3RyZWFtJTNEVHJ1ZSUyQyUwQSklMEElMEElMjMlMjBJdGVyYXRlJTIwb3ZlciUyMHRoZSUyMGV2ZW50cyUyMGluJTIwdGhlJTIwc3RyZWFtJTBBZm9yJTIwZXZlbnQlMjBpbiUyMHN0cmVhbSUzQSUwQSUyMCUyMCUyMCUyMHByaW50KGV2ZW50KQ==",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI


client = OpenAI(
    base_url=<span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
    api_key=os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>),
)

<span class="hljs-comment"># Set stream=True to receive a stream of semantic events</span>
stream = client.responses.create(
    model=<span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
    <span class="hljs-built_in">input</span>=<span class="hljs-string">&quot;Tell me a short story about a robot who discovers music.&quot;</span>,
    stream=<span class="hljs-literal">True</span>,
)

<span class="hljs-comment"># Iterate over the events in the stream</span>
<span class="hljs-keyword">for</span> event <span class="hljs-keyword">in</span> stream:
    <span class="hljs-built_in">print</span>(event)`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function xl(w){let t,n;return t=new d({props:{code:"aW1wb3J0JTIwT3BlbkFJJTIwZnJvbSUyMCUyMm9wZW5haSUyMiUzQiUwQSUwQWNvbnN0JTIwb3BlbmFpJTIwJTNEJTIwbmV3JTIwT3BlbkFJKCU3QiUwQSUyMCUyMGJhc2VVUkwlM0ElMjAlMjJodHRwcyUzQSUyRiUyRnJvdXRlci5odWdnaW5nZmFjZS5jbyUyRnYxJTIyJTJDJTBBJTIwJTIwYXBpS2V5JTNBJTIwcHJvY2Vzcy5lbnYuSEZfVE9LRU4lMkMlMEElN0QpJTNCJTBBJTBBJTJGJTJGJTIwU2V0JTIwc3RyZWFtJTNEdHJ1ZSUyMHRvJTIwcmVjZWl2ZSUyMGElMjBzdHJlYW0lMjBvZiUyMHNlbWFudGljJTIwZXZlbnRzJTBBY29uc3QlMjBzdHJlYW0lMjAlM0QlMjBhd2FpdCUyMG9wZW5haS5yZXNwb25zZXMuY3JlYXRlKCU3QiUwQSUyMCUyMG1vZGVsJTNBJTIwJTIyb3BlbmFpJTJGZ3B0LW9zcy0xMjBiJTNBZmlyZXdvcmtzLWFpJTIyJTJDJTBBJTIwJTIwaW5wdXQlM0ElMjAlMjJUZWxsJTIwbWUlMjBhJTIwc2hvcnQlMjBzdG9yeSUyMGFib3V0JTIwYSUyMHJvYm90JTIwd2hvJTIwZGlzY292ZXJzJTIwbXVzaWMuJTIyJTJDJTBBJTIwJTIwc3RyZWFtJTNBJTIwdHJ1ZSUyQyUwQSU3RCklM0IlMEElMEElMkYlMkYlMjBJdGVyYXRlJTIwb3ZlciUyMHRoZSUyMGV2ZW50cyUyMGluJTIwdGhlJTIwc3RyZWFtJTBBZm9yJTIwYXdhaXQlMjAoY29uc3QlMjBldmVudCUyMG9mJTIwc3RyZWFtKSUyMCU3QiUwQSUyMCUyMGNvbnNvbGUubG9nKGV2ZW50KSUzQiUwQSU3RA==",highlighted:`<span class="hljs-keyword">import</span> <span class="hljs-title class_">OpenAI</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;

<span class="hljs-keyword">const</span> openai = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
  <span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
  <span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});

<span class="hljs-comment">// Set stream=true to receive a stream of semantic events</span>
<span class="hljs-keyword">const</span> stream = <span class="hljs-keyword">await</span> openai.<span class="hljs-property">responses</span>.<span class="hljs-title function_">create</span>({
  <span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
  <span class="hljs-attr">input</span>: <span class="hljs-string">&quot;Tell me a short story about a robot who discovers music.&quot;</span>,
  <span class="hljs-attr">stream</span>: <span class="hljs-literal">true</span>,
});

<span class="hljs-comment">// Iterate over the events in the stream</span>
<span class="hljs-keyword">for</span> <span class="hljs-keyword">await</span> (<span class="hljs-keyword">const</span> event <span class="hljs-keyword">of</span> stream) {
  <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(event);
}`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function Ll(w){let t,n,s,M;return t=new g({props:{id:"stream",option:"python",$$slots:{default:[Fl]},$$scope:{ctx:w}}}),s=new g({props:{id:"stream",option:"javascript",$$slots:{default:[xl]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$scope={dirty:p,ctx:a}),s.$set(h)},i(a){M||(i(t.$$.fragment,a),i(s.$$.fragment,a),M=!0)},o(a){T(t.$$.fragment,a),T(s.$$.fragment,a),M=!1},d(a){a&&o(n),y(t,a),y(s,a)}}}function Dl(w){let t,n;return t=new d({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQWltcG9ydCUyMG9zJTBBJTBBY2xpZW50JTIwJTNEJTIwT3BlbkFJKCUwQSUyMCUyMCUyMCUyMGJhc2VfdXJsJTNEJTIyaHR0cHMlM0ElMkYlMkZyb3V0ZXIuaHVnZ2luZ2ZhY2UuY28lMkZ2MSUyMiUyQyUwQSUyMCUyMCUyMCUyMGFwaV9rZXklM0Rvcy5nZXRlbnYoJTIySEZfVE9LRU4lMjIpJTJDJTBBKSUwQSUwQXRvb2xzJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIydHlwZSUyMiUzQSUyMCUyMmZ1bmN0aW9uJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIybmFtZSUyMiUzQSUyMCUyMmdldF9jdXJyZW50X3dlYXRoZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJkZXNjcmlwdGlvbiUyMiUzQSUyMCUyMkdldCUyMHRoZSUyMGN1cnJlbnQlMjB3ZWF0aGVyJTIwaW4lMjBhJTIwZ2l2ZW4lMjBsb2NhdGlvbiUyM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jAlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyZXF1aXJlZCUyMiUzQSUyMCU1QiUyMmxvY2F0aW9uJTIyJTJDJTIwJTIydW5pdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUwQSU1RCUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LnJlc3BvbnNlcy5jcmVhdGUoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0QlMjJvcGVuYWklMkZncHQtb3NzLTEyMGIlM0FmaXJld29ya3MtYWklMjIlMkMlMjAlMEElMjAlMjAlMjAlMjB0b29scyUzRHRvb2xzJTJDJTBBJTIwJTIwJTIwJTIwaW5wdXQlM0QlMjJXaGF0JTIwaXMlMjB0aGUlMjB3ZWF0aGVyJTIwbGlrZSUyMGluJTIwQm9zdG9uJTIwdG9kYXklM0YlMjIlMkMlMEElMjAlMjAlMjAlMjB0b29sX2Nob2ljZSUzRCUyMmF1dG8lMjIlMkMlMEEpJTBBJTBBcHJpbnQocmVzcG9uc2Up",highlighted:`<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI
<span class="hljs-keyword">import</span> os

client = OpenAI(
    base_url=<span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
    api_key=os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>),
)

tools = [
    {
        <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;function&quot;</span>,
        <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;get_current_weather&quot;</span>,
        <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;Get the current weather in a given location&quot;</span>,
        <span class="hljs-string">&quot;parameters&quot;</span>: {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;object&quot;</span>,
            <span class="hljs-string">&quot;properties&quot;</span>: {
                <span class="hljs-string">&quot;location&quot;</span>: {
                    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
                    <span class="hljs-string">&quot;description&quot;</span>: <span class="hljs-string">&quot;The city and state, e.g. San Francisco, CA&quot;</span>,
                },
                <span class="hljs-string">&quot;unit&quot;</span>: {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-string">&quot;enum&quot;</span>: [<span class="hljs-string">&quot;celsius&quot;</span>, <span class="hljs-string">&quot;fahrenheit&quot;</span>]},
            },
            <span class="hljs-string">&quot;required&quot;</span>: [<span class="hljs-string">&quot;location&quot;</span>, <span class="hljs-string">&quot;unit&quot;</span>],
        },
    }
]

response = client.responses.create(
    model=<span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>, 
    tools=tools,
    <span class="hljs-built_in">input</span>=<span class="hljs-string">&quot;What is the weather like in Boston today?&quot;</span>,
    tool_choice=<span class="hljs-string">&quot;auto&quot;</span>,
)

<span class="hljs-built_in">print</span>(response)`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function Ol(w){let t,n;return t=new d({props:{code:"aW1wb3J0JTIwT3BlbkFJJTIwZnJvbSUyMCUyMm9wZW5haSUyMiUzQiUwQSUwQWNvbnN0JTIwb3BlbmFpJTIwJTNEJTIwbmV3JTIwT3BlbkFJKCU3QiUwQSUyMCUyMGJhc2VVUkwlM0ElMjAlMjJodHRwcyUzQSUyRiUyRnJvdXRlci5odWdnaW5nZmFjZS5jbyUyRnYxJTIyJTJDJTBBJTIwJTIwYXBpS2V5JTNBJTIwcHJvY2Vzcy5lbnYuSEZfVE9LRU4lMkMlMEElN0QpJTNCJTBBJTBBY29uc3QlMjB0b29scyUyMCUzRCUy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IlMjJsb2NhdGlvbiUyMiUyQyUyMCUyMnVuaXQlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlN0QlMkMlMEElNUQlM0IlMEElMEFjb25zdCUyMHJlc3BvbnNlJTIwJTNEJTIwYXdhaXQlMjBvcGVuYWkucmVzcG9uc2VzLmNyZWF0ZSglN0IlMEElMjAlMjBtb2RlbCUzQSUyMCUyMm9wZW5haSUyRmdwdC1vc3MtMTIwYiUzQWZpcmV3b3Jrcy1haSUyMiUyQyUwQSUyMCUyMHRvb2xzJTJDJTBBJTIwJTIwaW5wdXQlM0ElMjAlMjJXaGF0JTIwaXMlMjB0aGUlMjB3ZWF0aGVyJTIwbGlrZSUyMGluJTIwQm9zdG9uJTIwdG9kYXklM0YlMjIlMkMlMEElMjAlMjB0b29sX2Nob2ljZSUzQSUyMCUyMmF1dG8lMjIlMkMlMEElN0QpJTNCJTBBJTBBY29uc29sZS5sb2cocmVzcG9uc2UpJTNC",highlighted:`<span class="hljs-keyword">import</span> <span class="hljs-title class_">OpenAI</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;

<span class="hljs-keyword">const</span> openai = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
  <span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
  <span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});

<span class="hljs-keyword">const</span> tools = [
  {
    <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;function&quot;</span>,
    <span class="hljs-attr">name</span>: <span class="hljs-string">&quot;get_current_weather&quot;</span>,
    <span class="hljs-attr">description</span>: <span class="hljs-string">&quot;Get the current weather in a given location&quot;</span>,
    <span class="hljs-attr">parameters</span>: {
      <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;object&quot;</span>,
      <span class="hljs-attr">properties</span>: {
        <span class="hljs-attr">location</span>: {
          <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;string&quot;</span>,
          <span class="hljs-attr">description</span>: <span class="hljs-string">&quot;The city and state, e.g. San Francisco, CA&quot;</span>,
        },
        <span class="hljs-attr">unit</span>: { <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">enum</span>: [<span class="hljs-string">&quot;celsius&quot;</span>, <span class="hljs-string">&quot;fahrenheit&quot;</span>] },
      },
      <span class="hljs-attr">required</span>: [<span class="hljs-string">&quot;location&quot;</span>, <span class="hljs-string">&quot;unit&quot;</span>],
    },
  },
];

<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> openai.<span class="hljs-property">responses</span>.<span class="hljs-title function_">create</span>({
  <span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
  tools,
  <span class="hljs-attr">input</span>: <span class="hljs-string">&quot;What is the weather like in Boston today?&quot;</span>,
  <span class="hljs-attr">tool_choice</span>: <span class="hljs-string">&quot;auto&quot;</span>,
});

<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(response);`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function Kl(w){let t,n,s,M;return t=new g({props:{id:"tool-call-resp",option:"python",$$slots:{default:[Dl]},$$scope:{ctx:w}}}),s=new g({props:{id:"tool-call-resp",option:"javascript",$$slots:{default:[Ol]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$scope={dirty:p,ctx:a}),s.$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jAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJzZXJ2ZXJfdXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZtY3AuZGVlcHdpa2kuY29tJTJGbWNwJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycmVxdWlyZV9hcHByb3ZhbCUyMiUzQSUyMCUyMm5ldmVyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTJDJTBBKSUwQSUwQXByaW50KHJlc3BvbnNlKQ==",highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

client = OpenAI(
    base_url=<span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
    api_key=os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>),
)

response = client.responses.create(
    model=<span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
    <span class="hljs-built_in">input</span>=<span class="hljs-string">&quot;What transport protocols are supported in the 2025-03-26 version of the MCP spec?&quot;</span>,
    tools=[
        {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;mcp&quot;</span>,
            <span class="hljs-string">&quot;server_label&quot;</span>: <span class="hljs-string">&quot;deepwiki&quot;</span>,
            <span class="hljs-string">&quot;server_url&quot;</span>: <span class="hljs-string">&quot;https://mcp.deepwiki.com/mcp&quot;</span>,
            <span class="hljs-string">&quot;require_approval&quot;</span>: <span class="hljs-string">&quot;never&quot;</span>,
        },
    ],
)

<span class="hljs-built_in">print</span>(response)`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function st(w){let t,n;return t=new d({props:{code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wJTIwJTdEJTJDJTBBJTIwJTIwJTVEJTJDJTBBJTdEKSUzQiUwQSUwQWNvbnNvbGUubG9nKHJlc3BvbnNlKSUzQg==",highlighted:`<span class="hljs-keyword">import</span> <span class="hljs-title class_">OpenAI</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;

<span class="hljs-keyword">const</span> openai = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
  <span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
  <span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});

<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> openai.<span class="hljs-property">responses</span>.<span class="hljs-title function_">create</span>({
  <span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
  <span class="hljs-attr">input</span>:
    <span class="hljs-string">&quot;What transport protocols are supported in the 2025-03-26 version of the MCP spec?&quot;</span>,
  <span class="hljs-attr">tools</span>: [
    {
      <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;mcp&quot;</span>,
      <span class="hljs-attr">server_label</span>: <span class="hljs-string">&quot;deepwiki&quot;</span>,
      <span class="hljs-attr">server_url</span>: <span class="hljs-string">&quot;https://mcp.deepwiki.com/mcp&quot;</span>,
      <span class="hljs-attr">require_approval</span>: <span class="hljs-string">&quot;never&quot;</span>,
    },
  ],
});

<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(response);`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function lt(w){let t,n,s,M;return t=new g({props:{id:"mcp",option:"python",$$slots:{default:[Pl]},$$scope:{ctx:w}}}),s=new g({props:{id:"mcp",option:"javascript",$$slots:{default:[st]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$scope={dirty:p,ctx:a}),s.$set(h)},i(a){M||(i(t.$$.fragment,a),i(s.$$.fragment,a),M=!0)},o(a){T(t.$$.fragment,a),T(s.$$.fragment,a),M=!1},d(a){a&&o(n),y(t,a),y(s,a)}}}function tt(w){let t,n;return t=new d({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQWltcG9ydCUyMG9zJTBBJTBBY2xpZW50JTIwJTNEJTIwT3BlbkFJKCUwQSUyMCUyMCUyMCUyMGJhc2VfdXJsJTNEJTIyaHR0cHMlM0ElMkYlMkZyb3V0ZXIuaHVnZ2luZ2ZhY2UuY28lMkZ2MSUyMiUyQyUwQSUyMCUyMCUyMCUyMGFwaV9rZXklM0Rvcy5nZXRlbnYoJTIySEZfVE9LRU4lMjIpJTJDJTBBKSUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LnJlc3BvbnNlcy5jcmVhdGUoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0QlMjJvcGVuYWklMkZncHQtb3NzLTEyMGIlM0FmaXJld29ya3MtYWklMjIlMkMlMEElMjAlMjAlMjAlMjBpbnN0cnVjdGlvbnMlM0QlMjJZb3UlMjBhcmUlMjBhJTIwaGVscGZ1bCUyMGFzc2lzdGFudC4lMjIlMkMlMEElMjAlMjAlMjAlMjBpbnB1dCUzRCUyMlNheSUyMGhlbGxvJTIwdG8lMjB0aGUlMjB3b3JsZC4lMjIlMkMlMEElMjAlMjAlMjAlMjByZWFzb25pbmclM0QlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJlZmZvcnQlMjIlM0ElMjAlMjJsb3clMjIlMkMlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEEpJTBBJTBBZm9yJTIwaW5kZXglMkMlMjBpdGVtJTIwaW4lMjBlbnVtZXJhdGUocmVzcG9uc2Uub3V0cHV0KSUzQSUwQSUyMCUyMCUyMCUyMHByaW50KGYlMjJPdXRwdXQlMjAlMjMlN0JpbmRleCU3RCUzQSUyMCU3Qml0ZW0udHlwZSU3RCUyMiUyQyUyMGl0ZW0uY29udGVudCk=",highlighted:`<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI
<span class="hljs-keyword">import</span> os

client = OpenAI(
    base_url=<span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
    api_key=os.getenv(<span class="hljs-string">&quot;HF_TOKEN&quot;</span>),
)

response = client.responses.create(
    model=<span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
    instructions=<span class="hljs-string">&quot;You are a helpful assistant.&quot;</span>,
    <span class="hljs-built_in">input</span>=<span class="hljs-string">&quot;Say hello to the world.&quot;</span>,
    reasoning={
        <span class="hljs-string">&quot;effort&quot;</span>: <span class="hljs-string">&quot;low&quot;</span>,
    },
)

<span class="hljs-keyword">for</span> index, item <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(response.output):
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Output #<span class="hljs-subst">{index}</span>: <span class="hljs-subst">{item.<span class="hljs-built_in">type</span>}</span>&quot;</span>, item.content)`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function at(w){let t,n;return t=new d({props:{code:"aW1wb3J0JTIwT3BlbkFJJTIwZnJvbSUyMCUyMm9wZW5haSUyMiUzQiUwQSUwQWNvbnN0JTIwb3BlbmFpJTIwJTNEJTIwbmV3JTIwT3BlbkFJKCU3QiUwQSUyMCUyMGJhc2VVUkwlM0ElMjAlMjJodHRwcyUzQSUyRiUyRnJvdXRlci5odWdnaW5nZmFjZS5jbyUyRnYxJTIyJTJDJTBBJTIwJTIwYXBpS2V5JTNBJTIwcHJvY2Vzcy5lbnYuSEZfVE9LRU4lMkMlMEElN0QpJTNCJTBBJTBBY29uc3QlMjByZXNwb25zZSUyMCUzRCUyMGF3YWl0JTIwb3BlbmFpLnJlc3BvbnNlcy5jcmVhdGUoJTdCJTBBJTIwJTIwbW9kZWwlM0ElMjAlMjJvcGVuYWklMkZncHQtb3NzLTEyMGIlM0FmaXJld29ya3MtYWklMjIlMkMlMEElMjAlMjBpbnN0cnVjdGlvbnMlM0ElMjAlMjJZb3UlMjBhcmUlMjBhJTIwaGVscGZ1bCUyMGFzc2lzdGFudC4lMjIlMkMlMEElMjAlMjBpbnB1dCUzQSUyMCUyMlNheSUyMGhlbGxvJTIwdG8lMjB0aGUlMjB3b3JsZC4lMjIlMkMlMEElMjAlMjByZWFzb25pbmclM0ElMjAlN0IlMEElMjAlMjAlMjAlMjBlZmZvcnQlM0ElMjAlMjJsb3clMjIlMkMlMEElMjAlMjAlN0QlMkMlMEElN0QpJTNCJTBBJTBBcmVzcG9uc2Uub3V0cHV0LmZvckVhY2goKGl0ZW0lMkMlMjBpbmRleCklMjAlM0QlM0UlMjAlN0IlMEElMjAlMjBjb25zb2xlLmxvZyglNjBPdXRwdXQlMjAlMjMlMjQlN0JpbmRleCU3RCUzQSUyMCUyNCU3Qml0ZW0udHlwZSU3RCU2MCUyQyUyMGl0ZW0uY29udGVudCklM0IlMEElN0QpJTNC",highlighted:`<span class="hljs-keyword">import</span> <span class="hljs-title class_">OpenAI</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;openai&quot;</span>;

<span class="hljs-keyword">const</span> openai = <span class="hljs-keyword">new</span> <span class="hljs-title class_">OpenAI</span>({
  <span class="hljs-attr">baseURL</span>: <span class="hljs-string">&quot;https://router.huggingface.co/v1&quot;</span>,
  <span class="hljs-attr">apiKey</span>: process.<span class="hljs-property">env</span>.<span class="hljs-property">HF_TOKEN</span>,
});

<span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> openai.<span class="hljs-property">responses</span>.<span class="hljs-title function_">create</span>({
  <span class="hljs-attr">model</span>: <span class="hljs-string">&quot;openai/gpt-oss-120b:fireworks-ai&quot;</span>,
  <span class="hljs-attr">instructions</span>: <span class="hljs-string">&quot;You are a helpful assistant.&quot;</span>,
  <span class="hljs-attr">input</span>: <span class="hljs-string">&quot;Say hello to the world.&quot;</span>,
  <span class="hljs-attr">reasoning</span>: {
    <span class="hljs-attr">effort</span>: <span class="hljs-string">&quot;low&quot;</span>,
  },
});

response.<span class="hljs-property">output</span>.<span class="hljs-title function_">forEach</span>(<span class="hljs-function">(<span class="hljs-params">item, index</span>) =&gt;</span> {
  <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">\`Output #<span class="hljs-subst">\${index}</span>: <span class="hljs-subst">\${item.<span class="hljs-keyword">type</span>}</span>\`</span>, item.<span class="hljs-property">content</span>);
});`,wrap:!1}}),{c(){r(t.$$.fragment)},l(s){c(t.$$.fragment,s)},m(s,M){j(t,s,M),n=!0},p:B,i(s){n||(i(t.$$.fragment,s),n=!0)},o(s){T(t.$$.fragment,s),n=!1},d(s){y(t,s)}}}function nt(w){let t,n,s,M;return t=new g({props:{id:"reasoning",option:"python",$$slots:{default:[tt]},$$scope:{ctx:w}}}),s=new g({props:{id:"reasoning",option:"javascript",$$slots:{default:[at]},$$scope:{ctx:w}}}),{c(){r(t.$$.fragment),n=U(),r(s.$$.fragment)},l(a){c(t.$$.fragment,a),n=u(a),c(s.$$.fragment,a)},m(a,p){j(t,a,p),J(a,n,p),j(s,a,p),M=!0},p(a,p){const I={};p&2&&(I.$$scope={dirty:p,ctx:a}),t.$set(I);const h={};p&2&&(h.$$scope={dirty:p,ctx:a}),s.$set(h)},i(a){M||(i(t.$$.fragment,a),i(s.$$.fragment,a),M=!0)},o(a){T(t.$$.fragment,a),T(s.$$.fragment,a),M=!1},d(a){a&&o(n),y(t,a),y(s,a)}}}function et(w){let t,n,s,M,a,p,I,h,b,Ks='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/inference-providers-guides/gpt-oss-thumbnail-light.png"/>',Ts,Y,Ps='This guide walks you through using OpenAI’s latest gpt-oss models with Hugging Face Inference Providers, which is the same infra that powers the official OpenAI playground (<a href="https://gpt-oss.com" rel="nofollow">gpt-oss.com</a>). OpenAI gpt-oss is an open-weights family built for strong reasoning, agentic workflows and versatile developer use cases, and it comes in two sizes: a version with 120B parameters <a href="https://hf.co/openai/gpt-oss-120b" rel="nofollow">gpt-oss-120b</a>, and a smaller one with 20B parameters (<a href="https://hf.co/openai/gpt-oss-20b" rel="nofollow">gpt-oss-20b</a>).',ys,R,sl='Both models are supported on Inference Providers and can be accessed through either the OpenAI-compatible <a href="https://platform.openai.com/docs/api-reference/chat/completions" rel="nofollow">Chat Completions API</a>, or the more advanced <a href="https://platform.openai.com/docs/api-reference/responses" rel="nofollow">Responses API</a>.',ws,_,Us,X,ll='<li>You’ll need your Hugging Face token. Get one from your <a href="https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&amp;tokenType=fineGrained" rel="nofollow">settings page</a>. Then, set it as an environment variable.</li>',us,z,Is,A,tl='<p>💡 Pro tip: The free tier gives you monthly inference credits to start building and experimenting. Upgrade to <a href="https://huggingface.co/pro" rel="nofollow">Hugging Face PRO</a> for even more flexibility, $2 in monthly credits plus pay‑as‑you‑go access to all providers!</p>',hs,$,al="<li>Install the official OpenAI SDK.</li>",ms,Q,fs,H,Cs,F,nl="Getting started with gpt-oss models on Inference Providers is simple and straightforward. The OpenAI-compatible Chat Completions API supports features like tool calling, structured outputs, streaming, and reasoning effort controls.",ds,x,el='Here’s a basic example using <a href="https://hf.co/openai/gpt-oss-120b" rel="nofollow">gpt-oss-120b</a> through the fast Cerebras provider:',gs,Z,Bs,L,Ml="You can also give the model access to tools. Below, we define a <code>get_current_weather</code> function and let the model decide whether to call it:",bs,q,As,D,pl="For structured tasks like data extraction, you can force the model to return a valid JSON object using the <code>response_format</code> parameter. We use the Fireworks AI provider.",$s,E,Qs,O,ol="With just a few lines of code, you can start using gpt-oss models with Hugging Face Inference Providers, fully OpenAI API-compatible, easy to integrate, and ready out of the box!",Zs,K,qs,P,Jl="Inference Providers implements the <strong>OpenAI-compatible Responses API</strong>, the most advanced interface for chat-based models. It supports streaming, structured outputs, tool calling, reasoning effort controls (low, medium, hard), and Remote MCP calls to delegate tasks to external services.",Es,ss,rl="Key Advantages:",Ns,ls,cl="<li>Agent-Oriented Design: The API is specifically built to simplify workflows for agentic tasks. It has a native framework for integrating complex tool use, such as Remote MCP calls.</li> <li>Stateful, Event-Driven Architecture: Features a stateful, event-driven architecture. Instead of resending the entire text on every update, it streams semantic events that describe only the precise change (the “delta”). This eliminates the need for manual state tracking.</li> <li>Simplified Development for Complex Logic: The event-driven model makes it easier to build reliable applications with multi-step logic. Your code simply listens for specific events, leading to cleaner and more robust integrations.</li>",vs,N,jl='<p>The implementation is based on the open-source <a href="https://github.com/huggingface/responses.js" rel="nofollow">huggingface/responses.js</a> project.</p>',ks,ts,Gs,as,il="Unlike traditional text streaming, the Responses API uses a system of semantic events for streaming. This means the stream is not just raw text, but a series of structured event objects. Each event has a type, so you can listen for the specific events you care about, such as content being added (<code>output_text.delta</code>) or the message being completed (<code>completed</code>). The example below shows how to iterate through these events and print the content as it arrives.",Ss,v,Ws,ns,Vs,es,Tl="You can extend the model with tools to access external data. The example below defines a get_current_weather function that the model can choose to call.",Ys,k,Rs,Ms,_s,ps,yl="The API’s most advanced feature is Remote MCP calls, which allow the model to delegate tasks to external services. Calling a remote MCP server with the Responses API is straightforward. For example, here’s how you can use the DeepWiki MCP server to ask questions about nearly any public GitHub repository.",Xs,G,zs,os,Hs,Js,wl="You can also control the model’s “thinking” time with the <code>reasoning</code> parameter. The following example nudges the model to spend a medium amount of effort on the answer.",Fs,S,xs,rs,Ul="That’s it! With the Responses API on Inference Providers, you get fine-grained control over powerful open-weight models like gpt-oss, including streaming, tool calling, and remote MCP, making it ideal for building reliable, agent-driven applications.",Ls,cs,Ds,is,Os;return a=new El({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),I=new W({props:{title:"How to use OpenAI gpt-oss",local:"how-to-use-openai-gpt-oss",headingTag:"h1"}}),_=new W({props:{title:"Quickstart",local:"quickstart",headingTag:"h2"}}),z=new d({props:{code:"ZXhwb3J0JTIwSEZfVE9LRU4lM0QlMjJ5b3VyX3Rva2VuX2hlcmUlMjI=",highlighted:'<span class="hljs-built_in">export</span> HF_TOKEN=<span class="hljs-string">&quot;your_token_here&quot;</span>',wrap:!1}}),Q=new V({props:{id:"install",options:["python","javascript"],$$slots:{default:[Gl]},$$scope:{ctx:w}}}),H=new W({props:{title:"Chat Completion",local:"chat-completion",headingTag:"h2"}}),Z=new V({props:{id:"simple",options:["python","javascript"],$$slots:{default:[Vl]},$$scope:{ctx:w}}}),q=new V({props:{id:"tool-call",options:["python","javascript"],$$slots:{default:[_l]},$$scope:{ctx:w}}}),E=new V({props:{id:"structured",options:["python","javascript"],$$slots:{default:[Hl]},$$scope:{ctx:w}}}),K=new W({props:{title:"Responses API",local:"responses-api",headingTag:"h2"}}),ts=new W({props:{title:"Stream responses",local:"stream-responses",headingTag:"h3"}}),v=new V({props:{id:"stream",options:["python","javascript"],$$slots:{default:[Ll]},$$scope:{ctx:w}}}),ns=new W({props:{title:"Tool Calling",local:"tool-calling",headingTag:"h3"}}),k=new V({props:{id:"tool-call-resp",options:["python","javascript"],$$slots:{default:[Kl]},$$scope:{ctx:w}}}),Ms=new W({props:{title:"Remote MCP Calls",local:"remote-mcp-calls",headingTag:"h3"}}),G=new V({props:{id:"mcp",options:["python","javascript"],$$slots:{default:[lt]},$$scope:{ctx:w}}}),os=new W({props:{title:"Reasoning Effort",local:"reasoning-effort",headingTag:"h3"}}),S=new V({props:{id:"reasoning",options:["python","javascript"],$$slots:{default:[nt]},$$scope:{ctx:w}}}),cs=new Nl({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/inference-providers/guides/gpt-oss.md"}}),{c(){t=m("meta"),n=U(),s=m("p"),M=U(),r(a.$$.fragment),p=U(),r(I.$$.fragment),h=U(),b=m("div"),b.innerHTML=Ks,Ts=U(),Y=m("p"),Y.innerHTML=Ps,ys=U(),R=m("p"),R.innerHTML=sl,ws=U(),r(_.$$.fragment),Us=U(),X=m("ol"),X.innerHTML=ll,us=U(),r(z.$$.fragment),Is=U(),A=m("blockquote"),A.innerHTML=tl,hs=U(),$=m("ol"),$.innerHTML=al,ms=U(),r(Q.$$.fragment),fs=U(),r(H.$$.fragment),Cs=U(),F=m("p"),F.textContent=nl,ds=U(),x=m("p"),x.innerHTML=el,gs=U(),r(Z.$$.fragment),Bs=U(),L=m("p"),L.innerHTML=Ml,bs=U(),r(q.$$.fragment),As=U(),D=m("p"),D.innerHTML=pl,$s=U(),r(E.$$.fragment),Qs=U(),O=m("p"),O.textContent=ol,Zs=U(),r(K.$$.fragment),qs=U(),P=m("p"),P.innerHTML=Jl,Es=U(),ss=m("p"),ss.textContent=rl,Ns=U(),ls=m("ul"),ls.innerHTML=cl,vs=U(),N=m("blockquote"),N.innerHTML=jl,ks=U(),r(ts.$$.fragment),Gs=U(),as=m("p"),as.innerHTML=il,Ss=U(),r(v.$$.fragment),Ws=U(),r(ns.$$.fragment),Vs=U(),es=m("p"),es.textContent=Tl,Ys=U(),r(k.$$.fragment),Rs=U(),r(Ms.$$.fragment),_s=U(),ps=m("p"),ps.textContent=yl,Xs=U(),r(G.$$.fragment),zs=U(),r(os.$$.fragment),Hs=U(),Js=m("p"),Js.innerHTML=wl,Fs=U(),r(S.$$.fragment),xs=U(),rs=m("p"),rs.textContent=Ul,Ls=U(),r(cs.$$.fragment),Ds=U(),is=m("p"),this.h()},l(l){const e=Zl("svelte-u9bgzb",document.head);t=f(e,"META",{name:!0,content:!0}),e.forEach(o),n=u(l),s=f(l,"P",{}),Bl(s).forEach(o),M=u(l),c(a.$$.fragment,l),p=u(l),c(I.$$.fragment,l),h=u(l),b=f(l,"DIV",{class:!0,"data-svelte-h":!0}),C(b)!=="svelte-zpqiaf"&&(b.innerHTML=Ks),Ts=u(l),Y=f(l,"P",{"data-svelte-h":!0}),C(Y)!=="svelte-sc6h52"&&(Y.innerHTML=Ps),ys=u(l),R=f(l,"P",{"data-svelte-h":!0}),C(R)!=="svelte-4b4qci"&&(R.innerHTML=sl),ws=u(l),c(_.$$.fragment,l),Us=u(l),X=f(l,"OL",{"data-svelte-h":!0}),C(X)!=="svelte-pi7glh"&&(X.innerHTML=ll),us=u(l),c(z.$$.fragment,l),Is=u(l),A=f(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),C(A)!=="svelte-1h35tag"&&(A.innerHTML=tl),hs=u(l),$=f(l,"OL",{start:!0,"data-svelte-h":!0}),C($)!=="svelte-12js9c5"&&($.innerHTML=al),ms=u(l),c(Q.$$.fragment,l),fs=u(l),c(H.$$.fragment,l),Cs=u(l),F=f(l,"P",{"data-svelte-h":!0}),C(F)!=="svelte-l6kdm5"&&(F.textContent=nl),ds=u(l),x=f(l,"P",{"data-svelte-h":!0}),C(x)!=="svelte-4xiud5"&&(x.innerHTML=el),gs=u(l),c(Z.$$.fragment,l),Bs=u(l),L=f(l,"P",{"data-svelte-h":!0}),C(L)!=="svelte-1sfhiwp"&&(L.innerHTML=Ml),bs=u(l),c(q.$$.fragment,l),As=u(l),D=f(l,"P",{"data-svelte-h":!0}),C(D)!=="svelte-1lorwlc"&&(D.innerHTML=pl),$s=u(l),c(E.$$.fragment,l),Qs=u(l),O=f(l,"P",{"data-svelte-h":!0}),C(O)!=="svelte-1fgmnby"&&(O.textContent=ol),Zs=u(l),c(K.$$.fragment,l),qs=u(l),P=f(l,"P",{"data-svelte-h":!0}),C(P)!=="svelte-i7ibtp"&&(P.innerHTML=Jl),Es=u(l),ss=f(l,"P",{"data-svelte-h":!0}),C(ss)!=="svelte-15v2083"&&(ss.textContent=rl),Ns=u(l),ls=f(l,"UL",{"data-svelte-h":!0}),C(ls)!=="svelte-1akqial"&&(ls.innerHTML=cl),vs=u(l),N=f(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),C(N)!=="svelte-go0o2l"&&(N.innerHTML=jl),ks=u(l),c(ts.$$.fragment,l),Gs=u(l),as=f(l,"P",{"data-svelte-h":!0}),C(as)!=="svelte-13ny4ej"&&(as.innerHTML=il),Ss=u(l),c(v.$$.fragment,l),Ws=u(l),c(ns.$$.fragment,l),Vs=u(l),es=f(l,"P",{"data-svelte-h":!0}),C(es)!=="svelte-te09kn"&&(es.textContent=Tl),Ys=u(l),c(k.$$.fragment,l),Rs=u(l),c(Ms.$$.fragment,l),_s=u(l),ps=f(l,"P",{"data-svelte-h":!0}),C(ps)!=="svelte-1koxlc5"&&(ps.textContent=yl),Xs=u(l),c(G.$$.fragment,l),zs=u(l),c(os.$$.fragment,l),Hs=u(l),Js=f(l,"P",{"data-svelte-h":!0}),C(Js)!=="svelte-1cx48gc"&&(Js.innerHTML=wl),Fs=u(l),c(S.$$.fragment,l),xs=u(l),rs=f(l,"P",{"data-svelte-h":!0}),C(rs)!=="svelte-1eljq9t"&&(rs.textContent=Ul),Ls=u(l),c(cs.$$.fragment,l),Ds=u(l),is=f(l,"P",{}),Bl(is).forEach(o),this.h()},h(){js(t,"name","hf:doc:metadata"),js(t,"content",Mt),js(b,"class","flex justify-center"),js(A,"class","tip"),js($,"start","2"),js(N,"class","tip")},m(l,e){ql(document.head,t),J(l,n,e),J(l,s,e),J(l,M,e),j(a,l,e),J(l,p,e),j(I,l,e),J(l,h,e),J(l,b,e),J(l,Ts,e),J(l,Y,e),J(l,ys,e),J(l,R,e),J(l,ws,e),j(_,l,e),J(l,Us,e),J(l,X,e),J(l,us,e),j(z,l,e),J(l,Is,e),J(l,A,e),J(l,hs,e),J(l,$,e),J(l,ms,e),j(Q,l,e),J(l,fs,e),j(H,l,e),J(l,Cs,e),J(l,F,e),J(l,ds,e),J(l,x,e),J(l,gs,e),j(Z,l,e),J(l,Bs,e),J(l,L,e),J(l,bs,e),j(q,l,e),J(l,As,e),J(l,D,e),J(l,$s,e),j(E,l,e),J(l,Qs,e),J(l,O,e),J(l,Zs,e),j(K,l,e),J(l,qs,e),J(l,P,e),J(l,Es,e),J(l,ss,e),J(l,Ns,e),J(l,ls,e),J(l,vs,e),J(l,N,e),J(l,ks,e),j(ts,l,e),J(l,Gs,e),J(l,as,e),J(l,Ss,e),j(v,l,e),J(l,Ws,e),j(ns,l,e),J(l,Vs,e),J(l,es,e),J(l,Ys,e),j(k,l,e),J(l,Rs,e),j(Ms,l,e),J(l,_s,e),J(l,ps,e),J(l,Xs,e),j(G,l,e),J(l,zs,e),j(os,l,e),J(l,Hs,e),J(l,Js,e),J(l,Fs,e),j(S,l,e),J(l,xs,e),J(l,rs,e),J(l,Ls,e),j(cs,l,e),J(l,Ds,e),J(l,is,e),Os=!0},p(l,[e]){const ul={};e&2&&(ul.$$scope={dirty:e,ctx:l}),Q.$set(ul);const Il={};e&2&&(Il.$$scope={dirty:e,ctx:l}),Z.$set(Il);const hl={};e&2&&(hl.$$scope={dirty:e,ctx:l}),q.$set(hl);const ml={};e&2&&(ml.$$scope={dirty:e,ctx:l}),E.$set(ml);const fl={};e&2&&(fl.$$scope={dirty:e,ctx:l}),v.$set(fl);const Cl={};e&2&&(Cl.$$scope={dirty:e,ctx:l}),k.$set(Cl);const dl={};e&2&&(dl.$$scope={dirty:e,ctx:l}),G.$set(dl);const gl={};e&2&&(gl.$$scope={dirty:e,ctx:l}),S.$set(gl)},i(l){Os||(i(a.$$.fragment,l),i(I.$$.fragment,l),i(_.$$.fragment,l),i(z.$$.fragment,l),i(Q.$$.fragment,l),i(H.$$.fragment,l),i(Z.$$.fragment,l),i(q.$$.fragment,l),i(E.$$.fragment,l),i(K.$$.fragment,l),i(ts.$$.fragment,l),i(v.$$.fragment,l),i(ns.$$.fragment,l),i(k.$$.fragment,l),i(Ms.$$.fragment,l),i(G.$$.fragment,l),i(os.$$.fragment,l),i(S.$$.fragment,l),i(cs.$$.fragment,l),Os=!0)},o(l){T(a.$$.fragment,l),T(I.$$.fragment,l),T(_.$$.fragment,l),T(z.$$.fragment,l),T(Q.$$.fragment,l),T(H.$$.fragment,l),T(Z.$$.fragment,l),T(q.$$.fragment,l),T(E.$$.fragment,l),T(K.$$.fragment,l),T(ts.$$.fragment,l),T(v.$$.fragment,l),T(ns.$$.fragment,l),T(k.$$.fragment,l),T(Ms.$$.fragment,l),T(G.$$.fragment,l),T(os.$$.fragment,l),T(S.$$.fragment,l),T(cs.$$.fragment,l),Os=!1},d(l){l&&(o(n),o(s),o(M),o(p),o(h),o(b),o(Ts),o(Y),o(ys),o(R),o(ws),o(Us),o(X),o(us),o(Is),o(A),o(hs),o($),o(ms),o(fs),o(Cs),o(F),o(ds),o(x),o(gs),o(Bs),o(L),o(bs),o(As),o(D),o($s),o(Qs),o(O),o(Zs),o(qs),o(P),o(Es),o(ss),o(Ns),o(ls),o(vs),o(N),o(ks),o(Gs),o(as),o(Ss),o(Ws),o(Vs),o(es),o(Ys),o(Rs),o(_s),o(ps),o(Xs),o(zs),o(Hs),o(Js),o(Fs),o(xs),o(rs),o(Ls),o(Ds),o(is)),o(t),y(a,l),y(I,l),y(_,l),y(z,l),y(Q,l),y(H,l),y(Z,l),y(q,l),y(E,l),y(K,l),y(ts,l),y(v,l),y(ns,l),y(k,l),y(Ms,l),y(G,l),y(os,l),y(S,l),y(cs,l)}}}const Mt='{"title":"How to use OpenAI gpt-oss","local":"how-to-use-openai-gpt-oss","sections":[{"title":"Quickstart","local":"quickstart","sections":[],"depth":2},{"title":"Chat Completion","local":"chat-completion","sections":[],"depth":2},{"title":"Responses API","local":"responses-api","sections":[{"title":"Stream responses","local":"stream-responses","sections":[],"depth":3},{"title":"Tool Calling","local":"tool-calling","sections":[],"depth":3},{"title":"Remote MCP Calls","local":"remote-mcp-calls","sections":[],"depth":3},{"title":"Reasoning Effort","local":"reasoning-effort","sections":[],"depth":3}],"depth":2}],"depth":1}';function pt(w){return Al(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Tt extends $l{constructor(t){super(),Ql(this,t,pt,et,bl,{})}}export{Tt as component};
