AlloyDB AI 是 AlloyDB Omni 中包含的一套功能,可让您构建企业生成式 AI 应用。如需详细了解 AlloyDB 的 AI/机器学习功能,请参阅构建生成式 AI 应用。
借助具有 AlloyDB AI 的 AlloyDB Omni,您可以查询远程机器学习模型,以使用从机器学习模型生成的在线预测和文本嵌入。具有 AlloyDB AI 的 AlloyDB Omni 还可以处理来自其他内容(例如图片)的向量嵌入,例如,如果您使用 google_ml.predict_row 接口并自行在查询中进行转换。
根据您要在其中安装具有 AlloyDB AI 的 AlloyDB Omni 的位置,选择以下选项之一:
配置 AlloyDB Omni 实例以查询远程模型
您可以在数据库集群清单中启用 googleMLExtension,以使用模型端点管理查询远程模型。
(可选)如果您想查询 Vertex AI 模型,则必须使用 Vertex AI 配置 AlloyDB 服务账号,使用密钥创建 Kubernetes Secret,并在数据库集群清单中设置 Kubernetes Secret。
[[["易于理解","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-04。"],[[["\u003cp\u003eAlloyDB Omni with AlloyDB AI enables users to build enterprise generative AI applications and query remote ML models.\u003c/p\u003e\n"],["\u003cp\u003eAlloyDB AI, a feature suite within AlloyDB Omni, allows for online predictions and the generation of text embeddings from ML models.\u003c/p\u003e\n"],["\u003cp\u003eAlloyDB Omni can process vector embeddings from diverse content like images, using the \u003ccode\u003egoogle_ml.predict_row\u003c/code\u003e interface.\u003c/p\u003e\n"],["\u003cp\u003eA successful installation of AlloyDB Omni with AlloyDB AI can be verified by running a query that uses the \u003ccode\u003eembedding()\u003c/code\u003e function to generate text embeddings, using the \u003ccode\u003eCREATE EXTENSION IF NOT EXISTS google_ml_integration CASCADE;\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eThe example query, \u003ccode\u003eSELECT array_dims(embedding('text-embedding-005', 'AlloyDB AI')::real[]);\u003c/code\u003e, shows how to use the \u003ccode\u003eembedding()\u003c/code\u003e function to get vector dimensions for text inputs.\u003c/p\u003e\n"]]],[],null,["# Install AlloyDB AI in AlloyDB Omni\n\nSelect a documentation version: 15.7.0keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/install-with-alloydb-ai)\n- [16.8.0](/alloydb/omni/16.8.0/docs/install-with-alloydb-ai)\n- [16.3.0](/alloydb/omni/16.3.0/docs/install-with-alloydb-ai)\n- [15.12.0](/alloydb/omni/15.12.0/docs/install-with-alloydb-ai)\n- [15.7.1](/alloydb/omni/15.7.1/docs/install-with-alloydb-ai)\n- [15.7.0](/alloydb/omni/15.7.0/docs/install-with-alloydb-ai)\n- [15.5.5](/alloydb/omni/15.5.5/docs/install-with-alloydb-ai)\n- [15.5.4](/alloydb/omni/15.5.4/docs/install-with-alloydb-ai)\n- [15.5.2](/alloydb/omni/15.5.2/docs/install-with-alloydb-ai)\n\n\u003cbr /\u003e\n\n\n| **Note:** Your use of AlloyDB Omni is subject to the agreement between you and Google that governs Google Cloud offerings. If you do not have a Google Cloud account, or have not otherwise entered into an agreement with Google that governs Google Cloud offerings, please do not proceed or download this software until you have done so. To create a Google Cloud account, see [the Google Cloud homepage](/docs/get-started).\n\n\u003cbr /\u003e\n\nThis page shows you how to install AlloyDB Omni and integrate\nAlloyDB AI.\n\n[AlloyDB AI](https://cloud.google.com/alloydb/ai)\nis a suite of features included with AlloyDB Omni that let you\nbuild enterprise generative AI applications. For more information about the\nAI/ML functionality of AlloyDB, see\n[Build generative AI applications](/alloydb/docs/vertex-ai).\n\nAlloyDB Omni with AlloyDB AI lets you query remote ML models to work with online predictions and text embeddings generated from ML models. AlloyDB Omni with AlloyDB AI can also process vector embeddings from other content such as an image, for example, if you use the `google_ml.predict_row` interface and do the translation yourself in the query.\n\nBased on where you want to install AlloyDB Omni with AlloyDB AI, select one of the following options: \nSingle-server Kubernetes GDC air-gapped\n\nVerify AlloyDB Omni with AlloyDB AI installation\n------------------------------------------------\n\nTo verify your installation is successful and uses model prediction, enter the following: \n\n CREATE EXTENSION IF NOT EXISTS google_ml_integration CASCADE;\n\n SELECT array_dims(embedding('text-embedding-005', 'AlloyDB AI')::real[]);\n\nThe output looks similar to the following: \n\n array_dims\n ------------\n [1:768]\n (1 row) \n\n| **Note:** Vertex AI model support is governed by Vertex AI model versioning and lifecycle guidelines. For more information about stable versions, see [Model versions and lifecycle](/vertex-ai/generative-ai/docs/learn/model-versions).\n\nIn the previous query, the `embedding()` call generates embeddings for the input text `AlloyDB AI`.\n`array_dims` returns the dimensions of the array returned by `embedding()`.\nSince the `text-embedding-005` model returns an output with 768 dimensions, the output is `[768]`.\n\nWhat's next\n-----------\n\n- [Run and connect to AlloyDB Omni](/alloydb/omni/15.7.0/docs/run-connect)\n- [Manage AlloyDB Omni](/alloydb/omni/15.7.0/docs/manage)\n- [Build generative AI applications using AlloyDB AI](/alloydb/omni/15.7.0/docs/ai/overview-ai)\n- [Register and call remote AI models](/alloydb/omni/15.7.0/docs/ai/register-model-endpoint)"]]