import{s as Lt,n as Tt,o as bt}from"../chunks/scheduler.505acc25.js";import{S as yt,i as $t,e as s,s as l,c as V,h as xt,a as r,d as n,b as o,f as dt,g as X,j as a,k as wt,l as Mt,m as i,n as Z,t as tt,o as et,p as nt}from"../chunks/index.fbb49fb4.js";import{C as _t}from"../chunks/CopyLLMTxtMenu.564b44fd.js";import{H as vt}from"../chunks/Heading.511e0027.js";import{E as kt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8c19e80e.js";function Ht(it){let u,H,_,C,p,P,m,A,f,lt='<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/bonus-unit1/thumbnail.jpg" alt="Bonus Unit 1 Thumbnail"/>',U,h,ot="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>.",I,g,st="In terms of LLMs, function calling is quickly becoming a <em>must-know</em> technique.",B,c,rt="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.",O,d,at="<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>",R,w,ut="The best way for you to be able to follow this Bonus Unit is:",E,v,pt='<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>',q,z,F,L,S,T,mt=`<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,W,K,b,ft="By the end of this bonus unit, you’ll be able to:",Y,y,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>",D,$,gt="And you’ll <strong>have fine-tuned your own model to do function calling.</strong> 🔥",G,x,ct="Let’s dive into <strong>function calling</strong>!",N,M,Q,k,J;return p=new _t({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),m=new vt({props:{title:"Introduction",local:"introduction",headingTag:"h1"}}),L=new vt({props:{title:"What You’ll Learn",local:"what-youll-learn",headingTag:"h2"}}),M=new kt({props:{source:"https://github.com/huggingface/agents-course/blob/main/units/en/bonus-unit1/introduction.mdx"}}),{c(){u=s("meta"),H=l(),_=s("p"),C=l(),V(p.$$.fragment),P=l(),V(m.$$.fragment),A=l(),f=s("p"),f.innerHTML=lt,U=l(),h=s("p"),h.innerHTML=ot,I=l(),g=s("p"),g.innerHTML=st,B=l(),c=s("p"),c.innerHTML=rt,O=l(),d=s("blockquote"),d.innerHTML=at,R=l(),w=s("p"),w.textContent=ut,E=l(),v=s("ol"),v.innerHTML=pt,q=l(),z=s("hr"),F=l(),V(L.$$.fragment),S=l(),T=s("ol"),T.innerHTML=mt,j=l(),W=s("hr"),K=l(),b=s("p"),b.textContent=ft,Y=l(),y=s("ul"),y.innerHTML=ht,D=l(),$=s("p"),$.innerHTML=gt,G=l(),x=s("p"),x.innerHTML=ct,N=l(),V(M.$$.fragment),Q=l(),k=s("p"),this.h()},l(t){const e=xt("svelte-u9bgzb",document.head);u=r(e,"META",{name:!0,content:!0}),e.forEach(n),H=o(t),_=r(t,"P",{}),dt(_).forEach(n),C=o(t),X(p.$$.fragment,t),P=o(t),X(m.$$.fragment,t),A=o(t),f=r(t,"P",{"data-svelte-h":!0}),a(f)!=="svelte-1lr1l38"&&(f.innerHTML=lt),U=o(t),h=r(t,"P",{"data-svelte-h":!0}),a(h)!=="svelte-8z0cvz"&&(h.innerHTML=ot),I=o(t),g=r(t,"P",{"data-svelte-h":!0}),a(g)!=="svelte-1sg02ug"&&(g.innerHTML=st),B=o(t),c=r(t,"P",{"data-svelte-h":!0}),a(c)!=="svelte-13lhy39"&&(c.innerHTML=rt),O=o(t),d=r(t,"BLOCKQUOTE",{"data-svelte-h":!0}),a(d)!=="svelte-8tejys"&&(d.innerHTML=at),R=o(t),w=r(t,"P",{"data-svelte-h":!0}),a(w)!=="svelte-euwzjp"&&(w.textContent=ut),E=o(t),v=r(t,"OL",{"data-svelte-h":!0}),a(v)!=="svelte-615ypg"&&(v.innerHTML=pt),q=o(t),z=r(t,"HR",{}),F=o(t),X(L.$$.fragment,t),S=o(t),T=r(t,"OL",{"data-svelte-h":!0}),a(T)!=="svelte-xska3c"&&(T.innerHTML=mt),j=o(t),W=r(t,"HR",{}),K=o(t),b=r(t,"P",{"data-svelte-h":!0}),a(b)!=="svelte-uu4unr"&&(b.textContent=ft),Y=o(t),y=r(t,"UL",{"data-svelte-h":!0}),a(y)!=="svelte-6ae99j"&&(y.innerHTML=ht),D=o(t),$=r(t,"P",{"data-svelte-h":!0}),a($)!=="svelte-16b35kb"&&($.innerHTML=gt),G=o(t),x=r(t,"P",{"data-svelte-h":!0}),a(x)!=="svelte-18eun8h"&&(x.innerHTML=ct),N=o(t),X(M.$$.fragment,t),Q=o(t),k=r(t,"P",{}),dt(k).forEach(n),this.h()},h(){wt(u,"name","hf:doc:metadata"),wt(u,"content",Ct)},m(t,e){Mt(document.head,u),i(t,H,e),i(t,_,e),i(t,C,e),Z(p,t,e),i(t,P,e),Z(m,t,e),i(t,A,e),i(t,f,e),i(t,U,e),i(t,h,e),i(t,I,e),i(t,g,e),i(t,B,e),i(t,c,e),i(t,O,e),i(t,d,e),i(t,R,e),i(t,w,e),i(t,E,e),i(t,v,e),i(t,q,e),i(t,z,e),i(t,F,e),Z(L,t,e),i(t,S,e),i(t,T,e),i(t,j,e),i(t,W,e),i(t,K,e),i(t,b,e),i(t,Y,e),i(t,y,e),i(t,D,e),i(t,$,e),i(t,G,e),i(t,x,e),i(t,N,e),Z(M,t,e),i(t,Q,e),i(t,k,e),J=!0},p:Tt,i(t){J||(tt(p.$$.fragment,t),tt(m.$$.fragment,t),tt(L.$$.fragment,t),tt(M.$$.fragment,t),J=!0)},o(t){et(p.$$.fragment,t),et(m.$$.fragment,t),et(L.$$.fragment,t),et(M.$$.fragment,t),J=!1},d(t){t&&(n(H),n(_),n(C),n(P),n(A),n(f),n(U),n(h),n(I),n(g),n(B),n(c),n(O),n(d),n(R),n(w),n(E),n(v),n(q),n(z),n(F),n(S),n(T),n(j),n(W),n(K),n(b),n(Y),n(y),n(D),n($),n(G),n(x),n(N),n(Q),n(k)),n(u),nt(p,t),nt(m,t),nt(L,t),nt(M,t)}}}const Ct='{"title":"Introduction","local":"introduction","sections":[{"title":"What You’ll Learn","local":"what-youll-learn","sections":[],"depth":2}],"depth":1}';function Pt(it){return bt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Rt extends yt{constructor(u){super(),$t(this,u,Pt,Ht,Lt,{})}}export{Rt as component};
