Skip to content

Commit 3e04ced

Browse files
author
fengyikai
committed
星流平台(aicp):CreateMemorySdk 、QueryMemorySdk 更新为 apiexplorer 可见。
1 parent f195856 commit 3e04ced

10 files changed

Lines changed: 371 additions & 17 deletions

File tree

ksyun/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# limitations under the License.
1515

1616

17-
__version__ = '1.5.8.70'
17+
__version__ = '1.5.8.71'

ksyun/client/aicp/v20240612/client.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,29 @@ def DescribeApikeys(self, request):
721721
raise KsyunSDKException(message=str(e))
722722

723723

724+
def QueryTokenData(self, request):
725+
"""查询模型API token用量
726+
:param request: Request instance for QueryTokenData.
727+
:type request: :class:`ksyun.client.aicp.v20240612.models.QueryTokenDataRequest`
728+
"""
729+
try:
730+
params = request._serialize()
731+
body = self.call_judge("QueryTokenData", params, "application/x-www-form-urlencoded")
732+
response = json.loads(body)
733+
if "Error" not in response:
734+
return body
735+
else:
736+
code = response["Error"]["Code"]
737+
message = response["Error"]["Message"]
738+
req_id = response["RequestId"]
739+
raise KsyunSDKException(code, message, req_id)
740+
except Exception as e:
741+
if isinstance(e, KsyunSDKException):
742+
raise
743+
else:
744+
raise KsyunSDKException(message=str(e))
745+
746+
724747
def DisableApikeyStatus(self, request):
725748
"""禁用API Key
726749
:param request: Request instance for DisableApikeyStatus.

ksyun/client/aicp/v20240612/models.py

Lines changed: 78 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class DeleteStorageConfigRequest(AbstractModel):
147147

148148
def __init__(self):
149149
r"""删除存储配置
150-
:param StorageConfigId: 存储配置Id
150+
:param StorageConfigId: 存储配置ID
151151
:type PathPrefix: String
152152
"""
153153
self.StorageConfigId = None
@@ -241,9 +241,9 @@ def __init__(self):
241241
r"""修改开发任务
242242
:param NotebookId: 开发任务ID
243243
:type PathPrefix: String
244-
:param NotebookName: 名称
244+
:param NotebookName: 开发任务名称
245245
:type PathPrefix: String
246-
:param Description: 描述
246+
:param Description: 描述信息
247247
:type PathPrefix: String
248248
:param ImageId: 镜像ID
249249
:type PathPrefix: String
@@ -289,7 +289,7 @@ def __init__(self):
289289
:type PathPrefix: String
290290
:param ImageSource: 镜像来源,当改变镜像来源时,需传入该值。
291291
- Official 官方镜像
292-
- Personal 个人镜像
292+
- Personal 自定义镜像
293293
- ThirdParty 第三方镜像
294294
295295
当修改镜像类型为第三方镜像时,需同时传入"ImageRegistryId", "ImageRepoId", "ImageTagId"三个入参
@@ -401,13 +401,13 @@ class DescribeNotebooksRequest(AbstractModel):
401401

402402
def __init__(self):
403403
r"""查询开发任务
404-
:param NotebookId: 开发任务ID
404+
:param NotebookId: 多个开发任务的ID
405405
:type PathPrefix: Filter
406406
:param Name: 开发任务名称
407407
:type PathPrefix: String
408-
:param Page: 页数
408+
:param Page: 页码
409409
:type PathPrefix: Int
410-
:param PageSize: 每页查询数目
410+
:param PageSize: 单次调用可返回的最大条目数量
411411
:type PathPrefix: Int
412412
:param Filter: 条件过滤
413413
:type PathPrefix: Filter
@@ -442,17 +442,17 @@ class CreateNotebookRequest(AbstractModel):
442442

443443
def __init__(self):
444444
r"""创建开发任务
445-
:param NotebookName: 任务名称
445+
:param NotebookName: 开发任务名称
446446
:type PathPrefix: String
447447
:param Description: 描述信息
448448
:type PathPrefix: String
449-
:param ResourcePoolId: 资源池ID
449+
:param ResourcePoolId: 资源组ID
450450
:type PathPrefix: String
451451
:param QueueName: 队列名称
452452
:type PathPrefix: String
453453
:param GPUType: GPU类型
454454
:type PathPrefix: String
455-
:param GPUNumber: GPU卡数,当GPUType不为空时,此值有效,允许范围为0~10000, 如果可虚拟化,支持[0.1,0.9]
455+
:param GPUNumber: GPU卡数,当GPUType不为空时,此值有效且必传,允许范围为0~10000, 如果可虚拟化,支持[0.1,0.9]
456456
:type PathPrefix: String
457457
:param CPUNum: CPU核数,允许范围为0~10000
458458
:type PathPrefix: Int
@@ -462,13 +462,13 @@ def __init__(self):
462462
:type PathPrefix: String
463463
:param StorageConfigs: 存储配置列表
464464
:type PathPrefix: Array
465-
:param AutoSave: 是否自动保存镜像
465+
:param AutoSave: 自动保存镜像。当值为true时,开发任务停止前会执行自动保存镜像
466466
:type PathPrefix: Boolean
467-
:param ServiceConfigs: 开放服务端口列表
467+
:param ServiceConfigs: 自定义服务配置
468468
:type PathPrefix: Array
469469
:param ImageSource: 镜像来源
470470
- 官方镜像 Official
471-
- 个人镜像 Personal
471+
- 自定义镜像 Personal
472472
- 第三方镜像 ThirdParty
473473
474474
当传入值为ThirdParty时,"ImageRegistryId", "ImageRepoId", "ImageTagId"必须传入
@@ -492,7 +492,7 @@ def __init__(self):
492492
:type PathPrefix: Boolean
493493
:param AllocationId: 弹性IP ID,当EnablePublicNetworkSsh=true时,此参数必传
494494
:type PathPrefix: String
495-
:param RunOnCPU: 开启后,仅调度CPU
495+
:param RunOnCPU: 仅调度到CPU节点。当GPUNumber为空或值为0时此值有效
496496
:type PathPrefix: String
497497
"""
498498
self.NotebookName = None
@@ -1069,7 +1069,7 @@ class DescribeNotebookLogRequest(AbstractModel):
10691069

10701070
def __init__(self):
10711071
r"""查看开发机的pod日志
1072-
:param NotebookId: 开发任务Id
1072+
:param NotebookId: 开发任务ID
10731073
:type PathPrefix: String
10741074
:param SinceSeconds: 日志默认显示时间,单位秒;比如10分钟内的,值为600
10751075
:type PathPrefix: Int
@@ -1357,6 +1357,69 @@ def _deserialize(self, params):
13571357
self.KeyId = params.get("KeyId")
13581358

13591359

1360+
class QueryTokenDataRequest(AbstractModel):
1361+
"""QueryTokenData请求参数结构体
1362+
"""
1363+
1364+
def __init__(self):
1365+
r"""查询模型API token用量
1366+
:param StartTimestamp: 开始时间,毫秒时间戳
1367+
:type PathPrefix: Long
1368+
:param EndTimestamp: 截止时间,毫秒时间戳
1369+
:type PathPrefix: Long
1370+
:param LastKey: 分页用的游标,表示上次已经获取到的数据,当前请求可以取上次返回结果的LastKey,首页时不传
1371+
:type PathPrefix: String
1372+
:param MaxResults: 分页页长,最大10000
1373+
:type PathPrefix: Int
1374+
:param ModelKeyword: model 搜索关键词
1375+
:type PathPrefix: String
1376+
:param Keyword: 搜索关键词
1377+
:type PathPrefix: String
1378+
:param GroupBy: 分组字段:model、keyId
1379+
:type PathPrefix: String
1380+
:param ReasoningType: 推理类型:normal-在线,batch-批量,web-在线体验,为空表示全部。
1381+
:type PathPrefix: String
1382+
:param Marker: 页码,从1开始。
1383+
:type PathPrefix: Int
1384+
:param ModelName: 模型名称
1385+
- 当按照模型分组时,Keyword优先,Keyword为空再以该字段筛选
1386+
- 当按照APIKEY分组时,该字段始终生效
1387+
:type PathPrefix: String
1388+
"""
1389+
self.StartTimestamp = None
1390+
self.EndTimestamp = None
1391+
self.LastKey = None
1392+
self.MaxResults = None
1393+
self.ModelKeyword = None
1394+
self.Keyword = None
1395+
self.GroupBy = None
1396+
self.ReasoningType = None
1397+
self.Marker = None
1398+
self.ModelName = None
1399+
1400+
def _deserialize(self, params):
1401+
if params.get("StartTimestamp"):
1402+
self.StartTimestamp = params.get("StartTimestamp")
1403+
if params.get("EndTimestamp"):
1404+
self.EndTimestamp = params.get("EndTimestamp")
1405+
if params.get("LastKey"):
1406+
self.LastKey = params.get("LastKey")
1407+
if params.get("MaxResults"):
1408+
self.MaxResults = params.get("MaxResults")
1409+
if params.get("ModelKeyword"):
1410+
self.ModelKeyword = params.get("ModelKeyword")
1411+
if params.get("Keyword"):
1412+
self.Keyword = params.get("Keyword")
1413+
if params.get("GroupBy"):
1414+
self.GroupBy = params.get("GroupBy")
1415+
if params.get("ReasoningType"):
1416+
self.ReasoningType = params.get("ReasoningType")
1417+
if params.get("Marker"):
1418+
self.Marker = params.get("Marker")
1419+
if params.get("ModelName"):
1420+
self.ModelName = params.get("ModelName")
1421+
1422+
13601423
class DisableApikeyStatusRequest(AbstractModel):
13611424
"""DisableApikeyStatus请求参数结构体
13621425
"""

ksyun/client/aicp/v20251114/client.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,49 @@ def CreateKnowledgeBase(self, request):
376376
raise KsyunSDKException(message=str(e))
377377

378378

379+
def CreateMemorySdk(self, request):
380+
"""向指定记忆库写入记忆
381+
:param request: Request instance for CreateMemorySdk.
382+
:type request: :class:`ksyun.client.aicp.v20251114.models.CreateMemorySdkRequest`
383+
"""
384+
try:
385+
params = request._serialize()
386+
body = self.call_judge("CreateMemorySdk", params, "application/json")
387+
response = json.loads(body)
388+
if "Error" not in response:
389+
return body
390+
else:
391+
code = response["Error"]["Code"]
392+
message = response["Error"]["Message"]
393+
req_id = response["RequestId"]
394+
raise KsyunSDKException(code, message, req_id)
395+
except Exception as e:
396+
if isinstance(e, KsyunSDKException):
397+
raise
398+
else:
399+
raise KsyunSDKException(message=str(e))
400+
401+
402+
def QueryMemorySdk(self, request):
403+
"""从记忆库检索记忆
404+
:param request: Request instance for QueryMemorySdk.
405+
:type request: :class:`ksyun.client.aicp.v20251114.models.QueryMemorySdkRequest`
406+
"""
407+
try:
408+
params = request._serialize()
409+
body = self.call_judge("QueryMemorySdk", params, "application/json")
410+
response = json.loads(body)
411+
if "Error" not in response:
412+
return body
413+
else:
414+
code = response["Error"]["Code"]
415+
message = response["Error"]["Message"]
416+
req_id = response["RequestId"]
417+
raise KsyunSDKException(code, message, req_id)
418+
except Exception as e:
419+
if isinstance(e, KsyunSDKException):
420+
raise
421+
else:
422+
raise KsyunSDKException(message=str(e))
423+
424+

ksyun/client/aicp/v20251114/models.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,105 @@ def _deserialize(self, params):
372372
self.RetrievalModel = params.get("RetrievalModel")
373373

374374

375+
class CreateMemorySdkRequest(AbstractModel):
376+
"""CreateMemorySdk请求参数结构体
377+
"""
378+
379+
def __init__(self):
380+
r"""向指定记忆库写入记忆
381+
:param Namespace:
382+
:type PathPrefix: String
383+
:param UserId:
384+
:type PathPrefix: String
385+
:param AgentId:
386+
:type PathPrefix: String
387+
:param SessionId:
388+
:type PathPrefix: String
389+
:param SceneId:
390+
:type PathPrefix: String
391+
:param DataType:
392+
:type PathPrefix: String
393+
:param Data:
394+
:type PathPrefix: Object
395+
"""
396+
self.Namespace = None
397+
self.UserId = None
398+
self.AgentId = None
399+
self.SessionId = None
400+
self.SceneId = None
401+
self.DataType = None
402+
self.Data = None
403+
404+
def _deserialize(self, params):
405+
if params.get("Namespace"):
406+
self.Namespace = params.get("Namespace")
407+
if params.get("UserId"):
408+
self.UserId = params.get("UserId")
409+
if params.get("AgentId"):
410+
self.AgentId = params.get("AgentId")
411+
if params.get("SessionId"):
412+
self.SessionId = params.get("SessionId")
413+
if params.get("SceneId"):
414+
self.SceneId = params.get("SceneId")
415+
if params.get("DataType"):
416+
self.DataType = params.get("DataType")
417+
if params.get("Data"):
418+
self.Data = params.get("Data")
419+
420+
421+
class QueryMemorySdkRequest(AbstractModel):
422+
"""QueryMemorySdk请求参数结构体
423+
"""
424+
425+
def __init__(self):
426+
r"""从记忆库检索记忆
427+
:param Namespace:
428+
:type PathPrefix: String
429+
:param UserId:
430+
:type PathPrefix: String
431+
:param Query:
432+
:type PathPrefix: String
433+
:param SceneId:
434+
:type PathPrefix: String
435+
:param OccurredAfter:
436+
:type PathPrefix: Long
437+
:param OccurredBefore:
438+
:type PathPrefix: Long
439+
:param Mode:
440+
:type PathPrefix: String
441+
:param ReturnCitations:
442+
:type PathPrefix: Boolean
443+
:param Limit:
444+
:type PathPrefix: Int
445+
"""
446+
self.Namespace = None
447+
self.UserId = None
448+
self.Query = None
449+
self.SceneId = None
450+
self.OccurredAfter = None
451+
self.OccurredBefore = None
452+
self.Mode = None
453+
self.ReturnCitations = None
454+
self.Limit = None
455+
456+
def _deserialize(self, params):
457+
if params.get("Namespace"):
458+
self.Namespace = params.get("Namespace")
459+
if params.get("UserId"):
460+
self.UserId = params.get("UserId")
461+
if params.get("Query"):
462+
self.Query = params.get("Query")
463+
if params.get("SceneId"):
464+
self.SceneId = params.get("SceneId")
465+
if params.get("OccurredAfter"):
466+
self.OccurredAfter = params.get("OccurredAfter")
467+
if params.get("OccurredBefore"):
468+
self.OccurredBefore = params.get("OccurredBefore")
469+
if params.get("Mode"):
470+
self.Mode = params.get("Mode")
471+
if params.get("ReturnCitations"):
472+
self.ReturnCitations = params.get("ReturnCitations")
473+
if params.get("Limit"):
474+
self.Limit = params.get("Limit")
475+
476+

ksyun/client/aicp/v20251212/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self):
1515
:param Priority: 优先级,有效值:
1616
- kaic-high 高优先级
1717
- kaic-normal 中优先级
18-
- kaic-low 低优先级
18+
- kaic-low 低优先级
1919
:type PathPrefix: String
2020
:param QueueName: 队列名称
2121
:type PathPrefix: String

ksyun/client/kmaf/__init__.py

Whitespace-only changes.

ksyun/client/kmaf/v20260130/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)