Skip to content

Commit ce5cc38

Browse files
committed
fix test
1 parent 9955544 commit ce5cc38

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/system/small/bigquery/test_ai.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import sys
16+
1517
import pandas as pd
1618
import pandas.testing
19+
import pytest
1720

1821
import bigframes.bigquery as bbq
1922
import bigframes.pandas as bpd
@@ -35,3 +38,26 @@ def test_ai_generate_bool(session):
3538
check_dtype=False,
3639
check_index=False,
3740
)
41+
42+
43+
def test_ai_generate_bool_with_model_params(session):
44+
if sys.version_info < (3, 12):
45+
pytest.skip(
46+
"Skip test because SQLGLot cannot compile model params to JSON at this env."
47+
)
48+
49+
s1 = bpd.Series(["apple", "bear"], session=session)
50+
s2 = bpd.Series(["fruit", "tree"], session=session)
51+
prompt = (s1, " is a ", s2)
52+
model_params = {"generation_config": {"thinking_config": {"thinking_budget": 0}}}
53+
54+
result = bbq.ai.generate_bool(
55+
prompt, endpoint="gemini-2.5-flash", model_params=model_params
56+
).struct.field("result")
57+
58+
pandas.testing.assert_series_equal(
59+
result.to_pandas(),
60+
pd.Series([True, False], name="result"),
61+
check_dtype=False,
62+
check_index=False,
63+
)

0 commit comments

Comments
 (0)