Skip to content

Commit 2a2c83e

Browse files
committed
add warnign for deprcated models
1 parent 2995d0d commit 2a2c83e

File tree

6 files changed

+29
-12
lines changed

6 files changed

+29
-12
lines changed

bigframes/ml/llm.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import bigframes_vendored.constants as constants
2323
from google.cloud import bigquery
24+
import typing_extensions
2425

2526
from bigframes import dtypes, exceptions
2627
import bigframes.bigquery as bbq
@@ -113,17 +114,28 @@
113114
)
114115

115116

117+
@typing_extensions.deprecated(
118+
"text-embedding-004 is going to be deprecated. Use text-embedding-005 (https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.TextEmbeddingGenerator) instead. ",
119+
category=exceptions.ApiDeprecationWarning,
120+
)
116121
@log_adapter.class_logger
117122
class TextEmbeddingGenerator(base.RetriableRemotePredictor):
118123
"""Text embedding generator LLM model.
119124
125+
.. note::
126+
text-embedding-004 is going to be deprecated. Use text-embedding-005( https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.TextEmbeddingGenerator) instead.
127+
120128
Args:
121129
model_name (str, Default to "text-embedding-004"):
122130
The model for text embedding. Possible values are "text-embedding-005", "text-embedding-004"
123131
or "text-multilingual-embedding-002". text-embedding models returns model embeddings for text inputs.
124132
text-multilingual-embedding models returns model embeddings for text inputs which support over 100 languages.
125133
If no setting is provided, "text-embedding-004" will be used by
126134
default and a warning will be issued.
135+
136+
.. note::
137+
"text-embedding-004" is going to be deprecated. Bigframes 3 will transition to using text-embedding-004.
138+
127139
session (bigframes.Session or None):
128140
BQ session to create the model. If None, use the global default session.
129141
connection_name (str or None):
@@ -398,6 +410,10 @@ def to_gbq(
398410
return new_model.session.read_gbq_model(model_name)
399411

400412

413+
@typing_extensions.deprecated(
414+
"gemini-1.5-X are going to be deprecated. Use gemini-2.0-X (https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.GeminiTextGenerator) instead. ",
415+
category=exceptions.ApiDeprecationWarning,
416+
)
401417
@log_adapter.class_logger
402418
class GeminiTextGenerator(base.RetriableRemotePredictor):
403419
"""Gemini text generator LLM model.
@@ -416,6 +432,7 @@ class GeminiTextGenerator(base.RetriableRemotePredictor):
416432
default and a warning will be issued.
417433
418434
.. note::
435+
"gemini-1.5-X" is going to be deprecated. Bigframes 2 will transition to using gemini-2.0-X.
419436
"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
420437
Service Specific Terms(https://cloud.google.com/terms/service-terms#1). Pre-GA products and features are available "as is"
421438
and might have limited support. For more information, see the launch stage descriptions

bigframes/operations/semantics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def cluster_by(
252252
>>> bpd.options.compute.semantic_ops_confirmation_threshold = 25
253253
254254
>>> import bigframes.ml.llm as llm
255-
>>> model = llm.TextEmbeddingGenerator()
255+
>>> model = llm.TextEmbeddingGenerator(model_name="text-embedding-005")
256256
257257
>>> df = bpd.DataFrame({
258258
... "Product": ["Smartphone", "Laptop", "T-shirt", "Jeans"],

notebooks/generative_ai/bq_dataframes_llm_vector_search.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@
18161816
"source": [
18171817
"## gemini model\n",
18181818
"\n",
1819-
"llm_model = bf_llm.GeminiTextGenerator(model_name = \"gemini-1.5-flash-002\") ## replace with other model as needed"
1819+
"llm_model = bf_llm.GeminiTextGenerator(model_name = \"gemini-2.0-flash-001\") ## replace with other model as needed"
18201820
]
18211821
},
18221822
{

notebooks/generative_ai/bq_dataframes_ml_drug_name_generation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@
581581
],
582582
"source": [
583583
"# Define the model\n",
584-
"model = GeminiTextGenerator(model_name=\"gemini-1.5-flash-002\")\n",
584+
"model = GeminiTextGenerator(model_name=\"gemini-2.0-flash-001\")\n",
585585
"\n",
586586
"# Invoke LLM with prompt\n",
587587
"response = predict(zero_shot_prompt, temperature = TEMPERATURE)\n",

notebooks/generative_ai/large_language_models.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": 2,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -21,23 +21,23 @@
2121
},
2222
{
2323
"cell_type": "code",
24-
"execution_count": 2,
24+
"execution_count": 3,
2525
"metadata": {},
2626
"outputs": [
2727
{
2828
"name": "stderr",
2929
"output_type": "stream",
3030
"text": [
31-
"/tmp/ipykernel_604997/3896046356.py:1: ApiDeprecationWarning: gemini-pro and gemini-1.5-X are going to be deprecated. Use gemini-2.0-X (https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.GeminiTextGenerator) instead. \n",
32-
" model = GeminiTextGenerator(model_name=\"gemini-1.5-flash-002\")\n",
33-
"/usr/local/google/home/shuowei/src/python-bigquery-dataframes/bigframes/ml/llm.py:981: DefaultLocationWarning: No explicit location is set, so using location US for the session.\n",
31+
"/tmp/ipykernel_176683/987800245.py:1: ApiDeprecationWarning: gemini-1.5-X are going to be deprecated. Use gemini-2.0-X (https://cloud.google.com/python/docs/reference/bigframes/latest/bigframes.ml.llm.GeminiTextGenerator) instead. \n",
32+
" model = GeminiTextGenerator(model_name=\"gemini-2.0-flash-001\")\n",
33+
"/usr/local/google/home/shuowei/src/python-bigquery-dataframes/bigframes/ml/llm.py:486: DefaultLocationWarning: No explicit location is set, so using location US for the session.\n",
3434
" self.session = session or global_session.get_global_session()\n"
3535
]
3636
},
3737
{
3838
"data": {
3939
"text/html": [
40-
"Query job dd2da3cc-27c3-4c6f-9936-4f7769c85090 is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:dd2da3cc-27c3-4c6f-9936-4f7769c85090&page=queryresults\">Open Job</a>"
40+
"Query job 6fa5121a-6da4-4c75-92ec-936799da4513 is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:6fa5121a-6da4-4c75-92ec-936799da4513&page=queryresults\">Open Job</a>"
4141
],
4242
"text/plain": [
4343
"<IPython.core.display.HTML object>"
@@ -49,7 +49,7 @@
4949
{
5050
"data": {
5151
"text/html": [
52-
"Query job 00947011-4d7c-42fa-ae19-3b684976cec6 is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:00947011-4d7c-42fa-ae19-3b684976cec6&page=queryresults\">Open Job</a>"
52+
"Query job 74460ae9-3e89-49e7-93ad-bafbb6197a86 is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:74460ae9-3e89-49e7-93ad-bafbb6197a86&page=queryresults\">Open Job</a>"
5353
],
5454
"text/plain": [
5555
"<IPython.core.display.HTML object>"
@@ -60,7 +60,7 @@
6060
}
6161
],
6262
"source": [
63-
"model = GeminiTextGenerator(model_name=\"gemini-1.5-flash-002\")"
63+
"model = GeminiTextGenerator(model_name=\"gemini-2.0-flash-001\")"
6464
]
6565
},
6666
{

notebooks/getting_started/bq_dataframes_template.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@
14191419
"source": [
14201420
"# from bigframes.ml.llm import GeminiTextGenerator\n",
14211421
"\n",
1422-
"# model = GeminiTextGenerator(model_name=\"gemini-1.5-flash-002\")\n",
1422+
"# model = GeminiTextGenerator(model_name=\"gemini-2.0-flash-001\")\n",
14231423
"\n",
14241424
"# pred = model.predict(df)\n",
14251425
"# pred"

0 commit comments

Comments
 (0)