This document provides a comparison of the document processing functions
available in BigQuery ML, which are
AI.GENERATE_TEXT
and
ML.PROCESS_DOCUMENT.
You can use the information in this document to help you decide which function
to use in cases where the functions have overlapping capabilities.
At a high level, the difference between these functions is as follows:
AI.GENERATE_TEXT is a good choice for performing natural
language processing (NLP) tasks where some of the content resides in
documents. This function offers the following benefits:
For examples of document processing tasks that work best with this approach, see Explore document processing capabilities with the Gemini API.
ML.PROCESS_DOCUMENT is a good choice for performing document processing
tasks that require document parsing and a predefined, structured response.
Use the following table to compare the AI.GENERATE_TEXT and
ML.PROCESS_DOCUMENT functions:
AI.GENERATE_TEXTML.PROCESS_DOCUMENTPerform any document-related NLP task by passing a prompt to a Gemini or partner model or to an open model.
For example, given a financial document for a company, you can retrieve
document information by providing a prompt such as What is
the quarterly revenue for each division?.
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 charges for calls to the Document AI API. For more information, see Document AI API pricing.
EU and US multi-regions
for all processors. Some processors are also available in certain single
regions. For more information, see
Regional and multi-regional support.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-06-09 UTC.