google-cloud-agentplatform 1.165.1.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentplatform/__init__.py +72 -0
- agentplatform/_genai/__init__.py +43 -0
- agentplatform/_genai/_agent_engines_utils.py +2341 -0
- agentplatform/_genai/_bigquery_utils.py +49 -0
- agentplatform/_genai/_datasets_utils.py +344 -0
- agentplatform/_genai/_evals_builtin_tools.py +209 -0
- agentplatform/_genai/_evals_common.py +4268 -0
- agentplatform/_genai/_evals_constant.py +122 -0
- agentplatform/_genai/_evals_data_converters.py +926 -0
- agentplatform/_genai/_evals_metric_handlers.py +1783 -0
- agentplatform/_genai/_evals_metric_loaders.py +401 -0
- agentplatform/_genai/_evals_utils.py +1043 -0
- agentplatform/_genai/_evals_visualization.py +2070 -0
- agentplatform/_genai/_gcs_utils.py +262 -0
- agentplatform/_genai/_logging_utils.py +47 -0
- agentplatform/_genai/_memory_bank_utils.py +206 -0
- agentplatform/_genai/_observability_data_converter.py +186 -0
- agentplatform/_genai/_operations_utils.py +94 -0
- agentplatform/_genai/_prompt_management_utils.py +147 -0
- agentplatform/_genai/_prompt_optimizer_utils.py +215 -0
- agentplatform/_genai/_skills_utils.py +69 -0
- agentplatform/_genai/_transformers.py +628 -0
- agentplatform/_genai/a2a_task_events.py +509 -0
- agentplatform/_genai/a2a_tasks.py +861 -0
- agentplatform/_genai/agent_engines.py +3931 -0
- agentplatform/_genai/client.py +519 -0
- agentplatform/_genai/datasets.py +3045 -0
- agentplatform/_genai/endpoints.py +1149 -0
- agentplatform/_genai/evals.py +6883 -0
- agentplatform/_genai/example_stores.py +1445 -0
- agentplatform/_genai/feedback_contexts.py +700 -0
- agentplatform/_genai/feedback_entries.py +1644 -0
- agentplatform/_genai/live.py +64 -0
- agentplatform/_genai/live_agent_engines.py +179 -0
- agentplatform/_genai/memories.py +2962 -0
- agentplatform/_genai/memory_banks.py +1927 -0
- agentplatform/_genai/memory_revisions.py +465 -0
- agentplatform/_genai/model_garden.py +2638 -0
- agentplatform/_genai/prompt_optimizer.py +995 -0
- agentplatform/_genai/prompts.py +4515 -0
- agentplatform/_genai/rag.py +4961 -0
- agentplatform/_genai/runtime_revisions.py +1257 -0
- agentplatform/_genai/runtimes.py +78 -0
- agentplatform/_genai/sandbox_snapshots.py +1015 -0
- agentplatform/_genai/sandbox_templates.py +1088 -0
- agentplatform/_genai/sandboxes.py +1604 -0
- agentplatform/_genai/session_events.py +543 -0
- agentplatform/_genai/sessions.py +1449 -0
- agentplatform/_genai/skill_revisions.py +377 -0
- agentplatform/_genai/skills.py +1708 -0
- agentplatform/_genai/types/__init__.py +4695 -0
- agentplatform/_genai/types/agent_engines.py +16 -0
- agentplatform/_genai/types/common.py +32784 -0
- agentplatform/_genai/types/evals.py +1031 -0
- agentplatform/_genai/types/prompt_optimizer.py +107 -0
- agentplatform/_genai/types/prompts.py +107 -0
- agentplatform/version.py +17 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/METADATA +79 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/RECORD +62 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/WHEEL +5 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/licenses/LICENSE +202 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# Copyright 2025 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
|
+
|
|
16
|
+
# Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
17
|
+
|
|
18
|
+
import json
|
|
19
|
+
import logging
|
|
20
|
+
from typing import Any, Optional, Union
|
|
21
|
+
from urllib.parse import urlencode
|
|
22
|
+
|
|
23
|
+
from google.genai import _api_module
|
|
24
|
+
from google.genai import _common
|
|
25
|
+
from google.genai._common import get_value_by_path as getv
|
|
26
|
+
from google.genai._common import set_value_by_path as setv
|
|
27
|
+
|
|
28
|
+
from . import types
|
|
29
|
+
|
|
30
|
+
logger = logging.getLogger("agentplatform_genai.skillrevisions")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _GetSkillRevisionRequestParameters_to_vertex(
|
|
34
|
+
from_object: Union[dict[str, Any], object],
|
|
35
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
36
|
+
) -> dict[str, Any]:
|
|
37
|
+
to_object: dict[str, Any] = {}
|
|
38
|
+
if getv(from_object, ["name"]) is not None:
|
|
39
|
+
setv(to_object, ["_url", "name"], getv(from_object, ["name"]))
|
|
40
|
+
|
|
41
|
+
if getv(from_object, ["config"]) is not None:
|
|
42
|
+
setv(to_object, ["config"], getv(from_object, ["config"]))
|
|
43
|
+
|
|
44
|
+
return to_object
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _ListSkillRevisionsConfig_to_vertex(
|
|
48
|
+
from_object: Union[dict[str, Any], object],
|
|
49
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
50
|
+
) -> dict[str, Any]:
|
|
51
|
+
to_object: dict[str, Any] = {}
|
|
52
|
+
|
|
53
|
+
if getv(from_object, ["page_size"]) is not None:
|
|
54
|
+
setv(parent_object, ["_query", "pageSize"], getv(from_object, ["page_size"]))
|
|
55
|
+
|
|
56
|
+
if getv(from_object, ["page_token"]) is not None:
|
|
57
|
+
setv(parent_object, ["_query", "pageToken"], getv(from_object, ["page_token"]))
|
|
58
|
+
|
|
59
|
+
return to_object
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _ListSkillRevisionsRequestParameters_to_vertex(
|
|
63
|
+
from_object: Union[dict[str, Any], object],
|
|
64
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
65
|
+
) -> dict[str, Any]:
|
|
66
|
+
to_object: dict[str, Any] = {}
|
|
67
|
+
if getv(from_object, ["name"]) is not None:
|
|
68
|
+
setv(to_object, ["_url", "name"], getv(from_object, ["name"]))
|
|
69
|
+
|
|
70
|
+
if getv(from_object, ["config"]) is not None:
|
|
71
|
+
setv(
|
|
72
|
+
to_object,
|
|
73
|
+
["config"],
|
|
74
|
+
_ListSkillRevisionsConfig_to_vertex(
|
|
75
|
+
getv(from_object, ["config"]), to_object
|
|
76
|
+
),
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return to_object
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class SkillRevisions(_api_module.BaseModule):
|
|
83
|
+
"""Class for managing Skill Revisions in the Skill Registry."""
|
|
84
|
+
|
|
85
|
+
def get(
|
|
86
|
+
self, *, name: str, config: Optional[types.GetSkillRevisionConfigOrDict] = None
|
|
87
|
+
) -> types.SkillRevision:
|
|
88
|
+
"""
|
|
89
|
+
Gets a Skill Revision.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
parameter_model = types._GetSkillRevisionRequestParameters(
|
|
93
|
+
name=name,
|
|
94
|
+
config=config,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
request_url_dict: Optional[dict[str, str]]
|
|
98
|
+
if not self._api_client.vertexai:
|
|
99
|
+
raise ValueError(
|
|
100
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
101
|
+
)
|
|
102
|
+
else:
|
|
103
|
+
request_dict = _GetSkillRevisionRequestParameters_to_vertex(parameter_model)
|
|
104
|
+
request_url_dict = request_dict.get("_url")
|
|
105
|
+
if request_url_dict:
|
|
106
|
+
path = "{name}".format_map(request_url_dict)
|
|
107
|
+
else:
|
|
108
|
+
path = "{name}"
|
|
109
|
+
|
|
110
|
+
query_params = request_dict.get("_query")
|
|
111
|
+
if query_params:
|
|
112
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
113
|
+
# TODO: remove the hack that pops config.
|
|
114
|
+
request_dict.pop("config", None)
|
|
115
|
+
|
|
116
|
+
http_options: Optional[types.HttpOptions] = None
|
|
117
|
+
if (
|
|
118
|
+
parameter_model.config is not None
|
|
119
|
+
and parameter_model.config.http_options is not None
|
|
120
|
+
):
|
|
121
|
+
http_options = parameter_model.config.http_options
|
|
122
|
+
|
|
123
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
124
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
125
|
+
|
|
126
|
+
response = self._api_client.request("get", path, request_dict, http_options)
|
|
127
|
+
|
|
128
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
129
|
+
|
|
130
|
+
return_value = types.SkillRevision._from_response(
|
|
131
|
+
response=response_dict,
|
|
132
|
+
kwargs=(
|
|
133
|
+
{
|
|
134
|
+
"config": {
|
|
135
|
+
"response_schema": getattr(
|
|
136
|
+
parameter_model.config, "response_schema", None
|
|
137
|
+
),
|
|
138
|
+
"response_json_schema": getattr(
|
|
139
|
+
parameter_model.config, "response_json_schema", None
|
|
140
|
+
),
|
|
141
|
+
"include_all_fields": getattr(
|
|
142
|
+
parameter_model.config, "include_all_fields", None
|
|
143
|
+
),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if getattr(parameter_model, "config", None)
|
|
147
|
+
else {}
|
|
148
|
+
),
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
self._api_client._verify_response(return_value)
|
|
152
|
+
return return_value
|
|
153
|
+
|
|
154
|
+
def list(
|
|
155
|
+
self,
|
|
156
|
+
*,
|
|
157
|
+
name: str,
|
|
158
|
+
config: Optional[types.ListSkillRevisionsConfigOrDict] = None,
|
|
159
|
+
) -> types.ListSkillRevisionsResponse:
|
|
160
|
+
"""
|
|
161
|
+
Lists Skill Revisions.
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
parameter_model = types._ListSkillRevisionsRequestParameters(
|
|
165
|
+
name=name,
|
|
166
|
+
config=config,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
request_url_dict: Optional[dict[str, str]]
|
|
170
|
+
if not self._api_client.vertexai:
|
|
171
|
+
raise ValueError(
|
|
172
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
173
|
+
)
|
|
174
|
+
else:
|
|
175
|
+
request_dict = _ListSkillRevisionsRequestParameters_to_vertex(
|
|
176
|
+
parameter_model
|
|
177
|
+
)
|
|
178
|
+
request_url_dict = request_dict.get("_url")
|
|
179
|
+
if request_url_dict:
|
|
180
|
+
path = "{name}/revisions".format_map(request_url_dict)
|
|
181
|
+
else:
|
|
182
|
+
path = "{name}/revisions"
|
|
183
|
+
|
|
184
|
+
query_params = request_dict.get("_query")
|
|
185
|
+
if query_params:
|
|
186
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
187
|
+
# TODO: remove the hack that pops config.
|
|
188
|
+
request_dict.pop("config", None)
|
|
189
|
+
|
|
190
|
+
http_options: Optional[types.HttpOptions] = None
|
|
191
|
+
if (
|
|
192
|
+
parameter_model.config is not None
|
|
193
|
+
and parameter_model.config.http_options is not None
|
|
194
|
+
):
|
|
195
|
+
http_options = parameter_model.config.http_options
|
|
196
|
+
|
|
197
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
198
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
199
|
+
|
|
200
|
+
response = self._api_client.request("get", path, request_dict, http_options)
|
|
201
|
+
|
|
202
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
203
|
+
|
|
204
|
+
return_value = types.ListSkillRevisionsResponse._from_response(
|
|
205
|
+
response=response_dict,
|
|
206
|
+
kwargs=(
|
|
207
|
+
{
|
|
208
|
+
"config": {
|
|
209
|
+
"response_schema": getattr(
|
|
210
|
+
parameter_model.config, "response_schema", None
|
|
211
|
+
),
|
|
212
|
+
"response_json_schema": getattr(
|
|
213
|
+
parameter_model.config, "response_json_schema", None
|
|
214
|
+
),
|
|
215
|
+
"include_all_fields": getattr(
|
|
216
|
+
parameter_model.config, "include_all_fields", None
|
|
217
|
+
),
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if getattr(parameter_model, "config", None)
|
|
221
|
+
else {}
|
|
222
|
+
),
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
self._api_client._verify_response(return_value)
|
|
226
|
+
return return_value
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class AsyncSkillRevisions(_api_module.BaseModule):
|
|
230
|
+
"""Class for managing Skill Revisions in the Skill Registry."""
|
|
231
|
+
|
|
232
|
+
async def get(
|
|
233
|
+
self, *, name: str, config: Optional[types.GetSkillRevisionConfigOrDict] = None
|
|
234
|
+
) -> types.SkillRevision:
|
|
235
|
+
"""
|
|
236
|
+
Gets a Skill Revision.
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
parameter_model = types._GetSkillRevisionRequestParameters(
|
|
240
|
+
name=name,
|
|
241
|
+
config=config,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
request_url_dict: Optional[dict[str, str]]
|
|
245
|
+
if not self._api_client.vertexai:
|
|
246
|
+
raise ValueError(
|
|
247
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
248
|
+
)
|
|
249
|
+
else:
|
|
250
|
+
request_dict = _GetSkillRevisionRequestParameters_to_vertex(parameter_model)
|
|
251
|
+
request_url_dict = request_dict.get("_url")
|
|
252
|
+
if request_url_dict:
|
|
253
|
+
path = "{name}".format_map(request_url_dict)
|
|
254
|
+
else:
|
|
255
|
+
path = "{name}"
|
|
256
|
+
|
|
257
|
+
query_params = request_dict.get("_query")
|
|
258
|
+
if query_params:
|
|
259
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
260
|
+
# TODO: remove the hack that pops config.
|
|
261
|
+
request_dict.pop("config", None)
|
|
262
|
+
|
|
263
|
+
http_options: Optional[types.HttpOptions] = None
|
|
264
|
+
if (
|
|
265
|
+
parameter_model.config is not None
|
|
266
|
+
and parameter_model.config.http_options is not None
|
|
267
|
+
):
|
|
268
|
+
http_options = parameter_model.config.http_options
|
|
269
|
+
|
|
270
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
271
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
272
|
+
|
|
273
|
+
response = await self._api_client.async_request(
|
|
274
|
+
"get", path, request_dict, http_options
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
278
|
+
|
|
279
|
+
return_value = types.SkillRevision._from_response(
|
|
280
|
+
response=response_dict,
|
|
281
|
+
kwargs=(
|
|
282
|
+
{
|
|
283
|
+
"config": {
|
|
284
|
+
"response_schema": getattr(
|
|
285
|
+
parameter_model.config, "response_schema", None
|
|
286
|
+
),
|
|
287
|
+
"response_json_schema": getattr(
|
|
288
|
+
parameter_model.config, "response_json_schema", None
|
|
289
|
+
),
|
|
290
|
+
"include_all_fields": getattr(
|
|
291
|
+
parameter_model.config, "include_all_fields", None
|
|
292
|
+
),
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if getattr(parameter_model, "config", None)
|
|
296
|
+
else {}
|
|
297
|
+
),
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
self._api_client._verify_response(return_value)
|
|
301
|
+
return return_value
|
|
302
|
+
|
|
303
|
+
async def list(
|
|
304
|
+
self,
|
|
305
|
+
*,
|
|
306
|
+
name: str,
|
|
307
|
+
config: Optional[types.ListSkillRevisionsConfigOrDict] = None,
|
|
308
|
+
) -> types.ListSkillRevisionsResponse:
|
|
309
|
+
"""
|
|
310
|
+
Lists Skill Revisions.
|
|
311
|
+
"""
|
|
312
|
+
|
|
313
|
+
parameter_model = types._ListSkillRevisionsRequestParameters(
|
|
314
|
+
name=name,
|
|
315
|
+
config=config,
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
request_url_dict: Optional[dict[str, str]]
|
|
319
|
+
if not self._api_client.vertexai:
|
|
320
|
+
raise ValueError(
|
|
321
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
322
|
+
)
|
|
323
|
+
else:
|
|
324
|
+
request_dict = _ListSkillRevisionsRequestParameters_to_vertex(
|
|
325
|
+
parameter_model
|
|
326
|
+
)
|
|
327
|
+
request_url_dict = request_dict.get("_url")
|
|
328
|
+
if request_url_dict:
|
|
329
|
+
path = "{name}/revisions".format_map(request_url_dict)
|
|
330
|
+
else:
|
|
331
|
+
path = "{name}/revisions"
|
|
332
|
+
|
|
333
|
+
query_params = request_dict.get("_query")
|
|
334
|
+
if query_params:
|
|
335
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
336
|
+
# TODO: remove the hack that pops config.
|
|
337
|
+
request_dict.pop("config", None)
|
|
338
|
+
|
|
339
|
+
http_options: Optional[types.HttpOptions] = None
|
|
340
|
+
if (
|
|
341
|
+
parameter_model.config is not None
|
|
342
|
+
and parameter_model.config.http_options is not None
|
|
343
|
+
):
|
|
344
|
+
http_options = parameter_model.config.http_options
|
|
345
|
+
|
|
346
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
347
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
348
|
+
|
|
349
|
+
response = await self._api_client.async_request(
|
|
350
|
+
"get", path, request_dict, http_options
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
354
|
+
|
|
355
|
+
return_value = types.ListSkillRevisionsResponse._from_response(
|
|
356
|
+
response=response_dict,
|
|
357
|
+
kwargs=(
|
|
358
|
+
{
|
|
359
|
+
"config": {
|
|
360
|
+
"response_schema": getattr(
|
|
361
|
+
parameter_model.config, "response_schema", None
|
|
362
|
+
),
|
|
363
|
+
"response_json_schema": getattr(
|
|
364
|
+
parameter_model.config, "response_json_schema", None
|
|
365
|
+
),
|
|
366
|
+
"include_all_fields": getattr(
|
|
367
|
+
parameter_model.config, "include_all_fields", None
|
|
368
|
+
),
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if getattr(parameter_model, "config", None)
|
|
372
|
+
else {}
|
|
373
|
+
),
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
self._api_client._verify_response(return_value)
|
|
377
|
+
return return_value
|