import{s as wt,n as vt,o as Lt}from"../chunks/scheduler.37c15a92.js";import{S as Tt,i as bt,g as s,s as o,r as Q,A as yt,h as r,f as n,c as l,j as ft,u as J,x as a,k as gt,y as _t,a as i,v as V,d as X,t as Z,w as tt}from"../chunks/index.2bf4358c.js";import{H as dt}from"../chunks/Heading.8ada512a.js";import{E as Mt}from"../chunks/index.3b54d7fe.js";function $t(et){let u,x,$,H,p,C,h,nt='<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/bonus-unit1/thumbnail.jpg" alt="Bonus Unit 1 Thumbnail"/>',P,m,it="Welcome to this first <strong>Bonus Unit</strong>, where you’ll learn to <strong>fine-tune a Large Language Model (LLM) for function calling</strong>.",A,c,ot="In terms of LLMs, function calling is quickly becoming a <em>must-know</em> technique.",U,f,lt="The idea is, rather than relying only on prompt-based approaches like we did in Unit 1, function calling trains your model to <strong>take actions and interpret observations during the training phase</strong>, making your AI more robust.",I,g,st="<p><strong>When should I do this Bonus Unit?</strong></p> <p>This section is <strong>optional</strong> and is more advanced than Unit 1, so don’t hesitate to either do this unit now or revisit it when your knowledge has improved thanks to this course.</p> <p>But don’t worry, this Bonus Unit is designed to have all the information you need, so we’ll walk you through every core concept of fine-tuning a model for function-calling even if you haven’t learned yet the inner workings of fine-tuning.</p>",B,d,rt="The best way for you to be able to follow this Bonus Unit is:",O,w,at='<li><p>Know how to Fine-Tune an LLM with Transformers, if it’s not the case <a href="https://huggingface.co/learn/nlp-course/chapter3/1?fw=pt" rel="nofollow">check this</a>.</p></li> <li><p>Know how to use <code>SFTTrainer</code> to fine-tune our model, to learn more about it <a href="https://huggingface.co/learn/nlp-course/en/chapter11/1" rel="nofollow">check this documentation</a>.</p></li>',R,E,q,v,F,L,ut=`<li><p><strong>Function Calling</strong><br/>
How modern LLMs structure their conversations effectively letting them trigger <strong>Tools</strong>.</p></li> <li><p><strong>LoRA (Low-Rank Adaptation)</strong><br/>
A <strong>lightweight and efficient</strong> fine-tuning method that cuts down on computational and storage overhead. LoRA makes training large models <em>faster, cheaper, and easier</em> to deploy.</p></li> <li><p><strong>The Thought → Act → Observe Cycle</strong> in Function Calling models<br/>
A simple but powerful approach for structuring how your model decides when (and how) to call functions, track intermediate steps, and interpret the results from external Tools or APIs.</p></li> <li><p><strong>New Special Tokens</strong><br/>
We’ll introduce <strong>special markers</strong> that help the model distinguish between:</p> <ul><li>Internal “chain-of-thought” reasoning</li> <li>Outgoing function calls</li> <li>Responses coming back from external tools</li></ul></li>`,j,z,S,T,pt="By the end of this bonus unit, you’ll be able to:",W,b,ht="<li><strong>Understand</strong> the inner working of APIs when it comes to Tools.</li> <li><strong>Fine-tune</strong> a model using the LoRA technique.</li> <li><strong>Implement</strong> and <strong>modify</strong> the Thought → Act → Observe cycle to create robust and maintainable Function-calling workflows.</li> <li><strong>Design and utilize</strong> special tokens to seamlessly separate the model’s internal reasoning from its external actions.</li>",K,y,mt="And you’ll <strong>have fine-tuned your own model to do function calling.</strong> 🔥",Y,_,ct="Let’s dive into <strong>function calling</strong>!",D,M,G,k,N;return p=new dt({props:{title:"Introduction",local:"introduction",headingTag:"h1"}}),v=new dt({props:{title:"What You’ll Learn",local:"what-youll-learn",headingTag:"h2"}}),M=new Mt({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/en/bonus-unit1/introduction.mdx"}}),{c(){u=s("meta"),x=o(),$=s("p"),H=o(),Q(p.$$.fragment),C=o(),h=s("p"),h.innerHTML=nt,P=o(),m=s("p"),m.innerHTML=it,A=o(),c=s("p"),c.innerHTML=ot,U=o(),f=s("p"),f.innerHTML=lt,I=o(),g=s("blockquote"),g.innerHTML=st,B=o(),d=s("p"),d.textContent=rt,O=o(),w=s("ol"),w.innerHTML=at,R=o(),E=s("hr"),q=o(),Q(v.$$.fragment),F=o(),L=s("ol"),L.innerHTML=ut,j=o(),z=s("hr"),S=o(),T=s("p"),T.textContent=pt,W=o(),b=s("ul"),b.innerHTML=ht,K=o(),y=s("p"),y.innerHTML=mt,Y=o(),_=s("p"),_.innerHTML=ct,D=o(),Q(M.$$.fragment),G=o(),k=s("p"),this.h()},l(t){const e=yt("svelte-u9bgzb",document.head);u=r(e,"META",{name:!0,content:!0}),e.forEach(n),x=l(t),$=r(t,"P",{}),ft($).forEach(n),H=l(t),J(p.$$.fragment,t),C=l(t),h=r(t,"P",{"data-svelte-h":!0}),a(h)!=="svelte-1lr1l38"&&(h.innerHTML=nt),P=l(t),m=r(t,"P",{"data-svelte-h":!0}),a(m)!=="svelte-8z0cvz"&&(m.innerHTML=it),A=l(t),c=r(t,"P",{"data-svelte-h":!0}),a(c)!=="svelte-1sg02ug"&&(c.innerHTML=ot),U=l(t),f=r(t,"P",{"data-svelte-h":!0}),a(f)!=="svelte-13lhy39"&&(f.innerHTML=lt),I=l(t),g=r(t,"BLOCKQUOTE",{"data-svelte-h":!0}),a(g)!=="svelte-8tejys"&&(g.innerHTML=st),B=l(t),d=r(t,"P",{"data-svelte-h":!0}),a(d)!=="svelte-euwzjp"&&(d.textContent=rt),O=l(t),w=r(t,"OL",{"data-svelte-h":!0}),a(w)!=="svelte-615ypg"&&(w.innerHTML=at),R=l(t),E=r(t,"HR",{}),q=l(t),J(v.$$.fragment,t),F=l(t),L=r(t,"OL",{"data-svelte-h":!0}),a(L)!=="svelte-xska3c"&&(L.innerHTML=ut),j=l(t),z=r(t,"HR",{}),S=l(t),T=r(t,"P",{"data-svelte-h":!0}),a(T)!=="svelte-uu4unr"&&(T.textContent=pt),W=l(t),b=r(t,"UL",{"data-svelte-h":!0}),a(b)!=="svelte-6ae99j"&&(b.innerHTML=ht),K=l(t),y=r(t,"P",{"data-svelte-h":!0}),a(y)!=="svelte-16b35kb"&&(y.innerHTML=mt),Y=l(t),_=r(t,"P",{"data-svelte-h":!0}),a(_)!=="svelte-18eun8h"&&(_.innerHTML=ct),D=l(t),J(M.$$.fragment,t),G=l(t),k=r(t,"P",{}),ft(k).forEach(n),this.h()},h(){gt(u,"name","hf:doc:metadata"),gt(u,"content",kt)},m(t,e){_t(document.head,u),i(t,x,e),i(t,$,e),i(t,H,e),V(p,t,e),i(t,C,e),i(t,h,e),i(t,P,e),i(t,m,e),i(t,A,e),i(t,c,e),i(t,U,e),i(t,f,e),i(t,I,e),i(t,g,e),i(t,B,e),i(t,d,e),i(t,O,e),i(t,w,e),i(t,R,e),i(t,E,e),i(t,q,e),V(v,t,e),i(t,F,e),i(t,L,e),i(t,j,e),i(t,z,e),i(t,S,e),i(t,T,e),i(t,W,e),i(t,b,e),i(t,K,e),i(t,y,e),i(t,Y,e),i(t,_,e),i(t,D,e),V(M,t,e),i(t,G,e),i(t,k,e),N=!0},p:vt,i(t){N||(X(p.$$.fragment,t),X(v.$$.fragment,t),X(M.$$.fragment,t),N=!0)},o(t){Z(p.$$.fragment,t),Z(v.$$.fragment,t),Z(M.$$.fragment,t),N=!1},d(t){t&&(n(x),n($),n(H),n(C),n(h),n(P),n(m),n(A),n(c),n(U),n(f),n(I),n(g),n(B),n(d),n(O),n(w),n(R),n(E),n(q),n(F),n(L),n(j),n(z),n(S),n(T),n(W),n(b),n(K),n(y),n(Y),n(_),n(D),n(G),n(k)),n(u),tt(p,t),tt(v,t),tt(M,t)}}}const kt='{"title":"Introduction","local":"introduction","sections":[{"title":"What You’ll Learn","local":"what-youll-learn","sections":[],"depth":2}],"depth":1}';function xt(et){return Lt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ut extends Tt{constructor(u){super(),bt(this,u,xt,$t,wt,{})}}export{Ut as component};
