Content Classifiers - Create Or Replace
异步创建新的分类器。
PUT {endpoint}/contentunderstanding/classifiers/{classifierId}?api-version=2025-05-01-preview
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
classifier
|
path | True |
string pattern: ^[a-zA-Z0-9._-]{1,64}$ |
分类器的唯一标识符。 |
|
endpoint
|
path | True |
string (uri) |
内容理解服务终结点。 |
|
api-version
|
query | True |
string minLength: 1 |
要用于此操作的 API 版本。 |
请求头
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| x-ms-client-request-id |
string (uuid) |
请求的不透明、全局唯一的客户端生成的字符串标识符。 |
请求正文
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| categories | True |
<string,
Classifier |
要分类的类别。 |
| description |
string |
分类器的描述。 |
|
| processingLocation |
可能处理数据的位置。 |
||
| splitMode |
用于将输入拆分为内容对象的模式。 |
||
| tags |
object |
与分类器关联的标签。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
请求已成功。 标头
|
|
| 201 Created |
请求已成功,因此创建了一个新资源。 标头
|
|
| Other Status Codes |
意外的错误响应。 标头 x-ms-error-code: string |
安全性
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 |
示例
Create or Replace Classifier
示例请求
PUT {endpoint}/contentunderstanding/classifiers/myClassifier?api-version=2025-05-01-preview
{
"description": "My classifier",
"tags": {
"createdBy": "John"
},
"splitMode": "auto",
"categories": {
"receipt": {
"description": "Sales receipts"
},
"invoice": {
"analyzerId": "myInvoice"
}
}
}
示例响应
Operation-Location: https://myendpoint.cognitiveservices.azure.com/contentunderstanding/classifiers/myClassifier/operations/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2025-05-01-preview
{
"classifierId": "myClassifier",
"description": "My classifier",
"tags": {
"createdBy": "John"
},
"status": "creating",
"createdAt": "2025-05-01T18:46:36.051Z",
"lastModifiedAt": "2025-05-01T18:46:36.051Z",
"splitMode": "auto",
"categories": {
"receipt": {
"description": "Sales receipts"
},
"invoice": {
"analyzerId": "myInvoice"
}
}
}
Operation-Location: https://myendpoint.cognitiveservices.azure.com/contentunderstanding/classifiers/myClassifier/operations/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2025-05-01-preview
{
"classifierId": "myClassifier",
"description": "My classifier",
"tags": {
"createdBy": "John"
},
"status": "creating",
"createdAt": "2025-05-01T18:46:36.051Z",
"lastModifiedAt": "2025-05-01T18:46:36.051Z",
"splitMode": "auto",
"categories": {
"receipt": {
"description": "Sales receipts"
},
"invoice": {
"analyzerId": "myInvoice"
}
}
}
定义
| 名称 | 说明 |
|---|---|
|
Azure. |
错误对象。 |
|
Azure. |
包含错误详细信息的响应。 |
|
Azure. |
包含有关错误的更具体信息的对象。 根据 Azure REST API 准则 - https://aka.ms/AzureRestApiGuidelines#handling-errors。 |
|
Classifier |
分类器类别。 |
|
Classifier |
用于将输入拆分为内容对象的模式。 |
|
Content |
分类器,用于将内容分类为具有可选拆分的类别。 |
|
Processing |
可能处理数据的位置。 |
|
Resource |
资源的状态。 |
Azure.Core.Foundations.Error
错误对象。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| details |
导致此报告错误的特定错误的详细信息数组。 |
|
| innererror |
包含与当前对象有关错误的更具体信息的对象。 |
|
| message |
string |
有关错误的可读的表示形式。 |
| target |
string |
错误的目标。 |
Azure.Core.Foundations.ErrorResponse
包含错误详细信息的响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |
Azure.Core.Foundations.InnerError
包含有关错误的更具体信息的对象。 根据 Azure REST API 准则 - https://aka.ms/AzureRestApiGuidelines#handling-errors。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
服务器定义的错误代码集之一。 |
| innererror |
内部错误。 |
ClassifierCategoryDefinition
分类器类别。
| 名称 | 类型 | 说明 |
|---|---|---|
| analyzerId |
string |
用于处理内容的可选分析器。 |
| description |
string |
类别的描述。 |
ClassifierSplitMode
用于将输入拆分为内容对象的模式。
| 值 | 说明 |
|---|---|
| noSplit |
将整个输入视为单个内容对象。 |
| perPage |
将输入的每一页拆分为单独的内容对象。 |
| auto |
根据输入和类别定义将输入拆分为内容对象。 |
ContentClassifier
分类器,用于将内容分类为具有可选拆分的类别。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| categories |
<string,
Classifier |
要分类的类别。 |
|
| classifierId |
string pattern: ^[a-zA-Z0-9._-]{1,64}$ |
分类器的唯一标识符。 |
|
| createdAt |
string (date-time) |
创建分类器的日期和时间。 |
|
| description |
string |
分类器的描述。 |
|
| lastModifiedAt |
string (date-time) |
上次修改分类器的日期和时间。 |
|
| processingLocation | geography |
可能处理数据的位置。 |
|
| splitMode | noSplit |
用于将输入拆分为内容对象的模式。 |
|
| status |
分类器的状态。 |
||
| tags |
object |
与分类器关联的标签。 |
|
| warnings |
创建分类器时遇到警告。 |
ProcessingLocation
可能处理数据的位置。
| 值 | 说明 |
|---|---|
| geography |
数据可以在与资源相同的地理位置进行处理。 |
| dataZone |
数据可以在与资源相同的数据区中进行处理。 |
| global |
数据可以在全球任何 Azure 数据中心进行处理。 |
ResourceStatus
资源的状态。
| 值 | 说明 |
|---|---|
| creating |
正在创建资源。 |
| ready |
资源已准备就绪。 |
| deleting |
正在删除此资源。 |
| failed |
创建期间资源失败。 |