8000 chore: remove prompt_optimizer property from GenAI client by copybara-service[bot] · Pull Request #5449 · googleapis/python-aiplatform · GitHub
[go: up one dir, main page]

Skip to content

chore: remove prompt_optimizer property from GenAI client #5449

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 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 28 additions & 27 deletions tests/unit/vertexai/genai/test_prompt_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
from google.cloud.aiplatform.compat.types import (
job_state as gca_job_state_compat,
)
from google.cloud.aiplatform.utils import gcs_utils
from google.genai import client

# from google.cloud.aiplatform.utils import gcs_utils
# from google.genai import client
import pytest


Expand Down Expand Up @@ -76,29 +77,29 @@ def setup_method(self):
location=_TEST_LOCATION,
)

@pytest.mark.usefixtures("google_auth_mock")
def test_prompt_optimizer_client(self):
test_client = vertexai.Client(project=_TEST_PROJECT, location=_TEST_LOCATION)
assert test_client is not None
assert test_client._api_client.vertexai
assert test_client._api_client.project == _TEST_PROJECT
assert test_client._api_client.location == _TEST_LOCATION
# @pytest.mark.usefixtures("google_auth_mock")
# def test_prompt_optimizer_client(self):
# test_client = vertexai.Client(project=_TEST_PROJECT, location=_TEST_LOCATION)
# assert test_client is not None
# assert test_client._api_client.vertexai
# assert test_client._api_client.project == _TEST_PROJECT
# assert test_client._api_client.location == _TEST_LOCATION

@mock.patch.object(client.Client, "_get_api_client")
@mock.patch.object(
gcs_utils.resource_manager_utils, "get_project_number", return_value=12345
)
def test_prompt_optimizer_optimize(
self, mock_get_project_number, mock_client, mock_create_custom_job
):
"""Test that prompt_optimizer.optimize method creates a custom job."""
test_client = vertexai.Client(project=_TEST_PROJECT, location=_TEST_LOCATION)
test_client.prompt_optimizer.optimize(
method="vapo",
config={
"config_path": "gs://ssusie-vapo-sdk-test/config.json",
"wait_for_completion": False,
},
)
mock_create_custom_job.assert_called_once()
mock_get_project_number.assert_called_once()
# @mock.patch.object(client.Client, "_get_api_client")
# @mock.patch.object(
# gcs_utils.resource_manager_utils, "get_project_number", return_value=12345
# )
# def test_prompt_optimizer_optimize(
# self, mock_get_project_number, mock_client, mock_create_custom_job
# ):
# """Test that prompt_optimizer.optimize method creates a custom job."""
# test_client = vertexai.Client(project=_TEST_PROJECT, location=_TEST_LOCATION)
# test_client.prompt_optimizer.optimize(
# method="vapo",
# config={
# "config_path": "gs://ssusie-vapo-sdk-test/config.json",
# "wait_for_completion": False,
# },
# )
# mock_create_custom_job.assert_called_once()
# mock_get_project_number.assert_called_once()
11 changes: 0 additions & 11 deletions vertexai/_genai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,6 @@ def evals(self):
) from e
return self._evals.Evals(self._api_client)

@property
@_common.experimental_warning(
"The Vertex SDK GenAI prompt optimizer module is experimental, "
"and may change in future versions."
)
def prompt_optimizer(self):
self._prompt_optimizer = importlib.import_module(
".prompt_optimizer", __package__
)
return self._prompt_optimizer.PromptOptimizer(self._api_client)

@property
@_common.experimental_warning(
"The Vertex SDK GenAI async client is experimental, "
Expand Down
0