This page describes how to register an AI model endpoint
and generate vector embeddings with model endpoint management.
To use AI models in
production environments, see
Generate and manage vector embeddings.
After the model endpoints are added and registered in model endpoint management, you can
reference them using the model ID to generate embeddings.
Before you begin
Make sure that you complete the following actions:
Use the mysql.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:
SELECTmysql.ml_embedding('MODEL_ID','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 endpoints are listed in this section.
Text embedding models with built-in support
Vertex AI embedding models are supported by default. You don't need to
register them. To generate embeddings for a registered gemini-embedding-001
model endpoint, run the following statement:
SELECTmysql.ml_embedding('gemini-embedding-001','Cloud SQL is a managed, cloud-hosted SQL database service');
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[],[],null,["# Generate vector embeddings with model endpoint management\n\n| **Preview**\n|\n|\n| This product is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/model-endpoint-embeddings \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\nThis page describes how to register an AI model endpoint\nand generate vector embeddings with model endpoint management.\n\nTo use AI models in\nproduction environments, see\n[Generate and manage vector embeddings](/sql/docs/mysql/generate-manage-vector-embeddings).\n\n\nAfter the model endpoints are added and registered in model endpoint management, you can\nreference them using the model ID to generate embeddings.\n\nBefore you begin\n----------------\n\nMake sure that you complete the following actions:\n\n- Register your model endpoint with model endpoint management. For more information, see [Register and call remote AI models using model endpoint management](/sql/docs/mysql/model-endpoint-register-model).\n- Create or update your Cloud SQL instance so that the instance can integrate with Vertex AI. For more information, see [Enable database integration with Vertex AI](/sql/docs/mysql/integrate-cloud-sql-with-vertex-ai#enable-database-integration-with-vertex-ai).\n\nGenerate embeddings\n-------------------\n\nUse the `mysql.ml_embedding()` SQL function to call the registered model endpoint with\nthe text embedding model type to generate embeddings.\n\nTo call the model and generate embeddings, use the following SQL query: \n\n SELECT\n mysql.ml_embedding(\n '\u003cvar translate=\"no\"\u003eMODEL_ID\u003c/var\u003e',\n '\u003cvar translate=\"no\"\u003eCONTENT\u003c/var\u003e');\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eMODEL_ID\u003c/var\u003e: the model ID you defined when registering the model endpoint\n- \u003cvar translate=\"no\"\u003eCONTENT\u003c/var\u003e: the text to translate into a vector embedding\n\nExamples\n--------\n\nSome examples for generating embeddings using registered model endpoints are listed in this section.\n\n### Text embedding models with built-in support\n\nVertex AI embedding models are supported by default. You don't need to\nregister them. To generate embeddings for a registered `gemini-embedding-001`\nmodel endpoint, run the following statement: \n\n SELECT\n mysql.ml_embedding(\n 'gemini-embedding-001',\n 'Cloud SQL is a managed, cloud-hosted SQL database service');"]]