Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 7e58f51

Browse files
committed
remove params
1 parent 58f647b commit 7e58f51

5 files changed

Lines changed: 2 additions & 26 deletions

File tree

bigframes/bigquery/_operations/ml.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from __future__ import annotations
1616

17-
from typing import Any, cast, List, Mapping, Optional, Union
17+
from typing import cast, List, Mapping, Optional, Union
1818

1919
import bigframes_vendored.constants
2020
import google.cloud.bigquery
@@ -443,10 +443,8 @@ def generate_text(
443443
top_k: Optional[int] = None,
444444
top_p: Optional[float] = None,
445445
flatten_json_output: Optional[bool] = None,
446-
safety_settings: Optional[Mapping[str, str]] = None,
447446
stop_sequences: Optional[List[str]] = None,
448447
ground_with_google_search: Optional[bool] = None,
449-
model_params: Optional[Mapping[str, Any]] = None,
450448
request_type: Optional[str] = None,
451449
) -> dataframe.DataFrame:
452450
"""
@@ -489,16 +487,10 @@ def generate_text(
489487
default value is ``0.95``.
490488
flatten_json_output (bool, optional):
491489
A BOOL value that determines the content of the generated JSON column.
492-
safety_settings (Mapping[str, str], optional):
493-
A STRUCT value that contains the safety settings for the model.
494-
The STRUCT must have a ``category`` field of type STRING and a
495-
``threshold`` field of type STRING.
496490
stop_sequences (List[str], optional):
497491
An ARRAY<STRING> value that contains the stop sequences for the model.
498492
ground_with_google_search (bool, optional):
499493
A BOOL value that determines whether to ground the model with Google Search.
500-
model_params (Mapping[str, Any], optional):
501-
A JSON value that contains the parameters for the model.
502494
request_type (str, optional):
503495
A STRING value that contains the request type for the model.
504496
@@ -519,10 +511,8 @@ def generate_text(
519511
top_k=top_k,
520512
top_p=top_p,
521513
flatten_json_output=flatten_json_output,
522-
safety_settings=safety_settings,
523514
stop_sequences=stop_sequences,
524515
ground_with_google_search=ground_with_google_search,
525-
model_params=model_params,
526516
request_type=request_type,
527517
)
528518

bigframes/core/sql/ml.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,8 @@ def generate_text(
264264
top_k: Optional[int] = None,
265265
top_p: Optional[float] = None,
266266
flatten_json_output: Optional[bool] = None,
267-
safety_settings: Optional[Mapping[str, str]] = None,
268267
stop_sequences: Optional[List[str]] = None,
269268
ground_with_google_search: Optional[bool] = None,
270-
model_params: Optional[Mapping[str, Any]] = None,
271269
request_type: Optional[str] = None,
272270
) -> str:
273271
"""Encode the ML.GENERATE_TEXT statement.
@@ -287,14 +285,10 @@ def generate_text(
287285
struct_options["top_p"] = top_p
288286
if flatten_json_output is not None:
289287
struct_options["flatten_json_output"] = flatten_json_output
290-
if safety_settings is not None:
291-
struct_options["safety_settings"] = safety_settings
292288
if stop_sequences is not None:
293289
struct_options["stop_sequences"] = stop_sequences
294290
if ground_with_google_search is not None:
295291
struct_options["ground_with_google_search"] = ground_with_google_search
296-
if model_params is not None:
297-
struct_options["model_params"] = model_params
298292
if request_type is not None:
299293
struct_options["request_type"] = request_type
300294

tests/unit/bigquery/test_ml.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,8 @@ def test_generate_text_with_pandas_dataframe(read_pandas_mock, read_gbq_query_mo
182182
top_k=20,
183183
top_p=0.9,
184184
flatten_json_output=True,
185-
safety_settings={"hate_speech": "BLOCK_ONLY_HIGH"},
186185
stop_sequences=["a", "b"],
187186
ground_with_google_search=True,
188-
model_params={"param1": "value1"},
189187
request_type="TYPE",
190188
)
191189
read_pandas_mock.assert_called_once()
@@ -199,10 +197,6 @@ def test_generate_text_with_pandas_dataframe(read_pandas_mock, read_gbq_query_mo
199197
assert "20 AS top_k" in generated_sql
200198
assert "0.9 AS top_p" in generated_sql
201199
assert "true AS flatten_json_output" in generated_sql
202-
assert (
203-
"STRUCT('BLOCK_ONLY_HIGH' AS hate_speech) AS safety_settings" in generated_sql
204-
)
205200
assert "['a', 'b'] AS stop_sequences" in generated_sql
206201
assert "true AS ground_with_google_search" in generated_sql
207-
assert """JSON'{"param1": "value1"}' AS model_params""" in generated_sql
208202
assert "'TYPE' AS request_type" in generated_sql
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SELECT * FROM ML.GENERATE_TEXT(MODEL `my_project.my_dataset.my_model`, (SELECT * FROM new_data), STRUCT(0.5 AS temperature, 128 AS max_output_tokens, 20 AS top_k, 0.9 AS top_p, true AS flatten_json_output, STRUCT('BLOCK_ONLY_HIGH' AS hate_speech) AS safety_settings, ['a', 'b'] AS stop_sequences, true AS ground_with_google_search, JSON'{"param1": "value1"}' AS model_params, 'TYPE' AS request_type))
1+
SELECT * FROM ML.GENERATE_TEXT(MODEL `my_project.my_dataset.my_model`, (SELECT * FROM new_data), STRUCT(0.5 AS temperature, 128 AS max_output_tokens, 20 AS top_k, 0.9 AS top_p, true AS flatten_json_output, ['a', 'b'] AS stop_sequences, true AS ground_with_google_search, 'TYPE' AS request_type))

tests/unit/core/sql/test_ml.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,8 @@ def test_generate_text_model_with_options(snapshot):
196196
top_k=20,
197197
top_p=0.9,
198198
flatten_json_output=True,
199-
safety_settings={"hate_speech": "BLOCK_ONLY_HIGH"},
200199
stop_sequences=["a", "b"],
201200
ground_with_google_search=True,
202-
model_params={"param1": "value1"},
203201
request_type="TYPE",
204202
)
205203
snapshot.assert_match(sql, "generate_text_model_with_options.sql")

0 commit comments

Comments
 (0)