Stay organized with collections Save and categorize content based on your preferences.
Generative AI overviewThis document describes the generative artificial intelligence (AI) features that BigQuery ML supports. These features let you perform AI tasks in BigQuery ML by using pre-trained Vertex AI models and built-in BigQuery ML models.
Supported tasks include the following:
You access a Vertex AI model to perform one of these functions by creating a remote model in BigQuery ML that represents the Vertex AI model's endpoint. Once you have created a remote model over the Vertex AI model that you want to use, you access that model's capabilities by running a BigQuery ML function against the remote model.
This approach lets you use the capabilities of these Vertex AI models in SQL queries to analyze BigQuery data.
WorkflowYou can use remote models over Vertex AI models and remote models over Cloud AI services together with BigQuery ML functions in order to accomplish complex data analysis and generative AI tasks.
The following diagram shows some typical workflows where you might use these capabilities together:
Generate textText generation is a form of generative AI in which text is generated based on either a prompt or on analysis of data. You can perform text generation using both text and multimodal data.
Some common use cases for text generation are as follows:
Data enrichment is a common next step after text generation, in which you enrich insights from the initial analysis by combining them with additional data. For example, you might analyze images of home furnishings to generate text for a design_type
column, so that the furnishings SKU has an associated description, such as mid-century modern
or farmhouse
.
To perform generative AI tasks, you can use remote models in BigQuery ML to reference to models deployed to or hosted in Vertex AI. You can create the following types of remote models:
Remote models over the following partner models:
After you create a remote model, you can use the ML.GENERATE_TEXT
function to interact with that model:
For remote models based on Gemini models, you can do the following:
Use the ML.GENERATE_TEXT
function to generate text from a prompt that you specify in a query or pull from a column in a standard table. When you specify the prompt in a query, you can reference the following types of table columns in the prompt:
STRING
columns to provide text data.STRUCT
columns that use the ObjectRef
format to provide unstructured data. You must use the OBJ.GET_ACCESS_URL
function within the prompt to convert the ObjectRef
values to ObjectRefRuntime
values.Use the ML.GENERATE_TEXT
function to analyze text, image, audio, video, or PDF content from an object table with a prompt that you provide as a function argument.
For all other types of remote models, you can use the ML.GENERATE_TEXT
function with a prompt that you provide in a query or from a column in a standard table.
Use the following topics to try text generation in BigQuery ML:
ML.GENERATE_TEXT
function.ML.GENERATE_TEXT
function.ML.GENERATE_TEXT
function with your data.You can use grounding and safety attributes when you use Gemini models with the ML.GENERATE_TEXT
function, provided that you are using a standard table for input. Grounding lets the Gemini model use additional information from the internet to generate more specific and factual responses. Safety attributes let the Gemini model filter the responses it returns based on the attributes you specify.
When you create a remote model that references any of the following models, you can optionally choose to configure supervised tuning at the same time:
gemini-2.0-flash-001
gemini-2.0-flash-lite-001
gemini-1.5-pro-002
gemini-1.5-flash-002
All inference occurs in Vertex AI. The results are stored in BigQuery.
Vertex AI Provisioned ThroughputFor supported Gemini models, you can use Vertex AI Provisioned Throughput with the ML.GENERATE_TEXT
function to provide consistent high throughput for requests. For more information, see Use Vertex AI Provisioned Throughput.
Preview
This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
Structured data generation is very similar to text generation, except you can additionally format the response from the model by specifying a SQL schema.
To generate structured data, create a remote model over any of the generally available or preview Gemini models. You can then use the AI.GENERATE_TABLE
function to interact with that model. To try creating structured data, see Generate structured data by using the AI.GENERATE_TABLE
function.
You can specify safety attributes when you use Gemini models with the AI.GENERATE_TABLE
function in order to filter the model's responses.
Preview
This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
You can use scalar generative AI functions with Gemini models to analyze data in BigQuery standard tables. Data includes both text data and unstructured data from columns that contain ObjectRef
values. For each row in the table, these functions generate output containing a specific type.
The following AI functions are available:
AI.GENERATE
, which generates a STRING
valueAI.GENERATE_BOOL
AI.GENERATE_DOUBLE
AI.GENERATE_INT
When you use the AI.GENERATE
function with supported Gemini models, you can use Vertex AI Provisioned Throughput to provide consistent high throughput for requests. For more information, see Use Vertex AI Provisioned Throughput.
An embedding is a high-dimensional numerical vector that represents a given entity, like a piece of text or an audio file. Generating embeddings lets you capture the semantics of your data in a way that makes it easier to reason about and compare the data.
Some common use cases for embedding generation are as follows:
The following models are supported:
text-embedding
and text-multilingual-embedding
models.multimodalembedding
model.For a smaller, lightweight text embedding, try using a pretrained TensorFlow model, such as NNLM, SWIVEL, or BERT.
Using embedding generation modelsAfter you create the model, you can use the ML.GENERATE_EMBEDDING
function to interact with it. For all types of supported models, ML.GENERATE_EMBEDDING
works with structured data in standard tables. For multimodal embedding models, ML.GENERATE_EMBEDDING
also works with visual content from either standard table columns that contain ObjectRef
values, or from object tables.
For remote models, all inference occurs in Vertex AI. For other model types, all inference occurs in BigQuery. The results are stored in BigQuery.
Use the following topics to try text generation in BigQuery ML:
ML.GENERATE_EMBEDDING
functionML.GENERATE_EMBEDDING
functionML.GENERATE_EMBEDDING
functionForecasting is a technique that lets you analyze historical time series data in order to make an informed prediction about future trends. You can use BigQuery ML's built-in TimesFM time series model (Preview) to perform forecasting without having to create your own model. The built-in TimesFM model works with the AI.FORECAST
function to generate forecasts based on your data.
Supported locations for text generation and embedding models vary based on the model type and version that you use. For more information, see Locations. Unlike other generative AI models, location support doesn't apply to the built-in TimesFM time series model. The TimesFM model is available in all BigQuery supported regions.
PricingYou are charged for the compute resources that you use to run queries against models. Remote models make calls to Vertex AI models, so queries against remote models also incur charges from Vertex AI.
For more information, see BigQuery ML pricing.
What's nextRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4