Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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-3.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.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-3.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.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-3.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.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-3.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.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-3.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.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-3.5-flash"``. You can specify any
Specifies the Vertex AI endpoint to use for the model. For example ``"gemini-2.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: 9 additions & 24 deletions packages/bigframes/bigframes/ml/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
_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 @@ -75,8 +73,6 @@
_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 @@ -100,8 +96,6 @@
_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 @@ -437,22 +431,21 @@ class GeminiTextGenerator(base.RetriableRemotePredictor):
"""Gemini text generator LLM model.

.. note::
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.
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.

Args:
model_name (str, Default to "gemini-3.5-flash"):
model_name (str, Default to "gemini-2.0-flash-001"):
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", "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
"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
default and a warning will be issued.

.. note::
"gemini-1.5-X" is going to be deprecated. Please use gemini-3.5-flash instead.
"gemini-1.5-X" is going to be deprecated. Please use gemini-2.5-X instead. For example, "gemini-2.5-flash".
"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 @@ -485,8 +478,6 @@ 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 @@ -505,7 +496,7 @@ def __init__(
warnings.warn(msg, category=exceptions.PreviewWarning)

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

Expand All @@ -531,21 +522,15 @@ def _create_bqml_model(self):
)
)
warnings.warn(msg)
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",
):
if self.model_name.startswith("gemini-1.5"):
msg = exceptions.format_message(
_MODEL_DEPRECATE_WARNING.format(
model_name=self.model_name,
new_model_name="gemini-3.5-flash",
new_model_name="gemini-2.5-X",
link="https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.GeminiTextGenerator",
)
)
warnings.warn(msg, category=exceptions.ApiDeprecationWarning)
warnings.warn(msg)

options = {"endpoint": self.model_name}

Expand Down
2 changes: 0 additions & 2 deletions packages/bigframes/bigframes/ml/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
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-3.5-flash") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # 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-3.5-flash") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # 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-3.5-flash") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # 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-3.5-flash") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # 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-3.5-flash") # doctest: +SKIP
>>> model = llm.GeminiTextGenerator(model_name="gemini-2.0-flash-001") # doctest: +SKIP

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