Skip to content

SystemLanguageModel

Represents the on-device Foundation Models language model. Provides availability checking and model configuration.

Constructor

ts
new SystemLanguageModel(options?: {
  useCase?: SystemLanguageModelUseCase;
  guardrails?: SystemLanguageModelGuardrails;
})
ParameterDefaultDescription
useCaseGENERALModel use case
guardrailsDEFAULTGuardrail configuration

Methods

isAvailable()

Synchronously checks if the model is ready.

ts
isAvailable(): AvailabilityResult

Returns { available: true } or { available: false, reason: SystemLanguageModelUnavailableReason }.

waitUntilAvailable()

Polls until the model is available or the timeout expires.

ts
waitUntilAvailable(timeoutMs?: number): Promise<AvailabilityResult>
ParameterDefaultDescription
timeoutMs30000Maximum wait time in milliseconds

dispose()

Releases the native model reference.

ts
dispose(): void

Enums

SystemLanguageModelUseCase

ValueDescription
GENERALGeneral-purpose generation
CONTENT_TAGGINGClassification and labeling

SystemLanguageModelGuardrails

ValueDescription
DEFAULTStandard content safety guardrails

SystemLanguageModelUnavailableReason

ValueDescription
APPLE_INTELLIGENCE_NOT_ENABLEDApple Intelligence is off
MODEL_NOT_READYModel assets still downloading
DEVICE_NOT_ELIGIBLEHardware not supported

Types

AvailabilityResult

ts
type AvailabilityResult =
  | { available: true }
  | { available: false; reason: SystemLanguageModelUnavailableReason };

Released under the Apache 2.0 License.