文档

RunPreTrainService

调用预训练模型服务。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String RunPreTrainService

系统规定参数。取值:RunPreTrainService

ServiceName String ReviewAnalysis

服务名称。

ServiceVersion String V1

服务版本。

PredictContent String {"input":{"content": "这件衣服真好看", "domain": "clothing"}}

预测输入。

返回数据

名称 类型 示例值 描述
PredictResult String {"cost":"21.812ms","imprs":[{"aspect":"款式","clause":"这件衣服真好看","neg_prob":0.0,"pos_prob":0.566100001335144,"position":"0,7","sentiment":"正"}]},"message":"SUCCESS","tracerId":"7973b50e31dcbea8323460e0134d3226"}

模型预测结果。

RequestId String 7310FFCF-9FE8-4257-AE38-0E1AD828C2CC

请求ID。

BillingCount Integer 1

计费次数,对应抵扣资源包数量

示例

请求示例

http(s)://[Endpoint]/?Action=RunPreTrainService
&PredictContent={"input":{"content": "这件衣服真好看", "domain": "clothing"}}
&ServiceName=ReviewAnalysis
&<公共请求参数>

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<RunPreTrainServiceResponse>
    <PredictResult>{"cost":"21.812ms","imprs":[{"aspect":"款式","clause":"这件衣服真好看","neg_prob":0.0,"pos_prob":0.566100001335144,"position":"0,7","sentiment":"正"}]},"message":"SUCCESS","tracerId":"7973b50e31dcbea8323460e0134d3226"}</PredictResult>
    <RequestId>7310FFCF-9FE8-4257-AE38-0E1AD828C2CC</RequestId>
    <BillingCount>1</BillingCount>
</RunPreTrainServiceResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "PredictResult" : "{\"cost\":\"21.812ms\",\"imprs\":[{\"aspect\":\"款式\",\"clause\":\"这件衣服真好看\",\"neg_prob\":0.0,\"pos_prob\":0.566100001335144,\"position\":\"0,7\",\"sentiment\":\"正\"}]},\"message\":\"SUCCESS\",\"tracerId\":\"7973b50e31dcbea8323460e0134d3226\"}",
  "RequestId" : "7310FFCF-9FE8-4257-AE38-0E1AD828C2CC",
  "BillingCount" : 1
}

错误码

HttpCode 错误码 错误信息 描述
400 InvalidAccountStatus.ServiceUnavailable The NLP Auto Machine Learning service has not been activated. 用户未开通NLP自学习服务。
400 InvalidAccountStatus.ServiceLimit The maximum number of free API daily visits is exceeded. API访问次数超过了免费额度限制。
400 parameterError The parameter is invalid. 参数错误
400 predictContentLength The length of content exceeds the limit. 输入预测内容的长度超出限制。
400 postPaidArrearage The service is not opened or the account is overdue. 服务未开通或账户已欠费。
404 ResourceNotFound The specified Model does not exist. 指定的模型不存在。
500 ModelInferenceError Failed to obtain the model prediction result. 获取模型预测结果失败。
500 UnknownError A server error occurred while processing your request. Please try again later or contact customer support. 未知错误。
500 InternalError An error occurred while processing your request. 未知错误。
500 predictTimeout model predict cost greater than 9000ms. 模型响应时间超过9秒。
503 ServiceUnavailable An error occurred while processing your request. 服务内部错误。

访问错误中心查看更多错误码。

  • 本页导读 (0)
文档反馈