AlloyDB Studio lets you register and call remote AI model endpoints in
AlloyDB for PostgreSQL by using interactive SQL templates in the Google Cloud console.
You can use registered or pre-registered model endpoints to generate vector
embeddings and invoke predictions directly from your database.

For more information about model endpoint management, see
[Model endpoint management overview](https://docs.cloud.google.com/alloydb/docs/ai/model-endpoint-overview.md.txt).

## Call pre-registered embedding model endpoints

The supported pre-registered embedding models are listed in the **Explorer pane** of AlloyDB Studio.

1. In the Google Cloud console, open the **AlloyDB** page.

   [Go to AlloyDB](https://console.cloud.google.com/alloydb)
2. Select a cluster from the list.

3. In the navigation menu, click **AlloyDB Studio**.

4. In the **Explorer** pane, expand **google_ml** , and then click **Models**.

5. Click more_vert **View actions** next to the pre-registered model, and then click **Call model**.

   The SQL query to generate embeddings using the pre-registered model appears.
6. Enter your text for which you want to generate embedding, and then click **Run**.

For more information about other SQL queries using pre-registered embedding models, see [Generate text embeddings](https://docs.cloud.google.com/alloydb/docs/ai/work-with-embeddings.md.txt).

## Register a model endpoint

You can use the template generated by AlloyDB Studio to register a model endpoint. After registering the model endpoint, you can then start invoking predictions or generating embeddings.

> [!NOTE]
> **Note:** Only pre-registered embedding models are listed in the **Models** menu of the **Explorer** pane.

1. In the Google Cloud console, open the **AlloyDB** page.

   [Go to AlloyDB](https://console.cloud.google.com/alloydb)
2. Select a cluster from the list.

3. In the navigation menu, click **AlloyDB Studio**.

4. In the **Explorer** pane, expand **google_ml**.

5. Click more_vert **View actions** next to **Models** , and then click **Register model**.

6. Modify required parameters based on the model endpoint provider. For more information about registering a model endpoint, see [Register and call remote AI models using model endpoint management](https://docs.cloud.google.com/alloydb/docs/ai/register-model-endpoint.md.txt).

7. Click **Run** to register the model endpoint.

For more information about other SQL queries using registered model endpoints, see [Invoke predictions](https://docs.cloud.google.com/alloydb/docs/ai/invoke-predictions.md.txt) or [Generate text embeddings](https://docs.cloud.google.com/alloydb/docs/ai/work-with-embeddings.md.txt).

## Alter a pre-registered model endpoint

For pre-registered model endpoints, you can alter the model metadata, if required.

1. In the Google Cloud console, open the **AlloyDB** page.

   [Go to AlloyDB](https://console.cloud.google.com/alloydb)
2. Select a cluster from the list.

3. In the navigation menu, click **AlloyDB Studio**.

4. In the **Explorer** pane, expand **google_ml** , and then click **Models**.

5. Click more_vert **View actions** next to the pre-registered model, and then click **Alter model**.

6. Click **Run** to save the model endpoint metadata.

You can run the `google_ml.alter_model()` function in the **Editor** tab of AlloyDB Studio to modify model metadata of other registered model endpoints. For more information, see [model endpoint management reference](https://docs.cloud.google.com/alloydb/docs/reference/model-endpoint.md.txt).

## Delete a pre-registered model endpoint

1. In the Google Cloud console, open the **AlloyDB** page.

   [Go to AlloyDB](https://console.cloud.google.com/alloydb)
2. Select a cluster from the list.

3. In the navigation menu, click **AlloyDB Studio**.

4. In the **Explorer** pane, expand **google_ml** , and then click **Models**.

5. Click more_vert **View actions** next to the pre-registered model, and then click **Delete model**.

6. Click **Run** to delete the model endpoint.

You can run the `google_ml.drop_model()` function in the **Editor** tab of AlloyDB Studio to delete other registered model endpoints. For more information, see [model endpoint management reference](https://docs.cloud.google.com/alloydb/docs/reference/model-endpoint.md.txt).

## What's next

- [Learn more about model endpoint management](https://docs.cloud.google.com/alloydb/docs/ai/model-endpoint-overview.md.txt)
- Use [sample templates for registering model endpoints](https://docs.cloud.google.com/alloydb/docs/ai/register-model-endpoint.md.txt)