Choose a natural language processing function
You can analyze and transform large amounts of text data directly within BigQuery by using machine learning (ML) functions. These functions let you gain insights from text without moving your data, which can streamline your workflow. BigQuery ML offers the following natural language processing (NLP) functions for working with text:
AI.GENERATE_TEXT: perform customized NLP tasks using any combination of text and unstructured data from BigQuery standard tables, or unstructured data from BigQuery object tables.ML.TRANSLATE: perform translation-specific NLP tasks where you need to support a high rate of queries per minute.ML.UNDERSTAND_TEXT: perform NLP tasks that are supported by the Cloud Natural Language API.
Function comparison
Use the following table to compare the AI.GENERATE_TEXT,
ML.TRANSLATE, and ML.UNDERSTAND_TEXT functions:
AI.GENERATE_TEXT |
ML.TRANSLATE |
ML.UNDERSTAND_TEXT |
|
|---|---|---|---|
| Purpose | Perform any NLP task by passing a prompt to a Gemini or partner model or to an open model. For
example, to perform a question answering task, you could provide a prompt
similar to |
Use the Cloud Translation API to perform the following tasks: | Use the Cloud Natural Language API to perform the following tasks: |
| Billing | Incurs BigQuery ML charges for data processed. For more information, see BigQuery ML pricing. Incurs Gemini Enterprise Agent Platform charges for calls to the model. If you are using a Gemini 2.0 or greater model, the call is billed at the batch API rate. For more information, see Cost of building and deploying AI models in Agent Platform. |
Incurs BigQuery ML charges for data processed. For more information, see
BigQuery ML pricing. Incurs charges for calls to the Cloud Translation API. For more information, see Cloud Translation API pricing. |
Incurs BigQuery ML charges for data processed. For more information, see BigQuery ML pricing. Incurs charges for calls to the Cloud Natural Language API. For more information, see Cloud Natural Language API pricing. |
| Requests per minute | Not applicable for Gemini models. Between 25 and 60 for partner models. For more information, see Requests per minute limits. | 200. For more information, see Cloud AI service functions. | 600. For more information, see Cloud AI service functions. |
| Tokens per minute | Ranges from 8,192 to over 1 million, depending on the model used. |
No token limit. However, ML_TRANSLATE does have a
30,000 bytes limit.
|
100,000. |
| Input data | Supports both text and unstructured data from BigQuery standard tables and object tables. | Supports text data from BigQuery standard tables. | Supports text data from BigQuery standard tables. |
| Function output | Output can vary for calls to the model, even with the same prompt. | Produces the same output for a given task type for each successful call to the API. The output includes information about the input language. | Produces the same output for a given task type for each successful call to the API. The output includes information about the magnitude of the sentiment for sentiment analysis tasks. |
| Data context | You can provide data context as part of the prompt you submit. | Not supported. | Not supported. |
| Supervised tuning | Supervised tuning is supported for some models. | Not supported. | Not supported. |
| Supported languages | Support varies based on the LLM you choose. | Supports Cloud Translation API languages. | Supports Cloud Natural Language API languages. |
| Supported regions | Supported in all Generative AI for Agent Platform regions. | Supported in the EU and US multi-regions. |
Supported in the EU and US multi-regions. |