import{s as De,o as Pe,n as Le}from"../chunks/scheduler.37c15a92.js";import{S as Oe,i as Ke,g as r,s as n,r as u,A as tl,h as p,f as l,c as a,j as we,u as c,x as h,k as Gt,y as _,a as s,v as m,d as J,t as T,w as y,m as qt,n as Nt}from"../chunks/index.2bf4358c.js";import{T as xt}from"../chunks/Tip.363c041f.js";import{C as A}from"../chunks/CodeBlock.4f5fc1ad.js";import{C as el}from"../chunks/CourseFloatingBanner.15ba07e6.js";import{H as S,E as ll}from"../chunks/EditOnGithub.8916dc7c.js";function sl(b){let M;return{c(){M=qt(`Chat templates are crucial for:
- Maintaining consistent conversation structure
- Ensuring proper role identification
- Managing context across multiple turns
- Supporting advanced features like tool use`)},l(o){M=Nt(o,`Chat templates are crucial for:
- Maintaining consistent conversation structure
- Ensuring proper role identification
- Managing context across multiple turns
- Supporting advanced features like tool use`)},m(o,U){s(o,M,U)},d(o){o&&l(M)}}}function nl(b){let M,o,U="this configuration",w;return{c(){M=qt("When using an instruct model, always verify you're using the correct chat template format. Using the wrong template can result in poor model performance or unexpected behavior. The easiest way to ensure this is to check the model tokenizer configuration on the Hub. For example, the `SmolLM2-135M-Instruct` model uses "),o=r("a"),o.textContent=U,w=qt("."),this.h()},l(d){M=Nt(d,"When using an instruct model, always verify you're using the correct chat template format. Using the wrong template can result in poor model performance or unexpected behavior. The easiest way to ensure this is to check the model tokenizer configuration on the Hub. For example, the `SmolLM2-135M-Instruct` model uses "),o=p(d,"A",{href:!0,"data-svelte-h":!0}),h(o)!=="svelte-xnja4f"&&(o.textContent=U),w=Nt(d,"."),this.h()},h(){Gt(o,"href","https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct/blob/e2c3f7557efbdec707ae3a336371d169783f1da1/tokenizer_config.json#L146")},m(d,f){s(d,M,f),s(d,o,f),s(d,w,f)},p:Le,d(d){d&&(l(M),l(o),l(w))}}}function al(b){let M;return{c(){M=qt(`When implementing advanced features:
- Test thoroughly with your specific model. Vision and tool use template are particularly diverse.
- Monitor token usage carefully between each feature and model.
- Document the expected format for each feature`)},l(o){M=Nt(o,`When implementing advanced features:
- Test thoroughly with your specific model. Vision and tool use template are particularly diverse.
- Monitor token usage carefully between each feature and model.
- Document the expected format for each feature`)},m(o,U){s(o,M,U)},d(o){o&&l(M)}}}function il(b){let M;return{c(){M=qt(`Common pitfalls to avoid:
- Mixing different template formats in the same application
- Exceeding token limits with long conversation histories
- Not properly escaping special characters in messages
- Forgetting to validate input message structure
- Ignoring model-specific template requirements`)},l(o){M=Nt(o,`Common pitfalls to avoid:
- Mixing different template formats in the same application
- Exceeding token limits with long conversation histories
- Not properly escaping special characters in messages
- Forgetting to validate input message structure
- Ignoring model-specific template requirements`)},m(o,U){s(o,M,U)},d(o){o&&l(M)}}}function ol(b){let M,o,U="<li>Load the dataset:</li>",w,d,f,j,k="<li>Create a processing function:</li>",q,N,B,G,W="<li>Apply the chat template using your chosen model’s tokenizer</li>",C,x,v="Remember to validate your output format matches your target model’s requirements!",Q;return d=new A({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJIdWdnaW5nRmFjZVRCJTJGc21vbHRhbGslMjIp",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

dataset = load_dataset(<span class="hljs-string">&quot;HuggingFaceTB/smoltalk&quot;</span>)`,wrap:!1}}),N=new A({props:{code:"ZGVmJTIwY29udmVydF90b19jaGF0bWwoZXhhbXBsZSklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJtZXNzYWdlcyUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMGV4YW1wbGUlNUIlMjJpbnB1dCUyMiU1RCU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJhc3Npc3RhbnQlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwZXhhbXBsZSU1QiUyMm91dHB1dCUyMiU1RCU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCU3RA==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">convert_to_chatml</span>(<span class="hljs-params">example</span>):
    <span class="hljs-keyword">return</span> {
        <span class="hljs-string">&quot;messages&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>: example[<span class="hljs-string">&quot;input&quot;</span>]},
            {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: example[<span class="hljs-string">&quot;output&quot;</span>]},
        ]
    }`,wrap:!1}}),{c(){M=qt("Follow these steps to convert the `HuggingFaceTB/smoltalk` dataset into chatml format:\n"),o=r("ol"),o.innerHTML=U,w=n(),u(d.$$.fragment),f=n(),j=r("ol"),j.innerHTML=k,q=n(),u(N.$$.fragment),B=n(),G=r("ol"),G.innerHTML=W,C=n(),x=r("p"),x.textContent=v,this.h()},l(i){M=Nt(i,"Follow these steps to convert the `HuggingFaceTB/smoltalk` dataset into chatml format:\n"),o=p(i,"OL",{"data-svelte-h":!0}),h(o)!=="svelte-1r7vb1q"&&(o.innerHTML=U),w=a(i),c(d.$$.fragment,i),f=a(i),j=p(i,"OL",{start:!0,"data-svelte-h":!0}),h(j)!=="svelte-1uqov0c"&&(j.innerHTML=k),q=a(i),c(N.$$.fragment,i),B=a(i),G=p(i,"OL",{start:!0,"data-svelte-h":!0}),h(G)!=="svelte-17g86i3"&&(G.innerHTML=W),C=a(i),x=p(i,"P",{"data-svelte-h":!0}),h(x)!=="svelte-tib7t6"&&(x.textContent=v),this.h()},h(){Gt(j,"start","2"),Gt(G,"start","3")},m(i,g){s(i,M,g),s(i,o,g),s(i,w,g),m(d,i,g),s(i,f,g),s(i,j,g),s(i,q,g),m(N,i,g),s(i,B,g),s(i,G,g),s(i,C,g),s(i,x,g),Q=!0},p:Le,i(i){Q||(J(d.$$.fragment,i),J(N.$$.fragment,i),Q=!0)},o(i){T(d.$$.fragment,i),T(N.$$.fragment,i),Q=!1},d(i){i&&(l(M),l(o),l(w),l(f),l(j),l(q),l(B),l(G),l(C),l(x)),y(d,i),y(N,i)}}}function Ml(b){let M,o,U,w,d,f,j,k,q,N,B,G="Chat templates are essential for structuring interactions between language models and users. Whether you’re building a simple chatbot or a complex AI agent, understanding how to properly format your conversations is crucial for getting the best results from your model. In this guide, we’ll explore what chat templates are, why they matter, and how to use them effectively.",W,C,x,v,Q,i,g,V,Ie='A base model is trained on raw text data to predict the next token, while an instruct model is fine-tuned specifically to follow instructions and engage in conversations. For example, <a href="https://huggingface.co/HuggingFaceTB/SmolLM2-135M" rel="nofollow"><code>SmolLM2-135M</code></a> is a base model, while <a href="https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct" rel="nofollow"><code>SmolLM2-135M-Instruct</code></a> is its instruction-tuned variant.',At,R,fe="Instuction tuned models are trained to follow a specific conversational structure, making them more suitable for chatbot applications. Moreover, instruct models can handle complex interactions, including tool use, multimodal inputs, and function calling.",vt,H,Ce='To make a base model behave like an instruct model, we need to format our prompts in a consistent way that the model can understand. This is where chat templates come in. ChatML is one such template format that structures conversations with clear role indicators (system, user, assistant). Here’s a guide on <a href="https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct/blob/e2c3f7557efbdec707ae3a336371d169783f1da1/tokenizer_config.json#L146" rel="nofollow">ChatML</a>.',St,E,Qt,X,Et,Y,$e="Before diving into specific implementations, it’s important to understand how different models expect their conversations to be formatted. Let’s explore some common template formats using a simple example conversation:",zt,L,be="We’ll use the following conversation structure for all examples:",Zt,D,Ft,P,qe="This is the ChatML template used in models like SmolLM2 and Qwen 2:",_t,O,kt,K,Ne="This is using the <code>mistral</code> template format:",Wt,tt,Vt,et,Be="And here’s the Llama 3 template format:",Rt,lt,Ht,st,xe="Key differences between these formats include:",Xt,nt,Ge="<li><p><strong>System Message Handling</strong>:</p> <ul><li>Llama 2 wraps system messages in <code>&lt;&lt;SYS&gt;&gt;</code> tags</li> <li>Llama 3 uses <code>&lt;|system|&gt;</code> tags with <code>&lt;/s&gt;</code> endings</li> <li>Mistral includes system message in the first instruction</li> <li>Qwen uses explicit <code>system</code> role with <code>&lt;|im_start|&gt;</code> tags</li> <li>ChatGPT uses <code>SYSTEM:</code> prefix</li></ul></li> <li><p><strong>Message Boundaries</strong>:</p> <ul><li>Llama 2 uses <code>[INST]</code> and <code>[/INST]</code> tags</li> <li>Llama 3 uses role-specific tags (<code>&lt;|system|&gt;</code>, <code>&lt;|user|&gt;</code>, <code>&lt;|assistant|&gt;</code>) with <code>&lt;/s&gt;</code> endings</li> <li>Mistral uses <code>[INST]</code> and <code>[/INST]</code> with <code>&lt;s&gt;</code> and <code>&lt;/s&gt;</code></li> <li>Qwen uses role-specific start/end tokens</li></ul></li> <li><p><strong>Special Tokens</strong>:</p> <ul><li>Llama 2 uses <code>&lt;s&gt;</code> and <code>&lt;/s&gt;</code> for conversation boundaries</li> <li>Llama 3 uses <code>&lt;/s&gt;</code> to end each message</li> <li>Mistral uses <code>&lt;s&gt;</code> and <code>&lt;/s&gt;</code> for turn boundaries</li> <li>Qwen uses role-specific start/end tokens</li></ul></li>",Yt,at,Ae="Understanding these differences is key to working with various models. Let’s look at how the transformers library helps us handle these variations automatically:",Lt,it,Dt,I,Ct,ve="Click to see template examples",de,$t,Se="Qwen 2 and SmolLM2 ChatML template:",Ue,ot,ge,bt,Qe="Mistral template:",je,Mt,Pt,rt,Ot,pt,Ee="Chat templates can handle more complex scenarios beyond just conversational interactions, including:",Kt,ut,ze="<li><strong>Tool Use</strong>: When models need to interact with external tools or APIs</li> <li><strong>Multimodal Inputs</strong>: For handling images, audio, or other media types</li> <li><strong>Function Calling</strong>: For structured function execution</li> <li><strong>Multi-turn Context</strong>: For maintaining conversation history</li>",te,z,ee,ct,Ze="For multimodal conversations, chat templates can include image references or base64-encoded images:",le,mt,se,Jt,Fe="Here’s an example of a chat template with tool use:",ne,Tt,ae,yt,ie,ht,oe,dt,_e="When working with chat templates, follow these key practices:",Me,Ut,ke="<li><strong>Consistent Formatting</strong>: Always use the same template format throughout your application</li> <li><strong>Clear Role Definition</strong>: Clearly specify roles (system, user, assistant, tool) for each message</li> <li><strong>Context Management</strong>: Be mindful of token limits when maintaining conversation history</li> <li><strong>Error Handling</strong>: Include proper error handling for tool calls and multimodal inputs</li> <li><strong>Validation</strong>: Validate message structure before sending to the model</li>",re,Z,pe,gt,ue,jt,We="Let’s practice implementing chat templates with a real-world example.",ce,F,me,wt,Je,It,Ve='<li><a href="https://huggingface.co/docs/transformers/main/en/chat_templating" rel="nofollow">Hugging Face Chat Templating Guide</a></li> <li><a href="https://huggingface.co/docs/transformers" rel="nofollow">Transformers Documentation</a></li> <li><a href="https://github.com/chujiezheng/chat_templates" rel="nofollow">Chat Templates Examples Repository</a></li>',Te,ft,ye,Bt,he;return d=new el({props:{chapter:2,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/course/en/chapter11/section2.ipynb"}]}}),j=new S({props:{title:"Chat Templates",local:"chat-templates",headingTag:"h1"}}),q=new S({props:{title:"Introduction",local:"introduction",headingTag:"h2"}}),C=new xt({props:{$$slots:{default:[sl]},$$scope:{ctx:b}}}),v=new S({props:{title:"Model Types and Templates",local:"model-types-and-templates",headingTag:"h2"}}),i=new S({props:{title:"Base Models vs Instruct Models",local:"base-models-vs-instruct-models",headingTag:"h3"}}),E=new xt({props:{warning:!0,$$slots:{default:[nl]},$$scope:{ctx:b}}}),X=new S({props:{title:"Common Template Formats",local:"common-template-formats",headingTag:"h3"}}),D=new A({props:{code:"bWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMllvdSUyMGFyZSUyMGElMjBoZWxwZnVsJTIwYXNzaXN0YW50LiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkhlbGxvISUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJhc3Npc3RhbnQlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIySGkhJTIwSG93JTIwY2FuJTIwSSUyMGhlbHAlMjB5b3UlMjB0b2RheSUzRiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMldoYXQncyUyMHRoZSUyMHdlYXRoZXIlM0YlMjIlN0QlMkMlMEElNUQ=",highlighted:`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.&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;Hello!&quot;</span>},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Hi! How can I help you today?&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;What&#x27;s the weather?&quot;</span>},
]`,wrap:!1}}),O=new A({props:{code:"JTNDJTdDaW1fc3RhcnQlN0MlM0VzeXN0ZW0lMEFZb3UlMjBhcmUlMjBhJTIwaGVscGZ1bCUyMGFzc2lzdGFudC4lM0MlN0NpbV9lbmQlN0MlM0UlMEElM0MlN0NpbV9zdGFydCU3QyUzRXVzZXIlMEFIZWxsbyElM0MlN0NpbV9lbmQlN0MlM0UlMEElM0MlN0NpbV9zdGFydCU3QyUzRWFzc2lzdGFudCUwQUhpISUyMEhvdyUyMGNhbiUyMEklMjBoZWxwJTIweW91JTIwdG9kYXklM0YlM0MlN0NpbV9lbmQlN0MlM0UlMEElM0MlN0NpbV9zdGFydCU3QyUzRXVzZXIlMEFXaGF0J3MlMjB0aGUlMjB3ZWF0aGVyJTNGJTNDJTdDaW1fZW5kJTdDJTNFJTBBJTNDJTdDaW1fc3RhcnQlN0MlM0Vhc3Npc3RhbnQ=",highlighted:`&lt;|im_start|&gt;system
You are a helpful assistant.&lt;|im_end|&gt;
&lt;|im_start|&gt;user
Hello!&lt;|im_end|&gt;
&lt;|im_start|&gt;assistant
Hi! How can I <span class="hljs-built_in">help</span> you today?&lt;|im_end|&gt;
&lt;|im_start|&gt;user
What<span class="hljs-string">&#x27;s the weather?&lt;|im_end|&gt;
&lt;|im_start|&gt;assistant</span>`,wrap:!1}}),tt=new A({props:{code:"JTNDcyUzRSU1QklOU1QlNUQlMjBZb3UlMjBhcmUlMjBhJTIwaGVscGZ1bCUyMGFzc2lzdGFudC4lMjAlNUIlMkZJTlNUJTVEJTBBSGkhJTIwSG93JTIwY2FuJTIwSSUyMGhlbHAlMjB5b3UlMjB0b2RheSUzRiUzQyUyRnMlM0UlMEElM0NzJTNFJTVCSU5TVCU1RCUyMEhlbGxvISUyMCU1QiUyRklOU1QlNUQlMEFIaSElMjBIb3clMjBjYW4lMjBJJTIwaGVscCUyMHlvdSUyMHRvZGF5JTNGJTNDJTJGcyUzRSUwQSUzQ3MlM0UlNUJJTlNUJTVEJTIwV2hhdCdzJTIwdGhlJTIwd2VhdGhlciUzRiUyMCU1QiUyRklOU1QlNUQ=",highlighted:`&lt;s&gt;[INST] You are a helpful assistant. [/INST]
Hi! How can I <span class="hljs-built_in">help</span> you today?&lt;/s&gt;
&lt;s&gt;[INST] Hello! [/INST]
Hi! How can I <span class="hljs-built_in">help</span> you today?&lt;/s&gt;
&lt;s&gt;[INST] What<span class="hljs-string">&#x27;s the weather? [/INST]</span>`,wrap:!1}}),lt=new A({props:{code:"JTNDJTdDc3lzdGVtJTdDJTNFJTBBWW91JTIwYXJlJTIwYSUyMGhlbHBmdWwlMjBhc3Npc3RhbnQuJTNDJTJGcyUzRSUwQSUzQyU3Q3VzZXIlN0MlM0UlMEFIZWxsbyElM0MlMkZzJTNFJTBBJTNDJTdDYXNzaXN0YW50JTdDJTNFJTBBSGkhJTIwSG93JTIwY2FuJTIwSSUyMGhlbHAlMjB5b3UlMjB0b2RheSUzRiUzQyUyRnMlM0UlMEElM0MlN0N1c2VyJTdDJTNFJTBBV2hhdCdzJTIwdGhlJTIwd2VhdGhlciUzRiUzQyUyRnMlM0UlMEElM0MlN0Nhc3Npc3RhbnQlN0MlM0U=",highlighted:`&lt;|system|&gt;
You are a helpful assistant.&lt;/s&gt;
&lt;|user|&gt;
Hello!&lt;/s&gt;
&lt;|assistant|&gt;
Hi! How can I <span class="hljs-built_in">help</span> you today?&lt;/s&gt;
&lt;|user|&gt;
What<span class="hljs-string">&#x27;s the weather?&lt;/s&gt;
&lt;|assistant|&gt;</span>`,wrap:!1}}),it=new A({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEElMjMlMjBUaGVzZSUyMHdpbGwlMjB1c2UlMjBkaWZmZXJlbnQlMjB0ZW1wbGF0ZXMlMjBhdXRvbWF0aWNhbGx5JTBBbWlzdHJhbF90b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaXN0cmFsYWklMkZNaXN0cmFsLTdCLUluc3RydWN0LXYwLjElMjIpJTBBcXdlbl90b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbi03Qi1DaGF0JTIyKSUwQXNtb2xfdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIySHVnZ2luZ0ZhY2VUQiUyRlNtb2xMTTItMTM1TS1JbnN0cnVjdCUyMiklMEElMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJzeXN0ZW0lMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIyWW91JTIwYXJlJTIwYSUyMGhlbHBmdWwlMjBhc3Npc3RhbnQuJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIySGVsbG8hJTIyJTdEJTJDJTBBJTVEJTBBJTBBJTIzJTIwRWFjaCUyMHdpbGwlMjBmb3JtYXQlMjBhY2NvcmRpbmclMjB0byUyMGl0cyUyMG1vZGVsJ3MlMjB0ZW1wbGF0ZSUwQW1pc3RyYWxfY2hhdCUyMCUzRCUyMG1pc3RyYWxfdG9rZW5pemVyLmFwcGx5X2NoYXRfdGVtcGxhdGUobWVzc2FnZXMlMkMlMjB0b2tlbml6ZSUzREZhbHNlKSUwQXF3ZW5fY2hhdCUyMCUzRCUyMHF3ZW5fdG9rZW5pemVyLmFwcGx5X2NoYXRfdGVtcGxhdGUobWVzc2FnZXMlMkMlMjB0b2tlbml6ZSUzREZhbHNlKSUwQXNtb2xfY2hhdCUyMCUzRCUyMHNtb2xfdG9rZW5pemVyLmFwcGx5X2NoYXRfdGVtcGxhdGUobWVzc2FnZXMlMkMlMjB0b2tlbml6ZSUzREZhbHNlKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-comment"># These will use different templates automatically</span>
mistral_tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;mistralai/Mistral-7B-Instruct-v0.1&quot;</span>)
qwen_tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen-7B-Chat&quot;</span>)
smol_tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;HuggingFaceTB/SmolLM2-135M-Instruct&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.&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;Hello!&quot;</span>},
]

<span class="hljs-comment"># Each will format according to its model&#x27;s template</span>
mistral_chat = mistral_tokenizer.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>)
qwen_chat = qwen_tokenizer.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>)
smol_chat = smol_tokenizer.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>)`,wrap:!1}}),ot=new A({props:{code:"JTNDJTdDaW1fc3RhcnQlN0MlM0VzeXN0ZW0lMEFZb3UlMjBhcmUlMjBhJTIwaGVscGZ1bCUyMGFzc2lzdGFudC4lM0MlN0NpbV9lbmQlN0MlM0UlMEElM0MlN0NpbV9zdGFydCU3QyUzRXVzZXIlMEFIZWxsbyElM0MlN0NpbV9lbmQlN0MlM0UlMEElM0MlN0NpbV9zdGFydCU3QyUzRWFzc2lzdGFudCUwQUhpISUyMEhvdyUyMGNhbiUyMEklMjBoZWxwJTIweW91JTIwdG9kYXklM0YlM0MlN0NpbV9lbmQlN0MlM0UlMEElM0MlN0NpbV9zdGFydCU3QyUzRXVzZXIlMEFXaGF0J3MlMjB0aGUlMjB3ZWF0aGVyJTNGJTNDJTdDaW1fZW5kJTdDJTNFJTBBJTNDJTdDaW1fc3RhcnQlN0MlM0Vhc3Npc3RhbnQ=",highlighted:`&lt;|im_start|&gt;system
You are a helpful assistant.&lt;|im_end|&gt;
&lt;|im_start|&gt;user
Hello!&lt;|im_end|&gt;
&lt;|im_start|&gt;assistant
Hi! How can I <span class="hljs-built_in">help</span> you today?&lt;|im_end|&gt;
&lt;|im_start|&gt;user
What<span class="hljs-string">&#x27;s the weather?&lt;|im_end|&gt;
&lt;|im_start|&gt;assistant</span>`,wrap:!1}}),Mt=new A({props:{code:"JTNDcyUzRSU1QklOU1QlNUQlMjBZb3UlMjBhcmUlMjBhJTIwaGVscGZ1bCUyMGFzc2lzdGFudC4lMjAlNUIlMkZJTlNUJTVEJTBBSGkhJTIwSG93JTIwY2FuJTIwSSUyMGhlbHAlMjB5b3UlMjB0b2RheSUzRiUzQyUyRnMlM0UlMEElNUJJTlNUJTVEJTIwSGVsbG8hJTIwJTVCJTJGSU5TVCU1RA==",highlighted:`&lt;s&gt;[INST] You are a helpful assistant. [/INST]
Hi! How can I <span class="hljs-built_in">help</span> you today?&lt;/s&gt;
[INST] Hello! [/INST]`,wrap:!1}}),rt=new S({props:{title:"Advanced Features",local:"advanced-features",headingTag:"h3"}}),z=new xt({props:{$$slots:{default:[al]},$$scope:{ctx:b}}}),mt=new A({props:{code:"bWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMllvdSUyMGFyZSUyMGElMjBoZWxwZnVsJTIwdmlzaW9uJTIwYXNzaXN0YW50JTIwdGhhdCUyMGNhbiUyMGFuYWx5emUlMjBpbWFnZXMuJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyV2hhdCdzJTIwaW4lMjB0aGlzJTIwaW1hZ2UlM0YlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIyaW1hZ2UlMjIlMkMlMjAlMjJpbWFnZV91cmwlMjIlM0ElMjAlMjJodHRwcyUzQSUyRiUyRmV4YW1wbGUuY29tJTJGaW1hZ2UuanBnJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTVE",highlighted:`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 vision assistant that can analyze images.&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;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What&#x27;s in this image?&quot;</span>},
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;image_url&quot;</span>: <span class="hljs-string">&quot;https://example.com/image.jpg&quot;</span>},
        ],
    },
]`,wrap:!1}}),Tt=new A({props:{code:"bWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMllvdSUyMGFyZSUyMGFuJTIwQUklMjBhc3Npc3RhbnQlMjB0aGF0JTIwY2FuJTIwdXNlJTIwdG9vbHMuJTIwQXZhaWxhYmxlJTIwdG9vbHMlM0ElMjBjYWxjdWxhdG9yJTJDJTIwd2VhdGhlcl9hcGklMjIlMkMlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJXaGF0J3MlMjAxMjMlMjAqJTIwNDU2JTIwYW5kJTIwaXMlMjBpdCUyMHJhaW5pbmclMjBpbiUyMFBhcmlzJTNGJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMmFzc2lzdGFudCUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJMZXQlMjBtZSUyMGhlbHAlMjB5b3UlMjB3aXRoJTIwdGhhdC4lMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0b29sX2NhbGxzJTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIydG9vbCUyMiUzQSUyMCUyMmNhbGN1bGF0b3IlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJwYXJhbWV0ZXJzJTIyJTNBJTIwJTdCJTIyb3BlcmF0aW9uJTIyJTNBJTIwJTIybXVsdGlwbHklMjIlMkMlMjAlMjJ4JTIyJTNBJTIwMTIzJTJDJTIwJTIyeSUyMiUzQSUyMDQ1NiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnRvb2wlMjIlM0ElMjAlMjJ3ZWF0aGVyX2FwaSUyMiUyQyUyMCUyMnBhcmFtZXRlcnMlMjIlM0ElMjAlN0IlMjJjaXR5JTIyJTNBJTIwJTIyUGFyaXMlMjIlMkMlMjAlMjJjb3VudHJ5JTIyJTNBJTIwJTIyRnJhbmNlJTIyJTdEJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnRvb2wlMjIlMkMlMjAlMjJ0b29sX25hbWUlMjIlM0ElMjAlMjJjYWxjdWxhdG9yJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMjU2MDg4JTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnRvb2wlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0b29sX25hbWUlMjIlM0ElMjAlMjJ3ZWF0aGVyX2FwaSUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjIlN0InY29uZGl0aW9uJyUzQSUyMCdyYWluJyUyQyUyMCd0ZW1wZXJhdHVyZSclM0ElMjAxNSU3RCUyMiUyQyUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSU1RA==",highlighted:`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 an AI assistant that can use tools. Available tools: calculator, weather_api&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;What&#x27;s 123 * 456 and is it raining in Paris?&quot;</span>},
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Let me help you with that.&quot;</span>,
        <span class="hljs-string">&quot;tool_calls&quot;</span>: [
            {
                <span class="hljs-string">&quot;tool&quot;</span>: <span class="hljs-string">&quot;calculator&quot;</span>,
                <span class="hljs-string">&quot;parameters&quot;</span>: {<span class="hljs-string">&quot;operation&quot;</span>: <span class="hljs-string">&quot;multiply&quot;</span>, <span class="hljs-string">&quot;x&quot;</span>: <span class="hljs-number">123</span>, <span class="hljs-string">&quot;y&quot;</span>: <span class="hljs-number">456</span>},
            },
            {<span class="hljs-string">&quot;tool&quot;</span>: <span class="hljs-string">&quot;weather_api&quot;</span>, <span class="hljs-string">&quot;parameters&quot;</span>: {<span class="hljs-string">&quot;city&quot;</span>: <span class="hljs-string">&quot;Paris&quot;</span>, <span class="hljs-string">&quot;country&quot;</span>: <span class="hljs-string">&quot;France&quot;</span>}},
        ],
    },
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;tool&quot;</span>, <span class="hljs-string">&quot;tool_name&quot;</span>: <span class="hljs-string">&quot;calculator&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;56088&quot;</span>},
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;tool&quot;</span>,
        <span class="hljs-string">&quot;tool_name&quot;</span>: <span class="hljs-string">&quot;weather_api&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;{&#x27;condition&#x27;: &#x27;rain&#x27;, &#x27;temperature&#x27;: 15}&quot;</span>,
    },
]`,wrap:!1}}),yt=new S({props:{title:"Best Practices",local:"best-practices",headingTag:"h2"}}),ht=new S({props:{title:"General Guidelines",local:"general-guidelines",headingTag:"h3"}}),Z=new xt({props:{warning:!0,$$slots:{default:[il]},$$scope:{ctx:b}}}),gt=new S({props:{title:"Hands-on Exercise",local:"hands-on-exercise",headingTag:"h2"}}),F=new xt({props:{$$slots:{default:[ol]},$$scope:{ctx:b}}}),wt=new S({props:{title:"Additional Resources",local:"additional-resources",headingTag:"h2"}}),ft=new ll({props:{source:"https://github.com/huggingface/course/blob/main/chapters/en/chapter11/2.mdx"}}),{c(){M=r("meta"),o=n(),U=r("p"),w=n(),u(d.$$.fragment),f=n(),u(j.$$.fragment),k=n(),u(q.$$.fragment),N=n(),B=r("p"),B.textContent=G,W=n(),u(C.$$.fragment),x=n(),u(v.$$.fragment),Q=n(),u(i.$$.fragment),g=n(),V=r("p"),V.innerHTML=Ie,At=n(),R=r("p"),R.textContent=fe,vt=n(),H=r("p"),H.innerHTML=Ce,St=n(),u(E.$$.fragment),Qt=n(),u(X.$$.fragment),Et=n(),Y=r("p"),Y.textContent=$e,zt=n(),L=r("p"),L.textContent=be,Zt=n(),u(D.$$.fragment),Ft=n(),P=r("p"),P.textContent=qe,_t=n(),u(O.$$.fragment),kt=n(),K=r("p"),K.innerHTML=Ne,Wt=n(),u(tt.$$.fragment),Vt=n(),et=r("p"),et.textContent=Be,Rt=n(),u(lt.$$.fragment),Ht=n(),st=r("p"),st.textContent=xe,Xt=n(),nt=r("ol"),nt.innerHTML=Ge,Yt=n(),at=r("p"),at.textContent=Ae,Lt=n(),u(it.$$.fragment),Dt=n(),I=r("details"),Ct=r("summary"),Ct.textContent=ve,de=n(),$t=r("p"),$t.textContent=Se,Ue=n(),u(ot.$$.fragment),ge=n(),bt=r("p"),bt.textContent=Qe,je=n(),u(Mt.$$.fragment),Pt=n(),u(rt.$$.fragment),Ot=n(),pt=r("p"),pt.textContent=Ee,Kt=n(),ut=r("ol"),ut.innerHTML=ze,te=n(),u(z.$$.fragment),ee=n(),ct=r("p"),ct.textContent=Ze,le=n(),u(mt.$$.fragment),se=n(),Jt=r("p"),Jt.textContent=Fe,ne=n(),u(Tt.$$.fragment),ae=n(),u(yt.$$.fragment),ie=n(),u(ht.$$.fragment),oe=n(),dt=r("p"),dt.textContent=_e,Me=n(),Ut=r("ol"),Ut.innerHTML=ke,re=n(),u(Z.$$.fragment),pe=n(),u(gt.$$.fragment),ue=n(),jt=r("p"),jt.textContent=We,ce=n(),u(F.$$.fragment),me=n(),u(wt.$$.fragment),Je=n(),It=r("ul"),It.innerHTML=Ve,Te=n(),u(ft.$$.fragment),ye=n(),Bt=r("p"),this.h()},l(t){const e=tl("svelte-u9bgzb",document.head);M=p(e,"META",{name:!0,content:!0}),e.forEach(l),o=a(t),U=p(t,"P",{}),we(U).forEach(l),w=a(t),c(d.$$.fragment,t),f=a(t),c(j.$$.fragment,t),k=a(t),c(q.$$.fragment,t),N=a(t),B=p(t,"P",{"data-svelte-h":!0}),h(B)!=="svelte-1k3k0tu"&&(B.textContent=G),W=a(t),c(C.$$.fragment,t),x=a(t),c(v.$$.fragment,t),Q=a(t),c(i.$$.fragment,t),g=a(t),V=p(t,"P",{"data-svelte-h":!0}),h(V)!=="svelte-pqh38m"&&(V.innerHTML=Ie),At=a(t),R=p(t,"P",{"data-svelte-h":!0}),h(R)!=="svelte-bw0cej"&&(R.textContent=fe),vt=a(t),H=p(t,"P",{"data-svelte-h":!0}),h(H)!=="svelte-t1qpmx"&&(H.innerHTML=Ce),St=a(t),c(E.$$.fragment,t),Qt=a(t),c(X.$$.fragment,t),Et=a(t),Y=p(t,"P",{"data-svelte-h":!0}),h(Y)!=="svelte-1rnoysy"&&(Y.textContent=$e),zt=a(t),L=p(t,"P",{"data-svelte-h":!0}),h(L)!=="svelte-1domsij"&&(L.textContent=be),Zt=a(t),c(D.$$.fragment,t),Ft=a(t),P=p(t,"P",{"data-svelte-h":!0}),h(P)!=="svelte-8sxtx3"&&(P.textContent=qe),_t=a(t),c(O.$$.fragment,t),kt=a(t),K=p(t,"P",{"data-svelte-h":!0}),h(K)!=="svelte-1yg6yh7"&&(K.innerHTML=Ne),Wt=a(t),c(tt.$$.fragment,t),Vt=a(t),et=p(t,"P",{"data-svelte-h":!0}),h(et)!=="svelte-ft17tr"&&(et.textContent=Be),Rt=a(t),c(lt.$$.fragment,t),Ht=a(t),st=p(t,"P",{"data-svelte-h":!0}),h(st)!=="svelte-qxk9qi"&&(st.textContent=xe),Xt=a(t),nt=p(t,"OL",{"data-svelte-h":!0}),h(nt)!=="svelte-udw0je"&&(nt.innerHTML=Ge),Yt=a(t),at=p(t,"P",{"data-svelte-h":!0}),h(at)!=="svelte-c21ogw"&&(at.textContent=Ae),Lt=a(t),c(it.$$.fragment,t),Dt=a(t),I=p(t,"DETAILS",{});var $=we(I);Ct=p($,"SUMMARY",{"data-svelte-h":!0}),h(Ct)!=="svelte-so6cx1"&&(Ct.textContent=ve),de=a($),$t=p($,"P",{"data-svelte-h":!0}),h($t)!=="svelte-2rzsq5"&&($t.textContent=Se),Ue=a($),c(ot.$$.fragment,$),ge=a($),bt=p($,"P",{"data-svelte-h":!0}),h(bt)!=="svelte-c25hqw"&&(bt.textContent=Qe),je=a($),c(Mt.$$.fragment,$),$.forEach(l),Pt=a(t),c(rt.$$.fragment,t),Ot=a(t),pt=p(t,"P",{"data-svelte-h":!0}),h(pt)!=="svelte-157lci4"&&(pt.textContent=Ee),Kt=a(t),ut=p(t,"OL",{"data-svelte-h":!0}),h(ut)!=="svelte-15wiqjs"&&(ut.innerHTML=ze),te=a(t),c(z.$$.fragment,t),ee=a(t),ct=p(t,"P",{"data-svelte-h":!0}),h(ct)!=="svelte-4u84x6"&&(ct.textContent=Ze),le=a(t),c(mt.$$.fragment,t),se=a(t),Jt=p(t,"P",{"data-svelte-h":!0}),h(Jt)!=="svelte-djgs24"&&(Jt.textContent=Fe),ne=a(t),c(Tt.$$.fragment,t),ae=a(t),c(yt.$$.fragment,t),ie=a(t),c(ht.$$.fragment,t),oe=a(t),dt=p(t,"P",{"data-svelte-h":!0}),h(dt)!=="svelte-18063wt"&&(dt.textContent=_e),Me=a(t),Ut=p(t,"OL",{"data-svelte-h":!0}),h(Ut)!=="svelte-tdiy2"&&(Ut.innerHTML=ke),re=a(t),c(Z.$$.fragment,t),pe=a(t),c(gt.$$.fragment,t),ue=a(t),jt=p(t,"P",{"data-svelte-h":!0}),h(jt)!=="svelte-1r51sxe"&&(jt.textContent=We),ce=a(t),c(F.$$.fragment,t),me=a(t),c(wt.$$.fragment,t),Je=a(t),It=p(t,"UL",{"data-svelte-h":!0}),h(It)!=="svelte-kyf9sf"&&(It.innerHTML=Ve),Te=a(t),c(ft.$$.fragment,t),ye=a(t),Bt=p(t,"P",{}),we(Bt).forEach(l),this.h()},h(){Gt(M,"name","hf:doc:metadata"),Gt(M,"content",rl)},m(t,e){_(document.head,M),s(t,o,e),s(t,U,e),s(t,w,e),m(d,t,e),s(t,f,e),m(j,t,e),s(t,k,e),m(q,t,e),s(t,N,e),s(t,B,e),s(t,W,e),m(C,t,e),s(t,x,e),m(v,t,e),s(t,Q,e),m(i,t,e),s(t,g,e),s(t,V,e),s(t,At,e),s(t,R,e),s(t,vt,e),s(t,H,e),s(t,St,e),m(E,t,e),s(t,Qt,e),m(X,t,e),s(t,Et,e),s(t,Y,e),s(t,zt,e),s(t,L,e),s(t,Zt,e),m(D,t,e),s(t,Ft,e),s(t,P,e),s(t,_t,e),m(O,t,e),s(t,kt,e),s(t,K,e),s(t,Wt,e),m(tt,t,e),s(t,Vt,e),s(t,et,e),s(t,Rt,e),m(lt,t,e),s(t,Ht,e),s(t,st,e),s(t,Xt,e),s(t,nt,e),s(t,Yt,e),s(t,at,e),s(t,Lt,e),m(it,t,e),s(t,Dt,e),s(t,I,e),_(I,Ct),_(I,de),_(I,$t),_(I,Ue),m(ot,I,null),_(I,ge),_(I,bt),_(I,je),m(Mt,I,null),s(t,Pt,e),m(rt,t,e),s(t,Ot,e),s(t,pt,e),s(t,Kt,e),s(t,ut,e),s(t,te,e),m(z,t,e),s(t,ee,e),s(t,ct,e),s(t,le,e),m(mt,t,e),s(t,se,e),s(t,Jt,e),s(t,ne,e),m(Tt,t,e),s(t,ae,e),m(yt,t,e),s(t,ie,e),m(ht,t,e),s(t,oe,e),s(t,dt,e),s(t,Me,e),s(t,Ut,e),s(t,re,e),m(Z,t,e),s(t,pe,e),m(gt,t,e),s(t,ue,e),s(t,jt,e),s(t,ce,e),m(F,t,e),s(t,me,e),m(wt,t,e),s(t,Je,e),s(t,It,e),s(t,Te,e),m(ft,t,e),s(t,ye,e),s(t,Bt,e),he=!0},p(t,[e]){const $={};e&2&&($.$$scope={dirty:e,ctx:t}),C.$set($);const Re={};e&2&&(Re.$$scope={dirty:e,ctx:t}),E.$set(Re);const He={};e&2&&(He.$$scope={dirty:e,ctx:t}),z.$set(He);const Xe={};e&2&&(Xe.$$scope={dirty:e,ctx:t}),Z.$set(Xe);const Ye={};e&2&&(Ye.$$scope={dirty:e,ctx:t}),F.$set(Ye)},i(t){he||(J(d.$$.fragment,t),J(j.$$.fragment,t),J(q.$$.fragment,t),J(C.$$.fragment,t),J(v.$$.fragment,t),J(i.$$.fragment,t),J(E.$$.fragment,t),J(X.$$.fragment,t),J(D.$$.fragment,t),J(O.$$.fragment,t),J(tt.$$.fragment,t),J(lt.$$.fragment,t),J(it.$$.fragment,t),J(ot.$$.fragment,t),J(Mt.$$.fragment,t),J(rt.$$.fragment,t),J(z.$$.fragment,t),J(mt.$$.fragment,t),J(Tt.$$.fragment,t),J(yt.$$.fragment,t),J(ht.$$.fragment,t),J(Z.$$.fragment,t),J(gt.$$.fragment,t),J(F.$$.fragment,t),J(wt.$$.fragment,t),J(ft.$$.fragment,t),he=!0)},o(t){T(d.$$.fragment,t),T(j.$$.fragment,t),T(q.$$.fragment,t),T(C.$$.fragment,t),T(v.$$.fragment,t),T(i.$$.fragment,t),T(E.$$.fragment,t),T(X.$$.fragment,t),T(D.$$.fragment,t),T(O.$$.fragment,t),T(tt.$$.fragment,t),T(lt.$$.fragment,t),T(it.$$.fragment,t),T(ot.$$.fragment,t),T(Mt.$$.fragment,t),T(rt.$$.fragment,t),T(z.$$.fragment,t),T(mt.$$.fragment,t),T(Tt.$$.fragment,t),T(yt.$$.fragment,t),T(ht.$$.fragment,t),T(Z.$$.fragment,t),T(gt.$$.fragment,t),T(F.$$.fragment,t),T(wt.$$.fragment,t),T(ft.$$.fragment,t),he=!1},d(t){t&&(l(o),l(U),l(w),l(f),l(k),l(N),l(B),l(W),l(x),l(Q),l(g),l(V),l(At),l(R),l(vt),l(H),l(St),l(Qt),l(Et),l(Y),l(zt),l(L),l(Zt),l(Ft),l(P),l(_t),l(kt),l(K),l(Wt),l(Vt),l(et),l(Rt),l(Ht),l(st),l(Xt),l(nt),l(Yt),l(at),l(Lt),l(Dt),l(I),l(Pt),l(Ot),l(pt),l(Kt),l(ut),l(te),l(ee),l(ct),l(le),l(se),l(Jt),l(ne),l(ae),l(ie),l(oe),l(dt),l(Me),l(Ut),l(re),l(pe),l(ue),l(jt),l(ce),l(me),l(Je),l(It),l(Te),l(ye),l(Bt)),l(M),y(d,t),y(j,t),y(q,t),y(C,t),y(v,t),y(i,t),y(E,t),y(X,t),y(D,t),y(O,t),y(tt,t),y(lt,t),y(it,t),y(ot),y(Mt),y(rt,t),y(z,t),y(mt,t),y(Tt,t),y(yt,t),y(ht,t),y(Z,t),y(gt,t),y(F,t),y(wt,t),y(ft,t)}}}const rl='{"title":"Chat Templates","local":"chat-templates","sections":[{"title":"Introduction","local":"introduction","sections":[],"depth":2},{"title":"Model Types and Templates","local":"model-types-and-templates","sections":[{"title":"Base Models vs Instruct Models","local":"base-models-vs-instruct-models","sections":[],"depth":3},{"title":"Common Template Formats","local":"common-template-formats","sections":[],"depth":3},{"title":"Advanced Features","local":"advanced-features","sections":[],"depth":3}],"depth":2},{"title":"Best Practices","local":"best-practices","sections":[{"title":"General Guidelines","local":"general-guidelines","sections":[],"depth":3}],"depth":2},{"title":"Hands-on Exercise","local":"hands-on-exercise","sections":[],"depth":2},{"title":"Additional Resources","local":"additional-resources","sections":[],"depth":2}],"depth":1}';function pl(b){return Pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class hl extends Oe{constructor(M){super(),Ke(this,M,pl,Ml,De,{})}}export{hl as component};
