Skip to content

Commit 8126796

Browse files
sararobcopybara-github
authored andcommitted
fix: Remove lazy loading of vertexai.types module
PiperOrigin-RevId: 834811652
1 parent bc26160 commit 8126796

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

vertexai/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
import sys
1919

2020
from google.cloud.aiplatform import version as aiplatform_version
21+
from vertexai._genai import types
22+
23+
sys.modules[__name__ + ".types"] = types
2124

2225
__version__ = aiplatform_version.__version__
2326

@@ -44,14 +47,6 @@ def __getattr__(name): # type: ignore[no-untyped-def]
4447
_genai_client = importlib.import_module("._genai.client", __name__)
4548
return getattr(_genai_client, name)
4649

47-
if name == "types":
48-
global _genai_types
49-
if _genai_types is None:
50-
_genai_types = importlib.import_module("._genai.types", __name__)
51-
if "vertexai.types" not in sys.modules:
52-
sys.modules["vertexai.types"] = _genai_types
53-
return _genai_types
54-
5550
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
5651

5752

0 commit comments

Comments
 (0)