Document Classifiers - Build Classifier
生成自定义文档分类器。
POST {endpoint}/documentintelligence/documentClassifiers:build?api-version=2024-11-30
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
文档智能服务终结点。 |
|
api-version
|
query | True |
string minLength: 1 |
用于此操作的 API 版本。 |
请求正文
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| classifierId | True |
string pattern: ^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$ |
唯一的文档分类器名称。 |
| docTypes | True |
<string,
Classifier |
要对其进行分类的文档类型列表。 |
| allowOverwrite |
boolean |
允许覆盖具有相同名称的现有分类器。 |
|
| baseClassifierId |
string pattern: ^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$ |
要训练分类器的基 classifierId。 |
|
| description |
string maxLength: 4096 |
文档分类器说明。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 202 Accepted |
已接受请求进行处理,但尚未完成处理。 标头
|
|
| Other Status Codes |
意外的错误响应。 |
安全性
Ocp-Apim-Subscription-Key
类型:
apiKey
在:
header
OAuth2Auth
类型:
oauth2
流向:
accessCode
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
令牌 URL:
https://login.microsoftonline.com/common/oauth2/token
作用域
| 名称 | 说明 |
|---|---|
| https://cognitiveservices.azure.com/.default |
示例
Build Document Classifier
示例请求
POST https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentClassifiers:build?api-version=2024-11-30
{
"classifierId": "myClassifier",
"description": "Classifier description",
"docTypes": {
"formA": {
"azureBlobSource": {
"containerUrl": "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken",
"prefix": "formADocs/"
}
},
"formB": {
"azureBlobFileListSource": {
"containerUrl": "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken",
"fileList": "formB.jsonl"
}
}
}
}
示例响应
Operation-Location: https://myendpoint.cognitiveservices.azure.com/documentintelligence/operations/b704bb00-d130-4f3f-a1d8-ca96de3eabb4?api-version=2024-11-30
定义
| 名称 | 说明 |
|---|---|
|
Azure |
Azure Blob 存储内容。 |
|
Azure |
Azure Blob 存储中的文件列表。 |
|
Build |
请求正文以生成新的自定义文档分类器。 |
|
Classifier |
分类器文档类型信息。 |
|
Content |
内容类型。 |
|
Document |
错误对象。 |
|
Document |
错误响应对象。 |
|
Document |
包含有关错误的更具体信息的对象。 |
AzureBlobContentSource
Azure Blob 存储内容。
| 名称 | 类型 | 说明 |
|---|---|---|
| containerUrl |
string (uri) |
Azure Blob 存储容器 URL。 |
| prefix |
string |
Blob 名称前缀。 |
AzureBlobFileListContentSource
Azure Blob 存储中的文件列表。
| 名称 | 类型 | 说明 |
|---|---|---|
| containerUrl |
string (uri) |
Azure Blob 存储容器 URL。 |
| fileList |
string |
指定文档子集的容器中的 JSONL 文件的路径。 |
BuildDocumentClassifierRequest
请求正文以生成新的自定义文档分类器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| allowOverwrite |
boolean |
False |
允许覆盖具有相同名称的现有分类器。 |
| baseClassifierId |
string pattern: ^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$ |
要训练分类器的基 classifierId。 |
|
| classifierId |
string pattern: ^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$ |
唯一的文档分类器名称。 |
|
| description |
string maxLength: 4096 |
文档分类器说明。 |
|
| docTypes |
<string,
Classifier |
要对其进行分类的文档类型列表。 |
ClassifierDocumentTypeDetails
分类器文档类型信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| azureBlobFileListSource |
Azure Blob 存储文件列表,指定分类器文档类型的训练数据。 必须指定 azureBlobSource 或 azureBlobFileListSource。 |
|
| azureBlobSource |
包含分类器文档类型的训练数据的 Azure Blob 存储位置。 必须指定 azureBlobSource 或 azureBlobFileListSource。 |
|
| sourceKind |
训练数据源的类型。 |
ContentSourceKind
内容类型。
| 值 | 说明 |
|---|---|
| url |
特定 URL 上的内容。 |
| base64 |
通过 Base64 编码表示的内容。 |
| azureBlob |
Azure Blob 存储容器中路径中的文件。 |
| azureBlobFileList |
一个文件列表,用于指定 Azure Blob 存储容器中的单个文件。 |
DocumentIntelligenceError
错误对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| details |
导致此报告错误的特定错误的详细信息数组。 |
|
| innererror |
包含与当前对象有关错误的更具体信息的对象。 |
|
| message |
string |
错误的人工可读表示形式。 |
| target |
string |
错误的目标。 |
DocumentIntelligenceErrorResponse
错误响应对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误信息。 |
DocumentIntelligenceInnerError
包含有关错误的更具体信息的对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| innererror |
内部错误。 |
|
| message |
string |
错误的人工可读表示形式。 |