PageSourceSearch

https://www.foundrylocal.ai/_app/immutable/nodes/2.CoCdDCtN.js

js foundrylocal.ai collected 2026-10-02 04:30:09 UTC 37,084 bytes, 284 lines download raw bytes

1import{t as e}from"../chunks/DK3Fl9T5.js";import{$t as t,At as n,Bt as r,C as i,D as a,E as o,Ft as s,G as c,Gt as l,It as u,J as d,N as f,O as p,Pt as m,R as h,U as g,Ut as _,Vt as v,Wt as y,Z as b,an as x,b as S,bt as C,ct as w,en as T,et as E,h as D,ht as O,i as k,in as A,it as j,k as M,l as N,lt as P,mt as F,nt as I,o as L,ot as R,r as z,tt as ee,ut as B,v as te,x as V,y as H,z as U,zt as W}from"../chunks/BFH5QoGh.js";import{w as G}from"../chunks/BsEKvHzv.js";import{i as K,t as q}from"../chunks/BY9LwpoE.js";import{c as J,d as Y,l as X,t as Z,u as Q}from"../chunks/f5SpsF3u.js";var ne=e({load:()=>$}),$=()=>({title:`Foundry Local - Run AI Models Locally with Complete Privacy`,description:`Run AI models locally on your device. Foundry Local provides on-device inference with complete data privacy, no Azure subscription required.`,keywords:`foundry local, microsoft ai, local ai, on-device inference, onnx runtime, openai compatible, npu, gpu, cpu, machine learning`,url:`https://foundrylocal.ai`,image:`https://foundrylocal.ai/og-image.png`}),re=B(`<div class="bg-gradient-to-b from-neutral-50 to-white dark:from-transparent dark:to-neutral-900"><div class="mx-auto max-w-[85rem] px-4 py-16 sm:px-6 lg:px-8 lg:py-24"><div class="mx-auto mb-16 max-w-3xl text-center"><h2 class="mb-4 text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl dark:text-white">The fastest path from SDK install to shipped local AI</h2> <p class="text-lg text-gray-600 dark:text-neutral-400">Start with native SDKs, keep inference in your app process, and use CLI or REST tools only
2				when they help your development workflow.</p></div> <div class="grid auto-rows-[minmax(180px,auto)] gap-4 sm:grid-cols-2 lg:grid-cols-4"><div tabindex="0" role="group" aria-labelledby="sdk-lifecycle-title" aria-describedby="sdk-lifecycle-description" class="group border-border bg-card text-card-foreground hover:border-primary/50 focus-visible:ring-primary focus-visible:ring-offset-background relative overflow-hidden rounded-3xl border shadow-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none lg:col-span-2 lg:row-span-2"><div class="relative z-10 flex h-full flex-col p-8"><div class="bg-primary/10 text-primary mb-4 flex size-14 items-center justify-center rounded-2xl transition-transform duration-300 group-hover:scale-110"><!></div> <h3 id="sdk-lifecycle-title" class="mb-2 text-2xl font-bold text-gray-900 dark:text-white">One SDK lifecycle</h3> <p id="sdk-lifecycle-description" class="mb-6 text-lg text-gray-600 dark:text-neutral-400">Initialize the manager, choose a model alias, download and cache it, load it, then call
3						chat or audio clients from your app.</p> <div class="mt-auto overflow-hidden rounded-xl bg-gray-900 p-4 font-mono text-xs text-gray-300 dark:bg-black/40"><div class="mb-1 text-emerald-400">// SDK lifecycle: initialize, download, load, call</div> <div class="code-line code-line-1"><span class="text-purple-400">const</span> mgr = <span class="text-blue-400">FoundryLocalManager</span>.<span class="text-yellow-300">create</span> <span class="text-amber-300">'my-app'</span> </div> <div class="code-line code-line-2"><span class="text-purple-400">const</span> model = <span class="text-purple-400">await</span> mgr.<span class="text-yellow-300">catalog</span>.<span class="text-yellow-300">getModel</span>(<span class="text-amber-300">'qwen2.5-0.5b'</span>)</div> <div class="code-line code-line-3"><span class="text-purple-400">await</span> model.<span class="text-yellow-300">download</span>(); <span class="text-purple-400">await</span> model.<span class="text-yellow-300">load</span>()</div> <div class="code-line code-line-4"><span class="text-purple-400">const</span> res = <span class="text-purple-400">await</span> model.<span class="text-yellow-300">createChatClient</span>().<span class="text-yellow-300">completeChat</span>(msgs)<span class="typing-cursor">|</span></div></div> <style>.code-line {
4							opacity: 0;
5							animation: typeIn 0.5s ease-out forwards;
6						}
7						.code-line-1 {
8							animation-delay: 0.3s;
9						}
10						.code-line-2 {
11							animation-delay: 0.9s;
12						}
13						.code-line-3 {
14							animation-delay: 1.5s;
15						}
16						.code-line-4 {
17							animation-delay: 2.1s;
18						}
19						@keyframes typeIn {
20							from {
21								opacity: 0;
22								transform: translateX(-10px);
23							}
24							to {
25								opacity: 1;
26								transform: translateX(0);
27							}
28						}
29						.typing-cursor {
30							animation: blink 0.8s step-end infinite;
31							color: #22c55e;
32							font-weight: bold;
33						}
34						@keyframes blink {
35							0%,
36							100% {
37								opacity: 1;
38							}
39							50% {
40								opacity: 0;
41							}
42						}</style></div></div> <div tabindex="0" role="group" aria-labelledby="hardware-title" aria-describedby="hardware-description" class="group border-border bg-card text-card-foreground hover:border-primary/50 focus-visible:ring-primary focus-visible:ring-offset-background relative overflow-hidden rounded-3xl border shadow-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none lg:col-span-2 lg:row-span-2"><div class="relative z-10 flex h-full flex-col p-8"><div class="mb-4 flex size-14 items-center justify-center rounded-2xl bg-blue-500/10 text-blue-500 transition-transform duration-300 group-hover:scale-110"><!></div> <h3 id="hardware-title" class="mb-2 text-2xl font-bold text-gray-900 dark:text-white">Hardware handled for you</h3> <p id="hardware-description" class="mb-6 text-lg text-gray-600 dark:text-neutral-400">The SDK picks and registers execution providers so apps can target NPU, GPU, or CPU
43						without custom device plumbing.</p> <div class="mt-auto grid grid-cols-3 gap-3"><div class="hw-card hw-1 border-border bg-secondary/50 flex flex-col items-center rounded-xl border p-3"><div class="text-primary text-2xl font-bold">NPU</div> <div class="text-muted-foreground text-xs whitespace-nowrap">Neural Engine</div></div> <div class="hw-card hw-2 border-border bg-secondary/50 flex flex-col items-center rounded-xl border p-3"><div class="text-2xl font-bold text-cyan-600">GPU</div> <div class="text-muted-foreground text-xs whitespace-nowrap">Graphics Card</div></div> <div class="hw-card hw-3 border-border bg-secondary/50 flex flex-col items-center rounded-xl border p-3"><div class="text-2xl font-bold text-violet-500">CPU</div> <div class="text-muted-foreground text-xs whitespace-nowrap">Processor</div></div></div> <style>.hw-card {
44							animation: hwGlow 3s ease-in-out infinite;
45							box-shadow: 0 0 0 transparent;
46						}
47						.hw-1 {
48							animation-delay: 0s;
49						}
50						.hw-2 {
51							animation-delay: 0.5s;
52						}
53						.hw-3 {
54							animation-delay: 1s;
55						}
56						@keyframes hwGlow {
57							0%,
58							100% {
59								box-shadow: 0 0 0 transparent;
60								transform: scale(1);
61							}
62							50% {
63								box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
64								transform: scale(1.02);
65							}
66						}</style></div></div> <div tabindex="0" role="group" aria-labelledby="offline-runtime-title" aria-describedby="offline-runtime-description" class="group border-border bg-card text-card-foreground hover:border-primary/50 focus-visible:ring-primary focus-visible:ring-offset-background relative overflow-hidden rounded-3xl border shadow-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"><div class="relative z-10 p-6 pb-20"><div class="mb-4 flex size-12 items-center justify-center rounded-xl bg-emerald-500/10 text-emerald-500 transition-transform duration-300 group-hover:scale-110"><!></div> <h3 id="offline-runtime-title" class="mb-2 text-xl font-semibold text-gray-900 dark:text-white">Offline app runtime</h3> <p id="offline-runtime-description" class="text-gray-600 dark:text-neutral-400">The runtime and cached models stay local so user workflows keep running without a
67						network.</p></div> <div class="absolute right-3 bottom-3 flex items-center gap-3"><div class="signal-container flex items-end gap-1"><div class="signal-bar bar-1 h-2 w-1.5 rounded-sm bg-emerald-500"></div> <div class="signal-bar bar-2 h-3 w-1.5 rounded-sm bg-emerald-500"></div> <div class="signal-bar bar-3 h-4 w-1.5 rounded-sm bg-emerald-500"></div> <div class="signal-bar bar-4 h-5 w-1.5 rounded-sm bg-emerald-500"></div></div> <div class="checkmark-container">
67<svg class="checkmark-icon size-6 text-emerald-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" aria-hidden="true"><path class="checkmark-path" d="M5 13l4 4L19 7" stroke-linecap="round" stroke-linejoin="round"></path></svg></div></div> <style>.bar-1 {
68						animation: signalRed 5s ease-in-out infinite;
69					}
70					.bar-2,
71					.bar-3,
72					.bar-4 {
73						animation: signalGray 5s ease-in-out infinite;
74					}
75
76					@keyframes signalRed {
77						0%,
78						20% {
79							background-color: #22c55e;
80						}
81						30%,
82						60% {
83							background-color: #ef4444;
84						}
85						70%,
86						100% {
87							background-color: #22c55e;
88						}
89					}
90					@keyframes signalGray {
91						0%,
92						20% {
93							background-color: #22c55e;
94						}
95						30%,
96						60% {
97							background-color: #52525b;
98						}
99						70%,
100						100% {
101							background-color: #22c55e;
102						}
103					}
104					.checkmark-icon {
105						animation: checkSync 5s ease-in-out infinite;
106					}
107					.checkmark-path {
108						stroke-dasharray: 30;
109						animation: checkDrawSync 5s ease-in-out infinite;
110					}
111					@keyframes checkSync {
112						0%,
113						100% {
114							transform: scale(1);
115						}
116						30%,
117						35% {
118							transform: scale(1.2);
119						}
120						70%,
121						75% {
122							transform: scale(1.2);
123						}
124					}
125					@keyframes checkDrawSync {
126						0%,
127						25% {
128							stroke-dashoffset: 0;
129						}
130						28% {
131							stroke-dashoffset: 30;
132						}
133						35%,
134						65% {
135							stroke-dashoffset: 0;
136						}
137						68% {
138							stroke-dashoffset: 30;
139						}
140						75%,
141						100% {
142							stroke-dashoffset: 0;
143						}
144					}</style></div> <div tabindex="0" role="group" aria-labelledby="native-sdks-title" aria-describedby="native-sdks-description" class="group border-border bg-card text-card-foreground hover:border-primary/50 focus-visible:ring-primary focus-visible:ring-offset-background relative overflow-hidden rounded-3xl border shadow-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"><div class="relative z-10 p-6 pb-20"><div class="mb-4 flex size-12 items-center justify-center rounded-xl bg-orange-500/10 text-orange-500 transition-transform duration-300 group-hover:scale-110"><!></div> <h3 id="native-sdks-title" class="mb-2 text-xl font-semibold text-gray-900 dark:text-white">Native SDKs</h3> <p id="native-sdks-description" class="text-gray-600 dark:text-neutral-400">Start in Python or JavaScript; ship production apps in C# and Rust too.</p></div> <div class="absolute right-4 bottom-4 flex gap-2"><div class="lang-badge lang-1 flex size-8 items-center justify-center rounded-lg bg-blue-500/10 text-xs font-bold text-blue-600 dark:text-blue-400">PY</div> <div class="lang-badge lang-2 flex size-8 items-center justify-center rounded-lg bg-yellow-500/10 text-xs font-bold text-yellow-700 dark:text-yellow-400">JS</div> <div class="lang-badge lang-3 flex size-8 items-center justify-center rounded-lg bg-purple-500/10 text-xs font-bold text-purple-600 dark:text-purple-400">C#</div> <div class="lang-badge lang-4 flex size-8 items-center justify-center rounded-lg bg-orange-500/10 text-xs font-bold text-orange-700 dark:text-orange-400">RS</div></div> <style>.lang-badge {
145						animation: langPop 4s ease-in-out infinite;
146					}
147					.lang-1 {
148						animation-delay: 0s;
149					}
150					.lang-2 {
151						animation-delay: 0.2s;
152					}
153					.lang-3 {
154						animation-delay: 0.4s;
155					}
156					.lang-4 {
157						animation-delay: 0.6s;
158					}
159					@keyframes langPop {
160						0%,
161						100% {
162							transform: scale(1);
163						}
164						10%,
165						30% {
166							transform: scale(1.15);
167						}
168					}</style></div> <div tabindex="0" role="group" aria-labelledby="native-rest-title" aria-describedby="native-rest-description" class="group border-border bg-card text-card-foreground hover:border-primary/50 focus-visible:ring-primary focus-visible:ring-offset-background relative overflow-hidden rounded-3xl border shadow-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"><div class="relative z-10 p-6 pb-20"><div class="mb-4 flex size-12 items-center justify-center rounded-xl bg-pink-500/10 text-pink-500 transition-transform duration-300 group-hover:scale-110"><!></div> <h3 id="native-rest-title" class="mb-2 text-xl font-semibold text-gray-900 dark:text-white">Native first, REST when needed</h3> <p id="native-rest-description" class="text-gray-600 dark:text-neutral-400">Use SDK clients in-process, or start the optional OpenAI-compatible server for
169						frameworks like LangChain.</p></div> <div class="absolute right-3 bottom-3 overflow-hidden rounded-lg bg-gray-900/90 p-2"><div class="api-compare font-mono text-[10px] leading-tight"><div class="api-line api-line-1 text-gray-400 line-through">base_url=<span class="text-amber-300">"api.openai.com"</span></div> <div class="api-line api-line-2 text-emerald-400">base_url=<span class="text-amber-300">"localhost"</span></div></div></div> <style>.api-line {
170						animation: apiLineReveal 6s ease-in-out infinite;
171					}
172					.api-line-1 {
173						animation-delay: 0s;
174					}
175					.api-line-2 {
176						animation-delay: 0.3s;
177					}
178					@keyframes apiLineReveal {
179						0%,
180						10% {
181							opacity: 0;
182							transform: translateX(-5px);
183						}
184						20%,
185						80% {
186							opacity: 1;
187							transform: translateX(0);
188						}
189						90%,
190						100% {
191							opacity: 0;
192							transform: translateX(0);
193						}
194					}</style></div> <div tabindex="0" role="group" aria-labelledby="data-privacy-title" aria-describedby="data-privacy-description" class="group border-border bg-card text-card-foreground hover:border-primary/50 focus-visible:ring-primary focus-visible:ring-offset-background relative overflow-hidden rounded-3xl border shadow-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"><div class="relative z-10 p-6 pb-20"><div class="mb-4 flex size-12 items-center justify-center rounded-xl bg-indigo-500/10 text-indigo-500 transition-transform duration-300 group-hover:scale-110"><!></div> <h3 id="data-privacy-title" class="mb-2 text-xl font-semibold text-gray-900 dark:text-white">Data Privacy</h3> <p id="data-privacy-description" class="text-gray-600 dark:text-neutral-400">Prompts, audio, and responses stay on the user's device.</p></div> <div class="absolute -right-4 -bottom-4"><!></div> <style>.shield-glow {
195						animation: shieldPulse 3s ease-in-out infinite;
196						filter: drop-shadow(0 0 0 transparent);
197					}
198					@keyframes shieldPulse {
199						0%,
200						100% {
201							opacity: 0.2;
202							filter: drop-shadow(0 0 0 transparent);
203							transform: scale(1);
204						}
205						50% {
206							opacity: 0.4;
207							filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.4));
208							transform: scale(1.05);
209						}
210					}</style></div></div></div></div>`);function ie(e,n){T(n,!1);let r=W();f(()=>{if(C(r)){let e=Array.from(C(r).children);e.forEach((e,t)=>{e.style.opacity=`0`,e.style.transform=`translateY(30px)`});let t=()=>{e.forEach((e,t)=>{e.style.transition=`opacity 600ms cubic-bezier(0.4, 0, 0.2, 1), transform 600ms cubic-bezier(0.4, 0, 0.2, 1)`,e.style.transitionDelay=`${t*100}ms`,requestAnimationFrame(()=>{e.style.opacity=`1`,e.style.transform=`translateY(0)`})})},n=C(r).getBoundingClientRect();if(n.top<window.innerHeight&&n.bottom>0)t();else{let e=new IntersectionObserver(n=>
210{n.forEach(n=>{n.isIntersecting&&(t(),e.unobserve(C(r)))})},{threshold:.1});e.observe(C(r))}}}),h();var i=re(),o=m(i),s=m(o),c=m(s);d(c,(e,t)=>Y?.(e,t),()=>({delay:0,duration:800,animation:`slide-up`,threshold:.2})),d(u(c,2),(e,t)=>Y?.(e,t),()=>({delay:200,duration:800,animation:`slide-up`,threshold:.2})),x(s);var l=u(s,2),p=m(l),g=m(p),_=m(g);N(m(_),{class:`size-7`,"aria-hidden":`true`}),x(_);var y=u(_,6),b=u(m(y),2),E=u(m(b),5);E.nodeValue=`({ appName: `;var D=u(E,2);D.nodeValue=` })`,x(b),A(6),x(y),A(2),x(g),x(p);var O=u(p,2),k=m(O),j=m(k);te(m(j),{class:`size-7`,"aria-hidden":`true`}),x(j),A(8),x(k),x(O);var M=u(O,2),P=m(M),F=m(P);z(m(F),{class:`size-6`,"aria-hidden":`true`}),x(F),A(4),x(P),A(4),x(M);var I=u(M,2),R=m(I),ee=m(R);S(m(ee),{class:`size-6`,"aria-hidden":`true`}),x(ee),A(4),x(R),A(4),x(I);var B=u(I,2),V=m(B),H=m(V);a(m(H),{class:`size-6`,"aria-hidden":`true`}),x(H),A(4),x(V),A(4),x(B);var G=u(B,2),K=m(G),q=m(K);L(m(q),{class:`size-6`,"aria-hidden":`true`}),x(q),A(4),x(K);var J=u(K,2);L(m(J),{class:`shield-glow size-24 text-indigo-500/20`,"aria-hidden":`true`}),x(J),A(2),x(G),x(l),U(l,e=>v(r,e),()=>C(r)),x(o),x(i),w(e,i),t()}var ae=B(`<button type="button"> </button>`),oe=B(`<!> Copied`,1),se=B(`<!> Copy`,1),ce=B(`<section class="border-primary/20 bg-background/55 rounded-lg border p-3"><div class="mb-2 flex items-center justify-between gap-3"><div class="text-muted-foreground flex items-center gap-2 text-xs font-medium"><span class="bg-primary text-primary-foreground flex size-5 items-center justify-center rounded-full font-mono text-[11px]" aria-hidden="true">2</span> <!> <span>Load a model</span></div> <button type="button" class="bg-primary/10 text-primary hover:bg-primary/20 focus:ring-primary flex shrink-0 items-center gap-1 rounded px-2 py-1 text-xs font-medium transition-all duration-200 focus:ring-2 focus:ring-offset-2 focus:outline-none" aria-label="Copy model setup"><!></button></div> <pre class="snippet border-border bg-muted/40 text-foreground max-h-40 overflow-auto rounded-md border p-3 font-mono text-[11px] leading-relaxed sm:text-xs svelte-1uhhtsn"><code></code></pre></section>`),le=B(`<button type="button" class="border-border/80 bg-background/35 hover:border-primary/35 hover:bg-primary/5 focus:ring-primary text-muted-foreground hover:text-foreground w-full rounded-lg border border-dashed p-3 text-left transition-all duration-200 focus:ring-2 focus:ring-offset-2 focus:outline-none" aria-label="Reveal model setup"><span class="flex items-center gap-2 text-xs"><span class="border-border bg-muted flex size-5 shrink-0 items-center justify-center rounded-full border font-mono text-[11px]" aria-hidden="true">2</span> <!> <span class="font-medium">Load a model</span> <span class="text-muted-foreground ml-auto hidden shrink-0 sm:inline">copy step 1 or click to reveal</span></span></button>`),ue=B(`<!> Copied`,1),de=B(`<!> Copy`,1),fe=B(`<section class="border-primary/20 bg-background/55 rounded-lg border p-3"><div class="mb-2 flex items-center justify-between gap-3"><div class="text-muted-foreground flex items-center gap-2 text-xs font-medium"><span class="bg-primary text-primary-foreground flex size-5 items-center justify-center rounded-full font-mono text-[11px]" aria-hidden="true">3</span> <!> <span>Run chat inference</span></div> <button type="button" class="bg-primary/10 text-primary hover:bg-primary/20 focus:ring-primary flex shrink-0 items-center gap-1 rounded px-2 py-1 text-xs font-medium transition-all duration-200 focus:ring-2 focus:ring-offset-2 focus:outline-none" aria-label="Copy inference call"><!></button></div> <pre class="snippet border-border bg-muted/40 text-foreground max-h-40 overflow-auto rounded-md border p-3 font-mono text-[11px] leading-relaxed sm:text-xs svelte-1uhhtsn"><code></code></pre></section>`),pe=B(`<button type="button" class="border-border/80 bg-background/35 hover:border-primary/35 hover:bg-primary/5 focus:ring-primary text-muted-foreground hover:text-foreground w-full rounded-lg border border-dashed p-3 text-left transition-all duration-200 focus:ring-2 focus:ring-offset-2 focus:outline-none" aria-label="Reveal chat inference call"><span class="flex items-center gap-2 text-xs"><span class="border-border bg-muted flex size-5 shrink-0 items-center justify-center rounded-full border font-mono text-[11px]" aria-hidden="true">3</span> <!> <span class="font-medium">Run chat inference</span> <span class="text-muted-foreground ml-auto hidden shrink-0 sm:inline">copy step 2 or click to reveal</span></span></button>`),me=B(`<div class="border-primary/20 bg-primary/5 hover:border-primary/40 relative w-full rounded-xl border p-4 transition-all duration-300 hover:shadow-lg sm:p-5"><div class="mb-4 text-center"><h2 class="text-foreground text-sm font-semibold sm:text-base">Start with the SDK</h2> <p class="text-muted-foreground mx-auto mt-1 max-w-xl text-xs">Install one package, load a model, then run inference in-process.</p></div> <div class="mb-4 flex justify-center gap-1"></div> <div class="grid gap-3"><section class="border-primary/20 bg-background/55 rounded-lg border p-3"><div class="text-muted-foreground mb-2 flex items-center gap-2 text-xs font-medium"><span class="bg-primary text-primary-foreground flex size-5 items-center justify-center rounded-full font-mono text-[11px]" aria-hidden="true">1</span> <!> <span>Install package</span></div> <div class="group border-border bg-muted/40 flex items-center gap-2 rounded-md border px-3 py-2.5"><code class="text-foreground min-w-0 flex-1 overflow-x-auto font-mono text-xs select-all"> </code> <button type="button" class="bg-primary/10 text-primary hover:bg-primary/20 focus:ring-primary flex shrink-0 items-center gap-1 rounded px-2 py-1.5 text-xs font-medium transition-all duration-200 focus:ring-2 focus:ring-offset-2 focus:outline-none" aria-label="Copy installation command"><!></button></div></section> <!> <!></div></div>`);function he(e,r){T(r,!0);let o=[{key:`python`,label:`Python`},{key:`javascript`,label:`JS`},{key:`csharp`,label:`C#`},{key:`rust`,label:`Rust`}],d={python:`pip install foundry-local-sdk`,javascript:`npm install foundry-local-sdk`,csharp:`dotnet add package Microsoft.AI.Foundry.Local`,rust:`cargo add foundry-local-sdk`},f={python:{raw:`from foundry_local_sdk import Configuration, FoundryLocalManager
211	
212FoundryLocalManager.initialize(Configuration(app_name="my-app"))
213model = FoundryLocalManager.instance.catalog.get_model("qwen2.5-0.5b")
214model.download(); model.load()
215client = model.get_chat_client()`,html:`<span class="code-keyword">from</span> <span class="code-type">foundry_local_sdk</span> <span class="code-keyword">
215import</span> <span class="code-type">Configuration</span>, <span class="code-type">FoundryLocalManager</span>
216
217<span class="code-type">FoundryLocalManager</span>.<span class="code-call">initialize</span>(<span class="code-type">Configuration</span>(app_name=<span class="code-string">"my-app"</span>))
218model = <span class="code-type">FoundryLocalManager</span>.instance.catalog.<span class="code-call">get_model</span>(<span class="code-string">"qwen2.5-0.5b"</span>)
219model.<span class="code-call">download</span>(); model.<span class="code-call">load</span>()
220client = model.<span class="code-call">get_chat_client</span>()`},javascript:{raw:`const manager = FoundryLocalManager.create({ appName: 'my-app' });
221const model = await manager.catalog.getModel('qwen2.5-0.5b');
222await model.download(); await model.load();
223const chat = model.createChatClient();`,html:`<span class="code-keyword">const</span> manager = <span class="code-type">FoundryLocalManager</span>.<span class="code-call">create</span>({ appName: <span class="code-string">'my-app'</span> });
224<span class="code-keyword">const</span> model = <span class="code-keyword">await</span> manager.catalog.<span class="code-call">getModel</span>(<span class="code-string">'qwen2.5-0.5b'</span>);
225<span class="code-keyword">await</span> model.<span class="code-call">download</span>(); <span class="code-keyword">await</span> model.<span class="code-call">load</span>();
226<span class="code-keyword">const</span> chat = model.<span class="code-call">createChatClient</span>();`},csharp:{raw:`using Microsoft.AI.Foundry.Local;
227using Microsoft.Extensions.Logging.Abstractions;
228using Betalgo.Ranul.OpenAI.ObjectModels.RequestModels;
229await FoundryLocalManager.CreateAsync(
230    new Configuration { AppName = "my-app" },
231    NullLogger.Instance);
232var catalog = await FoundryLocalManager.Instance.GetCatalogAsync();
233var model = await catalog.GetModelAsync("qwen2.5-0.5b")
234    ?? throw new Exception("Model not found.");
235await model.DownloadAsync(); await model.LoadAsync();
236var chat = await model.GetChatClientAsync();`,html:`<span class="code-keyword">using</span> <span class="code-type">Microsoft.AI.Foundry.Local</span>;
237<span class="code-keyword">using</span> <span class="code-type">Microsoft.Extensions.Logging.Abstractions</span>;
238<span class="code-keyword">using</span> <span class="code-type">Betalgo.Ranul.OpenAI.ObjectModels.RequestModels</span>;
239<span class="code-keyword">await</span> <span class="code-type">FoundryLocalManager</span>.<span class="code-call">CreateAsync</span>(
240    <span class="code-keyword">new</span> <span class="code-type">Configuration</span> { AppName = <span class="code-string">"my-app"</span> },
241    <span class="code-type">NullLogger</span>.Instance);
242<span class="code-keyword">var</span> catalog = <span class="code-keyword">await</span> <span class="code-type">FoundryLocalManager</span>.Instance.<span class="code-call">GetCatalogAsync</span>();
243<span class="code-keyword">var</span> model = <span class="code-keyword">await</span> catalog.<span class="code-call">GetModelAsync</span>(<span class="code-string">"qwen2.5-0.5b"</span>)
244    ?? <span class="code-keyword">throw new</span> <span class="code-type">Exception</span>(<span class="code-string">"Model not found."</span>);
245<span class="code-keyword">await</span> model.<span class="code-call">DownloadAsync</span>(); <span class="code-keyword">await</span> model.<span class="code-call">LoadAsync</span>();
246<span class="code-keyword">var</span> chat = <span class="code-keyword">await</span> model.<span class="code-call">GetChatClientAsync</span>();`},rust:{raw:`let manager = FoundryLocalManager::create(FoundryLocalConfig::new("my-app"))?;
247let model = manager.catalog().get_model("qwen2.5-0.5b").await?;
248model.download(None::<fn(f64)>).await?; model.load().await?;
249let client = model.create_chat_client();`,html:`<span class="code-keyword">let</span> manager = <span class="code-type">FoundryLocalManager</span>::<span class="code-call">create</span>(<span class="code-type">FoundryLocalConfig</span>::<span class="code-call">new</span>(<span class="code-string">"my-app"</span>))?;
250<span class="code-keyword">let</span> model = manager.<span class="code-call">catalog</span>().<span class="code-call">get_model</span>(<span class="code-string">"qwen2.5-0.5b"</span>).await?;
251model.<span class="code-call">download</span>(None::&lt;fn(f64)&gt;).await?; model.<span class="code-call">load</span>().await?;
252<span class="code-keyword">let</span> client = model.<span class="code-call">create_chat_client</span>();`}},p={python:{raw:`response = client.complete_chat([
253    {"role": "user", "content": "Hello!"}
254])
255print(response.choices[0].message.content)`,html:`response = client.<span class="code-call">complete_chat</span>([
256    {<span class="code-string">
256"role"</span>: <span class="code-string">"user"</span>, <span class="code-string">"content"</span>: <span class="code-string">"Hello!"</span>}
257])
258<span class="code-call">print</span>(response.choices[0].message.content)`},javascript:{raw:`const response = await chat.completeChat([
259  { role: 'user', content: 'Hello!' }
260]);
261console.log(response.choices[0]?.message?.content);`,html:`<span class="code-keyword">const</span> response = <span class="code-keyword">await</span> chat.<span class="code-call">completeChat</span>([
262  { role: <span class="code-string">'user'</span>, content: <span class="code-string">'Hello!'</span> }
263]);
264console.<span class="code-call">log</span>(response.choices[0]?.message?.content);`},csharp:{raw:`var response = await chat.CompleteChatAsync(new[] {
265    new ChatMessage { Role = "user", Content = "Hello!" }
266});
267Console.WriteLine(response.Choices![0].Message.Content);`,html:`<span class="code-keyword">var</span> response = <span class="code-keyword">await</span> chat.<span class="code-call">CompleteChatAsync</span>(new[] {
268    <span class="code-keyword">new</span> <span class="code-type">ChatMessage</span> { Role = <span class="code-string">"user"</span>, Content = <span class="code-string">"Hello!"</span> }
269});
270<span class="code-type">Console</span>.<span class="code-call">WriteLine</span>(response.Choices![0].Message.Content);`},rust:{raw:`let messages = vec![
271    ChatCompletionRequestUserMessage::from("Hello!").into()
272];
273let response = client.complete_chat(&messages, None).await?;`,html:`<span class="code-keyword">let</span> messages = vec![
274    <span class="code-type">ChatCompletionRequestUserMessage</span>::<span class="code-call">from</span>(<span class="code-string">"Hello!"</span>).<span class="code-call">into</span>()
275];
276<span class="code-keyword">let</span> response = client.<span class="code-call">complete_chat</span>(&messages, None).await?;`}},h=_(!1),y=_(!1),S=_(!1),D=_(`python`),M=_(1),N=l(()=>d[C(D)]),P=l(()=>f[C(D)]),F=l(()=>p[C(D)]);function L(e){let t=e.offsetHeight;return{duration:typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:240,easing:K,css:e=>`
277				max-height: ${e*t}px;
278				opacity: ${e};
279				overflow: hidden;
280				transform: translateY(${(1-e)*-6}px);
281			`}}function z(e){C(M)<e&&v(M,e,!0)}async function B(){try{await navigator.clipboard.writeText(C(N)),v(h,!0),z(2),G.success(`Copied install command`),setTimeout(()=>{v(h,!1)},2e3)}catch{G.error(`Failed to copy install command`)}}async function te(){try{await navigator.clipboard.writeText(C(P).raw),v(y,!0),z(3),G.success(`Copied model setup`),setTimeout(()=>{v(y,!1)},2e3)}catch{G.error(`Failed to copy model setup`)}}async function U(){try{await navigator.clipboard.writeText(C(F).raw),v(S,!0),G.success(`Copied inference call`),setTimeout(()=>{v(S,!1)},2e3)}catch{G.error(`Failed to copy inference call`)}}var W=me(),q=u(m(W),2);ee(q,21,()=>o,I,(e,t)=>{var r=ae(),i=m(r,!0);x(r),n(()=>{g(r,`aria-pressed`,C(D)===C(t).key),c(r,1,`min-h-9 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-200 ${C(D)===C(t).key?`bg-primary text-primary-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-muted`}`),R(i,C(t).label)}),O(`click`,r,()=>{v(D,C(t).key,!0)}),w(e,r)}),x(q);var J=u(q,2),Y=m(J),X=m(Y);k(u(m(X),2),{class:`text-primary size-4`,"aria-hidden":`true`}),A(2),x(X);var Z=u(X,2),Q=m(Z),ne=m(Q,!0);x(Q);var $=u(Q,2),re=m($),ie=e=>{i(e,{class:`size-3.5`,"aria-hidden":`true`})},he=e=>{H(e,{class:`size-3.5`,"aria-hidden":`true`})};j(re,e=>{C(h)?e(ie):e(he,-1)}),x($),x(Z),x(Y);var ge=u(Y,2),_e=e=>{var t=ce(),n=m(t),r=m(n);V(u(m(r),2),{class:`text-primary size-4`,"aria-hidden":`true`}),A(2),x(r);var a=u(r,2),o=m(a),c=e=>{var t=oe();i(s(t),{class:`size-3.5`,"aria-hidden":`true`}),A(),w(e,t)},l=e=>{var t=se();H(s(t),{class:`size-3.5`,"aria-hidden":`true`}),A(),w(e,t)};j(o,e=>{C(y)?e(c):e(l,-1)}),x(a),x(n);var d=u(n,2),f=m(d);E(f,()=>C(P).html,!0),x(f),x(d),x(t),O(`click`,a,te),b(3,t,()=>L),w(e,t)},ve=e=>{var t=le(),n=m(t);V(u(m(n),2),{class:`text-muted-foreground/60 size-4 shrink-0`,"aria-hidden":`true`}),A(4),x(n),x(t),O(`click`,t,()=>z(2)),b(3,t,()=>L),w(e,t)};j(ge,e=>{C(M)>=2?e(_e):e(ve,-1)});var ye=u(ge,2),be=e=>{var t=fe(),n=m(t),r=m(n);a(u(m(r),2),{class:`text-primary size-4`,"aria-hidden":`true`}),A(2),x(r);var o=u(r,2),c=m(o),l=e=>{var t=ue();i(s(t),{class:`size-3.5`,"aria-hidden":`true`}),A(),w(e,t)},d=e=>{var t=de();H(s(t),{class:`size-3.5`,"aria-hidden":`true`}),A(),w(e,t)};j(c,e=>{C(S)?e(l):e(d,-1)}),x(o),x(n);var f=u(n,2),p=m(f);E(p,()=>C(F).html,!0),x(p),x(f),x(t),O(`click`,o,U),b(3,t,()=>L),w(e,t)},xe=e=>{var t=pe(),n=m(t);
281a(u(m(n),2),{class:`text-muted-foreground/60 size-4 shrink-0`,"aria-hidden":`true`}),A(4),x(n),x(t),O(`click`,t,()=>z(3)),b(3,t,()=>L),w(e,t)};j(ye,e=>{C(M)>=3?e(be):e(xe,-1)}),x(J),x(W),n(()=>R(ne,C(N))),O(`click`,$,B),w(e,W),t()}F([`click`]);var ge=B(`<!> SDK Docs`,1),_e=B(`<!> Samples`,1),ve=B(`<!> Models`,1),ye=B(`<div class="relative overflow-hidden"><div class="relative mx-auto max-w-[85rem] px-4 pt-24 pb-10 sm:px-6 lg:px-8"><div class="mx-auto flex max-w-2xl justify-center"><span class="logo-hover-target inline-flex"><!></span></div> <div class="mx-auto mt-5 max-w-2xl text-center"><h1 class="block text-4xl font-bold text-gray-800 md:text-5xl lg:text-6xl dark:text-neutral-200"><span class="text-primary">Build local AI</span><br/> into your app</h1></div> <div class="mx-auto mt-5 max-w-3xl text-center"><p class="text-lg text-gray-600 dark:text-neutral-400"> </p></div> <div class="mt-8 flex flex-col items-center justify-center gap-6"><div class="w-full max-w-4xl px-4 sm:px-6"><!></div> <div class="flex w-full max-w-3xl flex-col items-stretch gap-3 px-4 sm:flex-row sm:justify-center sm:px-6"><!> <!> <!></div></div></div></div>`);function be(e,i){T(i,!1);let a=W(),c=W();f(()=>{if(C(c)&&(r(c,C(c).style.opacity=`0`),r(c,C(c).style.transform=`translateY(20px)`),r(c,C(c).style.transition=`all 600ms cubic-bezier(0.4, 0, 0.2, 1)`),r(c,C(c).style.transitionDelay=`900ms`),requestAnimationFrame(()=>{r(c,C(c).style.opacity=`1`),r(c,C(c).style.transform=`translateY(0)`)})),C(a)){let e=[],t=Array.from(C(a).querySelectorAll(`button, a`));e.push(...t),e.forEach((e,t)=>{e.style.opacity=`0`,e.style.transform=`translateY(20px)`,e.style.transition=`all 600ms cubic-bezier(0.4, 0, 0.2, 1)`,e.style.transitionDelay=`${1100+t*100}ms`,requestAnimationFrame(()=>{e.style.opacity=`1`,e.style.transform=`translateY(0)`})})}}),h();var l=ye(),g=m(l),_=m(g),b=m(_),S=m(b);{let e=y(()=>Q.logoDark??Q.logo);X(S,{get colorSrc(){return Q.logo},get darkSrc(){return C(e)},get strokeSrc(){return Q.logoMark},height:64,alt:`Foundry Local logo`})}x(b),x(_),d(_,(e,t)=>Y?.(e,t),()=>({delay:0,duration:700,animation:`fade-in`}));var E=u(_,2);d(m(E),(e,t)=>Y?.(e,t),()=>({delay:150,duration:800,animation:`slide-up`})),x(E);var O=u(E,2),k=m(O),j=m(k,!0);x(k),d(k,(e,t)=>Y?.(e,t),()=>({delay:350,duration:800,animation:`slide-up`})),x(O);var M=u(O,2),N=m(M);he(m(N),{}),x(N),U(N,e=>v(c,e),()=>C(c));var P=u(N,2),F=m(P);q(F,{variant:`outline`,href:`https://learn.microsoft.com/en-us/azure/foundry-local/get-started`,target:`_blank`,rel:`noopener noreferrer`,size:`lg`,class:`group min-h-[44px] flex-1 border-2 transition-all duration-300 hover:scale-105 hover:shadow-lg`,"aria-label":`Read the SDK documentation (opens in new tab)`,children:(e,t)=>{var n=ge();p(s(n),{class:`mr-2 size-4 transition-transform duration-300 group-hover:scale-110`,"aria-hidden":`true`}),A(),w(e,n)},$$slots:{default:!0}});var I=u(F,2);q(I,{variant:`outline`,href:`https://github.com/microsoft/Foundry-Local/tree/main/samples`,target:`_blank`,rel:`noopener noreferrer`,size:`lg`,class:`group min-h-[44px] flex-1 border-2 transition-all duration-300 hover:scale-105 hover:shadow-lg`,"aria-label":`Browse SDK samples on GitHub (opens in new tab)`,children:(e,t)=>{var n=_e();D(s(n),{class:`mr-2 size-4 transition-transform duration-300 group-hover:scale-110`,"aria-hidden":`true`}),A(),w(e,n)},$$slots:{default:!0}}),q(u(I,2),{variant:`outline`,href:`/models`,size:`lg`,class:`group min-h-[44px] flex-1 border-2 transition-all duration-300 hover:scale-105 hover:shadow-lg`,"aria-label":`Browse available AI models`,children:(e,t)=>{var n=ve();o(s(n),{class:`mr-2 size-4 transition-transform duration-300 group-hover:rotate-12`,"aria-hidden":`true`}),A(),w(e,n)},$$slots:{default:!0}}),x(P),U(P,e=>v(a,e),()=>C(a)),x(M),x(g),x(l),n(()=>R(j,Q.description)),w(e,l),t()}function xe(e){let t=e-1;return t*t*t+1}function Se(e,{delay:t=0,duration:n=400,easing:r=xe,start:i=0,opacity:a=0}={}){let o=getComputedStyle(e),s=+o.opacity,c=o.transform===`none`?``:o.transform,l=1-i,u=s*(1-a);return{delay:t,duration:n,easing:r,css:(e,t)=>`
282			transform: ${c} scale(${1-l*t});
283			opacity: ${s-u*t}
284		`}}var Ce=B(`<div class="fixed bottom-8 right-8 z-50"><!></div>`);function we(e,n){T(n,!0);let r=_(!1);function i(){window.scrollTo({top:0,behavior:`smooth`})}f(()=>{function e(){v(r,window.scrollY>400)}return window.addEventListener(`scroll`,e),e(),()=>{window.removeEventListener(`scroll`,e)}});var a=P(),o=s(a),c=e=>{var t=Ce();q(m(t),{onclick:i,size:`icon`,class:`size-12 rounded-full shadow-lg transition-all duration-300 hover:scale-110 hover:shadow-xl focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,"aria-label":`Scroll back to top`,children:(e,t)=>{M(e,{class:`size-5`,"aria-hidden":`true`})},$$slots:{default:!0}}),x(t),b(3,t,()=>Se,()=>({duration:300,easing:K,start:.8})),w(e,t)};j(o,e=>{C(r)&&e(c)}),w(e,a),t()}var Te=B(`<!>
284 <main id="main-content"><!> <!></main> <!> <!>`,1);function Ee(e){let t=_(!1);var n=Te(),r=s(n);Z(r,{get isDownloadOpen(){return C(t)},set isDownloadOpen(e){v(t,e,!0)}});var i=u(r,2),a=m(i);be(a,{}),ie(u(a,2),{}),x(i);var o=u(i,2);J(o,{}),we(u(o,2),{}),w(e,n)}export{Ee as component,ne as universal};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.