OnDeviceExtension
@PublicPreviewAPI
public final class OnDeviceExtension
Extension class for performing on-device operations.
Summary
Public methods |
|
|---|---|
final @NonNull OnDeviceModelStatus |
Checks the current status / availability of the on-device AI model. |
final @NonNull Flow<@NonNull DownloadStatus> |
download()Initiates the download of the on-device AI model. |
final void |
warmUp()Warms up the model to reduce latency for the first request. |
Public methods
checkStatus
public final @NonNull OnDeviceModelStatus checkStatus()
Checks the current status / availability of the on-device AI model.
| Returns | |
|---|---|
@NonNull OnDeviceModelStatus |
An |
download
public final @NonNull Flow<@NonNull DownloadStatus> download()
Initiates the download of the on-device AI model.
| Returns | |
|---|---|
@NonNull Flow<@NonNull DownloadStatus> |
A |
warmUp
public final void warmUp()
Warms up the model to reduce latency for the first request.
| Throws | |
|---|---|
com.google.firebase.ai.type.FirebaseAIException com.google.firebase.ai.type.FirebaseAIException |
if the warmup failed. |