File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
tests/unit/vertexai/genai Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 25
25
from vertexai import _genai
26
26
from vertexai ._genai import types as vertexai_genai_types
27
27
from google .genai import types as genai_types
28
+ import google .genai .errors as genai_errors
28
29
import pandas as pd
29
30
import pytest
31
+ import warnings
30
32
31
33
_TEST_PROJECT = "test-project"
32
34
_TEST_LOCATION = "us-central1"
@@ -52,11 +54,18 @@ def test_evaluate_instances(self):
52
54
test_client = _genai .client .Client (
53
55
project = _TEST_PROJECT , location = _TEST_LOCATION
54
56
)
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
60
69
61
70
@pytest .mark .usefixtures ("google_auth_mock" )
62
71
def test_eval_run (self ):
Original file line number Diff line number Diff line change 16
16
from typing import Optional , Union
17
17
18
18
import google .auth
19
+ from google .genai import _common
19
20
from google .genai import client
20
21
from google .genai import types
21
- from . evals import Evals
22
+
22
23
from .evals import AsyncEvals
24
+ from .evals import Evals
23
25
24
26
25
27
class AsyncClient :
@@ -31,6 +33,10 @@ def __init__(self, api_client: client.Client):
31
33
self ._evals = AsyncEvals (self ._api_client )
32
34
33
35
@property
36
+ @_common .experimental_warning (
37
+ "The Vertex SDK GenAI evals module is experimental, and may change in future "
38
+ "versions."
39
+ )
34
40
def evals (self ) -> AsyncEvals :
35
41
return self ._evals
36
42
@@ -88,5 +94,9 @@ def __init__(
88
94
self ._evals = Evals (self ._api_client )
89
95
90
96
@property
97
+ @_common .experimental_warning (
98
+ "The Vertex SDK GenAI evals module is experimental, and may change in future "
99
+ "versions."
100
+ )
91
101
def evals (self ) -> Evals :
92
102
return self ._evals
You can’t perform that action at this time.
0 commit comments