8000 docs: add deprecation notice to readme for Generative AI submodules: … · googleapis/python-aiplatform@beae2e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit beae2e3

Browse files
sararobcopybara-github
authored andcommitted
docs: add deprecation notice to readme for Generative AI submodules: vertexai.generative_models, vertexai.language_models, vertexai.vision_models, vertexai.tuning, vertexai.caching
PiperOrigin-RevId: 775267187
1 parent cdee7c2 commit beae2e3

File tree

8 files changed

+56
-2
lines changed

8 files changed

+56
-2
lines changed

README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Vertex AI SDK for Python
22
=================================================
33

4+
.. note::
5+
6+
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:
7+
`vertexai.generative_models`, `vertexai.language_models`, `vertexai.vision_models`, `vertexai.tuning`, `vertexai.caching`. Please use the
8+
[Google Gen AI SDK](https://pypi.org/project/google-genai/) to access these features. See
9+
[the migration guide](https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk) for details.
10+
You can continue using all other Vertex AI SDK modules, as they are the recommended way to use the API.
11+
412
|GA| |pypi| |versions| |unit-tests| |system-tests| |sample-tests|
513

614
`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.

vertexai/_model_garden/_model_garden_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from google.cloud.aiplatform import initializer as aiplatform_initializer
2525
from google.cloud.aiplatform import models as aiplatform_models
2626
from google.cloud.aiplatform import _publisher_models
27+
from vertexai._utils import warning_logs
2728

2829
_SUPPORTED_PUBLISHERS = ["google"]
2930

@@ -274,7 +275,7 @@ def from_pretrained(cls: Type[T], model_name: str) -> T:
274275
ValueError: If model_name is unknown.
275276
ValueError: If model does not support this class.
276277
"""
277-
278+
warning_logs.show_deprecation_warning()
278279
credential_exception_str = (
279280
"\nUnable to authenticate your request."
280281
"\nDepending on your runtime environment, you can complete authentication by:"

vertexai/_utils/warning_logs.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
import warnings
17+
18+
19+
GENAI_DEPRECATION_WARNING_MESSAGE = (
20+
"This feature is deprecated as of June 24, 2025 and will be removed on June"
21+
" 24, 2026. For details, see"
22+
" https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk."
23+
)
24+
25+
26+
def show_deprecation_warning() -> None:
27+
warnings.warn(
28+
message=GENAI_DEPRECATION_WARNING_MESSAGE,
29+
category=UserWarning,
30+
stacklevel=2,
31+
)

vertexai/caching/_caching.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
ContentsType,
5050
)
5151
from google.protobuf import field_mask_pb2
52+
from vertexai._utils import warning_logs
5253

5354

5455
def _prepare_create_request(
@@ -157,6 +158,7 @@ def __init__(self, cached_content_name: str):
157158
ID. Example: "projects/.../locations/../cachedContents/456" or
158159
"456".
159160
"""
161+
warning_logs.show_deprecation_warning()
160162
super().__init__(resource_name=cached_content_name)
161163
self._gca_resource = self._get_gca_resource(cached_content_name)
162164

vertexai/generative_models/_generative_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
from google.protobuf import json_format
6363
from google.protobuf import field_mask_pb2
6464
import warnings
65+
from vertexai._utils import warning_logs
6566

6667
if TYPE_CHECKING:
6768
from vertexai.caching import CachedContent
@@ -429,6 +430,7 @@ def __init__(
429430
Content of each part will become a separate paragraph.
430431
labels: labels that will be passed to billing for cost tracking.
431432
"""
433+
warning_logs.show_deprecation_warning()
432434
project = aiplatform_initializer.global_config.project
433435
location = aiplatform_initializer.global_config.location
434436
model_name = _reconcile_model_name(model_name, project, location)

vertexai/language_models/_language_models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from vertexai.language_models import (
4343
_evaluatable_language_models,
4444
)
45+
from vertexai._utils import warning_logs
4546

4647
try:
4748
import pandas
@@ -3275,6 +3276,7 @@ def __init__(
32753276
message_history: Optional[List[ChatMessage]] = None,
32763277
stop_sequences: Optional[List[str]] = None,
32773278
):
3279+
warning_logs.show_deprecation_warning()
32783280
super().__init__(
32793281
model=model,
32803282
context=context,
@@ -3305,6 +3307,7 @@ def __init__(
33053307
message_history: Optional[List[ChatMessage]] = None,
33063308
stop_sequences: Optional[List[str]] = None,
33073309
):
3310+
warning_logs.show_deprecation_warning()
33083311
super().__init__(
33093312
model=model,
33103313
context=context,

vertexai/tuning/_tuning.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from google.cloud.aiplatform_v1beta1 import types as gca_types
3939

4040
from google.rpc import status_pb2 # type: ignore
41-
41+
from vertexai._utils import warning_logs
4242

4343
_LOGGER = aiplatform_base.Logger(__name__)
4444

@@ -71,6 +71,7 @@ class TuningJob(aiplatform_base._VertexAiResourceNounPlus):
7171
api_client: gen_ai_tuning_service_v1beta1.client.GenAiTuningServiceClient
7272

7373
def __init__(self, tuning_job_name: str):
74+
warning_logs.show_deprecation_warning()
7475
super().__init__(resource_name=tuning_job_name)
7576
self._gca_resource: gca_tuning_job_types.TuningJob = self._get_gca_resource(
7677
resource_name=tuning_job_name

vertexai/vision_models/_vision_models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
from google.cloud.aiplatform import initializer as aiplatform_initializer
3131
from vertexai._model_garden import _model_garden_models
32+
from vertexai._utils import warning_logs
3233

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

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

@@ -594,6 +597,7 @@ def __init__(
594597
end_offset_sec: End time offset (in seconds) to generate embeddings for.
595598
interval_sec: Interval to divide video for generated embeddings.
596599
"""
600+
warning_logs.show_deprecation_warning()
597601
self.start_offset_sec = start_offset_sec
598602
self.end_offset_sec = end_offset_sec
599603
self.interval_sec = interval_sec
@@ -618,6 +622,7 @@ def __init__(
618622
end_offset_sec: End time offset (in seconds) of generated embeddings.
619623
embedding: Generated embedding for interval.
620624
"""
625+
warning_logs.show_deprecation_warning()
621626
self.start_offset_sec = start_offset_sec
622627
self.end_offset_sec = end_offset_sec
623628
self.embedding = embedding
@@ -1422,6 +1427,7 @@ def __init__(
14221427
generation_parameters: Image generation parameter values.
14231428
gcs_uri: Image file Google Cloud Storage uri.
14241429
"""
1430+
warning_logs.show_deprecation_warning()
14251431
super().__init__(image_bytes=image_bytes, gcs_uri=gcs_uri)
14261432
self._generation_parameters = generation_parameters
14271433

0 commit comments

Comments
 (0)
0