Skip to main content

PrivateCloudComputeLanguageModel

Struct PrivateCloudComputeLanguageModel 

Source
pub struct PrivateCloudComputeLanguageModel { /* private fields */ }
Expand description

Apple Foundation Models running on Private Cloud Compute.

This model requires a 27.0-or-newer Apple platform, network access, an Apple Intelligence-capable device, and Apple’s managed com.apple.developer.private-cloud-compute entitlement authorized by the app’s provisioning profile. Construction on an older SDK or runtime returns Error::UnsupportedPlatform.

Implementations§

Source§

impl PrivateCloudComputeLanguageModel

Source

pub fn new() -> Result<Self>

Creates the Private Cloud Compute language model.

Source

pub fn is_available(&self) -> bool

Checks whether PCC is currently available.

Source

pub fn availability(&self) -> ModelAvailability

Returns the current reason-specific PCC availability.

Source

pub fn ensure_available(&self) -> Result<()>

Returns a reason-specific error if PCC is unavailable.

Source

pub fn quota_usage(&self) -> Result<QuotaUsage>

Returns the user’s current Private Cloud Compute quota usage.

Apple applies a daily, per-user iCloud quota; check this before sending requests to decide whether to fall back to the on-device crate::SystemLanguageModel.

Source

pub fn context_size(&self) -> Result<u64>

Returns the Private Cloud Compute context window size in tokens.

This performs a network request and can fail with Error::NetworkFailure or Error::ServiceUnavailable.

Trait Implementations§

Source§

impl Debug for PrivateCloudComputeLanguageModel

Available on crate feature private-cloud-compute only.
Source§

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

Formats the value using the given formatter. Read more
Source§

impl LanguageModel for PrivateCloudComputeLanguageModel

Available on crate feature private-cloud-compute only.
Source§

fn is_available(&self) -> bool

Checks whether the model is currently available.
Source§

fn availability(&self) -> ModelAvailability

Returns the current reason-specific model availability.
Source§

fn ensure_available(&self) -> Result<()>

Returns a reason-specific error if the model is unavailable.
Source§

fn context_size(&self) -> Result<u64>

Returns the model context window size in tokens. 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> 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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.