[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model [Back]  [Original]

The CREATE MODEL statement for Gemini Enterprise Agent Platform LLMs as MaaS  |  BigQuery  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback Stay organized with collections Save and categorize content based on your preferences.

The CREATE MODEL statement for Gemini Enterprise Agent Platform LLMs as MaaS

This document describes the CREATE MODEL statement for creating remote models in BigQuery over LLMs in Gemini Enterprise Agent Platform as a model as a service (MaaS) by using SQL. When you use MaaS on Agent Platform, you don't have to provision or manage serving infrastructure for your models. Choose MaaS for rapid development and prototyping, when you want to minimize operational overhead. Agent Platform offers access to Google models, partner models and open models using MaaS. For more information, see When to use MaaS.

Alternatively, you can use the Google Cloud console user interface to create a model by using a UI (Preview) instead of constructing the SQL statement yourself.

After you create the remote model, you can use one of the following functions to perform generative AI with that model:

CREATE MODEL syntax

{CREATE MODEL | CREATE MODEL IF NOT EXISTS | CREATE OR REPLACE MODEL}
`project_id.dataset.model_name`
REMOTE WITH CONNECTION {DEFAULT | `project_id.region.connection_id`}
OPTIONS(ENDPOINT = 'vertex_ai_llm_endpoint');

CREATE MODEL

Creates and trains a new model in the specified dataset. If the model name exists, CREATE MODEL returns an error.

CREATE MODEL IF NOT EXISTS

Creates and trains a new model only if the model doesn't exist in the specified dataset.

CREATE OR REPLACE MODEL

Creates and trains a model and replaces an existing model with the same name in the specified dataset.

model_name

The name of the model you're creating or replacing. The model name must be unique in the dataset: no other model or table can have the same name. The model name must follow the same naming rules as a BigQuery table. A model name can:

model_name is case-sensitive.

If you don't have a default project configured, then you must prepend the project ID to the model name in the following format, including backticks:

`[PROJECT_ID].[DATASET].[MODEL]`

For example, `myproject.mydataset.mymodel`.

REMOTE WITH CONNECTION

Syntax

`[PROJECT_ID].[LOCATION].[CONNECTION_ID]`

BigQuery uses a Cloud resource connection to interact with the Gemini Enterprise Agent Platform endpoint.

The connection elements are as follows:

If you are creating a remote model over an Agent Platform model that uses supervised tuning, you need to grant the Vertex AI Service Agent role to the connection's service account in the project where you create the model. Otherwise, you need to grant the Agent Platform User role to the connection's service account in the project where you create the model.

If you are using the remote model to analyze unstructured data from an object table, you must also grant the Vertex AI Service Agent role to the service account of the connection associated with the object table. You can find the object table's connection in the Google Cloud console, on the Details pane for the object table.

Example

`myproject.us.my_connection`

ENDPOINT

Syntax

ENDPOINT = 'vertex_ai_llm_endpoint'

Description

The Agent Platform endpoint for the remote model to use. You can specify the name of the Agent Platform model, for example gemini-2.5-pro, or you can specify the Agent Platform model's endpoint URL, for example https://europe-west6-aiplatform.googleapis.com/v1/projects/myproject/locations/europe-west6/publishers/google/models/gemini-2.5-pro. If you specify the model name, BigQuery ML automatically identifies and uses the full endpoint of the Agent Platform model based on the location of the dataset in which you create the model.

Arguments

A STRING value that contains the model name of the target Agent Platform LLM. The following LLMs are supported:

Pretrained Gemini models

All of the generally available and preview Gemini models are supported.

Note: To provide feedback or request support for the models in preview, send an email to bqml-feedback@google.com.

For supported Gemini models, you can specify the global endpoint, as shown in the following example:

  https://aiplatform.googleapis.com/v1/projects/test-project/locations/global/publishers/google/models/gemini-2.5-pro

Using the global endpoint for your requests can improve overall availability while reducing resource exhausted (429) errors, which occur when you exceed your quota for a regional endpoint. If you want to use Gemini in a region where it isn't available, you can avoid migrating your data to a different region by using the global endpoint instead. You can only use the global endpoint with the AI.GENERATE_TEXT function.

Note: Don't use the global endpoint if you have requirements for the data processing location, because when you use the global endpoint, you can't control or know the region where your processing requests are handled.Note: Using Gemini 2.5 models with any of these functions incurs charges for the thinking process. With some functions, you can set a budget for the thinking process for Gemini 2.5 Flash and Gemini 2.5 Flash-Lite models. You can't set a budget for Gemini 2.5 Pro models. See the documentation for a given function for details.

BigQuery supports the gemini-3.1-flash-lite and gemini-3.5-flash models. Agent Platform only supports multi-regional endpoints for these models. Regional endpoints aren't supported. If you specify a short endpoint name that omits the region, such as gemini-3.5-flash, then BigQuery selects an endpoint according to the following rules:

To specify a specific endpoint, use a fully qualified multi-regional endpoint name in one of the following formats: If your query runs in the asia-south1 region, then you must use the fully qualified global endpoint name.

Claude models

The following Anthropic Claude models are supported:

You must enable Claude models in Gemini Enterprise Agent Platform before you can use them. For more information, see Enable a partner model.

Although Claude models are multimodal, you can only use text input with Claude models in BigQuery ML.

After you create a remote model based on a Claude model, you can use the model with the AI.GENERATE_TEXT function to generate text based on a prompt you provide in a query or from a column in a standard table.

Mistral AI models

The following Mistral AI models are supported:

Don't use a version suffix with any Mistral AI model.

You must enable Mistral AI models in Gemini Enterprise Agent Platform before you can use them. For more information, see Enable a partner model.

After you create a remote model based on a Mistral AI model, you can use the model with the AI.GENERATE_TEXT function to generate text based on a prompt you provide in a query or from a column in a standard table.

Llama models as MaaS

To create a Llama model in BigQuery ML, you must specify it as an OpenAI API endpoint in the format openapi/<publisher_name>/<model_name>.

The following Llama models are supported:

Important: For Llama 4.0 and greater models, you must create the dataset and connection for the remote model in the same region as the Llama model endpoint.

You must enable Llama models in Gemini Enterprise Agent Platform before you can use them. For more information, see Enable a partner model.

After you create a remote model based on a Llama model, you can use the model with the AI.GENERATE_TEXT function to generate text based on a prompt you provide in a query or from a column in a standard table.

For information that can help you choose between the supported models, see Model information.

Locations

For information about supported locations, see Locations for remote models.

Examples

The following examples create BigQuery ML remote models.

Create a Gemini model that uses the default connection

The following example creates a BigQuery ML remote model over a Gemini model:

CREATE OR REPLACE MODEL `mydataset.gemini_model`
REMOTE WITH CONNECTION DEFAULT
OPTIONS(ENDPOINT = 'gemini-2.5-pro');

Create a partner model that uses the default connection

The following example creates a BigQuery ML remote model over a Mistral AI model:

CREATE OR REPLACE MODEL `mydataset.mistral_model`
REMOTE WITH CONNECTION DEFAULT
OPTIONS(ENDPOINT = 'mistral-large-2411');

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-11 UTC.

Need to tell us more? [[["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 2026-08-11 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page