agentrun-inner-test 0.0.56__py3-none-any.whl → 0.0.64__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.
- agentrun/__init__.py +34 -1
- agentrun/agent_runtime/__endpoint_async_template.py +40 -0
- agentrun/agent_runtime/endpoint.py +79 -0
- agentrun/memory_collection/__client_async_template.py +178 -0
- agentrun/memory_collection/__init__.py +37 -0
- agentrun/memory_collection/__memory_collection_async_template.py +457 -0
- agentrun/memory_collection/api/__init__.py +5 -0
- agentrun/memory_collection/api/control.py +610 -0
- agentrun/memory_collection/client.py +323 -0
- agentrun/memory_collection/memory_collection.py +844 -0
- agentrun/memory_collection/model.py +162 -0
- {agentrun_inner_test-0.0.56.dist-info → agentrun_inner_test-0.0.64.dist-info}/METADATA +4 -4
- {agentrun_inner_test-0.0.56.dist-info → agentrun_inner_test-0.0.64.dist-info}/RECORD +16 -8
- {agentrun_inner_test-0.0.56.dist-info → agentrun_inner_test-0.0.64.dist-info}/WHEEL +0 -0
- {agentrun_inner_test-0.0.56.dist-info → agentrun_inner_test-0.0.64.dist-info}/licenses/LICENSE +0 -0
- {agentrun_inner_test-0.0.56.dist-info → agentrun_inner_test-0.0.64.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file is auto generated by the code generation script.
|
|
3
|
+
Do not modify this file manually.
|
|
4
|
+
Use the `make codegen` command to regenerate.
|
|
5
|
+
|
|
6
|
+
当前文件为自动生成的控制 API 客户端代码。请勿手动修改此文件。
|
|
7
|
+
使用 `make codegen` 命令重新生成。
|
|
8
|
+
|
|
9
|
+
source: codegen/configs/memory_collection_control_api.yaml
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Memory Collection 管控链路 API
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from typing import Dict, Optional
|
|
16
|
+
|
|
17
|
+
from alibabacloud_agentrun20250910.models import (
|
|
18
|
+
CreateMemoryCollectionInput,
|
|
19
|
+
CreateMemoryCollectionRequest,
|
|
20
|
+
ListMemoryCollectionsOutput,
|
|
21
|
+
ListMemoryCollectionsRequest,
|
|
22
|
+
MemoryCollection,
|
|
23
|
+
UpdateMemoryCollectionInput,
|
|
24
|
+
UpdateMemoryCollectionRequest,
|
|
25
|
+
)
|
|
26
|
+
from alibabacloud_tea_openapi.exceptions._client import ClientException
|
|
27
|
+
from alibabacloud_tea_openapi.exceptions._server import ServerException
|
|
28
|
+
from alibabacloud_tea_util.models import RuntimeOptions
|
|
29
|
+
import pydash
|
|
30
|
+
|
|
31
|
+
from agentrun.utils.config import Config
|
|
32
|
+
from agentrun.utils.control_api import ControlAPI
|
|
33
|
+
from agentrun.utils.exception import ClientError, ServerError
|
|
34
|
+
from agentrun.utils.log import logger
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class MemoryCollectionControlAPI(ControlAPI):
|
|
38
|
+
"""Memory Collection 管控链路 API"""
|
|
39
|
+
|
|
40
|
+
def __init__(self, config: Optional[Config] = None):
|
|
41
|
+
"""初始化 API 客户端
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
config: 全局配置对象
|
|
45
|
+
"""
|
|
46
|
+
super().__init__(config)
|
|
47
|
+
|
|
48
|
+
def create_memory_collection(
|
|
49
|
+
self,
|
|
50
|
+
input: CreateMemoryCollectionInput,
|
|
51
|
+
headers: Optional[Dict[str, str]] = None,
|
|
52
|
+
config: Optional[Config] = None,
|
|
53
|
+
) -> MemoryCollection:
|
|
54
|
+
"""创建 Memory Collection
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
input: Memory Collection 配置
|
|
58
|
+
|
|
59
|
+
headers: 请求头
|
|
60
|
+
config: 配置
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
MemoryCollection: 创建的 Memory Collection 对象
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
AgentRuntimeError: 调用失败时抛出
|
|
67
|
+
ClientError: 客户端错误
|
|
68
|
+
ServerError: 服务器错误
|
|
69
|
+
APIError: 运行时错误
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
client = self._get_client(config)
|
|
74
|
+
response = client.create_memory_collection_with_options(
|
|
75
|
+
CreateMemoryCollectionRequest(body=input),
|
|
76
|
+
headers=headers or {},
|
|
77
|
+
runtime=RuntimeOptions(),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
logger.debug(
|
|
81
|
+
"request api create_memory_collection, request Request ID:"
|
|
82
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
83
|
+
f" response: {response.body.data}"
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return response.body.data
|
|
87
|
+
except ClientException as e:
|
|
88
|
+
raise ClientError(
|
|
89
|
+
e.status_code,
|
|
90
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
91
|
+
request_id=e.request_id,
|
|
92
|
+
request=[
|
|
93
|
+
input,
|
|
94
|
+
],
|
|
95
|
+
) from e
|
|
96
|
+
except ServerException as e:
|
|
97
|
+
raise ServerError(
|
|
98
|
+
e.status_code,
|
|
99
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
100
|
+
request_id=e.request_id,
|
|
101
|
+
) from e
|
|
102
|
+
|
|
103
|
+
async def create_memory_collection_async(
|
|
104
|
+
self,
|
|
105
|
+
input: CreateMemoryCollectionInput,
|
|
106
|
+
headers: Optional[Dict[str, str]] = None,
|
|
107
|
+
config: Optional[Config] = None,
|
|
108
|
+
) -> MemoryCollection:
|
|
109
|
+
"""创建 Memory Collection
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
input: Memory Collection 配置
|
|
113
|
+
|
|
114
|
+
headers: 请求头
|
|
115
|
+
config: 配置
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
MemoryCollection: 创建的 Memory Collection 对象
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
AgentRuntimeError: 调用失败时抛出
|
|
122
|
+
ClientError: 客户端错误
|
|
123
|
+
ServerError: 服务器错误
|
|
124
|
+
APIError: 运行时错误
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
client = self._get_client(config)
|
|
129
|
+
response = await client.create_memory_collection_with_options_async(
|
|
130
|
+
CreateMemoryCollectionRequest(body=input),
|
|
131
|
+
headers=headers or {},
|
|
132
|
+
runtime=RuntimeOptions(),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
logger.debug(
|
|
136
|
+
"request api create_memory_collection, request Request ID:"
|
|
137
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
138
|
+
f" response: {response.body.data}"
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
return response.body.data
|
|
142
|
+
except ClientException as e:
|
|
143
|
+
raise ClientError(
|
|
144
|
+
e.status_code,
|
|
145
|
+
e.data.get("message", e.message),
|
|
146
|
+
request_id=e.request_id,
|
|
147
|
+
request=[
|
|
148
|
+
input,
|
|
149
|
+
],
|
|
150
|
+
) from e
|
|
151
|
+
except ServerException as e:
|
|
152
|
+
raise ServerError(
|
|
153
|
+
e.status_code,
|
|
154
|
+
e.data.get("message", e.message),
|
|
155
|
+
request_id=e.request_id,
|
|
156
|
+
) from e
|
|
157
|
+
|
|
158
|
+
def delete_memory_collection(
|
|
159
|
+
self,
|
|
160
|
+
memory_collection_name: str,
|
|
161
|
+
headers: Optional[Dict[str, str]] = None,
|
|
162
|
+
config: Optional[Config] = None,
|
|
163
|
+
) -> MemoryCollection:
|
|
164
|
+
"""删除 Memory Collection
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
memory_collection_name: Memory Collection 名称
|
|
168
|
+
|
|
169
|
+
headers: 请求头
|
|
170
|
+
config: 配置
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
MemoryCollection: 删除结果
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
AgentRuntimeError: 调用失败时抛出
|
|
177
|
+
ClientError: 客户端错误
|
|
178
|
+
ServerError: 服务器错误
|
|
179
|
+
APIError: 运行时错误
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
try:
|
|
183
|
+
client = self._get_client(config)
|
|
184
|
+
response = client.delete_memory_collection_with_options(
|
|
185
|
+
memory_collection_name,
|
|
186
|
+
headers=headers or {},
|
|
187
|
+
runtime=RuntimeOptions(),
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
logger.debug(
|
|
191
|
+
"request api delete_memory_collection, request Request ID:"
|
|
192
|
+
f" {response.body.request_id}\n request:"
|
|
193
|
+
f" {[memory_collection_name,]}\n response:"
|
|
194
|
+
f" {response.body.data}"
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
return response.body.data
|
|
198
|
+
except ClientException as e:
|
|
199
|
+
raise ClientError(
|
|
200
|
+
e.status_code,
|
|
201
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
202
|
+
request_id=e.request_id,
|
|
203
|
+
request=[
|
|
204
|
+
memory_collection_name,
|
|
205
|
+
],
|
|
206
|
+
) from e
|
|
207
|
+
except ServerException as e:
|
|
208
|
+
raise ServerError(
|
|
209
|
+
e.status_code,
|
|
210
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
211
|
+
request_id=e.request_id,
|
|
212
|
+
) from e
|
|
213
|
+
|
|
214
|
+
async def delete_memory_collection_async(
|
|
215
|
+
self,
|
|
216
|
+
memory_collection_name: str,
|
|
217
|
+
headers: Optional[Dict[str, str]] = None,
|
|
218
|
+
config: Optional[Config] = None,
|
|
219
|
+
) -> MemoryCollection:
|
|
220
|
+
"""删除 Memory Collection
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
memory_collection_name: Memory Collection 名称
|
|
224
|
+
|
|
225
|
+
headers: 请求头
|
|
226
|
+
config: 配置
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
MemoryCollection: 删除结果
|
|
230
|
+
|
|
231
|
+
Raises:
|
|
232
|
+
AgentRuntimeError: 调用失败时抛出
|
|
233
|
+
ClientError: 客户端错误
|
|
234
|
+
ServerError: 服务器错误
|
|
235
|
+
APIError: 运行时错误
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
try:
|
|
239
|
+
client = self._get_client(config)
|
|
240
|
+
response = await client.delete_memory_collection_with_options_async(
|
|
241
|
+
memory_collection_name,
|
|
242
|
+
headers=headers or {},
|
|
243
|
+
runtime=RuntimeOptions(),
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
logger.debug(
|
|
247
|
+
"request api delete_memory_collection, request Request ID:"
|
|
248
|
+
f" {response.body.request_id}\n request:"
|
|
249
|
+
f" {[memory_collection_name,]}\n response:"
|
|
250
|
+
f" {response.body.data}"
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
return response.body.data
|
|
254
|
+
except ClientException as e:
|
|
255
|
+
raise ClientError(
|
|
256
|
+
e.status_code,
|
|
257
|
+
e.data.get("message", e.message),
|
|
258
|
+
request_id=e.request_id,
|
|
259
|
+
request=[
|
|
260
|
+
memory_collection_name,
|
|
261
|
+
],
|
|
262
|
+
) from e
|
|
263
|
+
except ServerException as e:
|
|
264
|
+
raise ServerError(
|
|
265
|
+
e.status_code,
|
|
266
|
+
e.data.get("message", e.message),
|
|
267
|
+
request_id=e.request_id,
|
|
268
|
+
) from e
|
|
269
|
+
|
|
270
|
+
def update_memory_collection(
|
|
271
|
+
self,
|
|
272
|
+
memory_collection_name: str,
|
|
273
|
+
input: UpdateMemoryCollectionInput,
|
|
274
|
+
headers: Optional[Dict[str, str]] = None,
|
|
275
|
+
config: Optional[Config] = None,
|
|
276
|
+
) -> MemoryCollection:
|
|
277
|
+
"""更新 Memory Collection
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
memory_collection_name: Memory Collection 名称
|
|
281
|
+
input: Memory Collection 配置
|
|
282
|
+
|
|
283
|
+
headers: 请求头
|
|
284
|
+
config: 配置
|
|
285
|
+
|
|
286
|
+
Returns:
|
|
287
|
+
MemoryCollection: 更新的 Memory Collection 对象
|
|
288
|
+
|
|
289
|
+
Raises:
|
|
290
|
+
AgentRuntimeError: 调用失败时抛出
|
|
291
|
+
ClientError: 客户端错误
|
|
292
|
+
ServerError: 服务器错误
|
|
293
|
+
APIError: 运行时错误
|
|
294
|
+
"""
|
|
295
|
+
|
|
296
|
+
try:
|
|
297
|
+
client = self._get_client(config)
|
|
298
|
+
response = client.update_memory_collection_with_options(
|
|
299
|
+
memory_collection_name,
|
|
300
|
+
UpdateMemoryCollectionRequest(body=input),
|
|
301
|
+
headers=headers or {},
|
|
302
|
+
runtime=RuntimeOptions(),
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
logger.debug(
|
|
306
|
+
"request api update_memory_collection, request Request ID:"
|
|
307
|
+
f" {response.body.request_id}\n request:"
|
|
308
|
+
f" {[memory_collection_name,input.to_map(),]}\n response:"
|
|
309
|
+
f" {response.body.data}"
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
return response.body.data
|
|
313
|
+
except ClientException as e:
|
|
314
|
+
raise ClientError(
|
|
315
|
+
e.status_code,
|
|
316
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
317
|
+
request_id=e.request_id,
|
|
318
|
+
request=[
|
|
319
|
+
memory_collection_name,
|
|
320
|
+
input,
|
|
321
|
+
],
|
|
322
|
+
) from e
|
|
323
|
+
except ServerException as e:
|
|
324
|
+
raise ServerError(
|
|
325
|
+
e.status_code,
|
|
326
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
327
|
+
request_id=e.request_id,
|
|
328
|
+
) from e
|
|
329
|
+
|
|
330
|
+
async def update_memory_collection_async(
|
|
331
|
+
self,
|
|
332
|
+
memory_collection_name: str,
|
|
333
|
+
input: UpdateMemoryCollectionInput,
|
|
334
|
+
headers: Optional[Dict[str, str]] = None,
|
|
335
|
+
config: Optional[Config] = None,
|
|
336
|
+
) -> MemoryCollection:
|
|
337
|
+
"""更新 Memory Collection
|
|
338
|
+
|
|
339
|
+
Args:
|
|
340
|
+
memory_collection_name: Memory Collection 名称
|
|
341
|
+
input: Memory Collection 配置
|
|
342
|
+
|
|
343
|
+
headers: 请求头
|
|
344
|
+
config: 配置
|
|
345
|
+
|
|
346
|
+
Returns:
|
|
347
|
+
MemoryCollection: 更新的 Memory Collection 对象
|
|
348
|
+
|
|
349
|
+
Raises:
|
|
350
|
+
AgentRuntimeError: 调用失败时抛出
|
|
351
|
+
ClientError: 客户端错误
|
|
352
|
+
ServerError: 服务器错误
|
|
353
|
+
APIError: 运行时错误
|
|
354
|
+
"""
|
|
355
|
+
|
|
356
|
+
try:
|
|
357
|
+
client = self._get_client(config)
|
|
358
|
+
response = await client.update_memory_collection_with_options_async(
|
|
359
|
+
memory_collection_name,
|
|
360
|
+
UpdateMemoryCollectionRequest(body=input),
|
|
361
|
+
headers=headers or {},
|
|
362
|
+
runtime=RuntimeOptions(),
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
logger.debug(
|
|
366
|
+
"request api update_memory_collection, request Request ID:"
|
|
367
|
+
f" {response.body.request_id}\n request:"
|
|
368
|
+
f" {[memory_collection_name,input.to_map(),]}\n response:"
|
|
369
|
+
f" {response.body.data}"
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
return response.body.data
|
|
373
|
+
except ClientException as e:
|
|
374
|
+
raise ClientError(
|
|
375
|
+
e.status_code,
|
|
376
|
+
e.data.get("message", e.message),
|
|
377
|
+
request_id=e.request_id,
|
|
378
|
+
request=[
|
|
379
|
+
memory_collection_name,
|
|
380
|
+
input,
|
|
381
|
+
],
|
|
382
|
+
) from e
|
|
383
|
+
except ServerException as e:
|
|
384
|
+
raise ServerError(
|
|
385
|
+
e.status_code,
|
|
386
|
+
e.data.get("message", e.message),
|
|
387
|
+
request_id=e.request_id,
|
|
388
|
+
) from e
|
|
389
|
+
|
|
390
|
+
def get_memory_collection(
|
|
391
|
+
self,
|
|
392
|
+
memory_collection_name: str,
|
|
393
|
+
headers: Optional[Dict[str, str]] = None,
|
|
394
|
+
config: Optional[Config] = None,
|
|
395
|
+
) -> MemoryCollection:
|
|
396
|
+
"""获取 Memory Collection
|
|
397
|
+
|
|
398
|
+
Args:
|
|
399
|
+
memory_collection_name: Memory Collection 名称
|
|
400
|
+
|
|
401
|
+
headers: 请求头
|
|
402
|
+
config: 配置
|
|
403
|
+
|
|
404
|
+
Returns:
|
|
405
|
+
MemoryCollection: Memory Collection 对象
|
|
406
|
+
|
|
407
|
+
Raises:
|
|
408
|
+
AgentRuntimeError: 调用失败时抛出
|
|
409
|
+
ClientError: 客户端错误
|
|
410
|
+
ServerError: 服务器错误
|
|
411
|
+
APIError: 运行时错误
|
|
412
|
+
"""
|
|
413
|
+
|
|
414
|
+
try:
|
|
415
|
+
client = self._get_client(config)
|
|
416
|
+
response = client.get_memory_collection_with_options(
|
|
417
|
+
memory_collection_name,
|
|
418
|
+
headers=headers or {},
|
|
419
|
+
runtime=RuntimeOptions(),
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
logger.debug(
|
|
423
|
+
"request api get_memory_collection, request Request ID:"
|
|
424
|
+
f" {response.body.request_id}\n request:"
|
|
425
|
+
f" {[memory_collection_name,]}\n response:"
|
|
426
|
+
f" {response.body.data}"
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
return response.body.data
|
|
430
|
+
except ClientException as e:
|
|
431
|
+
raise ClientError(
|
|
432
|
+
e.status_code,
|
|
433
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
434
|
+
request_id=e.request_id,
|
|
435
|
+
request=[
|
|
436
|
+
memory_collection_name,
|
|
437
|
+
],
|
|
438
|
+
) from e
|
|
439
|
+
except ServerException as e:
|
|
440
|
+
raise ServerError(
|
|
441
|
+
e.status_code,
|
|
442
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
443
|
+
request_id=e.request_id,
|
|
444
|
+
) from e
|
|
445
|
+
|
|
446
|
+
async def get_memory_collection_async(
|
|
447
|
+
self,
|
|
448
|
+
memory_collection_name: str,
|
|
449
|
+
headers: Optional[Dict[str, str]] = None,
|
|
450
|
+
config: Optional[Config] = None,
|
|
451
|
+
) -> MemoryCollection:
|
|
452
|
+
"""获取 Memory Collection
|
|
453
|
+
|
|
454
|
+
Args:
|
|
455
|
+
memory_collection_name: Memory Collection 名称
|
|
456
|
+
|
|
457
|
+
headers: 请求头
|
|
458
|
+
config: 配置
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
MemoryCollection: Memory Collection 对象
|
|
462
|
+
|
|
463
|
+
Raises:
|
|
464
|
+
AgentRuntimeError: 调用失败时抛出
|
|
465
|
+
ClientError: 客户端错误
|
|
466
|
+
ServerError: 服务器错误
|
|
467
|
+
APIError: 运行时错误
|
|
468
|
+
"""
|
|
469
|
+
|
|
470
|
+
try:
|
|
471
|
+
client = self._get_client(config)
|
|
472
|
+
response = await client.get_memory_collection_with_options_async(
|
|
473
|
+
memory_collection_name,
|
|
474
|
+
headers=headers or {},
|
|
475
|
+
runtime=RuntimeOptions(),
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
logger.debug(
|
|
479
|
+
"request api get_memory_collection, request Request ID:"
|
|
480
|
+
f" {response.body.request_id}\n request:"
|
|
481
|
+
f" {[memory_collection_name,]}\n response:"
|
|
482
|
+
f" {response.body.data}"
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
return response.body.data
|
|
486
|
+
except ClientException as e:
|
|
487
|
+
raise ClientError(
|
|
488
|
+
e.status_code,
|
|
489
|
+
e.data.get("message", e.message),
|
|
490
|
+
request_id=e.request_id,
|
|
491
|
+
request=[
|
|
492
|
+
memory_collection_name,
|
|
493
|
+
],
|
|
494
|
+
) from e
|
|
495
|
+
except ServerException as e:
|
|
496
|
+
raise ServerError(
|
|
497
|
+
e.status_code,
|
|
498
|
+
e.data.get("message", e.message),
|
|
499
|
+
request_id=e.request_id,
|
|
500
|
+
) from e
|
|
501
|
+
|
|
502
|
+
def list_memory_collections(
|
|
503
|
+
self,
|
|
504
|
+
input: ListMemoryCollectionsRequest,
|
|
505
|
+
headers: Optional[Dict[str, str]] = None,
|
|
506
|
+
config: Optional[Config] = None,
|
|
507
|
+
) -> ListMemoryCollectionsOutput:
|
|
508
|
+
"""枚举 Memory Collection
|
|
509
|
+
|
|
510
|
+
Args:
|
|
511
|
+
input: 枚举的配置
|
|
512
|
+
|
|
513
|
+
headers: 请求头
|
|
514
|
+
config: 配置
|
|
515
|
+
|
|
516
|
+
Returns:
|
|
517
|
+
ListMemoryCollectionsOutput: Memory Collection 列表
|
|
518
|
+
|
|
519
|
+
Raises:
|
|
520
|
+
AgentRuntimeError: 调用失败时抛出
|
|
521
|
+
ClientError: 客户端错误
|
|
522
|
+
ServerError: 服务器错误
|
|
523
|
+
APIError: 运行时错误
|
|
524
|
+
"""
|
|
525
|
+
|
|
526
|
+
try:
|
|
527
|
+
client = self._get_client(config)
|
|
528
|
+
response = client.list_memory_collections_with_options(
|
|
529
|
+
input,
|
|
530
|
+
headers=headers or {},
|
|
531
|
+
runtime=RuntimeOptions(),
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
logger.debug(
|
|
535
|
+
"request api list_memory_collections, request Request ID:"
|
|
536
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
537
|
+
f" response: {response.body.data}"
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
return response.body.data
|
|
541
|
+
except ClientException as e:
|
|
542
|
+
raise ClientError(
|
|
543
|
+
e.status_code,
|
|
544
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
545
|
+
request_id=e.request_id,
|
|
546
|
+
request=[
|
|
547
|
+
input,
|
|
548
|
+
],
|
|
549
|
+
) from e
|
|
550
|
+
except ServerException as e:
|
|
551
|
+
raise ServerError(
|
|
552
|
+
e.status_code,
|
|
553
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
554
|
+
request_id=e.request_id,
|
|
555
|
+
) from e
|
|
556
|
+
|
|
557
|
+
async def list_memory_collections_async(
|
|
558
|
+
self,
|
|
559
|
+
input: ListMemoryCollectionsRequest,
|
|
560
|
+
headers: Optional[Dict[str, str]] = None,
|
|
561
|
+
config: Optional[Config] = None,
|
|
562
|
+
) -> ListMemoryCollectionsOutput:
|
|
563
|
+
"""枚举 Memory Collection
|
|
564
|
+
|
|
565
|
+
Args:
|
|
566
|
+
input: 枚举的配置
|
|
567
|
+
|
|
568
|
+
headers: 请求头
|
|
569
|
+
config: 配置
|
|
570
|
+
|
|
571
|
+
Returns:
|
|
572
|
+
ListMemoryCollectionsOutput: Memory Collection 列表
|
|
573
|
+
|
|
574
|
+
Raises:
|
|
575
|
+
AgentRuntimeError: 调用失败时抛出
|
|
576
|
+
ClientError: 客户端错误
|
|
577
|
+
ServerError: 服务器错误
|
|
578
|
+
APIError: 运行时错误
|
|
579
|
+
"""
|
|
580
|
+
|
|
581
|
+
try:
|
|
582
|
+
client = self._get_client(config)
|
|
583
|
+
response = await client.list_memory_collections_with_options_async(
|
|
584
|
+
input,
|
|
585
|
+
headers=headers or {},
|
|
586
|
+
runtime=RuntimeOptions(),
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
logger.debug(
|
|
590
|
+
"request api list_memory_collections, request Request ID:"
|
|
591
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
592
|
+
f" response: {response.body.data}"
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
return response.body.data
|
|
596
|
+
except ClientException as e:
|
|
597
|
+
raise ClientError(
|
|
598
|
+
e.status_code,
|
|
599
|
+
e.data.get("message", e.message),
|
|
600
|
+
request_id=e.request_id,
|
|
601
|
+
request=[
|
|
602
|
+
input,
|
|
603
|
+
],
|
|
604
|
+
) from e
|
|
605
|
+
except ServerException as e:
|
|
606
|
+
raise ServerError(
|
|
607
|
+
e.status_code,
|
|
608
|
+
e.data.get("message", e.message),
|
|
609
|
+
request_id=e.request_id,
|
|
610
|
+
) from e
|