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,465 @@
|
|
|
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 functools
|
|
19
|
+
import json
|
|
20
|
+
import logging
|
|
21
|
+
from typing import Any, Iterator, Optional, Union
|
|
22
|
+
from urllib.parse import urlencode
|
|
23
|
+
|
|
24
|
+
from google.genai import _api_module
|
|
25
|
+
from google.genai import _common
|
|
26
|
+
from google.genai._common import get_value_by_path as getv
|
|
27
|
+
from google.genai._common import set_value_by_path as setv
|
|
28
|
+
from google.genai.pagers import AsyncPager, Pager
|
|
29
|
+
|
|
30
|
+
from . import types
|
|
31
|
+
|
|
32
|
+
logger = logging.getLogger("agentplatform_genai.memoryrevisions")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _GetMemoryRevisionRequestParameters_to_vertex(
|
|
36
|
+
from_object: Union[dict[str, Any], object],
|
|
37
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
38
|
+
) -> dict[str, Any]:
|
|
39
|
+
to_object: dict[str, Any] = {}
|
|
40
|
+
if getv(from_object, ["name"]) is not None:
|
|
41
|
+
setv(to_object, ["_url", "name"], getv(from_object, ["name"]))
|
|
42
|
+
|
|
43
|
+
return to_object
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _ListMemoryRevisionsConfig_to_vertex(
|
|
47
|
+
from_object: Union[dict[str, Any], object],
|
|
48
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
49
|
+
) -> dict[str, Any]:
|
|
50
|
+
to_object: dict[str, Any] = {}
|
|
51
|
+
|
|
52
|
+
if getv(from_object, ["page_size"]) is not None:
|
|
53
|
+
setv(parent_object, ["_query", "pageSize"], getv(from_object, ["page_size"]))
|
|
54
|
+
|
|
55
|
+
if getv(from_object, ["page_token"]) is not None:
|
|
56
|
+
setv(parent_object, ["_query", "pageToken"], getv(from_object, ["page_token"]))
|
|
57
|
+
|
|
58
|
+
if getv(from_object, ["filter"]) is not None:
|
|
59
|
+
setv(parent_object, ["_query", "filter"], getv(from_object, ["filter"]))
|
|
60
|
+
|
|
61
|
+
return to_object
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _ListMemoryRevisionsRequestParameters_to_vertex(
|
|
65
|
+
from_object: Union[dict[str, Any], object],
|
|
66
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
67
|
+
) -> dict[str, Any]:
|
|
68
|
+
to_object: dict[str, Any] = {}
|
|
69
|
+
if getv(from_object, ["name"]) is not None:
|
|
70
|
+
setv(to_object, ["_url", "name"], getv(from_object, ["name"]))
|
|
71
|
+
|
|
72
|
+
if getv(from_object, ["config"]) is not None:
|
|
73
|
+
_ListMemoryRevisionsConfig_to_vertex(getv(from_object, ["config"]), to_object)
|
|
74
|
+
|
|
75
|
+
return to_object
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class MemoryRevisions(_api_module.BaseModule):
|
|
79
|
+
|
|
80
|
+
def get(
|
|
81
|
+
self, *, name: str, config: Optional[types.GetMemoryRevisionConfigOrDict] = None
|
|
82
|
+
) -> types.MemoryRevision:
|
|
83
|
+
"""
|
|
84
|
+
Gets a memory revision.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
name (str): Required. The name of the memory revision to get. Format:
|
|
88
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/memories/{memory_id}/revisions/{revision_id}`.
|
|
89
|
+
config (GetMemoryRevisionConfig):
|
|
90
|
+
Optional. Additional configurations for getting the memory revision.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
MemoryRevision: The requested memory revision.
|
|
94
|
+
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
parameter_model = types._GetMemoryRevisionRequestParameters(
|
|
98
|
+
name=name,
|
|
99
|
+
config=config,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
request_url_dict: Optional[dict[str, str]]
|
|
103
|
+
if not self._api_client.vertexai:
|
|
104
|
+
raise ValueError(
|
|
105
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
106
|
+
)
|
|
107
|
+
else:
|
|
108
|
+
request_dict = _GetMemoryRevisionRequestParameters_to_vertex(
|
|
109
|
+
parameter_model
|
|
110
|
+
)
|
|
111
|
+
request_url_dict = request_dict.get("_url")
|
|
112
|
+
if request_url_dict:
|
|
113
|
+
path = "{name}".format_map(request_url_dict)
|
|
114
|
+
else:
|
|
115
|
+
path = "{name}"
|
|
116
|
+
|
|
117
|
+
query_params = request_dict.get("_query")
|
|
118
|
+
if query_params:
|
|
119
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
120
|
+
# TODO: remove the hack that pops config.
|
|
121
|
+
request_dict.pop("config", None)
|
|
122
|
+
|
|
123
|
+
http_options: Optional[types.HttpOptions] = None
|
|
124
|
+
if (
|
|
125
|
+
parameter_model.config is not None
|
|
126
|
+
and parameter_model.config.http_options is not None
|
|
127
|
+
):
|
|
128
|
+
http_options = parameter_model.config.http_options
|
|
129
|
+
|
|
130
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
131
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
132
|
+
|
|
133
|
+
response = self._api_client.request("get", path, request_dict, http_options)
|
|
134
|
+
|
|
135
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
136
|
+
|
|
137
|
+
return_value = types.MemoryRevision._from_response(
|
|
138
|
+
response=response_dict,
|
|
139
|
+
kwargs=(
|
|
140
|
+
{
|
|
141
|
+
"config": {
|
|
142
|
+
"response_schema": getattr(
|
|
143
|
+
parameter_model.config, "response_schema", None
|
|
144
|
+
),
|
|
145
|
+
"response_json_schema": getattr(
|
|
146
|
+
parameter_model.config, "response_json_schema", None
|
|
147
|
+
),
|
|
148
|
+
"include_all_fields": getattr(
|
|
149
|
+
parameter_model.config, "include_all_fields", None
|
|
150
|
+
),
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if getattr(parameter_model, "config", None)
|
|
154
|
+
else {}
|
|
155
|
+
),
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
self._api_client._verify_response(return_value)
|
|
159
|
+
return return_value
|
|
160
|
+
|
|
161
|
+
def _list(
|
|
162
|
+
self,
|
|
163
|
+
*,
|
|
164
|
+
name: str,
|
|
165
|
+
config: Optional[types.ListMemoryRevisionsConfigOrDict] = None,
|
|
166
|
+
) -> types.ListMemoryRevisionsResponse:
|
|
167
|
+
"""
|
|
168
|
+
Lists memory revisions.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
name (str): Required. The name of the memory to list revisions for. Format:
|
|
172
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/memories/{memory_id}`.
|
|
173
|
+
config (ListMemoryRevisionsConfig):
|
|
174
|
+
Optional. Additional configurations for listing the memory revisions.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
LisemoryRevisionsResponse: The requested memory revisions.
|
|
178
|
+
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
parameter_model = types._ListMemoryRevisionsRequestParameters(
|
|
182
|
+
name=name,
|
|
183
|
+
config=config,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
request_url_dict: Optional[dict[str, str]]
|
|
187
|
+
if not self._api_client.vertexai:
|
|
188
|
+
raise ValueError(
|
|
189
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
190
|
+
)
|
|
191
|
+
else:
|
|
192
|
+
request_dict = _ListMemoryRevisionsRequestParameters_to_vertex(
|
|
193
|
+
parameter_model
|
|
194
|
+
)
|
|
195
|
+
request_url_dict = request_dict.get("_url")
|
|
196
|
+
if request_url_dict:
|
|
197
|
+
path = "{name}/revisions".format_map(request_url_dict)
|
|
198
|
+
else:
|
|
199
|
+
path = "{name}/revisions"
|
|
200
|
+
|
|
201
|
+
query_params = request_dict.get("_query")
|
|
202
|
+
if query_params:
|
|
203
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
204
|
+
# TODO: remove the hack that pops config.
|
|
205
|
+
request_dict.pop("config", None)
|
|
206
|
+
|
|
207
|
+
http_options: Optional[types.HttpOptions] = None
|
|
208
|
+
if (
|
|
209
|
+
parameter_model.config is not None
|
|
210
|
+
and parameter_model.config.http_options is not None
|
|
211
|
+
):
|
|
212
|
+
http_options = parameter_model.config.http_options
|
|
213
|
+
|
|
214
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
215
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
216
|
+
|
|
217
|
+
response = self._api_client.request("get", path, request_dict, http_options)
|
|
218
|
+
|
|
219
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
220
|
+
|
|
221
|
+
return_value = types.ListMemoryRevisionsResponse._from_response(
|
|
222
|
+
response=response_dict,
|
|
223
|
+
kwargs=(
|
|
224
|
+
{
|
|
225
|
+
"config": {
|
|
226
|
+
"response_schema": getattr(
|
|
227
|
+
parameter_model.config, "response_schema", None
|
|
228
|
+
),
|
|
229
|
+
"response_json_schema": getattr(
|
|
230
|
+
parameter_model.config, "response_json_schema", None
|
|
231
|
+
),
|
|
232
|
+
"include_all_fields": getattr(
|
|
233
|
+
parameter_model.config, "include_all_fields", None
|
|
234
|
+
),
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if getattr(parameter_model, "config", None)
|
|
238
|
+
else {}
|
|
239
|
+
),
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
self._api_client._verify_response(return_value)
|
|
243
|
+
return return_value
|
|
244
|
+
|
|
245
|
+
def list(
|
|
246
|
+
self,
|
|
247
|
+
*,
|
|
248
|
+
name: str,
|
|
249
|
+
config: Optional[types.ListMemoryRevisionsConfigOrDict] = None,
|
|
250
|
+
) -> Iterator[types.MemoryRevision]:
|
|
251
|
+
"""Lists memory revisions.
|
|
252
|
+
|
|
253
|
+
Args:
|
|
254
|
+
name (str):
|
|
255
|
+
Required. The name of the Memory to list revisions for.
|
|
256
|
+
config (ListMemoryRevisionsConfigOrDict):
|
|
257
|
+
Optional. The configuration for the memories to list revisions.
|
|
258
|
+
|
|
259
|
+
Returns:
|
|
260
|
+
Iterable[MemoryRevision]: An iterable of memory revisions.
|
|
261
|
+
"""
|
|
262
|
+
|
|
263
|
+
return Pager(
|
|
264
|
+
"memory_revisions",
|
|
265
|
+
functools.partial(self._list, name=name),
|
|
266
|
+
self._list(name=name, config=config),
|
|
267
|
+
config,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class AsyncMemoryRevisions(_api_module.BaseModule):
|
|
272
|
+
|
|
273
|
+
async def get(
|
|
274
|
+
self, *, name: str, config: Optional[types.GetMemoryRevisionConfigOrDict] = None
|
|
275
|
+
) -> types.MemoryRevision:
|
|
276
|
+
"""
|
|
277
|
+
Gets a memory revision.
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
name (str): Required. The name of the memory revision to get. Format:
|
|
281
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/memories/{memory_id}/revisions/{revision_id}`.
|
|
282
|
+
config (GetMemoryRevisionConfig):
|
|
283
|
+
Optional. Additional configurations for getting the memory revision.
|
|
284
|
+
|
|
285
|
+
Returns:
|
|
286
|
+
MemoryRevision: The requested memory revision.
|
|
287
|
+
|
|
288
|
+
"""
|
|
289
|
+
|
|
290
|
+
parameter_model = types._GetMemoryRevisionRequestParameters(
|
|
291
|
+
name=name,
|
|
292
|
+
config=config,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
request_url_dict: Optional[dict[str, str]]
|
|
296
|
+
if not self._api_client.vertexai:
|
|
297
|
+
raise ValueError(
|
|
298
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
299
|
+
)
|
|
300
|
+
else:
|
|
301
|
+
request_dict = _GetMemoryRevisionRequestParameters_to_vertex(
|
|
302
|
+
parameter_model
|
|
303
|
+
)
|
|
304
|
+
request_url_dict = request_dict.get("_url")
|
|
305
|
+
if request_url_dict:
|
|
306
|
+
path = "{name}".format_map(request_url_dict)
|
|
307
|
+
else:
|
|
308
|
+
path = "{name}"
|
|
309
|
+
|
|
310
|
+
query_params = request_dict.get("_query")
|
|
311
|
+
if query_params:
|
|
312
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
313
|
+
# TODO: remove the hack that pops config.
|
|
314
|
+
request_dict.pop("config", None)
|
|
315
|
+
|
|
316
|
+
http_options: Optional[types.HttpOptions] = None
|
|
317
|
+
if (
|
|
318
|
+
parameter_model.config is not None
|
|
319
|
+
and parameter_model.config.http_options is not None
|
|
320
|
+
):
|
|
321
|
+
http_options = parameter_model.config.http_options
|
|
322
|
+
|
|
323
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
324
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
325
|
+
|
|
326
|
+
response = await self._api_client.async_request(
|
|
327
|
+
"get", path, request_dict, http_options
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
331
|
+
|
|
332
|
+
return_value = types.MemoryRevision._from_response(
|
|
333
|
+
response=response_dict,
|
|
334
|
+
kwargs=(
|
|
335
|
+
{
|
|
336
|
+
"config": {
|
|
337
|
+
"response_schema": getattr(
|
|
338
|
+
parameter_model.config, "response_schema", None
|
|
339
|
+
),
|
|
340
|
+
"response_json_schema": getattr(
|
|
341
|
+
parameter_model.config, "response_json_schema", None
|
|
342
|
+
),
|
|
343
|
+
"include_all_fields": getattr(
|
|
344
|
+
parameter_model.config, "include_all_fields", None
|
|
345
|
+
),
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if getattr(parameter_model, "config", None)
|
|
349
|
+
else {}
|
|
350
|
+
),
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
self._api_client._verify_response(return_value)
|
|
354
|
+
return return_value
|
|
355
|
+
|
|
356
|
+
async def _list(
|
|
357
|
+
self,
|
|
358
|
+
*,
|
|
359
|
+
name: str,
|
|
360
|
+
config: Optional[types.ListMemoryRevisionsConfigOrDict] = None,
|
|
361
|
+
) -> types.ListMemoryRevisionsResponse:
|
|
362
|
+
"""
|
|
363
|
+
Lists memory revisions.
|
|
364
|
+
|
|
365
|
+
Args:
|
|
366
|
+
name (str): Required. The name of the memory to list revisions for. Format:
|
|
367
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/memories/{memory_id}`.
|
|
368
|
+
config (ListMemoryRevisionsConfig):
|
|
369
|
+
Optional. Additional configurations for listing the memory revisions.
|
|
370
|
+
|
|
371
|
+
Returns:
|
|
372
|
+
LisemoryRevisionsResponse: The requested memory revisions.
|
|
373
|
+
|
|
374
|
+
"""
|
|
375
|
+
|
|
376
|
+
parameter_model = types._ListMemoryRevisionsRequestParameters(
|
|
377
|
+
name=name,
|
|
378
|
+
config=config,
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
request_url_dict: Optional[dict[str, str]]
|
|
382
|
+
if not self._api_client.vertexai:
|
|
383
|
+
raise ValueError(
|
|
384
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
385
|
+
)
|
|
386
|
+
else:
|
|
387
|
+
request_dict = _ListMemoryRevisionsRequestParameters_to_vertex(
|
|
388
|
+
parameter_model
|
|
389
|
+
)
|
|
390
|
+
request_url_dict = request_dict.get("_url")
|
|
391
|
+
if request_url_dict:
|
|
392
|
+
path = "{name}/revisions".format_map(request_url_dict)
|
|
393
|
+
else:
|
|
394
|
+
path = "{name}/revisions"
|
|
395
|
+
|
|
396
|
+
query_params = request_dict.get("_query")
|
|
397
|
+
if query_params:
|
|
398
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
399
|
+
# TODO: remove the hack that pops config.
|
|
400
|
+
request_dict.pop("config", None)
|
|
401
|
+
|
|
402
|
+
http_options: Optional[types.HttpOptions] = None
|
|
403
|
+
if (
|
|
404
|
+
parameter_model.config is not None
|
|
405
|
+
and parameter_model.config.http_options is not None
|
|
406
|
+
):
|
|
407
|
+
http_options = parameter_model.config.http_options
|
|
408
|
+
|
|
409
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
410
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
411
|
+
|
|
412
|
+
response = await self._api_client.async_request(
|
|
413
|
+
"get", path, request_dict, http_options
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
417
|
+
|
|
418
|
+
return_value = types.ListMemoryRevisionsResponse._from_response(
|
|
419
|
+
response=response_dict,
|
|
420
|
+
kwargs=(
|
|
421
|
+
{
|
|
422
|
+
"config": {
|
|
423
|
+
"response_schema": getattr(
|
|
424
|
+
parameter_model.config, "response_schema", None
|
|
425
|
+
),
|
|
426
|
+
"response_json_schema": getattr(
|
|
427
|
+
parameter_model.config, "response_json_schema", None
|
|
428
|
+
),
|
|
429
|
+
"include_all_fields": getattr(
|
|
430
|
+
parameter_model.config, "include_all_fields", None
|
|
431
|
+
),
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if getattr(parameter_model, "config", None)
|
|
435
|
+
else {}
|
|
436
|
+
),
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
self._api_client._verify_response(return_value)
|
|
440
|
+
return return_value
|
|
441
|
+
|
|
442
|
+
async def list(
|
|
443
|
+
self,
|
|
444
|
+
*,
|
|
445
|
+
name: str,
|
|
446
|
+
config: Optional[types.ListMemoryRevisionsConfigOrDict] = None,
|
|
447
|
+
) -> AsyncPager[types.MemoryRevision]:
|
|
448
|
+
"""Lists memory revisions.
|
|
449
|
+
|
|
450
|
+
Args:
|
|
451
|
+
name (str):
|
|
452
|
+
Required. The name of the Memory to list revisions for.
|
|
453
|
+
config (ListMemoryRevisionsConfigOrDict):
|
|
454
|
+
Optional. The configuration for the memories to list revisions.
|
|
455
|
+
|
|
456
|
+
Returns:
|
|
457
|
+
AsyncPager[MemoryRevision]: An async pager of memory revisions.
|
|
458
|
+
"""
|
|
459
|
+
|
|
460
|
+
return AsyncPager(
|
|
461
|
+
"memory_revisions",
|
|
462
|
+
functools.partial(self._list, name=name),
|
|
463
|
+
await self._list(name=name, config=config),
|
|
464
|
+
config,
|
|
465
|
+
)
|