CreateModelAsyncPredict

Updated at:

Creates an asynchronous prediction task for Document AutoML.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

documentautoml:CreateModelAsyncPredict

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ModelVersion

string

No

The model version. If unspecified, the latest active model version is used.

V1

BinaryToText

boolean

No

Specifies how the document content is provided.

false:表示content传入的是url true:表示body是直接传入图片进行base64的内容

Content

string

No

The URL of the image or PDF file.

https://doc-automl-public.oss-cn-hangzhou.aliyuncs.com/3/1559855998794593/stage/upload/20230206/oss-hlfCRJ1SorSWs10MkqxK6YcL4OVAFSv4.png?Expires=1675665563&OSSAccessKeyId=XXXX&Signature=WLKghBc3zKzWJ3Td69%2B4C21jrbE%3D

ModelId

integer

No

The model ID. You can find this ID on the Model List Page in the console.

123

ServiceName

string

No

The name of the pre-trained service.

pre_train_service

ServiceVersion

string

No

The version of the pre-trained service.

V1

Body

string

No

The Base64-encoded content of the document.

data:image/png;base64,xxxxx

You must specify either the Content or Body parameter.

When providing a document URL, use the Content parameter. When providing the document's content directly, use the Body parameter for the Base64-encoded content and set BinaryToText to true.

PDF files are limited to 20 MB and 10 pages. All prediction services process only the first page, except for services that support the long document type.

Response elements

Element

Type

Description

Example

object

The response object.

RequestId

string

The request ID.

3EAC98E6-8DD6-511F-8764-DEE8B6EB6BB4

Code

integer

The status code of the request. A value of 200 indicates that the request was successful.

200

Message

string

The error message.

success

Data

string

A JSON-formatted string that contains the result. The Data field within this string is the asynchronous task ID.

{ "RequestId": "292D1584-134C-1221-B9BB-1B847C623D41", "Message": "", "Data": 1, "Code": 200 }

The Data field returns a JSON string. The Data field within this string is the asynchronous task ID. Use this ID with the GetModelAsyncPredict operation to retrieve the prediction result.

Examples

Success response

JSON format

{
  "RequestId": "3EAC98E6-8DD6-511F-8764-DEE8B6EB6BB4",
  "Code": 200,
  "Message": "success",
  "Data": "{\n  \"RequestId\": \"292D1584-134C-1221-B9BB-1B847C623D41\",\n  \"Message\": \"\",\n  \"Data\": 1,\n  \"Code\": 200\n}"
}

Error codes

HTTP status code

Error code

Error message

Description

200 21002 模板预测超时
200 21003 模板预测失败
200 10001 参数出错
200 10005 服务不存在
200 16001 未找到可预测的模型
200 13018 未找到模型信息
200 16004 指定的模型不存在
200 23002 获取资源HTTP异常
200 11002 账号没有开通服务
200 19999 未知异常

See Error CodesError Codes for a complete list.

Release notes

See Release NotesRelease Notes for a complete list.