调用通用行业能力模型服务。
调试
您可以在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。 |
示例
请求示例
http(s)://[Endpoint]/?Action=RunPreTrainService
&PredictContent={"input":{"content": "这件衣服真好看", "domain": "clothing"}}
&ServiceName=ReviewAnalysis
&<公共请求参数>
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<RunPreTrainServiceResponse>
<requestId>F67DEBB0-FFD0-4042-8AA9-90A705FB9F94</requestId>
<predictResult>{"code":1000,"data":{"cost":"18.346ms","imprs":[{"aspect":"款式","clause":"这件衣服真好看","neg_prob":0.0,"pos_prob":0.566100001335144,"position":"0,7","sentiment":"正"}]},"message":"SUCCESS","tracerId":"32846562fd4aeca63912956bbad18c47"}</predictResult>
</RunPreTrainServiceResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"requestId" : "F67DEBB0-FFD0-4042-8AA9-90A705FB9F94",
"predictResult" : "{\"code\":1000,\"data\":{\"cost\":\"18.346ms\",\"imprs\":[{\"aspect\":\"款式\",\"clause\":\"这件衣服真好看\",\"neg_prob\":0.0,\"pos_prob\":0.566100001335144,\"position\":\"0,7\",\"sentiment\":\"正\"}]},\"message\":\"SUCCESS\",\"tracerId\":\"32846562fd4aeca63912956bbad18c47\"}"
}
错误码
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. | 参数错误 |
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. | 未知错误。 |
404 | ResourceNotFound | The specified Model does not exist. | 指定的模型不存在。 |
503 | ServiceUnavailable | An error occurred while processing your request. | 服务内部错误。 |