[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-05。"],[[["\u003cp\u003eThis preview feature allows users to experiment with registering AI model endpoints and invoking predictions using Model endpoint management.\u003c/p\u003e\n"],["\u003cp\u003eRegistered model endpoints can be referenced using their model ID to generate embeddings.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle_ml.embedding()\u003c/code\u003e SQL function is used to call registered model endpoints and generate embeddings, requiring the model ID and text content.\u003c/p\u003e\n"],["\u003cp\u003eExamples are provided for generating embeddings using pre-supported models like \u003ccode\u003etextembedding-gecko@002\u003c/code\u003e and models from OpenAI, like \u003ccode\u003etext-embedding-ada-002\u003c/code\u003e, \u003ccode\u003etext-embedding-3-small\u003c/code\u003e, and \u003ccode\u003etext-embedding-3-large\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis feature is currently in Pre-GA and is available "as is" with limited support, as outlined in the Pre-GA Offerings Terms.\u003c/p\u003e\n"]]],[],null,["# Generate vector embeddings with model endpoint management\n\nSelect a documentation version: 15.5.2keyboard_arrow_down\n\n- [15.5.5](/alloydb/omni/15.5.5/docs/model-endpoint-embeddings)\n- [15.5.4](/alloydb/omni/15.5.4/docs/model-endpoint-embeddings)\n- [15.5.2](/alloydb/omni/15.5.2/docs/model-endpoint-embeddings)\n\n\u003cbr /\u003e\n\n|\n| **Preview\n| --- Model endpoint management**\n|\n|\n| This feature 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 features 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\nThis page describes a preview that lets you experiment with registering an AI model endpoint\nand invoking predictions with Model endpoint management. For using AI models in\nproduction environments, see [Build generative AI applications using\nAlloyDB AI](/alloydb/docs/ai) and [Work with vector embeddings](/alloydb/omni/docs/ai/work-with-embeddings).\n\nAfter the model endpoints are added and registered in the Model endpoint management, you can\nreference them using the model ID to generate embeddings.\n\nBefore you begin\n----------------\n\nMake sure that you have registered your model endpoint with Model endpoint management. For\nmore information, see [Register a model endpoint with\nmodel endpoint management](/alloydb/omni/15.5.2/docs/model-endpoint-register-model)\n\nGenerate embeddings\n-------------------\n\nUse the `google_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 google_ml.embedding(\n model_id =\u003e '\u003cvar translate=\"no\"\u003eMODEL_ID\u003c/var\u003e',\n content =\u003e '\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 endpoint are listed in this section.\n\n#### Text embedding models with in-built support\n\nTo generate embeddings for a registered `textembedding-gecko@002` model endpoint, run the following statement: \n\n SELECT\n google_ml.embedding(\n model_id =\u003e 'textembedding-gecko@002',\n content =\u003e 'AlloyDB is a managed, cloud-hosted SQL database service');\n\nTo generate embeddings for a registered `text-embedding-ada-002` model endpoint by OpenAI, run the following statement: \n\n SELECT\n google_ml.embedding(\n model_id =\u003e 'text-embedding-ada-002',\n content =\u003e 'e-mail spam');\n\n#### Other text embedding models\n\nTo generate embeddings for a registered `text-embedding-3-small` or `text-embedding-3-large` model endpoints by OpenAI, run the following statement: \n\n SELECT\n google_ml.embedding(\n model_id =\u003e 'text-embedding-3-small',\n content =\u003e 'Vector embeddings in AI');"]]