Skip to content

Commit 74ec5e1

Browse files
yyyu-googlecopybara-github
authored andcommitted
feat: migrate Agent Engines, Evaluation, Prompt Management, and Skill features to agentplatform
PiperOrigin-RevId: 914975401
1 parent 6b3269b commit 74ec5e1

192 files changed

Lines changed: 78617 additions & 787 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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@
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]
30+
# Lazy importing the preview submodule
31+
# See https://peps.python.org/pep-0562/
2532
if name == "preview":
2633
# We need to import carefully to avoid `RecursionError`.
2734
# This won't work since it causes `RecursionError`:
@@ -30,10 +37,26 @@ def __getattr__(name): # type: ignore[no-untyped-def]
3037
# `import google.cloud.aiplatform.agentplatform.preview as`
3138
# `agentplatform_preview`
3239
return importlib.import_module(".preview", __name__)
40+
if name == "Client":
41+
global _genai_client
42+
if _genai_client is None:
43+
_genai_client = importlib.import_module("._genai.client", __name__)
44+
return getattr(_genai_client, name)
45+
46+
if name == "types":
47+
global _genai_types
48+
if _genai_types is None:
49+
_genai_types = importlib.import_module("._genai.types", __name__)
50+
if "vertexai.types" not in sys.modules:
51+
sys.modules["vertexai.types"] = _genai_types
52+
return _genai_types
53+
3354
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
3455

3556

3657
__all__ = [
3758
"init",
3859
"preview",
60+
"Client",
61+
"types",
3962
]

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)