Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
77d6f39
feat: migrate gemini default and deprecations to gemini-2.5-pro
shuoweil Jun 2, 2026
e4b5997
Merge branch 'main' into shuowei-deprecate-gemini2p5
shuoweil Jun 3, 2026
16ca260
ruff format
shuoweil Jun 3, 2026
df218c1
simply logic
shuoweil Jun 3, 2026
2e07573
fix: gemini checks and nameless col to_frame bug
shuoweil Jun 3, 2026
493136b
Merge branch 'main' into shuowei-deprecate-gemini2p5
shuoweil Jun 3, 2026
6ef4ede
Merge remote-tracking branch 'origin/main' into shuowei-deprecate-gem…
shuoweil Jun 3, 2026
a37898a
revert: nameless column to_frame fix
shuoweil Jun 3, 2026
0b94417
Merge branch 'main' into shuowei-deprecate-gemini2p5
shuoweil Jun 5, 2026
3930187
feat(ml): add gemini-3.1-flash-lite and gemini-3.5-flash support
shuoweil Jun 8, 2026
361228d
Merge branch 'main' into shuowei-deprecate-gemini2p5
shuoweil Jun 15, 2026
d73e5d7
Merge branch 'main' into shuowei-deprecate-gemini2p5
shuoweil Jun 23, 2026
eee96fd
fix BQML loader endpoints, update tests & notebooks to gemini-3.x
shuoweil Jun 23, 2026
0550da8
chore: update default gemini model to gemini-3.5-flash
shuoweil Jun 23, 2026
bc466eb
test: update test default endpoint to gemini-3.5-flash and update sna…
shuoweil Jun 23, 2026
9a79db4
Merge branch 'main' into shuowei-deprecate-gemini2p5
shuoweil Jun 24, 2026
ddf8028
format
shuoweil Jun 24, 2026
c96de0b
rerun sqlglot
shuoweil Jun 24, 2026
fdf4a9c
minimize changes in notebooks
shuoweil Jun 24, 2026
7dcd29c
update gemini model names in docstrings
shuoweil Jun 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/bigframes/bigframes/bigquery/_operations/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def generate(
Specifies the connection to use to communicate with the model. For example, ``myproject.us.myconnection``.
If not provided, the query uses your end-user credential.
endpoint (str, optional):
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-3.5-flash"``. You can specify any
generally available or preview Gemini model. If you specify the model name, BigQuery ML automatically identifies and
uses the full endpoint of the model. If you don't specify an ENDPOINT value, BigQuery ML selects a recent stable
version of Gemini to use.
Expand Down Expand Up @@ -178,7 +178,7 @@ def generate_bool(
Specifies the connection to use to communicate with the model. For example, ``myproject.us.myconnection``.
If not provided, the query uses your end-user credential.
endpoint (str, optional):
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-3.5-flash"``. You can specify any
generally available or preview Gemini model. If you specify the model name, BigQuery ML automatically identifies and
uses the full endpoint of the model. If you don't specify an ENDPOINT value, BigQuery ML selects a recent stable
version of Gemini to use.
Expand Down Expand Up @@ -252,7 +252,7 @@ def generate_int(
Specifies the connection to use to communicate with the model. For example, ``myproject.us.myconnection``.
If not provided, the query uses your end-user credential.
endpoint (str, optional):
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-3.5-flash"``. You can specify any
generally available or preview Gemini model. If you specify the model name, BigQuery ML automatically identifies and
uses the full endpoint of the model. If you don't specify an ENDPOINT value, BigQuery ML selects a recent stable
version of Gemini to use.
Expand Down Expand Up @@ -326,7 +326,7 @@ def generate_double(
Specifies the connection to use to communicate with the model. For example, ``myproject.us.myconnection``.
If not provided, the query uses your end-user credential.
endpoint (str, optional):
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-3.5-flash"``. You can specify any
generally available or preview Gemini model. If you specify the model name, BigQuery ML automatically identifies and
uses the full endpoint of the model. If you don't specify an ENDPOINT value, BigQuery ML selects a recent stable
version of Gemini to use.
Expand Down Expand Up @@ -809,7 +809,7 @@ def if_(
Specifies the connection to use to communicate with the model. For example, ``myproject.us.myconnection``.
If not provided, the query uses your end-user credential.
endpoint (str, optional):
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-3.5-flash"``. You can specify any
generally available or preview Gemini model. If you specify the model name, BigQuery ML automatically identifies and
uses the full endpoint of the model. If you don't specify an ENDPOINT value, BigQuery ML dynamically chooses a model based on your query to have the
best cost to quality tradeoff for the task.
Expand Down Expand Up @@ -960,7 +960,7 @@ def score(
Specifies the connection to use to communicate with the model. For example, ``myproject.us.myconnection``.
If not provided, the query uses your end-user credential.
endpoint (str, optional):
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-3.5-flash"``. You can specify any
generally available or preview Gemini model. If you specify the model name, BigQuery ML automatically identifies and
uses the full endpoint of the model. If you don't specify an endpoint value, BigQuery ML dynamically chooses a model
based on your query to have the best cost to quality tradeoff for the task.
Expand Down
33 changes: 24 additions & 9 deletions packages/bigframes/bigframes/ml/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
_GEMINI_2P5_PRO_ENDPOINT = "gemini-2.5-pro"
_GEMINI_2P5_FLASH_ENDPOINT = "gemini-2.5-flash"
_GEMINI_2P5_FLASH_LITE_ENDPOINT = "gemini-2.5-flash-lite"
_GEMINI_3P1_FLASH_LITE_ENDPOINT = "gemini-3.1-flash-lite"
_GEMINI_3P5_FLASH_ENDPOINT = "gemini-3.5-flash"

_GEMINI_ENDPOINTS = (
_GEMINI_1P5_PRO_PREVIEW_ENDPOINT,
Expand All @@ -73,6 +75,8 @@
_GEMINI_2P5_PRO_ENDPOINT,
_GEMINI_2P5_FLASH_ENDPOINT,
_GEMINI_2P5_FLASH_LITE_ENDPOINT,
_GEMINI_3P1_FLASH_LITE_ENDPOINT,
_GEMINI_3P5_FLASH_ENDPOINT,
)
_GEMINI_PREVIEW_ENDPOINTS = (
_GEMINI_1P5_PRO_PREVIEW_ENDPOINT,
Expand All @@ -96,6 +100,8 @@
_GEMINI_2P5_PRO_ENDPOINT,
_GEMINI_2P5_FLASH_ENDPOINT,
_GEMINI_2P5_FLASH_LITE_ENDPOINT,
_GEMINI_3P1_FLASH_LITE_ENDPOINT,
_GEMINI_3P5_FLASH_ENDPOINT,
)

_CLAUDE_3_SONNET_ENDPOINT = "claude-3-sonnet"
Expand Down Expand Up @@ -431,21 +437,22 @@ class GeminiTextGenerator(base.RetriableRemotePredictor):
"""Gemini text generator LLM model.

.. note::
gemini-1.5-X are going to be deprecated. Use gemini-2.5-X (https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.GeminiTextGenerator) instead.
gemini-1.5-X are going to be deprecated. Use gemini-3.5-flash (https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.GeminiTextGenerator) instead.

Args:
model_name (str, Default to "gemini-2.0-flash-001"):
model_name (str, Default to "gemini-3.5-flash"):
The model for natural language tasks. Accepted values are
"gemini-1.5-pro-preview-0514", "gemini-1.5-flash-preview-0514",
"gemini-1.5-pro-001", "gemini-1.5-pro-002", "gemini-1.5-flash-001",
"gemini-1.5-flash-002", "gemini-2.0-flash-exp",
"gemini-2.0-flash-lite-001", "gemini-2.0-flash-001",
"gemini-2.5-pro", "gemini-2.5-flash" and "gemini-2.5-flash-lite".
If no setting is provided, "gemini-2.0-flash-001" will be used by
"gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite",
"gemini-3.1-flash-lite" and "gemini-3.5-flash".
If no setting is provided, "gemini-3.5-flash" will be used by
default and a warning will be issued.

.. note::
"gemini-1.5-X" is going to be deprecated. Please use gemini-2.5-X instead. For example, "gemini-2.5-flash".
"gemini-1.5-X" is going to be deprecated. Please use gemini-3.5-flash instead.
"gemini-2.0-flash-exp", "gemini-1.5-pro-preview-0514" and "gemini-1.5-flash-preview-0514" is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
Service Specific Terms(https://cloud.google.com/terms/service-terms#1). Pre-GA products and features are available "as is"
and might have limited support. For more information, see the launch stage descriptions
Expand Down Expand Up @@ -478,6 +485,8 @@ def __init__(
"gemini-2.5-pro",
"gemini-2.5-flash",
"gemini-2.5-flash-lite",
"gemini-3.1-flash-lite",
"gemini-3.5-flash",
]
] = None,
session: Optional[bigframes.Session] = None,
Expand All @@ -496,7 +505,7 @@ def __init__(
warnings.warn(msg, category=exceptions.PreviewWarning)

if model_name is None:
model_name = "gemini-2.0-flash-001"
model_name = "gemini-3.5-flash"
msg = exceptions.format_message(_REMOVE_DEFAULT_MODEL_WARNING)
warnings.warn(msg, category=FutureWarning, stacklevel=2)

Expand All @@ -522,15 +531,21 @@ def _create_bqml_model(self):
)
)
warnings.warn(msg)
if self.model_name.startswith("gemini-1.5"):
if self.model_name.startswith(
("gemini-2.0", "gemini-1.5")
) or self.model_name in (
"gemini-2.5-flash",
"gemini-2.5-flash-lite",
"gemini-2.5-pro-preview-05-06",
):
msg = exceptions.format_message(
_MODEL_DEPRECATE_WARNING.format(
model_name=self.model_name,
new_model_name="gemini-2.5-X",
new_model_name="gemini-3.5-flash",
link="https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.GeminiTextGenerator",
)
)
warnings.warn(msg)
warnings.warn(msg, category=exceptions.ApiDeprecationWarning)

options = {"endpoint": self.model_name}

Expand Down
2 changes: 2 additions & 0 deletions packages/bigframes/bigframes/ml/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
llm._GEMINI_2P5_FLASH_ENDPOINT: llm.GeminiTextGenerator,
llm._GEMINI_2P5_FLASH_LITE_ENDPOINT: llm.GeminiTextGenerator,
llm._GEMINI_2P5_PRO_ENDPOINT: llm.GeminiTextGenerator,
llm._GEMINI_3P1_FLASH_LITE_ENDPOINT: llm.GeminiTextGenerator,
llm._GEMINI_3P5_FLASH_ENDPOINT: llm.GeminiTextGenerator,
llm._CLAUDE_3_HAIKU_ENDPOINT: llm.Claude3TextGenerator,
llm._CLAUDE_3_SONNET_ENDPOINT: llm.Claude3TextGenerator,
llm._CLAUDE_3_5_SONNET_ENDPOINT: llm.Claude3TextGenerator,
Expand Down
10 changes: 5 additions & 5 deletions packages/bigframes/bigframes/operations/semantics.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def agg(
>>> bpd.options.compute.semantic_ops_confirmation_threshold = 25

>>> import bigframes.ml.llm as llm
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-3.5-flash") # doctest: +SKIP

>>> df = bpd.DataFrame(
... {
Expand Down Expand Up @@ -330,7 +330,7 @@ def filter(self, instruction: str, model, ground_with_google_search: bool = Fals
>>> bpd.options.compute.semantic_ops_confirmation_threshold = 25

>>> import bigframes.ml.llm as llm
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-3.5-flash") # doctest: +SKIP

>>> df = bpd.DataFrame({"country": ["USA", "Germany"], "city": ["Seattle", "Berlin"]})
>>> df.semantics.filter("{city} is the capital of {country}", model) # doctest: +SKIP
Expand Down Expand Up @@ -443,7 +443,7 @@ def map(
>>> bpd.options.compute.semantic_ops_confirmation_threshold = 25

>>> import bigframes.ml.llm as llm
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-3.5-flash") # doctest: +SKIP

>>> df = bpd.DataFrame({"ingredient_1": ["Burger Bun", "Soy Bean"], "ingredient_2": ["Beef Patty", "Bittern"]})
>>> df.semantics.map("What is the food made from {ingredient_1} and {ingredient_2}? One word only.", output_column="food", model=model) # doctest: +SKIP
Expand Down Expand Up @@ -565,7 +565,7 @@ def join(
>>> bpd.options.compute.semantic_ops_confirmation_threshold = 25

>>> import bigframes.ml.llm as llm
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-3.5-flash") # doctest: +SKIP

>>> cities = bpd.DataFrame({'city': ['Seattle', 'Ottawa', 'Berlin', 'Shanghai', 'New Delhi']})
>>> continents = bpd.DataFrame({'continent': ['North America', 'Africa', 'Asia']})
Expand Down Expand Up @@ -805,7 +805,7 @@ def top_k(
>>> bpd.options.compute.semantic_ops_confirmation_threshold = 25

>>> import bigframes.ml.llm as llm
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-3.5-flash") # doctest: +SKIP

>>> df = bpd.DataFrame(
... {
Expand Down
Loading
Loading