> > [!WARNING]
> > **Warning:** This API is now obsolete.
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Firebase Machine Learning.

## Functions

| Function | Description |
|---|---|
| [getMachineLearning(app)](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning#getmachinelearning_8a40afc) | Gets the [MachineLearning](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.machinelearning#machinelearning_class) service for the default app or a given app.`getMachineLearning()` can be called with no arguments to access the default app's `MachineLearning` service or as `getMachineLearning(app)` to access the `MachineLearning` service associated with a specific app. |

## Classes

| Class | Description |
|---|---|
| [FirebaseMachineLearningError](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.firebasemachinelearningerror#firebasemachinelearningerror_class) | Firebase Machine Learning error code structure. This extends `FirebaseError`. |
| [MachineLearning](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.machinelearning#machinelearning_class) | The Firebase `MachineLearning` service interface. |
| [Model](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.model#model_class) | A Firebase ML Model output object. |

## Interfaces

| Interface | Description |
|---|---|
| [GcsTfliteModelOptions](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.gcstflitemodeloptions#gcstflitemodeloptions_interface) |   |
| [ListModelsOptions](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.listmodelsoptions#listmodelsoptions_interface) | Interface representing options for listing Models. |
| [ListModelsResult](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.listmodelsresult#listmodelsresult_interface) | Response object for a listModels operation. |
| [ModelOptionsBase](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.modeloptionsbase#modeloptionsbase_interface) | Firebase ML Model input objects |
| [TFLiteModel](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.tflitemodel#tflitemodel_interface) | A TensorFlow Lite Model output object |

## Variables

| Variable | Description |
|---|---|
| [MachineLearningErrorCode](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning#machinelearningerrorcode) | The constant mapping for valid Machine Learning client error codes. |

## Type Aliases

| Type Alias | Description |
|---|---|
| [MachineLearningErrorCode](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning#machinelearningerrorcode) | The type definition for valid Machine Learning client error codes. |
| [ModelOptions](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning#modeloptions) |   |

## getMachineLearning(app)

> > [!WARNING]
> > **Warning:** This API is now obsolete.
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Gets the [MachineLearning](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.machinelearning#machinelearning_class) service for the default app or a given app.

`getMachineLearning()` can be called with no arguments to access the default app's `MachineLearning` service or as `getMachineLearning(app)` to access the `MachineLearning` service associated with a specific app.

**Signature:**

    export declare function getMachineLearning(app?: App): MachineLearning;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app whose `MachineLearning` service to return. If not provided, the default `MachineLearning` service will be returned. |

**Returns:**

[MachineLearning](https://firebase.google.com/docs/reference/admin/node/firebase-admin.machine-learning.machinelearning#machinelearning_class)

The default `MachineLearning` service if no app is provided or the `MachineLearning` service associated with the provided app.

### Example 1

    // Get the MachineLearning service for the default app
    const defaultMachineLearning = getMachineLearning();

### Example 2

    // Get the MachineLearning service for a given app
    const otherMachineLearning = getMachineLearning(otherApp);

## MachineLearningErrorCode

> > [!WARNING]
> > **Warning:** This API is now obsolete.
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The constant mapping for valid Machine Learning client error codes.

**Signature:**

    MachineLearningErrorCode: {
        readonly ALREADY_EXISTS: "already-exists";
        readonly AUTHENTICATION_ERROR: "authentication-error";
        readonly INTERNAL_ERROR: "internal-error";
        readonly INVALID_ARGUMENT: "invalid-argument";
        readonly INVALID_SERVER_RESPONSE: "invalid-server-response";
        readonly NOT_FOUND: "not-found";
        readonly RESOURCE_EXHAUSTED: "resource-exhausted";
        readonly SERVICE_UNAVAILABLE: "service-unavailable";
        readonly UNKNOWN_ERROR: "unknown-error";
        readonly CANCELLED: "cancelled";
        readonly DEADLINE_EXCEEDED: "deadline-exceeded";
        readonly PERMISSION_DENIED: "permission-denied";
        readonly FAILED_PRECONDITION: "failed-precondition";
        readonly ABORTED: "aborted";
        readonly OUT_OF_RANGE: "out-of-range";
        readonly DATA_LOSS: "data-loss";
        readonly UNAUTHENTICATED: "unauthenticated";
    }

## MachineLearningErrorCode

> > [!WARNING]
> > **Warning:** This API is now obsolete.
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The type definition for valid Machine Learning client error codes.

**Signature:**

    export type MachineLearningErrorCode = typeof MachineLearningErrorCode[keyof typeof MachineLearningErrorCode];

## ModelOptions

> > [!WARNING]
> > **Warning:** This API is now obsolete.
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

**Signature:**

    export type ModelOptions = ModelOptionsBase | GcsTfliteModelOptions;