Skip to content

docs: add deprecation notice to readme for Generative AI submodules: vertexai.generative_models, vertexai.language_models, vertexai.vision_models, vertexai.tuning, vertexai.caching #5468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Vertex AI SDK for Python
=================================================

.. note::

The following Generative AI modules in the Vertex AI SDK are deprecated as of June 24, 2025 and will be removed on June 24, 2026:
`vertexai.generative_models`, `vertexai.language_models`, `vertexai.vision_models`, `vertexai.tuning`, `vertexai.caching`. Please use the
[Google Gen AI SDK](https://pypi.org/project/google-genai/) to access these features. See
[the migration guide](https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk) for details.
You can continue using all other Vertex AI SDK modules, as they are the recommended way to use the API.

|GA| |pypi| |versions| |unit-tests| |system-tests| |sample-tests|

`Vertex AI`_: Google Vertex AI is an integrated suite of machine learning tools and services for building and using ML models with AutoML or custom code. It offers both novices and experts the best workbench for the entire machine learning development lifecycle.
Expand Down
3 changes: 2 additions & 1 deletion vertexai/_model_garden/_model_garden_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from google.cloud.aiplatform import initializer as aiplatform_initializer
from google.cloud.aiplatform import models as aiplatform_models
from google.cloud.aiplatform import _publisher_models
from vertexai._utils import warning_logs

_SUPPORTED_PUBLISHERS = ["google"]

Expand Down Expand Up @@ -274,7 +275,7 @@ def from_pretrained(cls: Type[T], model_name: str) -> T:
ValueError: If model_name is unknown.
ValueError: If model does not support this class.
"""

warning_logs.show_deprecation_warning()
credential_exception_str = (
"\nUnable to authenticate your request."
"\nDepending on your runtime environment, you can complete authentication by:"
Expand Down
31 changes: 31 additions & 0 deletions vertexai/_utils/warning_logs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import warnings


GENAI_DEPRECATION_WARNING_MESSAGE = (
"This feature is deprecated as of June 24, 2025 and will be removed on June"
" 24, 2026. For details, see"
" https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk."
)


def show_deprecation_warning() -> None:
warnings.warn(
message=GENAI_DEPRECATION_WARNING_MESSAGE,
category=UserWarning,
stacklevel=2,
)
2 changes: 2 additions & 0 deletions vertexai/caching/_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
ContentsType,
)
from google.protobuf import field_mask_pb2
from vertexai._utils import warning_logs


def _prepare_create_request(
Expand Down Expand Up @@ -157,6 +158,7 @@ def __init__(self, cached_content_name: str):
ID. Example: "projects/.../locations/../cachedContents/456" or
"456".
"""
warning_logs.show_deprecation_warning()
super().__init__(resource_name=cached_content_name)
self._gca_resource = self._get_gca_resource(cached_content_name)

Expand Down
2 changes: 2 additions & 0 deletions vertexai/generative_models/_generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
from google.protobuf import json_format
from google.protobuf import field_mask_pb2
import warnings
from vertexai._utils import warning_logs

if TYPE_CHECKING:
from vertexai.caching import CachedContent
Expand Down Expand Up @@ -429,6 +430,7 @@ def __init__(
Content of each part will become a separate paragraph.
labels: labels that will be passed to billing for cost tracking.
"""
warning_logs.show_deprecation_warning()
project = aiplatform_initializer.global_config.project
location = aiplatform_initializer.global_config.location
model_name = _reconcile_model_name(model_name, project, location)
Expand Down
3 changes: 3 additions & 0 deletions vertexai/language_models/_language_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from vertexai.language_models import (
_evaluatable_language_models,
)
from vertexai._utils import warning_logs

try:
import pandas
Expand Down Expand Up @@ -3275,6 +3276,7 @@ def __init__(
message_history: Optional[List[ChatMessage]] = None,
stop_sequences: Optional[List[str]] = None,
):
warning_logs.show_deprecation_warning()
super().__init__(
model=model,
context=context,
Expand Down Expand Up @@ -3305,6 +3307,7 @@ def __init__(
message_history: Optional[List[ChatMessage]] = None,
stop_sequences: Optional[List[str]] = None,
):
warning_logs.show_deprecation_warning()
super().__init__(
model=model,
context=context,
Expand Down
3 changes: 2 additions & 1 deletion vertexai/tuning/_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from google.cloud.aiplatform_v1beta1 import types as gca_types

from google.rpc import status_pb2 # type: ignore

from vertexai._utils import warning_logs

_LOGGER = aiplatform_base.Logger(__name__)

Expand Down Expand Up @@ -71,6 +71,7 @@ class TuningJob(aiplatform_base._VertexAiResourceNounPlus):
api_client: gen_ai_tuning_service_v1beta1.client.GenAiTuningServiceClient

def __init__(self, tuning_job_name: str):
warning_logs.show_deprecation_warning()
super().__init__(resource_name=tuning_job_name)
self._gca_resource: gca_tuning_job_types.TuningJob = self._get_gca_resource(
resource_name=tuning_job_name
Expand Down
6 changes: 6 additions & 0 deletions vertexai/vision_models/_vision_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from google.cloud.aiplatform import initializer as aiplatform_initializer
from vertexai._model_garden import _model_garden_models
from vertexai._utils import warning_logs

# pylint: disable=g-import-not-at-top
try:
Expand Down Expand Up @@ -149,6 +150,7 @@ def __init__(
image_bytes: Image file bytes. Image can be in PNG or JPEG format.
gcs_uri: Image URI in Google Cloud Storage.
"""
warning_logs.show_deprecation_warning()
if bool(image_bytes) == bool(gcs_uri):
raise ValueError("Either image_bytes or gcs_uri must be provided.")

Expand Down Expand Up @@ -487,6 +489,7 @@ def __init__(
MP4, MPEG, MPG, WEBM, and WMV formats.
gcs_uri: Image URI in Google Cloud Storage.
"""
warning_logs.show_deprecation_warning()
if bool(video_bytes) == bool(gcs_uri):
raise ValueError("Either video_bytes or gcs_uri must be provided.")

Expand Down Expand Up @@ -594,6 +597,7 @@ def __init__(
end_offset_sec: End time offset (in seconds) to generate embeddings for.
interval_sec: Interval to divide video for generated embeddings.
"""
warning_logs.show_deprecation_warning()
self.start_offset_sec = start_offset_sec
self.end_offset_sec = end_offset_sec
self.interval_sec = interval_sec
Expand All @@ -618,6 +622,7 @@ def __init__(
end_offset_sec: End time offset (in seconds) of generated embeddings.
embedding: Generated embedding for interval.
"""
warning_logs.show_deprecation_warning()
self.start_offset_sec = start_offset_sec
self.end_offset_sec = end_offset_sec
self.embedding = embedding
Expand Down Expand Up @@ -1422,6 +1427,7 @@ def __init__(
generation_parameters: Image generation parameter values.
gcs_uri: Image file Google Cloud Storage uri.
"""
warning_logs.show_deprecation_warning()
super().__init__(image_bytes=image_bytes, gcs_uri=gcs_uri)
self._generation_parameters = generation_parameters

Expand Down