8000 chore: enable 'from vertexai.types import *' for GenAI client · googleapis/python-aiplatform@c1b3761 · GitHub
[go: up one dir, main page]

Skip to content

Commit c1b3761

Browse files
sararobcopybara-github
authored andcommitted
chore: enable 'from vertexai.types import *' for GenAI client
PiperOrigin-RevId: 772477280
1 parent 364db79 commit c1b3761

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/unit/vertexai/genai/test_genai_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@ def test_genai_client(self):
5555
async def test_async_client(self):
5656
test_client = vertexai.Client(project=_TEST_PROJECT, location=_TEST_LOCATION)
5757
assert isinstance(test_client.aio, vertexai._genai.client.AsyncClient)
58+
59+
@pytest.mark.usefixtures("google_auth_mock")
60+
def test_types(self):
61+
assert vertexai.types is not None
62+
assert vertexai.types.LLMMetric is not None

vertexai/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""The vertexai module."""
1616

1717
import importlib
18+
import sys
1819

1920
from google.cloud.aiplatform import version as aiplatform_version
2021

@@ -47,6 +48,8 @@ def __getattr__(name):
4748
global _genai_types
4849
if _genai_types is None:
4950
_genai_types = importlib.import_module("._genai.types", __name__)
51+
if "vertexai.types" not in sys.modules:
52+
sys.modules["vertexai.types"] = _genai_types
5053
return _genai_types
5154

5255
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

0 commit comments

Comments
 (0)
0