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.
- agentrun/__init__.py +358 -0
- agentrun/agent_runtime/__client_async_template.py +466 -0
- agentrun/agent_runtime/__endpoint_async_template.py +345 -0
- agentrun/agent_runtime/__init__.py +53 -0
- agentrun/agent_runtime/__runtime_async_template.py +477 -0
- agentrun/agent_runtime/api/__data_async_template.py +58 -0
- agentrun/agent_runtime/api/__init__.py +6 -0
- agentrun/agent_runtime/api/control.py +1362 -0
- agentrun/agent_runtime/api/data.py +98 -0
- agentrun/agent_runtime/client.py +868 -0
- agentrun/agent_runtime/endpoint.py +649 -0
- agentrun/agent_runtime/model.py +362 -0
- agentrun/agent_runtime/runtime.py +904 -0
- agentrun/credential/__client_async_template.py +177 -0
- agentrun/credential/__credential_async_template.py +216 -0
- agentrun/credential/__init__.py +28 -0
- agentrun/credential/api/__init__.py +5 -0
- agentrun/credential/api/control.py +606 -0
- agentrun/credential/client.py +319 -0
- agentrun/credential/credential.py +381 -0
- agentrun/credential/model.py +248 -0
- agentrun/integration/__init__.py +21 -0
- agentrun/integration/agentscope/__init__.py +13 -0
- agentrun/integration/agentscope/adapter.py +17 -0
- agentrun/integration/agentscope/builtin.py +88 -0
- agentrun/integration/agentscope/message_adapter.py +185 -0
- agentrun/integration/agentscope/model_adapter.py +60 -0
- agentrun/integration/agentscope/tool_adapter.py +59 -0
- agentrun/integration/builtin/__init__.py +18 -0
- agentrun/integration/builtin/knowledgebase.py +137 -0
- agentrun/integration/builtin/model.py +93 -0
- agentrun/integration/builtin/sandbox.py +1234 -0
- agentrun/integration/builtin/toolset.py +47 -0
- agentrun/integration/crewai/__init__.py +13 -0
- agentrun/integration/crewai/adapter.py +9 -0
- agentrun/integration/crewai/builtin.py +88 -0
- agentrun/integration/crewai/model_adapter.py +31 -0
- agentrun/integration/crewai/tool_adapter.py +26 -0
- agentrun/integration/google_adk/__init__.py +13 -0
- agentrun/integration/google_adk/adapter.py +15 -0
- agentrun/integration/google_adk/builtin.py +88 -0
- agentrun/integration/google_adk/message_adapter.py +144 -0
- agentrun/integration/google_adk/model_adapter.py +46 -0
- agentrun/integration/google_adk/tool_adapter.py +235 -0
- agentrun/integration/langchain/__init__.py +31 -0
- agentrun/integration/langchain/adapter.py +15 -0
- agentrun/integration/langchain/builtin.py +94 -0
- agentrun/integration/langchain/message_adapter.py +141 -0
- agentrun/integration/langchain/model_adapter.py +37 -0
- agentrun/integration/langchain/tool_adapter.py +50 -0
- agentrun/integration/langgraph/__init__.py +36 -0
- agentrun/integration/langgraph/adapter.py +20 -0
- agentrun/integration/langgraph/agent_converter.py +1073 -0
- agentrun/integration/langgraph/builtin.py +88 -0
- agentrun/integration/pydantic_ai/__init__.py +13 -0
- agentrun/integration/pydantic_ai/adapter.py +13 -0
- agentrun/integration/pydantic_ai/builtin.py +88 -0
- agentrun/integration/pydantic_ai/model_adapter.py +44 -0
- agentrun/integration/pydantic_ai/tool_adapter.py +19 -0
- agentrun/integration/utils/__init__.py +112 -0
- agentrun/integration/utils/adapter.py +560 -0
- agentrun/integration/utils/canonical.py +164 -0
- agentrun/integration/utils/converter.py +134 -0
- agentrun/integration/utils/model.py +110 -0
- agentrun/integration/utils/tool.py +1759 -0
- agentrun/knowledgebase/__client_async_template.py +173 -0
- agentrun/knowledgebase/__init__.py +53 -0
- agentrun/knowledgebase/__knowledgebase_async_template.py +438 -0
- agentrun/knowledgebase/api/__data_async_template.py +414 -0
- agentrun/knowledgebase/api/__init__.py +19 -0
- agentrun/knowledgebase/api/control.py +606 -0
- agentrun/knowledgebase/api/data.py +624 -0
- agentrun/knowledgebase/client.py +311 -0
- agentrun/knowledgebase/knowledgebase.py +748 -0
- agentrun/knowledgebase/model.py +270 -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/model/__client_async_template.py +357 -0
- agentrun/model/__init__.py +57 -0
- agentrun/model/__model_proxy_async_template.py +270 -0
- agentrun/model/__model_service_async_template.py +267 -0
- agentrun/model/api/__init__.py +6 -0
- agentrun/model/api/control.py +1173 -0
- agentrun/model/api/data.py +196 -0
- agentrun/model/client.py +674 -0
- agentrun/model/model.py +235 -0
- agentrun/model/model_proxy.py +439 -0
- agentrun/model/model_service.py +438 -0
- agentrun/sandbox/__aio_sandbox_async_template.py +523 -0
- agentrun/sandbox/__browser_sandbox_async_template.py +110 -0
- agentrun/sandbox/__client_async_template.py +491 -0
- agentrun/sandbox/__code_interpreter_sandbox_async_template.py +463 -0
- agentrun/sandbox/__init__.py +69 -0
- agentrun/sandbox/__sandbox_async_template.py +463 -0
- agentrun/sandbox/__template_async_template.py +152 -0
- agentrun/sandbox/aio_sandbox.py +912 -0
- agentrun/sandbox/api/__aio_data_async_template.py +335 -0
- agentrun/sandbox/api/__browser_data_async_template.py +140 -0
- agentrun/sandbox/api/__code_interpreter_data_async_template.py +206 -0
- agentrun/sandbox/api/__init__.py +19 -0
- agentrun/sandbox/api/__sandbox_data_async_template.py +107 -0
- agentrun/sandbox/api/aio_data.py +551 -0
- agentrun/sandbox/api/browser_data.py +172 -0
- agentrun/sandbox/api/code_interpreter_data.py +396 -0
- agentrun/sandbox/api/control.py +1051 -0
- agentrun/sandbox/api/playwright_async.py +492 -0
- agentrun/sandbox/api/playwright_sync.py +492 -0
- agentrun/sandbox/api/sandbox_data.py +154 -0
- agentrun/sandbox/browser_sandbox.py +185 -0
- agentrun/sandbox/client.py +925 -0
- agentrun/sandbox/code_interpreter_sandbox.py +823 -0
- agentrun/sandbox/model.py +384 -0
- agentrun/sandbox/sandbox.py +848 -0
- agentrun/sandbox/template.py +217 -0
- agentrun/server/__init__.py +191 -0
- agentrun/server/agui_normalizer.py +180 -0
- agentrun/server/agui_protocol.py +797 -0
- agentrun/server/invoker.py +309 -0
- agentrun/server/model.py +427 -0
- agentrun/server/openai_protocol.py +535 -0
- agentrun/server/protocol.py +140 -0
- agentrun/server/server.py +208 -0
- agentrun/toolset/__client_async_template.py +62 -0
- agentrun/toolset/__init__.py +51 -0
- agentrun/toolset/__toolset_async_template.py +204 -0
- agentrun/toolset/api/__init__.py +17 -0
- agentrun/toolset/api/control.py +262 -0
- agentrun/toolset/api/mcp.py +100 -0
- agentrun/toolset/api/openapi.py +1251 -0
- agentrun/toolset/client.py +102 -0
- agentrun/toolset/model.py +321 -0
- agentrun/toolset/toolset.py +271 -0
- agentrun/utils/__data_api_async_template.py +721 -0
- agentrun/utils/__init__.py +5 -0
- agentrun/utils/__resource_async_template.py +158 -0
- agentrun/utils/config.py +270 -0
- agentrun/utils/control_api.py +105 -0
- agentrun/utils/data_api.py +1121 -0
- agentrun/utils/exception.py +151 -0
- agentrun/utils/helper.py +108 -0
- agentrun/utils/log.py +77 -0
- agentrun/utils/model.py +168 -0
- agentrun/utils/resource.py +291 -0
- agentrun_inner_test-0.0.62.dist-info/METADATA +265 -0
- agentrun_inner_test-0.0.62.dist-info/RECORD +154 -0
- agentrun_inner_test-0.0.62.dist-info/WHEEL +5 -0
- agentrun_inner_test-0.0.62.dist-info/licenses/LICENSE +201 -0
- agentrun_inner_test-0.0.62.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"""Agent Runtime 端点资源 / Agent Runtime Endpoint Resource
|
|
2
|
+
|
|
3
|
+
此模块定义 Agent Runtime 端点的高级API。
|
|
4
|
+
This module defines the high-level API for Agent Runtime Endpoint.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import List, Optional
|
|
8
|
+
|
|
9
|
+
from typing_extensions import Self, Unpack
|
|
10
|
+
|
|
11
|
+
from agentrun.agent_runtime.api.data import AgentRuntimeDataAPI, InvokeArgs
|
|
12
|
+
from agentrun.agent_runtime.model import (
|
|
13
|
+
AgentRuntimeEndpointCreateInput,
|
|
14
|
+
AgentRuntimeEndpointImmutableProps,
|
|
15
|
+
AgentRuntimeEndpointListInput,
|
|
16
|
+
AgentRuntimeEndpointMutableProps,
|
|
17
|
+
AgentRuntimeEndpointSystemProps,
|
|
18
|
+
AgentRuntimeEndpointUpdateInput,
|
|
19
|
+
)
|
|
20
|
+
from agentrun.utils.config import Config
|
|
21
|
+
from agentrun.utils.resource import ResourceBase
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AgentRuntimeEndpoint(
|
|
25
|
+
AgentRuntimeEndpointMutableProps,
|
|
26
|
+
AgentRuntimeEndpointImmutableProps,
|
|
27
|
+
AgentRuntimeEndpointSystemProps,
|
|
28
|
+
ResourceBase,
|
|
29
|
+
):
|
|
30
|
+
"""智能体运行时端点信息 / Agent Runtime Endpoint Information
|
|
31
|
+
|
|
32
|
+
提供端点的创建、删除、更新、查询功能。
|
|
33
|
+
Provides create, delete, update, and query functions for endpoints.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def __get_client(cls, config: Optional[Config] = None):
|
|
38
|
+
"""获取客户端实例 / Get client instance
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
AgentRuntimeClient: 客户端实例 / Client instance
|
|
42
|
+
"""
|
|
43
|
+
from agentrun.agent_runtime.client import AgentRuntimeClient
|
|
44
|
+
|
|
45
|
+
return AgentRuntimeClient(config=config)
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
async def create_by_id_async(
|
|
49
|
+
cls,
|
|
50
|
+
agent_runtime_id: str,
|
|
51
|
+
input: AgentRuntimeEndpointCreateInput,
|
|
52
|
+
config: Optional[Config] = None,
|
|
53
|
+
):
|
|
54
|
+
"""根据 ID 异步创建端点 / Create endpoint by ID asynchronously
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
agent_runtime_id: Agent Runtime ID
|
|
58
|
+
input: 端点创建配置 / Endpoint creation configuration
|
|
59
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
AgentRuntimeEndpoint: 创建的端点对象 / Created endpoint object
|
|
63
|
+
|
|
64
|
+
Raises:
|
|
65
|
+
ResourceAlreadyExistError: 资源已存在 / Resource already exists
|
|
66
|
+
ResourceNotExistError: Agent Runtime 不存在 / Agent Runtime does not exist
|
|
67
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
68
|
+
"""
|
|
69
|
+
cli = cls.__get_client()
|
|
70
|
+
return await cli.create_endpoint_async(
|
|
71
|
+
agent_runtime_id,
|
|
72
|
+
input,
|
|
73
|
+
config=config,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
async def delete_by_id_async(
|
|
78
|
+
cls,
|
|
79
|
+
agent_runtime_id: str,
|
|
80
|
+
endpoint_id: str,
|
|
81
|
+
config: Optional[Config] = None,
|
|
82
|
+
):
|
|
83
|
+
"""根据 ID 异步删除端点 / Delete endpoint by ID asynchronously
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
agent_runtime_id: Agent Runtime ID
|
|
87
|
+
endpoint_id: 端点 ID / Endpoint ID
|
|
88
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
AgentRuntimeEndpoint: 删除的端点对象 / Deleted endpoint object
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
ResourceNotExistError: 资源不存在 / Resource does not exist
|
|
95
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
96
|
+
"""
|
|
97
|
+
cli = cls.__get_client()
|
|
98
|
+
return await cli.delete_endpoint_async(
|
|
99
|
+
agent_runtime_id,
|
|
100
|
+
endpoint_id,
|
|
101
|
+
config=config,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
async def update_by_id_async(
|
|
106
|
+
cls,
|
|
107
|
+
agent_runtime_id: str,
|
|
108
|
+
endpoint_id: str,
|
|
109
|
+
input: AgentRuntimeEndpointUpdateInput,
|
|
110
|
+
config: Optional[Config] = None,
|
|
111
|
+
):
|
|
112
|
+
"""根据 ID 异步更新端点 / Update endpoint by ID asynchronously
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
agent_runtime_id: Agent Runtime ID
|
|
116
|
+
endpoint_id: 端点 ID / Endpoint ID
|
|
117
|
+
input: 端点更新配置 / Endpoint update configuration
|
|
118
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
AgentRuntimeEndpoint: 更新后的端点对象 / Updated endpoint object
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
ResourceNotExistError: 资源不存在 / Resource does not exist
|
|
125
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
126
|
+
"""
|
|
127
|
+
cli = cls.__get_client()
|
|
128
|
+
return await cli.update_endpoint_async(
|
|
129
|
+
agent_runtime_id,
|
|
130
|
+
endpoint_id,
|
|
131
|
+
input,
|
|
132
|
+
config=config,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
@classmethod
|
|
136
|
+
async def get_by_id_async(
|
|
137
|
+
cls,
|
|
138
|
+
agent_runtime_id: str,
|
|
139
|
+
endpoint_id: str,
|
|
140
|
+
config: Optional[Config] = None,
|
|
141
|
+
):
|
|
142
|
+
"""根据 ID 异步获取端点 / Get endpoint by ID asynchronously
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
agent_runtime_id: Agent Runtime ID
|
|
146
|
+
endpoint_id: 端点 ID / Endpoint ID
|
|
147
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
AgentRuntimeEndpoint: 端点对象 / Endpoint object
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
ResourceNotExistError: 资源不存在 / Resource does not exist
|
|
154
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
155
|
+
"""
|
|
156
|
+
cli = cls.__get_client()
|
|
157
|
+
return await cli.get_endpoint_async(
|
|
158
|
+
agent_runtime_id,
|
|
159
|
+
endpoint_id,
|
|
160
|
+
config=config,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
@classmethod
|
|
164
|
+
async def list_by_id_async(
|
|
165
|
+
cls, agent_runtime_id: str, config: Optional[Config] = None
|
|
166
|
+
):
|
|
167
|
+
"""根据 Agent Runtime ID 异步列出所有端点 / List all endpoints by Agent Runtime ID asynchronously
|
|
168
|
+
|
|
169
|
+
此方法会自动分页获取所有端点并去重。
|
|
170
|
+
This method automatically paginates to get all endpoints and deduplicates them.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
agent_runtime_id: Agent Runtime ID
|
|
174
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
List[AgentRuntimeEndpoint]: 端点对象列表 / List of endpoint objects
|
|
178
|
+
|
|
179
|
+
Raises:
|
|
180
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
181
|
+
"""
|
|
182
|
+
cli = cls.__get_client()
|
|
183
|
+
|
|
184
|
+
endpoints: List[AgentRuntimeEndpoint] = []
|
|
185
|
+
page = 1
|
|
186
|
+
page_size = 50
|
|
187
|
+
while True:
|
|
188
|
+
result = await cli.list_endpoints_async(
|
|
189
|
+
agent_runtime_id,
|
|
190
|
+
AgentRuntimeEndpointListInput(
|
|
191
|
+
page_number=page,
|
|
192
|
+
page_size=page_size,
|
|
193
|
+
),
|
|
194
|
+
config=config,
|
|
195
|
+
)
|
|
196
|
+
page += 1
|
|
197
|
+
endpoints.extend(result) # type: ignore
|
|
198
|
+
if len(result) < page_size:
|
|
199
|
+
break
|
|
200
|
+
|
|
201
|
+
endpoint_id_set = set()
|
|
202
|
+
results: List[AgentRuntimeEndpoint] = []
|
|
203
|
+
for endpoint in endpoints:
|
|
204
|
+
if endpoint.agent_runtime_endpoint_id not in endpoint_id_set:
|
|
205
|
+
endpoint_id_set.add(endpoint.agent_runtime_endpoint_id)
|
|
206
|
+
results.append(endpoint)
|
|
207
|
+
|
|
208
|
+
return results
|
|
209
|
+
|
|
210
|
+
async def delete_async(
|
|
211
|
+
self, config: Optional[Config] = None
|
|
212
|
+
) -> "AgentRuntimeEndpoint":
|
|
213
|
+
"""异步删除当前端点 / Delete current endpoint asynchronously
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
AgentRuntimeEndpoint: 删除后的端点对象(self) / Deleted endpoint object (self)
|
|
220
|
+
|
|
221
|
+
Raises:
|
|
222
|
+
ValueError: 当 agent_runtime_id 或 agent_runtime_endpoint_id 为空时 / When agent_runtime_id or agent_runtime_endpoint_id is None
|
|
223
|
+
ResourceNotExistError: 资源不存在 / Resource does not exist
|
|
224
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
225
|
+
"""
|
|
226
|
+
if (
|
|
227
|
+
self.agent_runtime_id is None
|
|
228
|
+
or self.agent_runtime_endpoint_id is None
|
|
229
|
+
):
|
|
230
|
+
raise ValueError(
|
|
231
|
+
"agent_runtime_id and agent_runtime_endpoint_id are required to"
|
|
232
|
+
" delete an Agent Runtime Endpoint"
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
result = await self.delete_by_id_async(
|
|
236
|
+
self.agent_runtime_id, self.agent_runtime_endpoint_id, config=config
|
|
237
|
+
)
|
|
238
|
+
self.update_self(result)
|
|
239
|
+
return self
|
|
240
|
+
|
|
241
|
+
async def update_async(
|
|
242
|
+
self,
|
|
243
|
+
input: AgentRuntimeEndpointUpdateInput,
|
|
244
|
+
config: Optional[Config] = None,
|
|
245
|
+
) -> Self:
|
|
246
|
+
"""异步更新当前端点 / Update current endpoint asynchronously
|
|
247
|
+
|
|
248
|
+
Args:
|
|
249
|
+
input: 端点更新配置 / Endpoint update configuration
|
|
250
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
251
|
+
|
|
252
|
+
Returns:
|
|
253
|
+
Self: 更新后的端点对象(self) / Updated endpoint object (self)
|
|
254
|
+
|
|
255
|
+
Raises:
|
|
256
|
+
ValueError: 当 agent_runtime_id 或 agent_runtime_endpoint_id 为空时 / When agent_runtime_id or agent_runtime_endpoint_id is None
|
|
257
|
+
ResourceNotExistError: 资源不存在 / Resource does not exist
|
|
258
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
259
|
+
"""
|
|
260
|
+
if (
|
|
261
|
+
self.agent_runtime_id is None
|
|
262
|
+
or self.agent_runtime_endpoint_id is None
|
|
263
|
+
):
|
|
264
|
+
raise ValueError(
|
|
265
|
+
"agent_runtime_id and agent_runtime_endpoint_id are required to"
|
|
266
|
+
" update an Agent Runtime Endpoint"
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
result = await self.update_by_id_async(
|
|
270
|
+
self.agent_runtime_id,
|
|
271
|
+
self.agent_runtime_endpoint_id,
|
|
272
|
+
input=input,
|
|
273
|
+
config=config,
|
|
274
|
+
)
|
|
275
|
+
self.update_self(result)
|
|
276
|
+
return self
|
|
277
|
+
|
|
278
|
+
async def get_async(self, config: Optional[Config] = None):
|
|
279
|
+
"""异步获取当前端点信息 / Get current endpoint information asynchronously
|
|
280
|
+
|
|
281
|
+
Args:
|
|
282
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
283
|
+
|
|
284
|
+
Returns:
|
|
285
|
+
AgentRuntimeEndpoint: 获取后的端点对象(self) / Retrieved endpoint object (self)
|
|
286
|
+
|
|
287
|
+
Raises:
|
|
288
|
+
ValueError: 当 agent_runtime_id 或 agent_runtime_endpoint_id 为空时 / When agent_runtime_id or agent_runtime_endpoint_id is None
|
|
289
|
+
ResourceNotExistError: 资源不存在 / Resource does not exist
|
|
290
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
291
|
+
"""
|
|
292
|
+
if (
|
|
293
|
+
self.agent_runtime_id is None
|
|
294
|
+
or self.agent_runtime_endpoint_id is None
|
|
295
|
+
):
|
|
296
|
+
raise ValueError(
|
|
297
|
+
"agent_runtime_id and agent_runtime_endpoint_id are required to"
|
|
298
|
+
" get an Agent Runtime Endpoint"
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
result = await self.get_by_id_async(
|
|
302
|
+
self.agent_runtime_id, self.agent_runtime_endpoint_id
|
|
303
|
+
)
|
|
304
|
+
self.update_self(result)
|
|
305
|
+
return self
|
|
306
|
+
|
|
307
|
+
async def refresh_async(self, config: Optional[Config] = None):
|
|
308
|
+
"""刷新当前端点信息 / Refresh current endpoint information
|
|
309
|
+
|
|
310
|
+
这是 get_async 的别名方法。
|
|
311
|
+
This is an alias method for get_async.
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
config: 配置对象,可选 / Configuration object, optional
|
|
315
|
+
|
|
316
|
+
Returns:
|
|
317
|
+
AgentRuntimeEndpoint: 刷新后的端点对象(self) / Refreshed endpoint object (self)
|
|
318
|
+
|
|
319
|
+
Raises:
|
|
320
|
+
ValueError: 当 agent_runtime_id 或 agent_runtime_endpoint_id 为空时 / When agent_runtime_id or agent_runtime_endpoint_id is None
|
|
321
|
+
ResourceNotExistError: 资源不存在 / Resource does not exist
|
|
322
|
+
HTTPError: HTTP 请求错误 / HTTP request error
|
|
323
|
+
"""
|
|
324
|
+
return await self.get_async(config=config)
|
|
325
|
+
|
|
326
|
+
async def invoke_openai_async(self, **kwargs: Unpack[InvokeArgs]):
|
|
327
|
+
cfg = Config.with_configs(self._config, kwargs.get("config"))
|
|
328
|
+
kwargs["config"] = cfg
|
|
329
|
+
|
|
330
|
+
if self.__data_api is None:
|
|
331
|
+
if not self.__agent_runtime_name:
|
|
332
|
+
client = self.__get_client(cfg)
|
|
333
|
+
ar = await client.get_async(
|
|
334
|
+
id=self.agent_runtime_id or "", config=cfg
|
|
335
|
+
)
|
|
336
|
+
self.__agent_runtime_name = ar.agent_runtime_name
|
|
337
|
+
|
|
338
|
+
self.__data_api = AgentRuntimeDataAPI(
|
|
339
|
+
agent_runtime_name=self.__agent_runtime_name or "",
|
|
340
|
+
agent_runtime_endpoint_name=self.agent_runtime_endpoint_name
|
|
341
|
+
or "",
|
|
342
|
+
config=cfg,
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
return await self.__data_api.invoke_openai_async(**kwargs)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Agent Runtime 模块 / Agent Runtime Module"""
|
|
2
|
+
|
|
3
|
+
from .api import AgentRuntimeControlAPI
|
|
4
|
+
from .client import AgentRuntimeClient
|
|
5
|
+
from .endpoint import AgentRuntimeEndpoint
|
|
6
|
+
from .model import (
|
|
7
|
+
AgentRuntimeArtifact,
|
|
8
|
+
AgentRuntimeCode,
|
|
9
|
+
AgentRuntimeContainer,
|
|
10
|
+
AgentRuntimeCreateInput,
|
|
11
|
+
AgentRuntimeEndpointCreateInput,
|
|
12
|
+
AgentRuntimeEndpointListInput,
|
|
13
|
+
AgentRuntimeEndpointRoutingConfig,
|
|
14
|
+
AgentRuntimeEndpointRoutingWeight,
|
|
15
|
+
AgentRuntimeEndpointUpdateInput,
|
|
16
|
+
AgentRuntimeHealthCheckConfig,
|
|
17
|
+
AgentRuntimeLanguage,
|
|
18
|
+
AgentRuntimeListInput,
|
|
19
|
+
AgentRuntimeLogConfig,
|
|
20
|
+
AgentRuntimeProtocolConfig,
|
|
21
|
+
AgentRuntimeProtocolType,
|
|
22
|
+
AgentRuntimeUpdateInput,
|
|
23
|
+
Status,
|
|
24
|
+
)
|
|
25
|
+
from .runtime import AgentRuntime
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
# base
|
|
29
|
+
"AgentRuntime",
|
|
30
|
+
"AgentRuntimeEndpoint",
|
|
31
|
+
"AgentRuntimeClient",
|
|
32
|
+
"AgentRuntimeControlAPI",
|
|
33
|
+
# enum
|
|
34
|
+
"AgentRuntimeArtifact",
|
|
35
|
+
"AgentRuntimeLanguage",
|
|
36
|
+
"AgentRuntimeProtocolType",
|
|
37
|
+
"Status",
|
|
38
|
+
# inner model
|
|
39
|
+
"AgentRuntimeCode",
|
|
40
|
+
"AgentRuntimeContainer",
|
|
41
|
+
"AgentRuntimeHealthCheckConfig",
|
|
42
|
+
"AgentRuntimeLogConfig",
|
|
43
|
+
"AgentRuntimeProtocolConfig",
|
|
44
|
+
"AgentRuntimeEndpointRoutingConfig",
|
|
45
|
+
"AgentRuntimeEndpointRoutingWeight",
|
|
46
|
+
# api model
|
|
47
|
+
"AgentRuntimeCreateInput",
|
|
48
|
+
"AgentRuntimeUpdateInput",
|
|
49
|
+
"AgentRuntimeListInput",
|
|
50
|
+
"AgentRuntimeEndpointCreateInput",
|
|
51
|
+
"AgentRuntimeEndpointUpdateInput",
|
|
52
|
+
"AgentRuntimeEndpointListInput",
|
|
53
|
+
]
|