Document Models - Build Model

Builds a custom document analysis model.

POST {endpoint}/documentintelligence/documentModels:build?api-version=2024-07-31-preview

URI Parameters

Name In Required Type Description
endpoint
path True

string

uri

The Document Intelligence service endpoint.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Required Type Description
buildMode True

DocumentBuildMode

Custom document model build mode.

modelId True

string

Unique document model name.

allowOverwrite

boolean

Allow overwriting an existing model with the same name.

azureBlobFileListSource

AzureBlobFileListContentSource

Azure Blob Storage file list specifying the training data. Either azureBlobSource or azureBlobFileListSource must be specified.

azureBlobSource

AzureBlobContentSource

Azure Blob Storage location containing the training data. Either azureBlobSource or azureBlobFileListSource must be specified.

description

string

Document model description.

maxTrainingHours

number

Max number of V100-equivalent GPU hours to use for model training. Default=0.5.

tags

object

List of key-value tag attributes associated with the document model.

Responses

Name Type Description
202 Accepted

The request has been accepted for processing, but processing has not yet completed.

Headers

  • Operation-Location: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

An unexpected error response.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

OAuth2Auth

Type: oauth2
Flow: accessCode
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize
Token URL: https://login.microsoftonline.com/common/oauth2/token

Scopes

Name Description
https://cognitiveservices.azure.com/.default

Examples

Build Document Model

Sample request

POST https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels:build?api-version=2024-07-31-preview

{
  "modelId": "myCustomModel",
  "description": "Custom model description",
  "buildMode": "template",
  "azureBlobSource": {
    "containerUrl": "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken",
    "prefix": "trainingDocs/"
  },
  "tags": {
    "createdBy": "myUserId"
  }
}

Sample response

Operation-Location: https://myendpoint.cognitiveservices.azure.com/documentintelligence/operations/b704bb00-d130-4f3f-a1d8-ca96de3eabb4?api-version=2024-07-31-preview

Definitions

Name Description
AzureBlobContentSource

Azure Blob Storage content.

AzureBlobFileListContentSource

File list in Azure Blob Storage.

BuildDocumentModelRequest

Request body to build a new custom document model.

DocumentBuildMode

Custom document model build mode.

Error

The error object.

ErrorResponse

Error response object.

InnerError

An object containing more specific information about the error.

AzureBlobContentSource

Azure Blob Storage content.

Name Type Description
containerUrl

string

Azure Blob Storage container URL.

prefix

string

Blob name prefix.

AzureBlobFileListContentSource

File list in Azure Blob Storage.

Name Type Description
containerUrl

string

Azure Blob Storage container URL.

fileList

string

Path to a JSONL file within the container specifying a subset of documents.

BuildDocumentModelRequest

Request body to build a new custom document model.

Name Type Default value Description
allowOverwrite

boolean

False

Allow overwriting an existing model with the same name.

azureBlobFileListSource

AzureBlobFileListContentSource

Azure Blob Storage file list specifying the training data. Either azureBlobSource or azureBlobFileListSource must be specified.

azureBlobSource

AzureBlobContentSource

Azure Blob Storage location containing the training data. Either azureBlobSource or azureBlobFileListSource must be specified.

buildMode

DocumentBuildMode

Custom document model build mode.

description

string

Document model description.

maxTrainingHours

number

0.5

Max number of V100-equivalent GPU hours to use for model training. Default=0.5.

modelId

string

Unique document model name.

tags

object

List of key-value tag attributes associated with the document model.

DocumentBuildMode

Custom document model build mode.

Name Type Description
generative

string

Enable documents of all types using generative AI techniques.

neural

string

Support documents with diverse visual templates.

template

string

Target documents with similar visual templates.

Error

The error object.

Name Type Description
code

string

One of a server-defined set of error codes.

details

Error[]

An array of details about specific errors that led to this reported error.

innererror

InnerError

An object containing more specific information than the current object about the error.

message

string

A human-readable representation of the error.

target

string

The target of the error.

ErrorResponse

Error response object.

Name Type Description
error

Error

Error info.

InnerError

An object containing more specific information about the error.

Name Type Description
code

string

One of a server-defined set of error codes.

innererror

InnerError

Inner error.

message

string

A human-readable representation of the error.