Skip to content

Commit 0d77025

Browse files
committed
refactor: fix synchronous method documentation and import statements
Updated documentation strings to correctly reflect synchronous operations instead of asynchronous ones across multiple modules. Also updated import statements to use the correct runtime options module. fix: 修复同步方法文档和导入语句 更新了多个模块中的文档字符串,正确反映同步操作而不是异步操作。 同时更新了导入语句以使用正确的运行时选项模块。 Change-Id: I38a1ea35939d81b9359634ad80a833bb65278a8e Signed-off-by: OhYee <oyohyee@oyohyee.com>
1 parent f2e5070 commit 0d77025

13 files changed

Lines changed: 53 additions & 60 deletions

File tree

agentrun/agent_runtime/client.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async def create_async(
111111
def create(
112112
self, input: AgentRuntimeCreateInput, config: Optional[Config] = None
113113
) -> AgentRuntime:
114-
"""同步创建 Agent Runtime / Create Agent Runtime asynchronously
114+
"""同步创建 Agent Runtime / Create Agent Runtime synchronously
115115
116116
Args:
117117
input: Agent Runtime 创建配置 / Agent Runtime creation configuration
@@ -176,7 +176,7 @@ async def delete_async(
176176
raise e.to_resource_error("AgentRuntime", id) from e
177177

178178
def delete(self, id: str, config: Optional[Config] = None) -> AgentRuntime:
179-
"""同步删除 Agent Runtime / Delete Agent Runtime asynchronously
179+
"""同步删除 Agent Runtime / Delete Agent Runtime synchronously
180180
181181
Args:
182182
id: Agent Runtime ID
@@ -231,7 +231,7 @@ def update(
231231
input: AgentRuntimeUpdateInput,
232232
config: Optional[Config] = None,
233233
) -> AgentRuntime:
234-
"""同步更新 Agent Runtime / Update Agent Runtime asynchronously
234+
"""同步更新 Agent Runtime / Update Agent Runtime synchronously
235235
236236
Args:
237237
id: Agent Runtime ID
@@ -286,7 +286,7 @@ def get(
286286
id: str,
287287
config: Optional[Config] = None,
288288
) -> AgentRuntime:
289-
"""同步获取 Agent Runtime / Get Agent Runtime asynchronously
289+
"""同步获取 Agent Runtime / Get Agent Runtime synchronously
290290
291291
Args:
292292
id: Agent Runtime ID
@@ -343,7 +343,7 @@ def list(
343343
input: Optional[AgentRuntimeListInput] = None,
344344
config: Optional[Config] = None,
345345
) -> List[AgentRuntime]:
346-
"""同步列出 Agent Runtimes / List Agent Runtimes asynchronously
346+
"""同步列出 Agent Runtimes / List Agent Runtimes synchronously
347347
348348
Args:
349349
input: 列表查询配置,可选 / List query configuration, optional
@@ -417,7 +417,7 @@ def create_endpoint(
417417
endpoint: AgentRuntimeEndpointCreateInput,
418418
config: Optional[Config] = None,
419419
) -> AgentRuntimeEndpoint:
420-
"""同步创建 Agent Runtime 端点 / Create Agent Runtime Endpoint asynchronously
420+
"""同步创建 Agent Runtime 端点 / Create Agent Runtime Endpoint synchronously
421421
422422
Args:
423423
agent_runtime_id: Agent Runtime ID
@@ -496,7 +496,7 @@ def delete_endpoint(
496496
endpoint_id: str,
497497
config: Optional[Config] = None,
498498
) -> AgentRuntimeEndpoint:
499-
"""同步删除 Agent Runtime 端点 / Delete Agent Runtime Endpoint asynchronously
499+
"""同步删除 Agent Runtime 端点 / Delete Agent Runtime Endpoint synchronously
500500
501501
Args:
502502
agent_runtime_id: Agent Runtime ID
@@ -578,7 +578,7 @@ def update_endpoint(
578578
endpoint: AgentRuntimeEndpointUpdateInput,
579579
config: Optional[Config] = None,
580580
) -> AgentRuntimeEndpoint:
581-
"""同步更新 Agent Runtime 端点 / Update Agent Runtime Endpoint asynchronously
581+
"""同步更新 Agent Runtime 端点 / Update Agent Runtime Endpoint synchronously
582582
583583
Args:
584584
agent_runtime_id: Agent Runtime ID
@@ -656,7 +656,7 @@ def get_endpoint(
656656
endpoint_id: str,
657657
config: Optional[Config] = None,
658658
) -> AgentRuntimeEndpoint:
659-
"""同步获取 Agent Runtime 端点 / Get Agent Runtime Endpoint asynchronously
659+
"""同步获取 Agent Runtime 端点 / Get Agent Runtime Endpoint synchronously
660660
661661
Args:
662662
agent_runtime_id: Agent Runtime ID
@@ -732,7 +732,7 @@ def list_endpoints(
732732
input: Optional[AgentRuntimeEndpointListInput] = None,
733733
config: Optional[Config] = None,
734734
) -> List[AgentRuntimeEndpoint]:
735-
"""同步列出 Agent Runtime 端点 / List Agent Runtime Endpoints asynchronously
735+
"""同步列出 Agent Runtime 端点 / List Agent Runtime Endpoints synchronously
736736
737737
Args:
738738
agent_runtime_id: Agent Runtime ID
@@ -806,7 +806,7 @@ def list_versions(
806806
input: Optional[AgentRuntimeVersionListInput] = None,
807807
config: Optional[Config] = None,
808808
) -> List[AgentRuntimeVersion]:
809-
"""同步列出 Agent Runtime 版本 / List Agent Runtime Versions asynchronously
809+
"""同步列出 Agent Runtime 版本 / List Agent Runtime Versions synchronously
810810
811811
Args:
812812
agent_runtime_id: Agent Runtime ID

agentrun/agent_runtime/endpoint.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def create_by_id(
9191
input: AgentRuntimeEndpointCreateInput,
9292
config: Optional[Config] = None,
9393
):
94-
"""根据 ID 同步创建端点 / Create endpoint by ID asynchronously
94+
"""根据 ID 同步创建端点 / Create endpoint by ID synchronously
9595
9696
Args:
9797
agent_runtime_id: Agent Runtime ID
@@ -148,7 +148,7 @@ def delete_by_id(
148148
endpoint_id: str,
149149
config: Optional[Config] = None,
150150
):
151-
"""根据 ID 同步删除端点 / Delete endpoint by ID asynchronously
151+
"""根据 ID 同步删除端点 / Delete endpoint by ID synchronously
152152
153153
Args:
154154
agent_runtime_id: Agent Runtime ID
@@ -208,7 +208,7 @@ def update_by_id(
208208
input: AgentRuntimeEndpointUpdateInput,
209209
config: Optional[Config] = None,
210210
):
211-
"""根据 ID 同步更新端点 / Update endpoint by ID asynchronously
211+
"""根据 ID 同步更新端点 / Update endpoint by ID synchronously
212212
213213
Args:
214214
agent_runtime_id: Agent Runtime ID
@@ -266,7 +266,7 @@ def get_by_id(
266266
endpoint_id: str,
267267
config: Optional[Config] = None,
268268
):
269-
"""根据 ID 同步获取端点 / Get endpoint by ID asynchronously
269+
"""根据 ID 同步获取端点 / Get endpoint by ID synchronously
270270
271271
Args:
272272
agent_runtime_id: Agent Runtime ID
@@ -414,7 +414,7 @@ async def list_by_id_async(
414414

415415
@classmethod
416416
def list_by_id(cls, agent_runtime_id: str, config: Optional[Config] = None):
417-
"""根据 Agent Runtime ID 同步列出所有端点 / List all endpoints by Agent Runtime ID asynchronously
417+
"""根据 Agent Runtime ID 同步列出所有端点 / List all endpoints by Agent Runtime ID synchronously
418418
419419
此方法会自动分页获取所有端点并去重。
420420
This method automatically paginates to get all endpoints and deduplicates them.
@@ -489,7 +489,7 @@ async def delete_async(
489489
return self
490490

491491
def delete(self, config: Optional[Config] = None) -> "AgentRuntimeEndpoint":
492-
"""同步删除当前端点 / Delete current endpoint asynchronously
492+
"""同步删除当前端点 / Delete current endpoint synchronously
493493
494494
Args:
495495
config: 配置对象,可选 / Configuration object, optional
@@ -559,7 +559,7 @@ def update(
559559
input: AgentRuntimeEndpointUpdateInput,
560560
config: Optional[Config] = None,
561561
) -> Self:
562-
"""同步更新当前端点 / Update current endpoint asynchronously
562+
"""同步更新当前端点 / Update current endpoint synchronously
563563
564564
Args:
565565
input: 端点更新配置 / Endpoint update configuration
@@ -621,7 +621,7 @@ async def get_async(self, config: Optional[Config] = None):
621621
return self
622622

623623
def get(self, config: Optional[Config] = None):
624-
"""同步获取当前端点信息 / Get current endpoint information asynchronously
624+
"""同步获取当前端点信息 / Get current endpoint information synchronously
625625
626626
Args:
627627
config: 配置对象,可选 / Configuration object, optional

agentrun/agent_runtime/runtime.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async def create_async(
8888
def create(
8989
cls, input: AgentRuntimeCreateInput, config: Optional[Config] = None
9090
):
91-
"""同步创建 Agent Runtime / Create Agent Runtime asynchronously
91+
"""同步创建 Agent Runtime / Create Agent Runtime synchronously
9292
9393
Args:
9494
input: Agent Runtime 创建配置 / Agent Runtime creation configuration
@@ -142,7 +142,7 @@ async def delete_by_id_async(cls, id: str, config: Optional[Config] = None):
142142

143143
@classmethod
144144
def delete_by_id(cls, id: str, config: Optional[Config] = None):
145-
"""根据 ID 同步删除 Agent Runtime / Delete Agent Runtime by ID asynchronously
145+
"""根据 ID 同步删除 Agent Runtime / Delete Agent Runtime by ID synchronously
146146
147147
此方法会先删除所有关联的端点,然后再删除 Agent Runtime。
148148
This method will first delete all associated endpoints, then delete the Agent Runtime.
@@ -205,7 +205,7 @@ def update_by_id(
205205
input: AgentRuntimeUpdateInput,
206206
config: Optional[Config] = None,
207207
):
208-
"""根据 ID 同步更新 Agent Runtime / Update Agent Runtime by ID asynchronously
208+
"""根据 ID 同步更新 Agent Runtime / Update Agent Runtime by ID synchronously
209209
210210
Args:
211211
id: Agent Runtime ID
@@ -240,7 +240,7 @@ async def get_by_id_async(cls, id: str, config: Optional[Config] = None):
240240

241241
@classmethod
242242
def get_by_id(cls, id: str, config: Optional[Config] = None):
243-
"""根据 ID 同步获取 Agent Runtime / Get Agent Runtime by ID asynchronously
243+
"""根据 ID 同步获取 Agent Runtime / Get Agent Runtime by ID synchronously
244244
245245
Args:
246246
id: Agent Runtime ID
@@ -359,7 +359,7 @@ async def list_async(cls, config: Optional[Config] = None):
359359

360360
@classmethod
361361
def list(cls, config: Optional[Config] = None):
362-
"""同步列出所有 Agent Runtimes / List all Agent Runtimes asynchronously
362+
"""同步列出所有 Agent Runtimes / List all Agent Runtimes synchronously
363363
364364
此方法会自动分页获取所有 Agent Runtimes 并去重。
365365
This method automatically paginates to get all Agent Runtimes and deduplicates them.

agentrun/credential/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def create_async(
8484
def create(
8585
self, input: CredentialCreateInput, config: Optional[Config] = None
8686
):
87-
"""创建凭证(同步) / Create credential asynchronously
87+
"""创建凭证(同步) / Create credential synchronously
8888
8989
Args:
9090
input: 凭证输入参数 / Credential input parameters

agentrun/knowledgebase/api/control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626
from alibabacloud_tea_openapi.exceptions._client import ClientException
2727
from alibabacloud_tea_openapi.exceptions._server import ServerException
28-
from alibabacloud_tea_util.models import RuntimeOptions
28+
from darabonba.runtime import RuntimeOptions
2929
import pydash
3030

3131
from agentrun.utils.config import Config

agentrun/knowledgebase/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async def create_async(
8181
def create(
8282
self, input: KnowledgeBaseCreateInput, config: Optional[Config] = None
8383
):
84-
"""创建知识库(同步) / Create knowledge base asynchronously
84+
"""创建知识库(同步) / Create knowledge base synchronously
8585
8686
Args:
8787
input: 知识库输入参数 / KnowledgeBase input parameters
@@ -131,7 +131,7 @@ async def delete_async(
131131
) from e
132132

133133
def delete(self, knowledge_base_name: str, config: Optional[Config] = None):
134-
"""删除知识库(同步)/ Delete knowledge base asynchronously
134+
"""删除知识库(同步)/ Delete knowledge base synchronously
135135
136136
Args:
137137
knowledge_base_name: 知识库名称 / KnowledgeBase name
@@ -190,7 +190,7 @@ def update(
190190
input: KnowledgeBaseUpdateInput,
191191
config: Optional[Config] = None,
192192
):
193-
"""更新知识库(同步)/ Update knowledge base asynchronously
193+
"""更新知识库(同步)/ Update knowledge base synchronously
194194
195195
Args:
196196
knowledge_base_name: 知识库名称 / KnowledgeBase name
@@ -242,7 +242,7 @@ async def get_async(
242242
) from e
243243

244244
def get(self, knowledge_base_name: str, config: Optional[Config] = None):
245-
"""获取知识库(同步)/ Get knowledge base asynchronously
245+
"""获取知识库(同步)/ Get knowledge base synchronously
246246
247247
Args:
248248
knowledge_base_name: 知识库名称 / KnowledgeBase name
@@ -292,7 +292,7 @@ def list(
292292
input: Optional[KnowledgeBaseListInput] = None,
293293
config: Optional[Config] = None,
294294
):
295-
"""列出知识库(同步)/ List knowledge bases asynchronously
295+
"""列出知识库(同步)/ List knowledge bases synchronously
296296
297297
Args:
298298
input: 分页查询参数 / Pagination query parameters

agentrun/knowledgebase/knowledgebase.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def create_async(
8282
def create(
8383
cls, input: KnowledgeBaseCreateInput, config: Optional[Config] = None
8484
):
85-
"""创建知识库(同步)/ Create knowledge base asynchronously
85+
"""创建知识库(同步)/ Create knowledge base synchronously
8686
8787
Args:
8888
input: 知识库输入参数 / KnowledgeBase input parameters
@@ -111,7 +111,7 @@ async def delete_by_name_async(
111111
def delete_by_name(
112112
cls, knowledge_base_name: str, config: Optional[Config] = None
113113
):
114-
"""根据名称删除知识库(同步)/ Delete knowledge base by name asynchronously
114+
"""根据名称删除知识库(同步)/ Delete knowledge base by name synchronously
115115
116116
Args:
117117
knowledge_base_name: 知识库名称 / KnowledgeBase name
@@ -147,7 +147,7 @@ def update_by_name(
147147
input: KnowledgeBaseUpdateInput,
148148
config: Optional[Config] = None,
149149
):
150-
"""根据名称更新知识库(同步)/ Update knowledge base by name asynchronously
150+
"""根据名称更新知识库(同步)/ Update knowledge base by name synchronously
151151
152152
Args:
153153
knowledge_base_name: 知识库名称 / KnowledgeBase name
@@ -182,7 +182,7 @@ async def get_by_name_async(
182182
def get_by_name(
183183
cls, knowledge_base_name: str, config: Optional[Config] = None
184184
):
185-
"""根据名称获取知识库(同步)/ Get knowledge base by name asynchronously
185+
"""根据名称获取知识库(同步)/ Get knowledge base by name synchronously
186186
187187
Args:
188188
knowledge_base_name: 知识库名称 / KnowledgeBase name
@@ -246,7 +246,7 @@ def list_all(
246246
provider: Optional[str] = None,
247247
config: Optional[Config] = None,
248248
) -> List[KnowledgeBaseListOutput]:
249-
"""列出所有知识库(同步)/ List all knowledge bases asynchronously
249+
"""列出所有知识库(同步)/ List all knowledge bases synchronously
250250
251251
Args:
252252
provider: 提供商 / Provider
@@ -288,7 +288,7 @@ async def update_async(
288288
def update(
289289
self, input: KnowledgeBaseUpdateInput, config: Optional[Config] = None
290290
):
291-
"""更新知识库(同步)/ Update knowledge base asynchronously
291+
"""更新知识库(同步)/ Update knowledge base synchronously
292292
293293
Args:
294294
input: 知识库更新输入参数 / KnowledgeBase update input parameters
@@ -325,7 +325,7 @@ async def delete_async(self, config: Optional[Config] = None):
325325
)
326326

327327
def delete(self, config: Optional[Config] = None):
328-
"""删除知识库(同步)/ Delete knowledge base asynchronously
328+
"""删除知识库(同步)/ Delete knowledge base synchronously
329329
330330
Args:
331331
config: 配置 / Configuration
@@ -359,7 +359,7 @@ async def get_async(self, config: Optional[Config] = None):
359359
return self
360360

361361
def get(self, config: Optional[Config] = None):
362-
"""刷新知识库信息(同步)/ Refresh knowledge base info asynchronously
362+
"""刷新知识库信息(同步)/ Refresh knowledge base info synchronously
363363
364364
Args:
365365
config: 配置 / Configuration
@@ -393,7 +393,7 @@ async def refresh_async(self, config: Optional[Config] = None):
393393
# =========================================================================
394394

395395
def refresh(self, config: Optional[Config] = None):
396-
"""刷新知识库信息(同步)/ Refresh knowledge base info asynchronously
396+
"""刷新知识库信息(同步)/ Refresh knowledge base info synchronously
397397
398398
Args:
399399
config: 配置 / Configuration
@@ -506,7 +506,7 @@ def retrieve(
506506
query: str,
507507
config: Optional[Config] = None,
508508
) -> Dict[str, Any]:
509-
"""检索知识库(同步)/ Retrieve from knowledge base asynchronously
509+
"""检索知识库(同步)/ Retrieve from knowledge base synchronously
510510
511511
根据当前知识库的 provider 类型和配置执行检索。
512512
Executes retrieval based on current knowledge base provider type and configuration.
@@ -547,7 +547,7 @@ def _safe_get_kb(
547547
kb_name: str,
548548
config: Optional[Config] = None,
549549
) -> Any:
550-
"""安全获取知识库(同步)/ Safely get knowledge base asynchronously
550+
"""安全获取知识库(同步)/ Safely get knowledge base synchronously
551551
552552
Args:
553553
kb_name: 知识库名称 / Knowledge base name
@@ -611,7 +611,7 @@ def _safe_retrieve_kb(
611611
query: str,
612612
config: Optional[Config] = None,
613613
) -> Dict[str, Any]:
614-
"""安全执行知识库检索(同步)/ Safely retrieve from knowledge base asynchronously
614+
"""安全执行知识库检索(同步)/ Safely retrieve from knowledge base synchronously
615615
616616
Args:
617617
kb_name: 知识库名称 / Knowledge base name
@@ -704,7 +704,7 @@ def multi_retrieve(
704704
knowledge_base_names: List[str],
705705
config: Optional[Config] = None,
706706
) -> Dict[str, Any]:
707-
"""多知识库检索(同步)/ Multi knowledge base retrieval asynchronously
707+
"""多知识库检索(同步)/ Multi knowledge base retrieval synchronously
708708
709709
根据知识库名称列表进行检索,自动获取各知识库的配置并执行检索。
710710
如果某个知识库查询失败,不影响其他知识库的查询。

0 commit comments

Comments
 (0)