OnDeviceExtension

Extension class for performing on-device operations.

Extension class for performing on-device operations.

The on-device model of a GenerativeModel. The platforms other than Android have none (as Android without the firebase-ai-ondevice library), so GenerativeModel.onDeviceExtension is always null there and no instance exists; its members report the model as unavailable.

Functions

Link copied to clipboard
actual suspend fun checkStatus(): OnDeviceModelStatus

Checks the current status / availability of the on-device AI model.

expect suspend fun checkStatus(): OnDeviceModelStatus

Checks the current status / availability of the on-device AI model.

actual suspend fun checkStatus(): OnDeviceModelStatus

Checks the current status / availability of the on-device AI model.

Link copied to clipboard
actual fun download(): Flow<DownloadStatus>

Initiates the download of the on-device AI model.

expect fun download(): Flow<DownloadStatus>

Initiates the download of the on-device AI model.

actual fun download(): Flow<DownloadStatus>

Initiates the download of the on-device AI model.

Link copied to clipboard
actual suspend fun getModelName(): String

Returns the name of the on-device model.

expect suspend fun getModelName(): String

Returns the name of the on-device model.

actual suspend fun getModelName(): String

Returns the name of the on-device model.

Link copied to clipboard
actual suspend fun warmUp()

Warms up the model to reduce latency for the first request.

expect suspend fun warmUp()

Warms up the model to reduce latency for the first request.

actual suspend fun warmUp()

Warms up the model to reduce latency for the first request.