agentrun-inner-test 0.0.62__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.

Potentially problematic release.


This version of agentrun-inner-test might be problematic. Click here for more details.

Files changed (154) hide show
  1. agentrun/__init__.py +358 -0
  2. agentrun/agent_runtime/__client_async_template.py +466 -0
  3. agentrun/agent_runtime/__endpoint_async_template.py +345 -0
  4. agentrun/agent_runtime/__init__.py +53 -0
  5. agentrun/agent_runtime/__runtime_async_template.py +477 -0
  6. agentrun/agent_runtime/api/__data_async_template.py +58 -0
  7. agentrun/agent_runtime/api/__init__.py +6 -0
  8. agentrun/agent_runtime/api/control.py +1362 -0
  9. agentrun/agent_runtime/api/data.py +98 -0
  10. agentrun/agent_runtime/client.py +868 -0
  11. agentrun/agent_runtime/endpoint.py +649 -0
  12. agentrun/agent_runtime/model.py +362 -0
  13. agentrun/agent_runtime/runtime.py +904 -0
  14. agentrun/credential/__client_async_template.py +177 -0
  15. agentrun/credential/__credential_async_template.py +216 -0
  16. agentrun/credential/__init__.py +28 -0
  17. agentrun/credential/api/__init__.py +5 -0
  18. agentrun/credential/api/control.py +606 -0
  19. agentrun/credential/client.py +319 -0
  20. agentrun/credential/credential.py +381 -0
  21. agentrun/credential/model.py +248 -0
  22. agentrun/integration/__init__.py +21 -0
  23. agentrun/integration/agentscope/__init__.py +13 -0
  24. agentrun/integration/agentscope/adapter.py +17 -0
  25. agentrun/integration/agentscope/builtin.py +88 -0
  26. agentrun/integration/agentscope/message_adapter.py +185 -0
  27. agentrun/integration/agentscope/model_adapter.py +60 -0
  28. agentrun/integration/agentscope/tool_adapter.py +59 -0
  29. agentrun/integration/builtin/__init__.py +18 -0
  30. agentrun/integration/builtin/knowledgebase.py +137 -0
  31. agentrun/integration/builtin/model.py +93 -0
  32. agentrun/integration/builtin/sandbox.py +1234 -0
  33. agentrun/integration/builtin/toolset.py +47 -0
  34. agentrun/integration/crewai/__init__.py +13 -0
  35. agentrun/integration/crewai/adapter.py +9 -0
  36. agentrun/integration/crewai/builtin.py +88 -0
  37. agentrun/integration/crewai/model_adapter.py +31 -0
  38. agentrun/integration/crewai/tool_adapter.py +26 -0
  39. agentrun/integration/google_adk/__init__.py +13 -0
  40. agentrun/integration/google_adk/adapter.py +15 -0
  41. agentrun/integration/google_adk/builtin.py +88 -0
  42. agentrun/integration/google_adk/message_adapter.py +144 -0
  43. agentrun/integration/google_adk/model_adapter.py +46 -0
  44. agentrun/integration/google_adk/tool_adapter.py +235 -0
  45. agentrun/integration/langchain/__init__.py +31 -0
  46. agentrun/integration/langchain/adapter.py +15 -0
  47. agentrun/integration/langchain/builtin.py +94 -0
  48. agentrun/integration/langchain/message_adapter.py +141 -0
  49. agentrun/integration/langchain/model_adapter.py +37 -0
  50. agentrun/integration/langchain/tool_adapter.py +50 -0
  51. agentrun/integration/langgraph/__init__.py +36 -0
  52. agentrun/integration/langgraph/adapter.py +20 -0
  53. agentrun/integration/langgraph/agent_converter.py +1073 -0
  54. agentrun/integration/langgraph/builtin.py +88 -0
  55. agentrun/integration/pydantic_ai/__init__.py +13 -0
  56. agentrun/integration/pydantic_ai/adapter.py +13 -0
  57. agentrun/integration/pydantic_ai/builtin.py +88 -0
  58. agentrun/integration/pydantic_ai/model_adapter.py +44 -0
  59. agentrun/integration/pydantic_ai/tool_adapter.py +19 -0
  60. agentrun/integration/utils/__init__.py +112 -0
  61. agentrun/integration/utils/adapter.py +560 -0
  62. agentrun/integration/utils/canonical.py +164 -0
  63. agentrun/integration/utils/converter.py +134 -0
  64. agentrun/integration/utils/model.py +110 -0
  65. agentrun/integration/utils/tool.py +1759 -0
  66. agentrun/knowledgebase/__client_async_template.py +173 -0
  67. agentrun/knowledgebase/__init__.py +53 -0
  68. agentrun/knowledgebase/__knowledgebase_async_template.py +438 -0
  69. agentrun/knowledgebase/api/__data_async_template.py +414 -0
  70. agentrun/knowledgebase/api/__init__.py +19 -0
  71. agentrun/knowledgebase/api/control.py +606 -0
  72. agentrun/knowledgebase/api/data.py +624 -0
  73. agentrun/knowledgebase/client.py +311 -0
  74. agentrun/knowledgebase/knowledgebase.py +748 -0
  75. agentrun/knowledgebase/model.py +270 -0
  76. agentrun/memory_collection/__client_async_template.py +178 -0
  77. agentrun/memory_collection/__init__.py +37 -0
  78. agentrun/memory_collection/__memory_collection_async_template.py +457 -0
  79. agentrun/memory_collection/api/__init__.py +5 -0
  80. agentrun/memory_collection/api/control.py +610 -0
  81. agentrun/memory_collection/client.py +323 -0
  82. agentrun/memory_collection/memory_collection.py +844 -0
  83. agentrun/memory_collection/model.py +162 -0
  84. agentrun/model/__client_async_template.py +357 -0
  85. agentrun/model/__init__.py +57 -0
  86. agentrun/model/__model_proxy_async_template.py +270 -0
  87. agentrun/model/__model_service_async_template.py +267 -0
  88. agentrun/model/api/__init__.py +6 -0
  89. agentrun/model/api/control.py +1173 -0
  90. agentrun/model/api/data.py +196 -0
  91. agentrun/model/client.py +674 -0
  92. agentrun/model/model.py +235 -0
  93. agentrun/model/model_proxy.py +439 -0
  94. agentrun/model/model_service.py +438 -0
  95. agentrun/sandbox/__aio_sandbox_async_template.py +523 -0
  96. agentrun/sandbox/__browser_sandbox_async_template.py +110 -0
  97. agentrun/sandbox/__client_async_template.py +491 -0
  98. agentrun/sandbox/__code_interpreter_sandbox_async_template.py +463 -0
  99. agentrun/sandbox/__init__.py +69 -0
  100. agentrun/sandbox/__sandbox_async_template.py +463 -0
  101. agentrun/sandbox/__template_async_template.py +152 -0
  102. agentrun/sandbox/aio_sandbox.py +912 -0
  103. agentrun/sandbox/api/__aio_data_async_template.py +335 -0
  104. agentrun/sandbox/api/__browser_data_async_template.py +140 -0
  105. agentrun/sandbox/api/__code_interpreter_data_async_template.py +206 -0
  106. agentrun/sandbox/api/__init__.py +19 -0
  107. agentrun/sandbox/api/__sandbox_data_async_template.py +107 -0
  108. agentrun/sandbox/api/aio_data.py +551 -0
  109. agentrun/sandbox/api/browser_data.py +172 -0
  110. agentrun/sandbox/api/code_interpreter_data.py +396 -0
  111. agentrun/sandbox/api/control.py +1051 -0
  112. agentrun/sandbox/api/playwright_async.py +492 -0
  113. agentrun/sandbox/api/playwright_sync.py +492 -0
  114. agentrun/sandbox/api/sandbox_data.py +154 -0
  115. agentrun/sandbox/browser_sandbox.py +185 -0
  116. agentrun/sandbox/client.py +925 -0
  117. agentrun/sandbox/code_interpreter_sandbox.py +823 -0
  118. agentrun/sandbox/model.py +384 -0
  119. agentrun/sandbox/sandbox.py +848 -0
  120. agentrun/sandbox/template.py +217 -0
  121. agentrun/server/__init__.py +191 -0
  122. agentrun/server/agui_normalizer.py +180 -0
  123. agentrun/server/agui_protocol.py +797 -0
  124. agentrun/server/invoker.py +309 -0
  125. agentrun/server/model.py +427 -0
  126. agentrun/server/openai_protocol.py +535 -0
  127. agentrun/server/protocol.py +140 -0
  128. agentrun/server/server.py +208 -0
  129. agentrun/toolset/__client_async_template.py +62 -0
  130. agentrun/toolset/__init__.py +51 -0
  131. agentrun/toolset/__toolset_async_template.py +204 -0
  132. agentrun/toolset/api/__init__.py +17 -0
  133. agentrun/toolset/api/control.py +262 -0
  134. agentrun/toolset/api/mcp.py +100 -0
  135. agentrun/toolset/api/openapi.py +1251 -0
  136. agentrun/toolset/client.py +102 -0
  137. agentrun/toolset/model.py +321 -0
  138. agentrun/toolset/toolset.py +271 -0
  139. agentrun/utils/__data_api_async_template.py +721 -0
  140. agentrun/utils/__init__.py +5 -0
  141. agentrun/utils/__resource_async_template.py +158 -0
  142. agentrun/utils/config.py +270 -0
  143. agentrun/utils/control_api.py +105 -0
  144. agentrun/utils/data_api.py +1121 -0
  145. agentrun/utils/exception.py +151 -0
  146. agentrun/utils/helper.py +108 -0
  147. agentrun/utils/log.py +77 -0
  148. agentrun/utils/model.py +168 -0
  149. agentrun/utils/resource.py +291 -0
  150. agentrun_inner_test-0.0.62.dist-info/METADATA +265 -0
  151. agentrun_inner_test-0.0.62.dist-info/RECORD +154 -0
  152. agentrun_inner_test-0.0.62.dist-info/WHEEL +5 -0
  153. agentrun_inner_test-0.0.62.dist-info/licenses/LICENSE +201 -0
  154. agentrun_inner_test-0.0.62.dist-info/top_level.txt +1 -0
@@ -0,0 +1,270 @@
1
+ """KnowledgeBase 模型定义 / KnowledgeBase Model Definitions
2
+
3
+ 定义知识库相关的数据模型和枚举。
4
+ Defines data models and enumerations related to knowledge bases.
5
+ """
6
+
7
+ from enum import Enum
8
+ from typing import Any, Dict, List, Optional, Union
9
+
10
+ from agentrun.utils.config import Config
11
+ from agentrun.utils.model import BaseModel, PageableInput
12
+
13
+
14
+ class KnowledgeBaseProvider(str, Enum):
15
+ """知识库提供商类型 / KnowledgeBase Provider Type"""
16
+
17
+ RAGFLOW = "ragflow"
18
+ """RagFlow 知识库 / RagFlow knowledge base"""
19
+ BAILIAN = "bailian"
20
+ """百炼知识库 / Bailian knowledge base"""
21
+
22
+
23
+ # =============================================================================
24
+ # RagFlow 配置模型 / RagFlow Configuration Models
25
+ # =============================================================================
26
+
27
+
28
+ class RagFlowProviderSettings(BaseModel):
29
+ """RagFlow 提供商设置 / RagFlow Provider Settings"""
30
+
31
+ base_url: str
32
+ """RagFlow 服务地址,http或https开头,最后不能有/
33
+ RagFlow service URL, starting with http or https, no trailing slash"""
34
+ dataset_ids: List[str]
35
+ """RagFlow 知识库 ID 列表,可以填写多个
36
+ List of RagFlow dataset IDs, multiple values allowed"""
37
+
38
+
39
+ class RagFlowRetrieveSettings(BaseModel):
40
+ """RagFlow 检索设置 / RagFlow Retrieve Settings"""
41
+
42
+ similarity_threshold: Optional[float] = None
43
+ """相似度阈值 / Similarity threshold"""
44
+ vector_similarity_weight: Optional[float] = None
45
+ """向量相似度权重 / Vector similarity weight"""
46
+ cross_languages: Optional[List[str]] = None
47
+ """跨语言检索语言列表,如 ["English", "Chinese"]
48
+ Cross-language retrieval languages, e.g. ["English", "Chinese"]"""
49
+
50
+
51
+ # =============================================================================
52
+ # Bailian 配置模型 / Bailian Configuration Models
53
+ # =============================================================================
54
+
55
+
56
+ class BailianProviderSettings(BaseModel):
57
+ """百炼提供商设置 / Bailian Provider Settings"""
58
+
59
+ workspace_id: str
60
+ """百炼工作空间 ID / Bailian workspace ID"""
61
+ index_ids: List[str]
62
+ """绑定的知识库索引列表 / List of bound knowledge base index IDs"""
63
+
64
+
65
+ class BailianRetrieveSettings(BaseModel):
66
+ """百炼检索设置 / Bailian Retrieve Settings"""
67
+
68
+ dense_similarity_top_k: Optional[int] = None
69
+ """稠密向量检索返回的 Top K 数量 / Dense similarity top K"""
70
+ sparse_similarity_top_k: Optional[int] = None
71
+ """稀疏向量检索返回的 Top K 数量 / Sparse similarity top K"""
72
+ rerank_min_score: Optional[float] = None
73
+ """重排序最低分数阈值 / Rerank minimum score threshold"""
74
+ rerank_top_n: Optional[int] = None
75
+ """重排序返回的 Top N 数量 / Rerank top N"""
76
+
77
+
78
+ # =============================================================================
79
+ # 联合类型定义 / Union Type Definitions
80
+ # =============================================================================
81
+
82
+ ProviderSettings = Union[
83
+ RagFlowProviderSettings, BailianProviderSettings, Dict[str, Any]
84
+ ]
85
+ """提供商设置联合类型 / Provider settings union type"""
86
+
87
+ RetrieveSettings = Union[
88
+ RagFlowRetrieveSettings, BailianRetrieveSettings, Dict[str, Any]
89
+ ]
90
+ """检索设置联合类型 / Retrieve settings union type"""
91
+
92
+
93
+ # =============================================================================
94
+ # 知识库属性模型 / KnowledgeBase Property Models
95
+ # =============================================================================
96
+
97
+
98
+ class KnowledgeBaseMutableProps(BaseModel):
99
+ """知识库可变属性 / KnowledgeBase Mutable Properties"""
100
+
101
+ description: Optional[str] = None
102
+ """描述 / Description"""
103
+ credential_name: Optional[str] = None
104
+ """凭证名称 / Credential name"""
105
+ provider_settings: Optional[Union[ProviderSettings, Dict[str, Any]]] = None
106
+ """提供商设置 / Provider settings"""
107
+ retrieve_settings: Optional[Union[RetrieveSettings, Dict[str, Any]]] = None
108
+ """检索设置 / Retrieve settings"""
109
+
110
+
111
+ class KnowledgeBaseImmutableProps(BaseModel):
112
+ """知识库不可变属性 / KnowledgeBase Immutable Properties"""
113
+
114
+ knowledge_base_name: Optional[str] = None
115
+ """知识库名称 / KnowledgeBase name"""
116
+ provider: Optional[Union[KnowledgeBaseProvider, str]] = None
117
+ """提供商 / Provider"""
118
+
119
+
120
+ class KnowledgeBaseSystemProps(BaseModel):
121
+ """知识库系统属性 / KnowledgeBase System Properties"""
122
+
123
+ knowledge_base_id: Optional[str] = None
124
+ """知识库 ID / KnowledgeBase ID"""
125
+ created_at: Optional[str] = None
126
+ """创建时间 / Created at"""
127
+ last_updated_at: Optional[str] = None
128
+ """最后更新时间 / Last updated at"""
129
+
130
+
131
+ # =============================================================================
132
+ # API 输入输出模型 / API Input/Output Models
133
+ # =============================================================================
134
+
135
+
136
+ class KnowledgeBaseCreateInput(
137
+ KnowledgeBaseImmutableProps, KnowledgeBaseMutableProps
138
+ ):
139
+ """知识库创建输入参数 / KnowledgeBase Create Input"""
140
+
141
+ knowledge_base_name: str # type: ignore
142
+ """知识库名称(必填)/ KnowledgeBase name (required)"""
143
+ provider: Union[KnowledgeBaseProvider, str] # type: ignore
144
+ """提供商(必填)/ Provider (required)"""
145
+ provider_settings: Union[ProviderSettings, Dict[str, Any]] # type: ignore
146
+ """提供商设置(必填)/ Provider settings (required)"""
147
+
148
+
149
+ class KnowledgeBaseUpdateInput(KnowledgeBaseMutableProps):
150
+ """知识库更新输入参数 / KnowledgeBase Update Input"""
151
+
152
+ pass
153
+
154
+
155
+ class KnowledgeBaseListInput(PageableInput):
156
+ """知识库列表查询输入参数 / KnowledgeBase List Input"""
157
+
158
+ provider: Optional[Union[KnowledgeBaseProvider, str]] = None
159
+ """提供商 / Provider"""
160
+
161
+
162
+ class KnowledgeBaseListOutput(BaseModel):
163
+ """知识库列表查询输出 / KnowledgeBase List Output"""
164
+
165
+ knowledge_base_id: Optional[str] = None
166
+ """知识库 ID / KnowledgeBase ID"""
167
+ knowledge_base_name: Optional[str] = None
168
+ """知识库名称 / KnowledgeBase name"""
169
+ provider: Optional[Union[KnowledgeBaseProvider, str]] = None
170
+ """提供商 / Provider"""
171
+ description: Optional[str] = None
172
+ """描述 / Description"""
173
+ credential_name: Optional[str] = None
174
+ """凭证名称 / Credential name"""
175
+ provider_settings: Optional[Union[ProviderSettings, Dict[str, Any]]] = None
176
+ """提供商设置 / Provider settings"""
177
+ retrieve_settings: Optional[Union[RetrieveSettings, Dict[str, Any]]] = None
178
+ """检索设置 / Retrieve settings"""
179
+ created_at: Optional[str] = None
180
+ """创建时间 / Created at"""
181
+ last_updated_at: Optional[str] = None
182
+ """最后更新时间 / Last updated at"""
183
+
184
+ async def to_knowledge_base_async(self, config: Optional[Config] = None):
185
+ """转换为知识库对象(异步)/ Convert to KnowledgeBase object (async)
186
+
187
+ Args:
188
+ config: 配置 / Configuration
189
+
190
+ Returns:
191
+ KnowledgeBase: 知识库对象 / KnowledgeBase object
192
+ """
193
+ from .client import KnowledgeBaseClient
194
+
195
+ return await KnowledgeBaseClient(config).get_async(
196
+ self.knowledge_base_name or "", config=config
197
+ )
198
+
199
+ def to_knowledge_base(self, config: Optional[Config] = None):
200
+ """转换为知识库对象(同步)/ Convert to KnowledgeBase object (sync)
201
+
202
+ Args:
203
+ config: 配置 / Configuration
204
+
205
+ Returns:
206
+ KnowledgeBase: 知识库对象 / KnowledgeBase object
207
+ """
208
+ from .client import KnowledgeBaseClient
209
+
210
+ return KnowledgeBaseClient(config).get(
211
+ self.knowledge_base_name or "", config=config
212
+ )
213
+
214
+
215
+ class RetrieveInput(BaseModel):
216
+ """知识库检索输入参数 / KnowledgeBase Retrieve Input
217
+
218
+ 用于多知识库检索的输入参数。
219
+ Input parameters for multi-knowledge base retrieval.
220
+ """
221
+
222
+ knowledge_base_names: List[str]
223
+ """知识库名称列表 / List of knowledge base names"""
224
+ query: str
225
+ """查询文本 / Query text"""
226
+
227
+ knowledge_base_id: Optional[str] = None
228
+ """知识库 ID / KnowledgeBase ID"""
229
+ knowledge_base_name: Optional[str] = None
230
+ """知识库名称 / KnowledgeBase name"""
231
+ provider: Optional[str] = None
232
+ """提供商 / Provider"""
233
+ description: Optional[str] = None
234
+ """描述 / Description"""
235
+ credential_name: Optional[str] = None
236
+ """凭证名称 / Credential name"""
237
+ created_at: Optional[str] = None
238
+ """创建时间 / Created at"""
239
+ last_updated_at: Optional[str] = None
240
+ """最后更新时间 / Last updated at"""
241
+
242
+ async def to_knowledge_base_async(self, config: Optional[Config] = None):
243
+ """转换为知识库对象(异步)/ Convert to KnowledgeBase object (async)
244
+
245
+ Args:
246
+ config: 配置 / Configuration
247
+
248
+ Returns:
249
+ KnowledgeBase: 知识库对象 / KnowledgeBase object
250
+ """
251
+ from .client import KnowledgeBaseClient
252
+
253
+ return await KnowledgeBaseClient(config).get_async(
254
+ self.knowledge_base_name or "", config=config
255
+ )
256
+
257
+ def to_knowledge_base(self, config: Optional[Config] = None):
258
+ """转换为知识库对象(同步)/ Convert to KnowledgeBase object (sync)
259
+
260
+ Args:
261
+ config: 配置 / Configuration
262
+
263
+ Returns:
264
+ KnowledgeBase: 知识库对象 / KnowledgeBase object
265
+ """
266
+ from .client import KnowledgeBaseClient
267
+
268
+ return KnowledgeBaseClient(config).get(
269
+ self.knowledge_base_name or "", config=config
270
+ )
@@ -0,0 +1,178 @@
1
+ """MemoryCollection 客户端 / MemoryCollection Client
2
+
3
+ 此模块提供记忆集合管理的客户端API。
4
+ This module provides the client API for memory collection management.
5
+ """
6
+
7
+ from typing import Optional
8
+
9
+ from alibabacloud_agentrun20250910.models import (
10
+ CreateMemoryCollectionInput,
11
+ ListMemoryCollectionsRequest,
12
+ UpdateMemoryCollectionInput,
13
+ )
14
+
15
+ from agentrun.utils.config import Config
16
+ from agentrun.utils.exception import HTTPError
17
+
18
+ from .api.control import MemoryCollectionControlAPI
19
+ from .memory_collection import MemoryCollection
20
+ from .model import (
21
+ MemoryCollectionCreateInput,
22
+ MemoryCollectionListInput,
23
+ MemoryCollectionListOutput,
24
+ MemoryCollectionUpdateInput,
25
+ )
26
+
27
+
28
+ class MemoryCollectionClient:
29
+ """MemoryCollection 客户端 / MemoryCollection Client
30
+
31
+ 提供记忆集合的创建、删除、更新和查询功能。
32
+ Provides create, delete, update and query functions for memory collections.
33
+ """
34
+
35
+ def __init__(self, config: Optional[Config] = None):
36
+ """初始化客户端 / Initialize client
37
+
38
+ Args:
39
+ config: 配置对象,可选 / Configuration object, optional
40
+ """
41
+ self.__control_api = MemoryCollectionControlAPI(config)
42
+
43
+ async def create_async(
44
+ self,
45
+ input: MemoryCollectionCreateInput,
46
+ config: Optional[Config] = None,
47
+ ):
48
+ """创建记忆集合(异步) / Create memory collection asynchronously
49
+
50
+ Args:
51
+ input: 记忆集合输入参数 / Memory collection input parameters
52
+ config: 配置对象,可选 / Configuration object, optional
53
+
54
+ Returns:
55
+ MemoryCollection: 创建的记忆集合对象 / Created memory collection object
56
+
57
+ Raises:
58
+ ResourceAlreadyExistError: 资源已存在 / Resource already exists
59
+ HTTPError: HTTP 请求错误 / HTTP request error
60
+ """
61
+ try:
62
+ result = await self.__control_api.create_memory_collection_async(
63
+ CreateMemoryCollectionInput().from_map(input.model_dump()),
64
+ config=config,
65
+ )
66
+
67
+ return MemoryCollection.from_inner_object(result)
68
+ except HTTPError as e:
69
+ raise e.to_resource_error(
70
+ "MemoryCollection", input.memory_collection_name
71
+ ) from e
72
+
73
+ async def delete_async(
74
+ self, memory_collection_name: str, config: Optional[Config] = None
75
+ ):
76
+ """删除记忆集合(异步)
77
+
78
+ Args:
79
+ memory_collection_name: 记忆集合名称
80
+ config: 配置
81
+
82
+ Raises:
83
+ ResourceNotExistError: 记忆集合不存在
84
+ """
85
+ try:
86
+ result = await self.__control_api.delete_memory_collection_async(
87
+ memory_collection_name, config=config
88
+ )
89
+
90
+ return MemoryCollection.from_inner_object(result)
91
+
92
+ except HTTPError as e:
93
+ raise e.to_resource_error(
94
+ "MemoryCollection", memory_collection_name
95
+ ) from e
96
+
97
+ async def update_async(
98
+ self,
99
+ memory_collection_name: str,
100
+ input: MemoryCollectionUpdateInput,
101
+ config: Optional[Config] = None,
102
+ ):
103
+ """更新记忆集合(异步)
104
+
105
+ Args:
106
+ memory_collection_name: 记忆集合名称
107
+ input: 记忆集合更新输入参数
108
+ config: 配置
109
+
110
+ Returns:
111
+ MemoryCollection: 更新后的记忆集合对象
112
+
113
+ Raises:
114
+ ResourceNotExistError: 记忆集合不存在
115
+ """
116
+ try:
117
+ result = await self.__control_api.update_memory_collection_async(
118
+ memory_collection_name,
119
+ UpdateMemoryCollectionInput().from_map(input.model_dump()),
120
+ config=config,
121
+ )
122
+
123
+ return MemoryCollection.from_inner_object(result)
124
+ except HTTPError as e:
125
+ raise e.to_resource_error(
126
+ "MemoryCollection", memory_collection_name
127
+ ) from e
128
+
129
+ async def get_async(
130
+ self, memory_collection_name: str, config: Optional[Config] = None
131
+ ):
132
+ """获取记忆集合(异步)
133
+
134
+ Args:
135
+ memory_collection_name: 记忆集合名称
136
+ config: 配置
137
+
138
+ Returns:
139
+ MemoryCollection: 记忆集合对象
140
+
141
+ Raises:
142
+ ResourceNotExistError: 记忆集合不存在
143
+ """
144
+ try:
145
+ result = await self.__control_api.get_memory_collection_async(
146
+ memory_collection_name, config=config
147
+ )
148
+ return MemoryCollection.from_inner_object(result)
149
+ except HTTPError as e:
150
+ raise e.to_resource_error(
151
+ "MemoryCollection", memory_collection_name
152
+ ) from e
153
+
154
+ async def list_async(
155
+ self,
156
+ input: Optional[MemoryCollectionListInput] = None,
157
+ config: Optional[Config] = None,
158
+ ):
159
+ """列出记忆集合(异步)
160
+
161
+ Args:
162
+ input: 分页查询参数
163
+ config: 配置
164
+
165
+ Returns:
166
+ List[MemoryCollectionListOutput]: 记忆集合列表
167
+ """
168
+ if input is None:
169
+ input = MemoryCollectionListInput()
170
+
171
+ results = await self.__control_api.list_memory_collections_async(
172
+ ListMemoryCollectionsRequest().from_map(input.model_dump()),
173
+ config=config,
174
+ )
175
+ return [
176
+ MemoryCollectionListOutput.from_inner_object(item)
177
+ for item in results.items # type: ignore
178
+ ]
@@ -0,0 +1,37 @@
1
+ """MemoryCollection 模块 / MemoryCollection Module
2
+
3
+ 提供记忆集合管理功能。
4
+ Provides memory collection management functionality.
5
+ """
6
+
7
+ from .client import MemoryCollectionClient
8
+ from .memory_collection import MemoryCollection
9
+ from .model import (
10
+ EmbedderConfig,
11
+ EmbedderConfigConfig,
12
+ LLMConfig,
13
+ LLMConfigConfig,
14
+ MemoryCollectionCreateInput,
15
+ MemoryCollectionListInput,
16
+ MemoryCollectionListOutput,
17
+ MemoryCollectionUpdateInput,
18
+ NetworkConfiguration,
19
+ VectorStoreConfig,
20
+ VectorStoreConfigConfig,
21
+ )
22
+
23
+ __all__ = [
24
+ "MemoryCollection",
25
+ "MemoryCollectionClient",
26
+ "MemoryCollectionCreateInput",
27
+ "MemoryCollectionUpdateInput",
28
+ "MemoryCollectionListInput",
29
+ "MemoryCollectionListOutput",
30
+ "EmbedderConfig",
31
+ "EmbedderConfigConfig",
32
+ "LLMConfig",
33
+ "LLMConfigConfig",
34
+ "NetworkConfiguration",
35
+ "VectorStoreConfig",
36
+ "VectorStoreConfigConfig",
37
+ ]