Generate vector embeddings with model endpoint management Stay organized with collections Save and categorize content based on your preferences.
Preview This product is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA products are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
This page describes how to register an AI model endpointand generating vector embeddings with model endpoint management. To use AI models inproduction environments, seeBuild generative AI applications usingCloud SQL andWork with vector embeddings.
After the model endpoints are added and registered in model endpoint management, you canreference them using the model ID to generate embeddings.
Before you begin
Make sure that you complete the following actions:
- Register your model endpoint with model endpoint management. Formore information, seeRegister and call remote AI models using model endpoint management.
- Create or update your Cloud SQL instance so that the instance can integrate with Vertex AI. For more information, seeEnable database integration with Vertex AI.
Generate embeddings
Use thegoogle_ml.embedding()
SQL function to call the registered model endpoint withthe text embedding model type to generate embeddings.
To call the model and generate embeddings, use the following SQL query:
SELECTgoogle_ml.embedding(model_id=>'MODEL_ID',content=>'CONTENT');
Replace the following:
MODEL_ID
: the model ID you defined when registering the model endpointCONTENT
: the text to translate into a vector embedding
Examples
Some examples for generating embeddings using registered model endpoints are listed in this section.
Text embedding models with built-in support
To generate embeddings for a registeredtextembedding-gecko@002
model endpoint, run the following statement:
SELECTgoogle_ml.embedding(model_id=>'textembedding-gecko@002',content=>'Cloud SQL is a managed, cloud-hosted SQL database service');
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.