Skip to main content

AppleFMClient

Struct AppleFMClient 

Source
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

Source

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.

Source

pub fn provider_meta(&self) -> &ProviderMeta

Source

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

Source§

fn clone(&self) -> AppleFMClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CompletionProvider for AppleFMClient

Source§

fn complete<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 mut self, messages: &'life1 mut Messages, tool_declarations: Option<&'life2 dyn ToolDeclarations>, options: Option<&'life3 ChatOptions>, structured_output: Option<&'life4 Schema>, ) -> Pin<Box<dyn Future<Output = Result<ChatResponse, ChatFailure>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Run one completion step. Read more
Source§

fn metadata(&self) -> Option<&ProviderMeta>

Source§

impl Debug for AppleFMClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<M> MetaArg<M> for M

Source§

fn into_meta(self) -> M

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.