RunPreTrainService

更新时间:
复制 MD 格式

Calls a general-purpose industry model service.

Debug

You can run this operation in OpenAPI Explorer to simplify signature calculation. After a successful call, OpenAPI Explorer automatically generates sample code for the software development kit (SDK).

Request parameters

Name

Type

Required

Example

Description

Action

String

Yes

RunPreTrainService

A required parameter. Set the value to RunPreTrainService.

ServiceName

String

Yes

ReviewAnalysis

The service name.

ServiceVersion

String

No

V1

The service edition.

PredictContent

String

Yes

{"input":{"content": "This dress is beautiful", "domain": "clothing"}}

The input for prediction.

Response data

Name

Type

Example

Description

PredictResult

String

{"cost":"21.812ms","imprs":[{"aspect":"Style","clause":"This dress is beautiful","neg_prob":0.0,"pos_prob":0.566100001335144,"position":"0,7","sentiment":"Positive"}]},"message":"SUCCESS","tracerId":"7973b50e31dcbea8323460e0134d3226"}

The prediction result of the model.

RequestId

String

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

The request ID.

Examples

Sample request

http(s)://[Endpoint]/?Action=RunPreTrainService
&PredictContent={"input":{"content": "This dress is beautiful", "domain": "clothing"}}
&ServiceName=ReviewAnalysis
&<Common request parameters>

Sample responses

XML format

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":"Style","clause":"This dress is beautiful","neg_prob":0.0,"pos_prob":0.566100001335144,"position":"0,7","sentiment":"Positive"}]},"message":"SUCCESS","tracerId":"32846562fd4aeca63912956bbad18c47"}</predictResult>
</RunPreTrainServiceResponse>

JSON format

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

{
 "requestId" : "F67DEBB0-FFD0-4042-8AA9-90A705FB9F94",
 "predictResult" : "{\"code\":1000,\"data\":{\"cost\":\"18.346ms\",\"imprs\":[{\"aspect\":\"Style\",\"clause\":\"This dress is beautiful\",\"neg_prob\":0.0,\"pos_prob\":0.566100001335144,\"position\":\"0,7\",\"sentiment\":\"Positive\"}]},\"message\":\"SUCCESS\",\"tracerId\":\"32846562fd4aeca63912956bbad18c47\"}"
}

Error codes

HttpCode

Error code

Error message

Description

400

InvalidAccountStatus.ServiceUnavailable

The NLP Auto Machine Learning service has not been activated.

The NLP Auto Machine Learning service is not activated for your account.

400

InvalidAccountStatus.ServiceLimit

The maximum number of free API daily visits is exceeded.

The number of API calls exceeds the free quota.

400

parameterError

The parameter is invalid.

A parameter is invalid.

500

ModelInferenceError

Failed to obtain the model prediction result.

Failed to obtain the prediction result from the model.

500

UnknownError

A server error occurred while processing your request. Please try again later or contact customer support.

An unknown error occurred.

500

InternalError

An error occurred while processing your request.

An unknown error occurred.

404

ResourceNotFound

The specified Model does not exist.

The specified model does not exist.

503

ServiceUnavailable

An error occurred while processing your request.

An internal service error occurred.