获取模型版本详情
更新时间:2024-04-10
功能介绍
本接口用于根据模型版本id获取模型版本详情,如模型名称、版本号、模型版本来源类型等。
注意事项
- 调用本文API,使用“安全认证/Access Key ”中的Access Key ID 和 Secret Access Key等进行鉴权,无法使用获取Access Token的方式鉴权,具体鉴权认证机制参考鉴权认证机制。
请求说明
基本信息
请求地址: https://qianfan.baidubce.com/wenxinworkshop/modelrepo/modelVersionDetail
请求方式: POST
Header参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
Content-Type | string | 是 | 固定值:application/json |
x-bce-date | string | 否 | 当前时间,遵循ISO8601规范,格式如2016-04-06T08:23:49Z |
Authorization | string | 是 | 用于验证请求合法性的认证信息,更多内容请参考鉴权认证机制,签名工具可参考IAM签名工具 |
Body参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
modelVersionId | string | 是 | 模型版本id,示例:amv-g73j3faikzpz,说明: (1)通过以下方式获取该字段值: · 方式一,通过调用获取模型详情接口,返回的modelVersionIdStr字段获取 · 方式二,在千帆控制台-我的模型-点击某模型详情,在版本列表中查看 (2)该字段新增支持string类型,如果之前使用的是int类型,建议变更为string类型,后续可能将逐步废弃int类型;例如通过调用获取模型详情接口,返回的modelVersionId字段获取,请替换为接口返回的modelVersionIdStr字段获取 |
响应说明
名称 | 类型 | 描述 |
---|---|---|
log_id | string | 请求ID |
result | object | 请求结果 |
result说明
名称 | 类型 | 描述 |
---|---|---|
modelName | string | 模型名称 |
modelId | integer | 模型id,注意:该字段后续可能废弃,如需使用模型id,请使用modelIdStr |
modelIdStr | string | 模型id |
modelVersionId | integer | 版本id,注意:该字段后续可能废弃,如需使用版本id,请使用modelVersionIdStr |
modelVersionIdStr | string | 版本id |
state | string | 状态,说明: Ready:已就绪 Creating:创建中 Fail:创建失败 |
version | string | 版本号 |
sourceType | string | 模型版本来源类型,说明: Train:大模型训练产生 Acceleration:模型加速产生 PlatformPreset:平台预置模型版本 Import:外部导入模型 |
sourceExtra | object | 版本来源回溯信息 |
modelNet | string | 网络类型 |
framework | string | 版本框架 |
algorithm | string | 算法类型 |
description | string | 版本描述 |
createTime | integer | 版本创建时间戳 |
modifyTime | string | 版本修改时间戳 |
ioMode | string | 输入输出模式,说明: chat:对话模式 completion:续写模式 |
ioLength | string | 输入输出长度,示例:3K+1K |
params | object | 出入参 |
copyright | string | 版权信息,仅开源模型及其衍生模型返回该字段 |
license | string | 开源协议,仅预置开源模型返回该字段 |
property | string | 模型的额外属性信息,json字符串 |
deployResource | object | 模型可部署的资源池类型 |
supportOptions | []string | 模型支持的下游操作,说明: Deploy:部署 Acceleration:压缩 Evaluation:评估 |
trainType | string | 基础模型,说明: (1)字段值说明: · 当基础模型是ernieBotLite各版本模型,该字段返回ernieBotLite;例如基础模型是ernieBotLite-v201-8k,返回trainType值为ernieBotLite · 当基础模型是chatglm2-6b、chatglm2-6b-32k,该字段返回chatglm2-6b · 其他,该字段返回对应基础模型 (2)在将训练任务发布为模型场景,使用该字段时,需注意以下,更多详情请参考训练任务发布为模型: 该字段值需和模型调优-获取任务运行详情接口返回的trainType字段配合使用 |
isMainVersion | bool | 是否为主线版本 |
inputTokens | int | 输入tokens,说明:当模型为重排序Reranker类型,不返回此字段 |
outputTokens | int | 输出tokens,说明:当模型为重排序Reranker类型,不返回此字段 |
characterCnt | int | 上下文字符数,说明:当模型为重排序Reranker类型,不返回此字段 |
queryCharacterCnt | int | 查询Token字符限制,说明:只有当模型为重排序Reranker类型,返回此字段 |
docCharacterCnt | int | 文档Token字符限制,说明:只有当模型为重排序Reranker类型,返回此字段 |
queryTokens | int | 查询Token,说明:只有当模型为重排序Reranker类型,返回此字段 |
documentTokens | int | 文档Token,说明:只有当模型为重排序Reranker类型,返回此字段 |
baseModelId | string | 用户模型对应的基础模型id |
baseModelVersionId | string | 用户模型对应的基础模型版本id |
sourceExtra说明
名称 | 类型 | 描述 |
---|---|---|
sourceType | string | 版本来源类型,不同类型对应不同的数据结构,说明: Train:大模型训练产生 Acceleration:模型加速产生 Import:外部导入模型 |
trainSourceExtra | object | 大模型训练回溯信息 |
accelerationSourceExtra | object | 模型加速回溯信息 |
importModelVersionSourceExtra | object | 导入模型回溯信息 |
trainSourceExtra说明
名称 | 类型 | 描述 |
---|---|---|
taskId | integer | 训练ID,注意:该字段后续可能废弃,如需使用训练ID,请使用taskIdStr |
taskIdStr | string | 训练ID |
taskName | string | 训练名称 |
iterationVersion | integer | 训练任务版本 |
runId | integer | 训练运行ID,注意:该字段后续可能废弃,如需训练运行ID,请使用runIdStr |
runIdStr | string | 训练运行ID |
devType | integer | 说明: 1:大模型调优 2:RLHF-奖励模型 3:RLHF-强化学习 |
modelType | integer | 模型类型 |
step | integer | 如果是选择的step发布,字段值为选择的对应step |
accelerationSourceExtra说明
名称 | 类型 | 描述 |
---|---|---|
taskId | integer | 加速任务id |
taskName | string | 加速任务名称 |
sourceModelVersionId | integer | 源模型id |
importModelVersionSourceExtra说明
名称 | 类型 | 描述 |
---|---|---|
bucket | string | bos bucket |
object | string | bos object |
params说明
名称 | 类型 | 描述 |
---|---|---|
input | string | 入参,json字符串 |
output | integer | 出参,json字符串 |
deployResource说明
名称 | 类型 | 描述 |
---|---|---|
isAvailablePublic | bool | 是否支持公有资源池 |
privateResource | []object | 私有资源池支持信息 |
privateResource说明
名称 | 类型 | 描述 |
---|---|---|
resourceType | string | 资源类型 |
cuNum | integer | 资源数级 |
示例
请求示例
# 替换下列示例中的Authorization值、x-bce-date值、modelVersionId值
curl --location 'https://qianfan.baidubce.com/wenxinworkshop/modelrepo/modelVersionDetail' \
--header 'Authorization: bce-auth-v1/f0ee7axxxx/2023-09-19T13:42:13Z/180000/host;x-bce-date/9a8cfb8ee58a8f44a21a52640015de61bc55ca2e6d8cc23d080016e374525543' \
--header 'x-bce-date: 2023-09-19T13:37:10Z' \
--header 'Content-Type: application/json' \
--data '{
"modelVersionId":"amv-g73j3faikzpz"
}'
响应示例
{
"log_id": "3306310492",
"result": {
"modelId": 456,
"modelIdStr": "am-txtetnsfq9sb",
"modelName": "chatglm32k_v10",
"modelVersionId": 638,
"modelVersionIdStr": "amv-sxw7atka4jk0",
"version": "2",
"description": "clc_test_publish_chatglm32k_v10",
"sourceType": "Train",
"isMainVersion":"是否为主线版本",
"inputTokens":xxx,
"outputTokens":xxx,
"characterCnt":xxx,
"baseModelId":"xxxxx",
"baseModelVersionId":"xxxxx",
"sourceExtra": {
"trainSourceExtra": {
"taskId": 417,
"taskIdStr": "job-bzh162wfyrg8",
"taskName": "ccm_test",
"iterationVersion": 4,
"runId": 1498,
"runIdStr": "task-g0b6i9pvn5sj",
"devType": 1,
"modelType": 20,
"templateType": 2000
},
"sourceType": "Train"
},
"framework": "paddlepaddle",
"algorithm": "ERNIE_EB-ERNIEBOT_V202_FUSE",
"modelNet": "paddlepaddle-ERNIE_EB-ERNIEBOT_V202_FUSE",
"state": "Ready",
"ioMode": "chat",
"ioLength": "",
"copyright": "",
"property": {},
"createTime": "2023-12-15T16:30:06+08:00",
"modifyTime": "2024-01-04T16:10:45+08:00",
"deployResource": {
"isAvailablePublic": false,
"privateResource": [{
"resourceType": "gpu",
"cuNum": 2
}]
},
"supportOptions": [
"Deploy",
"Evaluation"
],
"trainType": "ernieBotLite",
"params": {
"input": {
"type": "object",
"required": [
"messages"
],
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"name": "role",
"type": "string",
"default": "user",
"description": "当前支持以下两个role: \"user\": 用户 \"assistant\": 对话助手"
},
"content": {
"name": "content",
"type": "string",
"description": "对话内容,不能为空"
}
}
}
},
"stream": {
"name": "stream",
"type": "boolean",
"description": "是否以流式接口的形式返回数据; 默认false"
},
"user_id": {
"name": "user_id",
"type": "string",
"description": "表示最终用户的唯一标识符,可以监视和检测滥用行为,防止接口恶意调用。"
}
}
},
"output": {
"type": "object",
"required": [],
"properties": {
"id": {
"name": "id",
"type": "string",
"description": "本轮对话的id"
},
"object": {
"name": "object",
"type": "string",
"description": "回包类型 “chat.completion”:多轮对话返回"
},
"created": {
"name": "created",
"type": "integer",
"format": "int32",
"description": "时间戳"
},
"sentence_id": {
"name": "sentence_id",
"type": "integer",
"format": "int32",
"description": "流式接口模式下会返回,表示当前子句的序号"
},
"is_end": {
"name": "is_end",
"type": "boolean",
"description": "流式接口模式下会返回,表示当前子句是否是最后一句"
},
"is_truncated": {
"name": "is_truncated",
"type": "boolean",
"description": "标识当前生成的结果是否被截断"
},
"result": {
"name": "result",
"type": "string",
"description": "对话返回结果, 当前对话返回结果限制在1000个token"
},
"need_clear_history": {
"name": "need_clear_history",
"type": "boolean",
"description": "值为true表示用户输入存在安全风险,建议关闭当前会话,清理历史会话信息"
},
"ban_round": {
"name": "ban_round",
"type": "integer",
"format": "int32",
"description": "当need_clear_history为true时,此字段会告知第几轮对话有敏感信息,如果是当前问题,ban_round = -1"
},
"usage": {
"type": "object",
"required": [],
"description": "token统计信息,token数 = 汉字数+单词数*1.3 (仅为估算逻辑)",
"properties": {
"prompt_tokens": {
"name": "prompt_tokens",
"type": "integer",
"format": "int32",
"description": "问题tokens数(包含历史QA)"
},
"completion_tokens": {
"name": "completion_tokens",
"type": "integer",
"format": "int32",
"description": "回答tokens数"
},
"total_tokens": {
"name": "total_tokens",
"type": "integer",
"format": "int32",
"description": "tokens总数"
}
}
}
}
}
}
}
}
错误码
若请求错误,服务器将返回的JSON文本包含以下参数:
名称 | 描述 |
---|---|
error_code | 错误码 |
error_msg | 错误描述信息,帮助理解和解决发生的错误 |
例如参数错误返回:
{
"error_code": 500001,
"error_msg": "param invalid"
}
更多千帆大模型平台其他错误码,也可以查看错误码说明。