pub struct AppleFMClient { /* private fields */ }Expand description
Client for the Apple Intelligence on-device foundation model.
There is no model slug and no API key: the OS owns the (one) model. What varies per client is the configuration — a LoRA adapter and decoding defaults.
The client holds a live session across turns: append-only conversations prefill only the newest message, which is what makes multi-turn chat fast. Clones share that session, so use one client per concurrent conversation.
Implementations§
Source§impl AppleFMClient
impl AppleFMClient
Sourcepub fn model_slug(&self) -> String
pub fn model_slug(&self) -> String
Identifier used as the response model_slug: the base model name,
plus the adapter file stem when a LoRA is loaded.
pub fn provider_meta(&self) -> &ProviderMeta
Sourcepub fn prewarm(&self)
pub fn prewarm(&self)
Hint the OS to stage model resources for an upcoming turn.
The runtime stages the model down between requests, so a turn that follows an idle pause (a user typing, say) pays seconds of warm-up. Call this when you can predict a turn is coming — on input focus, when the user starts typing — and the warm-up overlaps the wait.
Fire-and-forget and cheap: returns immediately, never fails, and is skipped entirely if a turn is already in flight (the model is active then anyway). Works before the first turn too.
Trait Implementations§
Source§impl Clone for AppleFMClient
impl Clone for AppleFMClient
Source§fn clone(&self) -> AppleFMClient
fn clone(&self) -> AppleFMClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more