Integrate BigQuery built-in AI functions into your BigQuery DataFrames workflow.

The bigframes.bigquery.ai module provides a Pythonic interface to leverage BigQuery ML’s generative AI and predictive functions directly on BigQuery DataFrames and Series objects. These functions enable you to perform advanced AI tasks at scale without moving data out of BigQuery.

Key capabilities include:

Example usage:

>>> import bigframes.pandas as bpd
>>> import bigframes.bigquery as bbq
>>> df = bpd.DataFrame({
...     "text_input": [
...         "Is this a positive review? The food was terrible.",
...     ],
... })
>>> # Assuming a Gemini model has been created in BigQuery as 'my_gemini_model'
>>> result = bq.ai.generate_text("my_gemini_model", df["text_input"])

For more information on the underlying BigQuery ML syntax, see: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-bool

Functions