Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,10 @@ ipv6gw
.. autoclass:: ucloud.services.ipv6gw.client.ipv6gwClient
:members:


sandbox
-------

.. autoclass:: ucloud.services.sandbox.client.sandboxClient
:members:

10 changes: 10 additions & 0 deletions ucloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,16 @@ def ipv6gw(self):
self.logger,
)

def sandbox(self):
from ucloud.services.sandbox.client import sandboxClient

return sandboxClient(
self._auto_config("sandbox"),
self.transport,
self.middleware,
self.logger,
)

def vpc(self):
from ucloud.services.vpc.client import VPCClient

Expand Down
Empty file.
62 changes: 62 additions & 0 deletions ucloud/services/sandbox/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
""" Code is generated by ucloud-model, DO NOT EDIT IT. """

import typing


from ucloud.core.client import Client
from ucloud.services.sandbox.schemas import apis


class sandboxClient(Client):

Check warning on line 10 in ucloud/services/sandbox/client.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename class "sandboxClient" to match the regular expression ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$.

See more on https://sonarcloud.io/project/issues?id=ucloud_ucloud-sdk-python3&issues=AaAZelwkgW3LcNHuFmIC&open=AaAZelwkgW3LcNHuFmIC&pullRequest=350
def __init__(
self, config: dict, transport=None, middleware=None, logger=None
):
super(sandboxClient, self).__init__(
config, transport, middleware, logger
)

def get_sandbox_site(
self, req: typing.Optional[dict] = None, **kwargs
) -> dict:
"""GetSandboxSite - 获取沙箱站点

**Request**

- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
- **SandboxID** (str) - (Required) 沙箱ID
- **Zone** (str) - (Required) 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_

**Response**

- **Site** (dict) - 见 **Site** 模型定义

**Response Model**

**Site**
- **AccessCode** (str) - 访问码
- **ConnectKey** (str) - 连接密钥
- **CustomDomain** (str) - 自定义域名
- **CustomDomainError** (str) - 自定义域名签发错误信息
- **CustomDomainStatus** (str) - 自定义域名签发状态
- **Envs** (list) - 站点环境变量。格式:key=value
- **Host** (str) - 站点访问地址
- **ID** (str) - 站点ID
- **KeyID** (str) - 站点Key ID
- **Name** (str) - 名称
- **Ready** (bool) - 是否就绪
- **SandboxID** (str) - 沙箱ID
- **UpdateTime** (int) - 更新时间


"""
# build request
d = {
"ProjectId": self.config.project_id,
"Region": self.config.region,
}
req and d.update(req)
d = apis.GetSandboxSiteRequestSchema().dumps(d)

resp = self.invoke("GetSandboxSite", d, **kwargs)
return apis.GetSandboxSiteResponseSchema().loads(resp)
Empty file.
33 changes: 33 additions & 0 deletions ucloud/services/sandbox/schemas/apis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
""" Code is generated by ucloud-model, DO NOT EDIT IT. """

from ucloud.core.typesystem import schema, fields
from ucloud.services.sandbox.schemas import models

""" sandbox API Schema
"""


"""
API: GetSandboxSite

获取沙箱站点
"""

Check warning on line 14 in ucloud/services/sandbox/schemas/apis.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=ucloud_ucloud-sdk-python3&issues=AaAZelwugW3LcNHuFmID&open=AaAZelwugW3LcNHuFmID&pullRequest=350


class GetSandboxSiteRequestSchema(schema.RequestSchema):
"""GetSandboxSite - 获取沙箱站点"""

fields = {
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
"Region": fields.Str(required=True, dump_to="Region"),
"SandboxID": fields.Str(required=True, dump_to="SandboxID"),
"Zone": fields.Str(required=True, dump_to="Zone"),
}


class GetSandboxSiteResponseSchema(schema.ResponseSchema):
"""GetSandboxSite - 获取沙箱站点"""

fields = {
"Site": models.SiteSchema(),
}
27 changes: 27 additions & 0 deletions ucloud/services/sandbox/schemas/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
""" Code is generated by ucloud-model, DO NOT EDIT IT. """

from ucloud.core.typesystem import schema, fields


class SiteSchema(schema.ResponseSchema):
"""Site - 站点空间"""

fields = {
"AccessCode": fields.Str(required=True, load_from="AccessCode"),
"ConnectKey": fields.Str(required=True, load_from="ConnectKey"),
"CustomDomain": fields.Str(required=False, load_from="CustomDomain"),
"CustomDomainError": fields.Str(
required=False, load_from="CustomDomainError"
),
"CustomDomainStatus": fields.Str(
required=False, load_from="CustomDomainStatus"
),
"Envs": fields.List(fields.Str()),
"Host": fields.Str(required=True, load_from="Host"),
"ID": fields.Str(required=True, load_from="ID"),
"KeyID": fields.Str(required=True, load_from="KeyID"),
"Name": fields.Str(required=True, load_from="Name"),
"Ready": fields.Bool(required=True, load_from="Ready"),
"SandboxID": fields.Str(required=True, load_from="SandboxID"),
"UpdateTime": fields.Int(required=True, load_from="UpdateTime"),
}
62 changes: 47 additions & 15 deletions ucloud/services/uai_modelverse/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def create_um_infer_api_key(
- **GrantAllModels** (bool) - 全部模型访问开关,开启不受 GrantedModels 参数控制,关闭只能访问 GrantedModels 中添加模型
- **GrantedModels** (str) - 授权模型,内容为数组格式。当 GrantAllModels 为false时 当前key只可访问数组中模型。例:["deepseek-ai/DeepSeek-V3.2-Think"]
- **IPWhitelist** (str) - ip白名单,换行分割的多组ip。支持IPv4和网段,输入后回车生效,最多100个, 示例:192.168.1.1192.168.1.10-192.168.1.100192.168.1.10/24
- **InferenceLogEnabled** (int) - 是否开启推理日志
- **ModelverseDisabled** (int) - 是否modelverse可用 0: 启用 1: 禁用
- **MonthlyLimitAmount** (str) - 月限额,单位随用户所在渠道。126渠道单位为美元
- **SandBoxDisabled** (int) - 是否沙盒可用 0: 启用 1: 禁用(astraflow 沙盒控制未上线,暂时无效)
Expand All @@ -43,14 +44,17 @@ def create_um_infer_api_key(
- **ChannelId** (int) - 渠道id
- **CreateTime** (int) - 创建时间
- **DailyLimitAmount** (str) - 日限额,单位随用户所在渠道。126渠道单位为美元
- **DailyUsedAmount** (str) - 日已使用额,单位随用户所在渠道。126渠道单位为美元
- **ExpireTime** (int) - 过期时间的unix时间戳,-1 用不过期
- **GrantAllModels** (bool) - 全部模型访问开关,开启不受 GrantedModels 参数控制,关闭只能访问 GrantedModels 中添加模型
- **GrantedModels** (list) - 授权的模型,英文逗号分隔,all表示所有模型都有权限
- **IPWhitelist** (str) - ip白名单,换行分割的多组ip。支持IPv4和网段,输入后回车生效,最多100个, 示例:  192.168.1.1 192.168.1.10-192.168.1.100 192.168.1.10/24
- **InferenceLogEnabled** (int) - 是否开启推理日志
- **Key** (str) - 密钥值
- **KeyId** (str) - 资源ID
- **ModelverseDisabled** (int) - 是否modelverse可用 0: 启用 1: 禁用
- **MonthlyLimitAmount** (str) - 月限额,单位随用户所在渠道。126渠道单位为美元
- **MonthlyUsedAmount** (str) - 月已使用额,单位随用户所在渠道。126渠道单位为美元
- **Name** (str) - 名称
- **OrganizationId** (int) - 项目id
- **SandBoxDisabled** (int) - 是否沙盒可用 0: 启用 1: 禁用(astraflow 沙盒控制未上线,暂时无效)
Expand Down Expand Up @@ -349,16 +353,6 @@ def get_uf_square_model_detail(

**Response Model**

**Pricing**
- **Completion** (float) - 输出定价
- **Currency** (str) - 币种
- **Image** (float) - 生图定价
- **Prompt** (float) - 提示词定价
- **Unit** (str) - 单位(中文),如“次” “百万”
- **UnitEn** (str) - 单位(English),如“Time” “Million”
- **Video** (str) - 生视频定价


**PriceRate**
- **ChargeItem** (str) - 收费项:input/output/thinking/tool...
- **ChargeItemDescription** (str) - 收费项描述
Expand All @@ -376,6 +370,16 @@ def get_uf_square_model_detail(
- **Rates** (list) - 见 **PriceRate** 模型定义


**Pricing**
- **Completion** (float) - 输出定价
- **Currency** (str) - 币种
- **Image** (float) - 生图定价
- **Prompt** (float) - 提示词定价
- **Unit** (str) - 单位(中文),如“次” “百万”
- **UnitEn** (str) - 单位(English),如“Time” “Million”
- **Video** (str) - 生视频定价


**SquareModel**
- **CreateAt** (int) - 创建时间
- **Describe** (str) - 详细描述
Expand Down Expand Up @@ -757,9 +761,11 @@ def list_uf_square_model(

- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
- **Capabilities** (list) - 模型特性,可选值来源于ListUFSquareModelFilters枚举接口。可多选
- **Keyword** (str) - 关键字
- **Language** (list) - 语言,数组类型,可选值 ["chinese", "english"]
- **Limit** (int) - 每页数量
- **Manufacturer** (list) - 制造商,可选值来源于ListUFSquareModelFilters枚举接口。可多选
- **MaxModelLen** (list) - 上下文长度,数组类型,可选值 [0,4096,16384,32768,131072,256000,262144,1048576]
- **ModelType** (str) - 模型类型
- **Offset** (int) - 偏移量
Expand All @@ -774,26 +780,51 @@ def list_uf_square_model(

**Response Model**

**PriceRate**
- **ChargeItem** (str) - 收费项:input/output/thinking/tool...
- **ChargeItemDescription** (str) - 收费项描述
- **ChargeItemDescriptionEn** (str) - 收费项描述英文描述
- **Currency** (str) - 货币单位
- **Price** (str) - 价格
- **Unit** (str) - 计价单位
- **UnitEn** (str) - 计价单位英文


**Pricing**
- **Completion** (float) - 输出定价
- **Currency** (str) - 币种
- **Image** (float) - 生图定价
- **Prompt** (float) - 提示词定价
- **Unit** (str) - 单位(中文),如“次” “百万”
- **UnitEn** (str) - 单位(English),如“Time” “Million”
- **Video** (str) - 生视频定价


**PriceTier**
- **Condition** (str) - 档位/条件(例如 "32k"、"128k")
- **Description** (str) - 档位描述(例如 "标准上下文 32k")
- **DescriptionEn** (str) - 档位描述(例如 "标准上下文 32k")
- **Rates** (list) - 见 **PriceRate** 模型定义


**SquareModel**
- **BatchName** (str) - 关联的 batch 模型名称
- **BatchSquareModelId** (str) - 关联的 batch 模型广场id
- **CreateAt** (int) - 创建时间
- **Describe** (str) - 详细描述
- **HfUpdateTime** (int) - HuggingFace 更新时间
- **Icon** (str) - 图标
- **Id** (str) - 主键
- **IsHasBatch** (bool) - 是否关联有可用 batch 模型
- **Language** (list) - 语言
- **Manufacturer** (str) - 制造商
- **MaxModelLen** (int) - 模型长度
- **ModelType** (str) - 模型类型
- **Name** (str) - 名称
- **Pricing** (dict) - 见 **Pricing** 模型定义
- **SimpleDescribe** (str) - 简要描述
- **SupportedCapabilities** (list) - 模型能力
- **Tiers** (list) - 见 **PriceTier** 模型定义
- **UpdateAt** (int) - 更新时间


Expand Down Expand Up @@ -910,11 +941,6 @@ def list_um_infer_request_logs(

**Response Model**

**RequestLogSummary**
- **FailedRequests** (int) - 查询条件命中的失败请求数
- **TotalRequests** (int) - 查询条件命中的总请求数


**RequestLogItem**
- **ApiKeyId** (str) - API Key ID
- **ApiKeyName** (str) - API Key 名称
Expand All @@ -939,6 +965,11 @@ def list_um_infer_request_logs(
- **TotalTokens** (int) - 总 Token 数


**RequestLogSummary**
- **FailedRequests** (int) - 查询条件命中的失败请求数
- **TotalRequests** (int) - 查询条件命中的总请求数


**ListUMInferRequestLogsData**
- **Items** (list) - 见 **RequestLogItem** 模型定义
- **Summary** (dict) - 见 **RequestLogSummary** 模型定义
Expand Down Expand Up @@ -1133,6 +1164,7 @@ def update_um_infer_api_key(
- **GrantAllModels** (bool) - 全部模型访问开关,开启不受 GrantedModels 参数控制,关闭只能访问 GrantedModels 中添加模型
- **GrantedModels** (str) - 授权模型,内容为数组格式。当 GrantAllModels 为false时 当前key只可访问数组中模型。例:["deepseek-ai/DeepSeek-V3.2-Think"]
- **IPWhitelist** (str) - ip白名单,换行分割的多组ip。支持IPv4和网段,输入后回车生效,最多100个, 示例:  192.168.1.1 192.168.1.10-192.168.1.100 192.168.1.10/24
- **InferenceLogEnabled** (int) - 是否开启推理日志
- **ModelverseDisabled** (int) - 是否modelverse可用 0: 启用 1: 禁用
- **MonthlyLimitAmount** (str) - 月限额,单位随用户所在渠道。126渠道单位为美元
- **Name** (str) - 更新的名称
Expand Down
8 changes: 8 additions & 0 deletions ucloud/services/uai_modelverse/schemas/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class CreateUMInferAPIKeyRequestSchema(schema.RequestSchema):
"GrantAllModels": fields.Bool(required=False, dump_to="GrantAllModels"),
"GrantedModels": fields.Str(required=False, dump_to="GrantedModels"),
"IPWhitelist": fields.Str(required=False, dump_to="IPWhitelist"),
"InferenceLogEnabled": fields.Int(
required=False, dump_to="InferenceLogEnabled"
),
"ModelverseDisabled": fields.Int(
required=False, dump_to="ModelverseDisabled"
),
Expand Down Expand Up @@ -534,9 +537,11 @@ class ListUFSquareModelRequestSchema(schema.RequestSchema):
"""ListUFSquareModel - 查询模型广场数据"""

fields = {
"Capabilities": fields.List(fields.Str()),
"Keyword": fields.Str(required=False, dump_to="Keyword"),
"Language": fields.List(fields.Str()),
"Limit": fields.Int(required=False, dump_to="Limit"),
"Manufacturer": fields.List(fields.Str()),
"MaxModelLen": fields.List(fields.Int()),
"ModelType": fields.Str(required=False, dump_to="ModelType"),
"Offset": fields.Int(required=False, dump_to="Offset"),
Expand Down Expand Up @@ -760,6 +765,9 @@ class UpdateUMInferAPIKeyRequestSchema(schema.RequestSchema):
"GrantAllModels": fields.Bool(required=False, dump_to="GrantAllModels"),
"GrantedModels": fields.Str(required=False, dump_to="GrantedModels"),
"IPWhitelist": fields.Str(required=False, dump_to="IPWhitelist"),
"InferenceLogEnabled": fields.Int(
required=False, dump_to="InferenceLogEnabled"
),
"KeyId": fields.Str(required=True, dump_to="KeyId"),
"ModelverseDisabled": fields.Int(
required=False, dump_to="ModelverseDisabled"
Expand Down
Loading