Repository navigation
Conversation
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new Python sample for BigQuery Vector Search, including unit tests and configuration files. The feedback suggests removing the redundant Python version environment marker from the test requirements and updating the ignored_versions in the Nox configuration to ensure only the oldest (3.10) and newest (3.13) supported Python versions are tested.
| @@ -0,0 +1 @@ | |||
| pytest==9.0.3; python_version >= "3.10" | |||
There was a problem hiding this comment.
According to the general rules, environment markers for Python versions older than 3.10 should not be specified because Python versions below 3.10 are no longer supported. The environment marker ; python_version >= "3.10" is redundant and can be removed.
pytest==9.0.3
References
- Do not specify fallback dependency versions or environment markers for Python versions older than 3.10, as Python versions below 3.10 are no longer supported.
|
|
||
| TEST_CONFIG_OVERRIDE = { | ||
| # You can opt out from the test for specific Python versions. | ||
| "ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"], |
There was a problem hiding this comment.
According to the general rules, only the oldest and newest supported Python releases should be tested in test configurations, ignoring intermediate versions. Since Python 3.10 is the oldest supported version and Python 3.13 is the newest, we should test 3.10 and 3.13, while ignoring the intermediate versions 3.11 and 3.12.
| "ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"], | |
| "ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.11", "3.12"], |
References
- Only test the oldest and newest supported Python releases in test configurations (such as noxfile_config.py), ignoring intermediate versions.
c6b71bc to
27e8348
Compare
…nearest-neighbor vector search Problem: The BigQuery documentation (https://cloud.google.com/bigquery/docs/vector-search) needs a standalone, tested Python code sample demonstrating how to run approximate nearest-neighbor vector search (region tag `bigquery_vector_search`). Solution: - Add `vector_search(project_id: str, dataset_id: str, table_id: str) -> None` in `bigquery/vector_search/bigquery_vector_search.py` (Find top-K nearest neighbors using VECTOR_SEARCH with an indexed embedding table and fraction_lists_to_search.) - Add unit tests (`bigquery/vector_search/bigquery_vector_search_test.py`) covering both the success path and API error handling (`GoogleAPICallError`)
27e8348 to
096f6cf
Compare
XrossFox
left a comment
There was a problem hiding this comment.
LGTM, i have a nitpick, but no changes are neccessary.
| def test_vector_search_success( | ||
| capsys: pytest.CaptureFixture[str], | ||
| ) -> None: | ||
| with mock.patch("google.cloud.bigquery.Client") as mock_client_cls: |
There was a problem hiding this comment.
This is more of a nitpick, not necessary to actually change the code. This should work, but patching should aim to modify the module's instance rather that the dependency, instead of patching "google.cloud.bigquery.Client", it should target "bigquery_vector_search.bigquery.Client", this could have side effects, but probably not a big deal in the current context.
…nearest-neighbor vector search
Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/vector-search) needs a standalone, tested Python code sample demonstrating how to run approximate nearest-neighbor vector search (region tag
bigquery_vector_search).Solution:
vector_search(project_id: str, dataset_id: str, table_id: str) -> Noneinbigquery/vector_search/bigquery_vector_search.py(Find top-K nearest neighbors using VECTOR_SEARCH with an indexed embedding table and fraction_lists_to_search.)bigquery/vector_search/bigquery_vector_search_test.py) covering both the success path and API error handling (GoogleAPICallError)Description
Fixes #
Checklist
Testing
Compliance & Style
Post-Approval Actions