#[non_exhaustive]pub enum Error {
Show 27 variants
ModelNotAvailable,
DeviceNotEligible,
AppleIntelligenceNotEnabled,
ModelNotReady,
PrivateCloudComputeSystemNotReady,
InvalidInput(String),
GenerationError(String),
Cancelled(String),
Timeout(String),
UnsupportedPlatform(String),
NetworkFailure(String),
QuotaLimitReached(String),
ServiceUnavailable(String),
ContextSizeExceeded(String),
RateLimited(String),
GuardrailViolation(String),
Refusal(String),
UnsupportedCapability(String),
UnsupportedTranscriptContent(String),
UnsupportedGenerationGuide(String),
UnsupportedLanguageOrLocale(String),
AssetsUnavailable(String),
ConcurrentRequests(String),
ToolCall(ToolCallError),
InternalError(String),
PoisonError,
Json(String),
}Expand description
Error types for FoundationModels operations.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ModelNotAvailable
Model is not available on this device.
DeviceNotEligible
Device is not eligible for Apple Intelligence.
AppleIntelligenceNotEnabled
Apple Intelligence is not enabled in system settings.
ModelNotReady
Model is not ready (downloading or other system reasons).
PrivateCloudComputeSystemNotReady
Private Cloud Compute isn’t ready to serve requests.
InvalidInput(String)
Invalid input provided (e.g., string contains null bytes).
GenerationError(String)
Error during generation.
Cancelled(String)
The operation was cancelled (e.g. via crate::CancellationHandle).
Timeout(String)
Operation timed out.
UnsupportedPlatform(String)
The requested API requires a newer Apple platform or SDK.
NetworkFailure(String)
A Private Cloud Compute request failed due to a network error.
QuotaLimitReached(String)
The user’s Private Cloud Compute quota is exhausted until it resets.
Private Cloud Compute is temporarily unable to serve requests.
ContextSizeExceeded(String)
The request exceeded the model’s context window.
RateLimited(String)
The request was rate limited; retry later.
GuardrailViolation(String)
The request or response was blocked by a safety guardrail.
Refusal(String)
The model declined to answer the request.
UnsupportedCapability(String)
The request uses a capability this model does not support.
UnsupportedTranscriptContent(String)
The transcript contains content this model cannot process.
UnsupportedGenerationGuide(String)
The generation guide or schema is not supported by this model.
UnsupportedLanguageOrLocale(String)
The request language or locale is not supported by this model.
The on-device model assets are unavailable (e.g. not yet downloaded).
ConcurrentRequests(String)
The session is already responding to another request.
ToolCall(ToolCallError)
Error during tool invocation.
InternalError(String)
Internal error in the FFI layer.
PoisonError
A lock was poisoned.
Json(String)
JSON serialization/deserialization error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()