Invoke predictions with Model endpoint management

This page describes a preview available with AlloyDB Omni that lets you experiment with registering AI models and invoking predictions with Model endpoint management. For using AI models in production environments, see Build generative AI applications using AlloyDB AI.

After the models are added and registered in the Model endpoint management, you can reference them using the model ID to invoke predictions.

Before you begin

Make sure that you have registered your model with Model endpoint management. For more information, see Register a model with model endpoint management

Invoke predictions for generic models

Use the google_ml.predict_row() SQL function to call a registered generic model to invoke predictions. You can use google_ml.predict_row() function with any model type.

SELECT
  google_ml.predict_row(
    model_id => 'MODEL_ID',
    request_body => 'REQUEST_BODY)';

Replace the following:

  • MODEL_ID: the model ID you defined when registering the model.
  • REQUEST_BODY: the parameters to the prediction function, in JSON format-for example, { 'inputs':'How can I replicate data from AlloyDB Omni to AlloyDB Cloud version', 'parameters':{ 'candidate_labels': ['question', 'complaint', 'feedback'] },}.