agentrun-inner-test 0.0.46__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.
Files changed (53) hide show
  1. agentrun/__init__.py +34 -1
  2. agentrun/agent_runtime/__endpoint_async_template.py +40 -0
  3. agentrun/agent_runtime/api/control.py +1 -1
  4. agentrun/agent_runtime/endpoint.py +79 -0
  5. agentrun/credential/api/control.py +1 -1
  6. agentrun/integration/agentscope/__init__.py +2 -1
  7. agentrun/integration/agentscope/builtin.py +23 -0
  8. agentrun/integration/builtin/__init__.py +2 -0
  9. agentrun/integration/builtin/knowledgebase.py +137 -0
  10. agentrun/integration/crewai/__init__.py +2 -1
  11. agentrun/integration/crewai/builtin.py +23 -0
  12. agentrun/integration/google_adk/__init__.py +2 -1
  13. agentrun/integration/google_adk/builtin.py +23 -0
  14. agentrun/integration/langchain/__init__.py +2 -1
  15. agentrun/integration/langchain/builtin.py +23 -0
  16. agentrun/integration/langgraph/__init__.py +2 -1
  17. agentrun/integration/langgraph/builtin.py +23 -0
  18. agentrun/integration/pydantic_ai/__init__.py +2 -1
  19. agentrun/integration/pydantic_ai/builtin.py +23 -0
  20. agentrun/knowledgebase/__client_async_template.py +173 -0
  21. agentrun/knowledgebase/__init__.py +53 -0
  22. agentrun/knowledgebase/__knowledgebase_async_template.py +438 -0
  23. agentrun/knowledgebase/api/__data_async_template.py +414 -0
  24. agentrun/knowledgebase/api/__init__.py +19 -0
  25. agentrun/knowledgebase/api/control.py +606 -0
  26. agentrun/knowledgebase/api/data.py +624 -0
  27. agentrun/knowledgebase/client.py +311 -0
  28. agentrun/knowledgebase/knowledgebase.py +748 -0
  29. agentrun/knowledgebase/model.py +270 -0
  30. agentrun/memory_collection/__client_async_template.py +178 -0
  31. agentrun/memory_collection/__init__.py +37 -0
  32. agentrun/memory_collection/__memory_collection_async_template.py +457 -0
  33. agentrun/memory_collection/api/__init__.py +5 -0
  34. agentrun/memory_collection/api/control.py +610 -0
  35. agentrun/memory_collection/client.py +323 -0
  36. agentrun/memory_collection/memory_collection.py +844 -0
  37. agentrun/memory_collection/model.py +162 -0
  38. agentrun/model/api/control.py +1 -1
  39. agentrun/sandbox/aio_sandbox.py +11 -4
  40. agentrun/sandbox/api/control.py +1 -1
  41. agentrun/sandbox/browser_sandbox.py +2 -2
  42. agentrun/sandbox/model.py +0 -13
  43. agentrun/toolset/api/control.py +1 -1
  44. agentrun/toolset/toolset.py +1 -0
  45. agentrun/utils/__data_api_async_template.py +1 -0
  46. agentrun/utils/config.py +12 -0
  47. agentrun/utils/control_api.py +27 -0
  48. agentrun/utils/data_api.py +1 -0
  49. {agentrun_inner_test-0.0.46.dist-info → agentrun_inner_test-0.0.64.dist-info}/METADATA +4 -2
  50. {agentrun_inner_test-0.0.46.dist-info → agentrun_inner_test-0.0.64.dist-info}/RECORD +53 -34
  51. {agentrun_inner_test-0.0.46.dist-info → agentrun_inner_test-0.0.64.dist-info}/WHEEL +0 -0
  52. {agentrun_inner_test-0.0.46.dist-info → agentrun_inner_test-0.0.64.dist-info}/licenses/LICENSE +0 -0
  53. {agentrun_inner_test-0.0.46.dist-info → agentrun_inner_test-0.0.64.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,311 @@
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: agentrun/knowledgebase/__client_async_template.py
10
+
11
+ KnowledgeBase 客户端 / KnowledgeBase Client
12
+
13
+ 此模块提供知识库管理的客户端API。
14
+ This module provides the client API for knowledge base management.
15
+ """
16
+
17
+ from typing import Optional
18
+
19
+ from alibabacloud_agentrun20250910.models import (
20
+ CreateKnowledgeBaseInput,
21
+ ListKnowledgeBasesRequest,
22
+ UpdateKnowledgeBaseInput,
23
+ )
24
+
25
+ from agentrun.utils.config import Config
26
+ from agentrun.utils.exception import HTTPError
27
+
28
+ from .api.control import KnowledgeBaseControlAPI
29
+ from .knowledgebase import KnowledgeBase
30
+ from .model import (
31
+ KnowledgeBaseCreateInput,
32
+ KnowledgeBaseListInput,
33
+ KnowledgeBaseListOutput,
34
+ KnowledgeBaseUpdateInput,
35
+ )
36
+
37
+
38
+ class KnowledgeBaseClient:
39
+ """KnowledgeBase 客户端 / KnowledgeBase Client
40
+
41
+ 提供知识库的创建、删除、更新和查询功能。
42
+ Provides create, delete, update and query functions for knowledge bases.
43
+ """
44
+
45
+ def __init__(self, config: Optional[Config] = None):
46
+ """初始化客户端 / Initialize client
47
+
48
+ Args:
49
+ config: 配置对象,可选 / Configuration object, optional
50
+ """
51
+ self.__control_api = KnowledgeBaseControlAPI(config)
52
+
53
+ async def create_async(
54
+ self, input: KnowledgeBaseCreateInput, config: Optional[Config] = None
55
+ ):
56
+ """创建知识库(异步) / Create knowledge base asynchronously
57
+
58
+ Args:
59
+ input: 知识库输入参数 / KnowledgeBase input parameters
60
+ config: 配置对象,可选 / Configuration object, optional
61
+
62
+ Returns:
63
+ KnowledgeBase: 创建的知识库对象 / Created knowledge base object
64
+
65
+ Raises:
66
+ ResourceAlreadyExistError: 资源已存在 / Resource already exists
67
+ HTTPError: HTTP 请求错误 / HTTP request error
68
+ """
69
+ try:
70
+ result = await self.__control_api.create_knowledge_base_async(
71
+ CreateKnowledgeBaseInput().from_map(input.model_dump()),
72
+ config=config,
73
+ )
74
+
75
+ return KnowledgeBase.from_inner_object(result)
76
+ except HTTPError as e:
77
+ raise e.to_resource_error(
78
+ "KnowledgeBase", input.knowledge_base_name
79
+ ) from e
80
+
81
+ def create(
82
+ self, input: KnowledgeBaseCreateInput, config: Optional[Config] = None
83
+ ):
84
+ """创建知识库(同步) / Create knowledge base asynchronously
85
+
86
+ Args:
87
+ input: 知识库输入参数 / KnowledgeBase input parameters
88
+ config: 配置对象,可选 / Configuration object, optional
89
+
90
+ Returns:
91
+ KnowledgeBase: 创建的知识库对象 / Created knowledge base object
92
+
93
+ Raises:
94
+ ResourceAlreadyExistError: 资源已存在 / Resource already exists
95
+ HTTPError: HTTP 请求错误 / HTTP request error
96
+ """
97
+ try:
98
+ result = self.__control_api.create_knowledge_base(
99
+ CreateKnowledgeBaseInput().from_map(input.model_dump()),
100
+ config=config,
101
+ )
102
+
103
+ return KnowledgeBase.from_inner_object(result)
104
+ except HTTPError as e:
105
+ raise e.to_resource_error(
106
+ "KnowledgeBase", input.knowledge_base_name
107
+ ) from e
108
+
109
+ async def delete_async(
110
+ self, knowledge_base_name: str, config: Optional[Config] = None
111
+ ):
112
+ """删除知识库(异步)/ Delete knowledge base asynchronously
113
+
114
+ Args:
115
+ knowledge_base_name: 知识库名称 / KnowledgeBase name
116
+ config: 配置 / Configuration
117
+
118
+ Raises:
119
+ ResourceNotExistError: 知识库不存在 / KnowledgeBase not found
120
+ """
121
+ try:
122
+ result = await self.__control_api.delete_knowledge_base_async(
123
+ knowledge_base_name, config=config
124
+ )
125
+
126
+ return KnowledgeBase.from_inner_object(result)
127
+
128
+ except HTTPError as e:
129
+ raise e.to_resource_error(
130
+ "KnowledgeBase", knowledge_base_name
131
+ ) from e
132
+
133
+ def delete(self, knowledge_base_name: str, config: Optional[Config] = None):
134
+ """删除知识库(同步)/ Delete knowledge base asynchronously
135
+
136
+ Args:
137
+ knowledge_base_name: 知识库名称 / KnowledgeBase name
138
+ config: 配置 / Configuration
139
+
140
+ Raises:
141
+ ResourceNotExistError: 知识库不存在 / KnowledgeBase not found
142
+ """
143
+ try:
144
+ result = self.__control_api.delete_knowledge_base(
145
+ knowledge_base_name, config=config
146
+ )
147
+
148
+ return KnowledgeBase.from_inner_object(result)
149
+
150
+ except HTTPError as e:
151
+ raise e.to_resource_error(
152
+ "KnowledgeBase", knowledge_base_name
153
+ ) from e
154
+
155
+ async def update_async(
156
+ self,
157
+ knowledge_base_name: str,
158
+ input: KnowledgeBaseUpdateInput,
159
+ config: Optional[Config] = None,
160
+ ):
161
+ """更新知识库(异步)/ Update knowledge base asynchronously
162
+
163
+ Args:
164
+ knowledge_base_name: 知识库名称 / KnowledgeBase name
165
+ input: 知识库更新输入参数 / KnowledgeBase update input parameters
166
+ config: 配置 / Configuration
167
+
168
+ Returns:
169
+ KnowledgeBase: 更新后的知识库对象 / Updated knowledge base object
170
+
171
+ Raises:
172
+ ResourceNotExistError: 知识库不存在 / KnowledgeBase not found
173
+ """
174
+ try:
175
+ result = await self.__control_api.update_knowledge_base_async(
176
+ knowledge_base_name,
177
+ UpdateKnowledgeBaseInput().from_map(input.model_dump()),
178
+ config=config,
179
+ )
180
+
181
+ return KnowledgeBase.from_inner_object(result)
182
+ except HTTPError as e:
183
+ raise e.to_resource_error(
184
+ "KnowledgeBase", knowledge_base_name
185
+ ) from e
186
+
187
+ def update(
188
+ self,
189
+ knowledge_base_name: str,
190
+ input: KnowledgeBaseUpdateInput,
191
+ config: Optional[Config] = None,
192
+ ):
193
+ """更新知识库(同步)/ Update knowledge base asynchronously
194
+
195
+ Args:
196
+ knowledge_base_name: 知识库名称 / KnowledgeBase name
197
+ input: 知识库更新输入参数 / KnowledgeBase update input parameters
198
+ config: 配置 / Configuration
199
+
200
+ Returns:
201
+ KnowledgeBase: 更新后的知识库对象 / Updated knowledge base object
202
+
203
+ Raises:
204
+ ResourceNotExistError: 知识库不存在 / KnowledgeBase not found
205
+ """
206
+ try:
207
+ result = self.__control_api.update_knowledge_base(
208
+ knowledge_base_name,
209
+ UpdateKnowledgeBaseInput().from_map(input.model_dump()),
210
+ config=config,
211
+ )
212
+
213
+ return KnowledgeBase.from_inner_object(result)
214
+ except HTTPError as e:
215
+ raise e.to_resource_error(
216
+ "KnowledgeBase", knowledge_base_name
217
+ ) from e
218
+
219
+ async def get_async(
220
+ self, knowledge_base_name: str, config: Optional[Config] = None
221
+ ):
222
+ """获取知识库(异步)/ Get knowledge base asynchronously
223
+
224
+ Args:
225
+ knowledge_base_name: 知识库名称 / KnowledgeBase name
226
+ config: 配置 / Configuration
227
+
228
+ Returns:
229
+ KnowledgeBase: 知识库对象 / KnowledgeBase object
230
+
231
+ Raises:
232
+ ResourceNotExistError: 知识库不存在 / KnowledgeBase not found
233
+ """
234
+ try:
235
+ result = await self.__control_api.get_knowledge_base_async(
236
+ knowledge_base_name, config=config
237
+ )
238
+ return KnowledgeBase.from_inner_object(result)
239
+ except HTTPError as e:
240
+ raise e.to_resource_error(
241
+ "KnowledgeBase", knowledge_base_name
242
+ ) from e
243
+
244
+ def get(self, knowledge_base_name: str, config: Optional[Config] = None):
245
+ """获取知识库(同步)/ Get knowledge base asynchronously
246
+
247
+ Args:
248
+ knowledge_base_name: 知识库名称 / KnowledgeBase name
249
+ config: 配置 / Configuration
250
+
251
+ Returns:
252
+ KnowledgeBase: 知识库对象 / KnowledgeBase object
253
+
254
+ Raises:
255
+ ResourceNotExistError: 知识库不存在 / KnowledgeBase not found
256
+ """
257
+ try:
258
+ result = self.__control_api.get_knowledge_base(
259
+ knowledge_base_name, config=config
260
+ )
261
+ return KnowledgeBase.from_inner_object(result)
262
+ except HTTPError as e:
263
+ raise e.to_resource_error(
264
+ "KnowledgeBase", knowledge_base_name
265
+ ) from e
266
+
267
+ async def list_async(
268
+ self,
269
+ input: Optional[KnowledgeBaseListInput] = None,
270
+ config: Optional[Config] = None,
271
+ ):
272
+ """列出知识库(异步)/ List knowledge bases asynchronously
273
+
274
+ Args:
275
+ input: 分页查询参数 / Pagination query parameters
276
+ config: 配置 / Configuration
277
+
278
+ Returns:
279
+ List[KnowledgeBaseListOutput]: 知识库列表 / KnowledgeBase list
280
+ """
281
+ if input is None:
282
+ input = KnowledgeBaseListInput()
283
+
284
+ results = await self.__control_api.list_knowledge_bases_async(
285
+ ListKnowledgeBasesRequest().from_map(input.model_dump()),
286
+ config=config,
287
+ )
288
+ return [KnowledgeBaseListOutput.from_inner_object(item) for item in results.items] # type: ignore
289
+
290
+ def list(
291
+ self,
292
+ input: Optional[KnowledgeBaseListInput] = None,
293
+ config: Optional[Config] = None,
294
+ ):
295
+ """列出知识库(同步)/ List knowledge bases asynchronously
296
+
297
+ Args:
298
+ input: 分页查询参数 / Pagination query parameters
299
+ config: 配置 / Configuration
300
+
301
+ Returns:
302
+ List[KnowledgeBaseListOutput]: 知识库列表 / KnowledgeBase list
303
+ """
304
+ if input is None:
305
+ input = KnowledgeBaseListInput()
306
+
307
+ results = self.__control_api.list_knowledge_bases(
308
+ ListKnowledgeBasesRequest().from_map(input.model_dump()),
309
+ config=config,
310
+ )
311
+ return [KnowledgeBaseListOutput.from_inner_object(item) for item in results.items] # type: ignore