This page describes a preview that lets you experiment with registering an AI model endpoint and invoking predictions with Model endpoint management. For using AI models in production environments, see Build generative AI applications using AlloyDB AI and Work with vector embeddings.
After the model endpoints are added and registered in the Model endpoint management, you can reference them using the model ID to generate embeddings.
Before you begin
Make sure that you have registered your model endpoint with Model endpoint management. For more information, see Register a model endpoint with model endpoint management
Generate embeddings
Use the google_ml.embedding()
SQL function to call the registered model endpoint with
the text embedding model type to generate embeddings.
To call the model and generate embeddings, use the following SQL query:
SELECT
google_ml.embedding(
model_id => 'MODEL_ID',
content => 'CONTENT');
Replace the following:
MODEL_ID
: the model ID you defined when registering the model endpoint.CONTENT
: the text to translate into a vector embedding.
Examples
Some examples for generating embeddings using registered model endpoint are listed in this section.
Text embedding models with in-built support
To generate embeddings for a registered textembedding-gecko@002
model endpoint, run the following statement:
SELECT
google_ml.embedding(
model_id => 'textembedding-gecko@002',
content => 'AlloyDB is a managed, cloud-hosted SQL database service');