Skip to content

fix(bigframes): update GeminiTextGenerator default model to gemini-2.5-flash - #18060

Merged
shuoweil merged 5 commits into
mainfrom
shuowei-default-model-gemini-2-5-flash
Aug 12, 2026
Merged

fix(bigframes): update GeminiTextGenerator default model to gemini-2.5-flash#18060
shuoweil merged 5 commits into
mainfrom
shuowei-default-model-gemini-2-5-flash

Conversation

@shuoweil

Copy link
Copy Markdown
Contributor

Fixes #<544873054> 🦕

@shuoweil
shuoweil requested review from GarrettWu, sycai and tswast August 10, 2026 23:48
@shuoweil shuoweil self-assigned this Aug 10, 2026
@shuoweil
shuoweil requested review from a team as code owners August 10, 2026 23:48

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the default model for GeminiTextGenerator from 'gemini-2.0-flash-001' to 'gemini-2.5-flash' in the bigframes library. It also introduces unit tests to verify the default model assignment and error handling for unsupported models. There are no review comments, and I have no additional feedback to provide.

@parthea

parthea commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Switching to draft since tests are failing. Please feel free to move it back to ready for review once they're green

@parthea
parthea marked this pull request as draft August 11, 2026 14:46
Comment on lines +25 to +63
def test_gemini_text_generator_unsupported_model_error():
# Create a mock session
mock_session = mock.create_autospec(spec=bigframes.session.Session)

# Mock _create_bq_connection to return a dummy connection
mock_session._create_bq_connection.return_value = (
"projects/test-project/locations/us-central1/connections/test-conn"
)

# Mock _anonymous_dataset which is used to create the temporary model reference
mock_session._anonymous_dataset = bigquery.DatasetReference(
"test-project", "test_dataset"
)

# Mock _start_query_ml_ddl to raise BadRequest (simulating BQML failure)
error_message = (
"Unsupported endpoint: Publisher model "
"projects/296675019294/locations/us-central1/publishers/google/models/gemini-3.5-flash "
"was not found or your project does not have access to it."
)
bq_error = google.api_core.exceptions.BadRequest(error_message)
mock_session._start_query_ml_ddl.side_effect = bq_error

# Attempting to create the model should raise the BadRequest exception
with pytest.raises(google.api_core.exceptions.BadRequest) as exc_info:
llm.GeminiTextGenerator(
model_name="gemini-3.5-flash",
session=mock_session,
connection_name="test-conn",
)

assert error_message in str(exc_info.value)

# Verify that the session's DDL execution method was called
mock_session._start_query_ml_ddl.assert_called_once()
generated_sql = mock_session._start_query_ml_ddl.call_args[0][0]
assert "CREATE OR REPLACE MODEL" in generated_sql
assert "gemini-3.5-flash" in generated_sql
assert "test-conn" in generated_sql

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this model validation logic is not handled by our code, right? If so, then we should probably not add test coverage for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, removed the redundant error-handling test case and kept only the default model resolution test.

Comment on lines +168 to +170
log_adapter.add_api_method("dataframe-max", session=session)
for _ in range(52):
df.head()
log_adapter.add_api_method("dataframe-head", session=session)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm why do we need this? It's not related to the default model change, right?

@shuoweil shuoweil Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted these changes to keep this PR focused purely on the default model update. I start a new branch to fix this.

job_config.labels = cur_labels

df.max()
log_adapter.add_api_method("dataframe-max", session=session)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar question here too: does the default model change break this test?

@shuoweil shuoweil Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted these changes to keep this PR focused purely on the default model update. I start a new branch to fix it.

@shuoweil
shuoweil force-pushed the shuowei-default-model-gemini-2-5-flash branch from 1e9393b to 89d87b2 Compare August 11, 2026 19:26
@shuoweil
shuoweil marked this pull request as ready for review August 11, 2026 19:55
@sycai sycai added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 11, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 12, 2026
@shuoweil
shuoweil enabled auto-merge (squash) August 12, 2026 17:28
@shuoweil
shuoweil merged commit 5770ff6 into main Aug 12, 2026
45 of 46 checks passed
@shuoweil
shuoweil deleted the shuowei-default-model-gemini-2-5-flash branch August 12, 2026 17:50
shuoweil pushed a commit that referenced this pull request Aug 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.48.0](bigframes-v2.47.0...bigframes-v2.48.0)
(2026-08-12)


### Features

* **bigframes:** Transpiler supports more string ops
([#17693](#17693))
([7d2bc21](7d2bc21))


### Bug Fixes

* **bigframes:** fix field name typos for ai.generate* functions
([#17983](#17983))
([1b5c48b](1b5c48b))
* **bigframes:** resolve session-scoped API method logging
([#18076](#18076))
([ace618b](ace618b))
* **bigframes:** update GeminiTextGenerator default model to
gemini-2.5-flash
([#18060](#18060))
([5770ff6](5770ff6))
* bump @angular/compiler, @angular/common, @angular/core,
@angular/forms, @angular/platform-browser, @angular/router and
@angular/compiler-cli in
/packages/bigframes/bigframes/display/table_widget_angular
([#17992](#17992))
([346aaab](346aaab))
* bump fast-uri from 3.1.4 to 3.1.5 in
/packages/bigframes/bigframes/display/table_widget_angular
([#17989](#17989))
([3b3f3f4](3b3f3f4))
* bump hono from 4.12.31 to 4.13.1 in
/packages/bigframes/bigframes/display/table_widget_angular
([#18032](#18032))
([cddf35b](cddf35b))
* bump ip-address and express-rate-limit in
/packages/bigframes/bigframes/display/table_widget_angular
([#17985](#17985))
([02ed656](02ed656))
* bump undici and @angular/build in
/packages/bigframes/bigframes/display/table_widget_angular
([#17986](#17986))
([6938061](6938061))
* bump undici from 7.25.0 to 7.29.0 in /packages/bigframes/tests/js
([#17987](#17987))
([65a3571](65a3571))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
copybara-service Bot pushed a commit to google/bigframes that referenced this pull request Aug 12, 2026
🤖 I have created a release *beep* *boop*
---

##
[2.48.0](googleapis/google-cloud-python@bigframes-v2.47.0...bigframes-v2.48.0)
(2026-08-12)

### Features

* **bigframes:** Transpiler supports more string ops
([#17693](googleapis/google-cloud-python#17693))
([7d2bc21](googleapis/google-cloud-python@7d2bc21))

### Bug Fixes

* **bigframes:** fix field name typos for ai.generate* functions
([#17983](googleapis/google-cloud-python#17983))
([1b5c48b](googleapis/google-cloud-python@1b5c48b))
* **bigframes:** resolve session-scoped API method logging
([#18076](googleapis/google-cloud-python#18076))
([ace618b](googleapis/google-cloud-python@ace618b))
* **bigframes:** update GeminiTextGenerator default model to
gemini-2.5-flash
([#18060](googleapis/google-cloud-python#18060))
([5770ff6](googleapis/google-cloud-python@5770ff6))
* bump @angular/compiler, @angular/common, @angular/core,
@angular/forms, @angular/platform-browser, @angular/router and
@angular/compiler-cli in
/packages/bigframes/bigframes/display/table_widget_angular
([#17992](googleapis/google-cloud-python#17992))
([346aaab](googleapis/google-cloud-python@346aaab))
* bump fast-uri from 3.1.4 to 3.1.5 in
/packages/bigframes/bigframes/display/table_widget_angular
([#17989](googleapis/google-cloud-python#17989))
([3b3f3f4](googleapis/google-cloud-python@3b3f3f4))
* bump hono from 4.12.31 to 4.13.1 in
/packages/bigframes/bigframes/display/table_widget_angular
([#18032](googleapis/google-cloud-python#18032))
([cddf35b](googleapis/google-cloud-python@cddf35b))
* bump ip-address and express-rate-limit in
/packages/bigframes/bigframes/display/table_widget_angular
([#17985](googleapis/google-cloud-python#17985))
([02ed656](googleapis/google-cloud-python@02ed656))
* bump undici and @angular/build in
/packages/bigframes/bigframes/display/table_widget_angular
([#17986](googleapis/google-cloud-python#17986))
([6938061](googleapis/google-cloud-python@6938061))
* bump undici from 7.25.0 to 7.29.0 in /packages/bigframes/tests/js
([#17987](googleapis/google-cloud-python#17987))
([65a3571](googleapis/google-cloud-python@65a3571))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
GitOrigin-RevId: 102c940183ac1cf5670b46c17a47f559926634de
Change-Id: Ia15429511df3ebed77f5b4ad45779f8c6be0316d
hebaalazzeh pushed a commit that referenced this pull request Aug 13, 2026
hebaalazzeh pushed a commit that referenced this pull request Aug 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.48.0](bigframes-v2.47.0...bigframes-v2.48.0)
(2026-08-12)


### Features

* **bigframes:** Transpiler supports more string ops
([#17693](#17693))
([7d2bc21](7d2bc21))


### Bug Fixes

* **bigframes:** fix field name typos for ai.generate* functions
([#17983](#17983))
([1b5c48b](1b5c48b))
* **bigframes:** resolve session-scoped API method logging
([#18076](#18076))
([ace618b](ace618b))
* **bigframes:** update GeminiTextGenerator default model to
gemini-2.5-flash
([#18060](#18060))
([5770ff6](5770ff6))
* bump @angular/compiler, @angular/common, @angular/core,
@angular/forms, @angular/platform-browser, @angular/router and
@angular/compiler-cli in
/packages/bigframes/bigframes/display/table_widget_angular
([#17992](#17992))
([346aaab](346aaab))
* bump fast-uri from 3.1.4 to 3.1.5 in
/packages/bigframes/bigframes/display/table_widget_angular
([#17989](#17989))
([3b3f3f4](3b3f3f4))
* bump hono from 4.12.31 to 4.13.1 in
/packages/bigframes/bigframes/display/table_widget_angular
([#18032](#18032))
([cddf35b](cddf35b))
* bump ip-address and express-rate-limit in
/packages/bigframes/bigframes/display/table_widget_angular
([#17985](#17985))
([02ed656](02ed656))
* bump undici and @angular/build in
/packages/bigframes/bigframes/display/table_widget_angular
([#17986](#17986))
([6938061](6938061))
* bump undici from 7.25.0 to 7.29.0 in /packages/bigframes/tests/js
([#17987](#17987))
([65a3571](65a3571))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants