Skip to content

Commit a50b339

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: Move templates to agentplatform/frameworks.
PiperOrigin-RevId: 911346789
1 parent 1f9c8e0 commit a50b339

187 files changed

Lines changed: 81083 additions & 616 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agentplatform/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515
"""The agentplatform module."""
1616

1717
import importlib
18+
import sys
19+
1820
from google.cloud.aiplatform import init
1921
from google.cloud.aiplatform import version as aiplatform_version
2022

2123
__version__ = aiplatform_version.__version__
2224

25+
_genai_client = None
26+
_genai_types = None
27+
2328

2429
def __getattr__(name): # type: ignore[no-untyped-def]
2530
if name == "preview":
@@ -30,10 +35,26 @@ def __getattr__(name): # type: ignore[no-untyped-def]
3035
# `import google.cloud.aiplatform.agentplatform.preview as`
3136
# `agentplatform_preview`
3237
return importlib.import_module(".preview", __name__)
38+
if name == "Client":
39+
global _genai_client
40+
if _genai_client is None:
41+
_genai_client = importlib.import_module("._genai.client", __name__)
42+
return getattr(_genai_client, name)
43+
44+
if name == "types":
45+
global _genai_types
46+
if _genai_types is None:
47+
_genai_types = importlib.import_module("._genai.types", __name__)
48+
if "vertexai.types" not in sys.modules:
49+
sys.modules["vertexai.types"] = _genai_types
50+
return _genai_types
51+
3352
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
3453

3554

3655
__all__ = [
3756
"init",
3857
"preview",
58+
"Client",
59+
"types",
3960
]

agentplatform/_genai/__init__.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
"""The agentplatform module."""
16+
17+
import importlib
18+
19+
from .client import Client
20+
21+
_evals = None
22+
23+
24+
def __getattr__(name): # type: ignore[no-untyped-def]
25+
if name == "evals":
26+
global _evals
27+
if _evals is None:
28+
try:
29+
_evals = importlib.import_module(".evals", __package__)
30+
except ImportError as e:
31+
raise ImportError(
32+
"The 'evals' module requires additional dependencies. "
33+
"Please install them using pip install "
34+
"google-cloud-aiplatform[evaluation]"
35+
) from e
36+
return _evals
37+
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
38+
39+
40+
__all__ = [
41+
"Client",
42+
"evals",
43+
]

0 commit comments

Comments
 (0)