From d6f690e061aa68f02ffdb82bcdee63911612325a Mon Sep 17 00:00:00 2001 From: A Vertex SDK engineer Date: Tue, 20 Oct 2026 15:30:51 -0700 Subject: [PATCH] fix: GenAI Evaluation: Lazily import scikit-learn in preview autorater_utils so importing vertexai.preview.evaluation doesn't require it PiperOrigin-RevId: 1003442640 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 47 ------------------- agentplatform/version.py | 2 +- google/cloud/aiplatform/gapic_version.py | 2 +- .../schema/predict/instance/gapic_version.py | 2 +- .../predict/instance_v1/gapic_version.py | 2 +- .../v1/schema/predict/params/gapic_version.py | 2 +- .../schema/predict/params_v1/gapic_version.py | 2 +- .../predict/prediction/gapic_version.py | 2 +- .../predict/prediction_v1/gapic_version.py | 2 +- .../trainingjob/definition/gapic_version.py | 2 +- .../definition_v1/gapic_version.py | 2 +- .../schema/predict/instance/gapic_version.py | 2 +- .../predict/instance_v1beta1/gapic_version.py | 2 +- .../schema/predict/params/gapic_version.py | 2 +- .../predict/params_v1beta1/gapic_version.py | 2 +- .../predict/prediction/gapic_version.py | 2 +- .../prediction_v1beta1/gapic_version.py | 2 +- .../trainingjob/definition/gapic_version.py | 2 +- .../definition_v1beta1/gapic_version.py | 2 +- google/cloud/aiplatform/version.py | 2 +- google/cloud/aiplatform_v1/gapic_version.py | 2 +- .../cloud/aiplatform_v1beta1/gapic_version.py | 2 +- pypi/_vertex_ai_placeholder/version.py | 2 +- ...t_metadata_google.cloud.aiplatform.v1.json | 2 +- ...adata_google.cloud.aiplatform.v1beta1.json | 2 +- .../preview/evaluation/autorater_utils.py | 9 +++- 27 files changed, 33 insertions(+), 73 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4ebecda1e1..51f885e8d3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.6.0" + ".": "2.5.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 607bd1656c..03c998e815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,52 +1,5 @@ # Changelog -## [2.6.0](https://github.com/googleapis/python-aiplatform/compare/v2.5.0...v2.6.0) (2026-10-20) - - -### ⚠ BREAKING CHANGES - -* An existing value `DEPRECATED` is removed from enum `State` - -### Features - -* Add ARCHIVED state to ReasoningEngineRuntimeRevision ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* Add client.memory_banks.update method. ([0ac315e](https://github.com/googleapis/python-aiplatform/commit/0ac315ef93924318ce53916ee47c6b28a67294de)) -* Add context to Memory, MemoryRevision, and IntermediateExtractedMemory in Vertex AI v1beta1 ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* Add extra_context to EvaluationItemRequest ([c0a8de2](https://github.com/googleapis/python-aiplatform/commit/c0a8de2206f08615e0c11bd63894a7bc6e7c3ebe)) -* Export ADK agent engine template logs to the Telemetry API ([448abba](https://github.com/googleapis/python-aiplatform/commit/448abba2e6d4c907f6d4e0970e1c5bc0b3ac18e9)) -* Onboard Vertex Model Garden to GenAI Python SDK: Add deploy_custom_model ([46ae3d0](https://github.com/googleapis/python-aiplatform/commit/46ae3d06858d9a8c278189c19b779818cd13c978)) -* Support batch predict in Model Garden ([6b2870f](https://github.com/googleapis/python-aiplatform/commit/6b2870f3004a039cc895bad31f4db841028165e3)) -* Update discovery doc ([b60bddc](https://github.com/googleapis/python-aiplatform/commit/b60bddc9d314b4fd29c0eddc9ed674d10805bba8)) - - -### Bug Fixes - -* An existing value `DEPRECATED` is removed from enum `State` ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* GenAI Client(evals) - Default missing rubric verdicts to False ([93c52a6](https://github.com/googleapis/python-aiplatform/commit/93c52a6c66a33651e8f978d2ff79d4c4a509fd56)) -* GenAI Client(evals) - Honor per-row tool_config in Gemini inference ([48ce2ae](https://github.com/googleapis/python-aiplatform/commit/48ce2ae53d3636adb580b19f4edbfc5581890baf)) -* GenAI Client(evals) - Keep eval_case_index aligned with dataset rows ([19b0c40](https://github.com/googleapis/python-aiplatform/commit/19b0c40452d732955ee2341ada0ba193e23ec141)) -* GenAI Client(evals) - Log serialization errors in show() instead of raising AttributeError ([4b1ace9](https://github.com/googleapis/python-aiplatform/commit/4b1ace936b3f03c8171956f6b9f3fedf36c212d8)) -* GenAI Client(evals) - Parse JSON-string and OpenAI-style conversation_history ([1d93955](https://github.com/googleapis/python-aiplatform/commit/1d93955196e7708b6eebd3995630adb6bf548563)) -* GenAI Client(evals) - Serialize DataFrame-backed evaluation datasets to JSON ([9e5c721](https://github.com/googleapis/python-aiplatform/commit/9e5c7210475a109b59064464a5936975896913ad)) - - -### Documentation - -* A comment for field `create_time` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `description` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `display_name` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `expire_time` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `fact` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `name` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `scope` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `ttl` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) -* A comment for field `update_time` in message `.google.cloud.aiplatform.v1beta1.Memory` is changed ([faed3f4](https://github.com/googleapis/python-aiplatform/commit/faed3f49931c037259880647ff96da11c3d1c5f4)) - - -### Miscellaneous Chores - -* Release 2.6.0 ([ed98faa](https://github.com/googleapis/python-aiplatform/commit/ed98faafee8d88db33c5fa8e5720243b0bf266b1)) - ## [2.5.0](https://github.com/googleapis/python-aiplatform/compare/v2.4.0...v2.5.0) (2026-10-13) diff --git a/agentplatform/version.py b/agentplatform/version.py index 1d35f1d202..acb388bb2d 100644 --- a/agentplatform/version.py +++ b/agentplatform/version.py @@ -14,4 +14,4 @@ # """Version file for agentplatform.""" -__version__ = "2.6.0" +__version__ = "2.5.0" diff --git a/google/cloud/aiplatform/gapic_version.py b/google/cloud/aiplatform/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/gapic_version.py +++ b/google/cloud/aiplatform/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/predict/instance/gapic_version.py b/google/cloud/aiplatform/v1/schema/predict/instance/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/predict/instance_v1/gapic_version.py b/google/cloud/aiplatform/v1/schema/predict/instance_v1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/instance_v1/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/predict/instance_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/predict/params/gapic_version.py b/google/cloud/aiplatform/v1/schema/predict/params/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/predict/params/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/predict/params_v1/gapic_version.py b/google/cloud/aiplatform/v1/schema/predict/params_v1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/params_v1/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/predict/params_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction/gapic_version.py b/google/cloud/aiplatform/v1/schema/predict/prediction/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/gapic_version.py b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/predict/prediction_v1/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/predict/prediction_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition/gapic_version.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/gapic_version.py b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/gapic_version.py +++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/predict/params/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/gapic_version.py b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/gapic_version.py +++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform/version.py b/google/cloud/aiplatform/version.py index 4b0357c379..d22247350f 100644 --- a/google/cloud/aiplatform/version.py +++ b/google/cloud/aiplatform/version.py @@ -15,4 +15,4 @@ # limitations under the License. # -__version__ = "2.6.0" +__version__ = "2.5.0" diff --git a/google/cloud/aiplatform_v1/gapic_version.py b/google/cloud/aiplatform_v1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform_v1/gapic_version.py +++ b/google/cloud/aiplatform_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/google/cloud/aiplatform_v1beta1/gapic_version.py b/google/cloud/aiplatform_v1beta1/gapic_version.py index b18b7b418c..84851a610b 100644 --- a/google/cloud/aiplatform_v1beta1/gapic_version.py +++ b/google/cloud/aiplatform_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.6.0" # {x-release-please-version} +__version__ = "2.5.0" # {x-release-please-version} diff --git a/pypi/_vertex_ai_placeholder/version.py b/pypi/_vertex_ai_placeholder/version.py index 8620558597..0c1c68effb 100644 --- a/pypi/_vertex_ai_placeholder/version.py +++ b/pypi/_vertex_ai_placeholder/version.py @@ -15,4 +15,4 @@ # limitations under the License. # -__version__ = "2.6.0" +__version__ = "2.5.0" diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json index aa655468e3..53753f28da 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "2.6.0" + "version": "0.0.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json index c3a3c33802..1211cc13ad 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "2.6.0" + "version": "0.0.0" }, "snippets": [ { diff --git a/vertexai/preview/evaluation/autorater_utils.py b/vertexai/preview/evaluation/autorater_utils.py index 8c8fc1ca31..3a01512e3c 100644 --- a/vertexai/preview/evaluation/autorater_utils.py +++ b/vertexai/preview/evaluation/autorater_utils.py @@ -26,7 +26,6 @@ from vertexai.preview.evaluation.metrics import pairwise_metric from vertexai.preview.evaluation.metrics import pointwise_metric from vertexai.preview.tuning import sft -from sklearn import metrics if TYPE_CHECKING: @@ -113,6 +112,14 @@ def _get_evaluation_result( human_eval_results: List[str], ) -> Dict[str, Any]: """Get evaluation result for autorater.""" + try: + from sklearn import metrics + except ImportError: + raise ImportError( + 'scikit-learn is not installed. Please install the SDK using "pip' + ' install google-cloud-aiplatform[evaluation]"' + ) + filtered_autorater_eval_results = [] filtered_human_eval_results = [] for autorater_eval_result, human_eval_result in zip(