Skip to content

Commit 86a12ab

Browse files
Merge branch 'main' into owl-bot-copy
2 parents 441c67b + 51394c1 commit 86a12ab

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

tests/unit/vertexai/genai/test_evals.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
from vertexai import _genai
2626
from vertexai._genai import types as vertexai_genai_types
2727
from google.genai import types as genai_types
28+
import google.genai.errors as genai_errors
2829
import pandas as pd
2930
import pytest
31+
import warnings
3032

3133
_TEST_PROJECT = "test-project"
3234
_TEST_LOCATION = "us-central1"
@@ -52,11 +54,18 @@ def test_evaluate_instances(self):
5254
test_client = _genai.client.Client(
5355
project=_TEST_PROJECT, location=_TEST_LOCATION
5456
)
55-
with mock.patch.object(
56-
test_client.evals, "_evaluate_instances"
57-
) as mock_evaluate:
58-
test_client.evals._evaluate_instances(bleu_input=_genai.types.BleuInput())
59-
mock_evaluate.assert_called_once_with(bleu_input=_genai.types.BleuInput())
57+
with warnings.catch_warnings(record=True) as captured_warnings:
58+
warnings.simplefilter("always")
59+
with mock.patch.object(
60+
test_client.evals, "_evaluate_instances"
61+
) as mock_evaluate:
62+
test_client.evals._evaluate_instances(
63+
bleu_input=_genai.types.BleuInput()
64+
)
65+
mock_evaluate.assert_called_once_with(
66+
bleu_input=_genai.types.BleuInput()
67+
)
68+
assert captured_warnings[0].category == genai_errors.ExperimentalWarning
6069

6170
@pytest.mark.usefixtures("google_auth_mock")
6271
def test_eval_run(self):

vertexai/_genai/client.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
from typing import Optional, Union
1717

1818
import google.auth
19+
from google.genai import _common
1920
from google.genai import client
2021
from google.genai import types
21-
from .evals import Evals
22+
2223
from .evals import AsyncEvals
24+
from .evals import Evals
2325

2426

2527
class AsyncClient:
@@ -31,6 +33,10 @@ def __init__(self, api_client: client.Client):
3133
self._evals = AsyncEvals(self._api_client)
3234

3335
@property
36+
@_common.experimental_warning(
37+
"The Vertex SDK GenAI evals module is experimental, and may change in future "
38+
"versions."
39+
)
3440
def evals(self) -> AsyncEvals:
3541
return self._evals
3642

@@ -88,5 +94,9 @@ def __init__(
8894
self._evals = Evals(self._api_client)
8995

9096
@property
97+
@_common.experimental_warning(
98+
"The Vertex SDK GenAI evals module is experimental, and may change in future "
99+
"versions."
100+
)
91101
def evals(self) -> Evals:
92102
return self._evals

0 commit comments

Comments
 (0)