Examples - Batch
Adds a batch of labeled example utterances to a version of the application.
POST {Endpoint}/luis/api/v2.0/apps/{appId}/versions/{versionId}/examples
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
app
|
path | True |
string (uuid) |
The application ID. |
|
Endpoint
|
path | True |
string |
Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). |
|
version
|
path | True |
string |
The version ID. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| Ocp-Apim-Subscription-Key | True |
string |
Request Body
| Name | Type | Description |
|---|---|---|
| exampleLabelObjectArray |
Array of example utterances. |
Responses
| Name | Type | Description |
|---|---|---|
| 201 Created |
A string array determining which labeled example utterances were added successfully. |
|
| Other Status Codes |
Indicates that the request was partially successful. The response contains a string array indicating the status of each of the added labeled example utterances. |
|
| Other Status Codes |
Error Response. |
Security
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
Examples
Successful Batch Add Labels request
Sample request
POST {Endpoint}/luis/api/v2.0/apps/2370fb9d-7dbc-4898-a361-a742cf290766/versions/0.1/examples
[
{
"text": "whats the weather in seattle?",
"entityLabels": [
{
"entityName": "Place",
"startCharIndex": 21,
"endCharIndex": 29
}
],
"intentName": "WeatherInPlace"
},
{
"text": "whats the weather in buenos aires?",
"entityLabels": [
{
"entityName": "Place",
"startCharIndex": 21,
"endCharIndex": 34
}
],
"intentName": "WeatherInPlace"
}
]
Sample response
[
{
"value": {
"UtteranceText": "whats the weather in seattle?",
"ExampleId": -728104
},
"hasError": false
},
{
"value": {
"UtteranceText": "whats the weather in buenos aires?",
"ExampleId": -5313943
},
"hasError": false
}
]
[
{
"hasError": true,
"error": {
"code": "FAILED",
"message": "whats the weather in seattle?. Error: The intent classifier InvalidIntent does not exist in the selected application"
}
},
{
"value": {
"UtteranceText": "whats the weather in buenos aires?",
"ExampleId": -5313943
},
"hasError": false
}
]
Definitions
| Name | Description |
|---|---|
|
Batch |
Response when adding a batch of labeled example utterances. |
|
Entity |
Defines the entity type and position of the extracted entity within the example. |
|
Error |
Error response when invoking an operation on the API. |
|
Example |
A labeled example utterance. |
|
Label |
Response when adding a labeled example utterance. |
|
Operation |
Response of an Operation status. |
|
Operation |
Status Code. |
BatchLabelExample
Response when adding a batch of labeled example utterances.
| Name | Type | Description |
|---|---|---|
| error |
Response of an Operation status. |
|
| hasError |
boolean |
|
| value |
Response when adding a labeled example utterance. |
EntityLabelObject
Defines the entity type and position of the extracted entity within the example.
| Name | Type | Description |
|---|---|---|
| endCharIndex |
integer |
The index within the utterance where the extracted entity ends. |
| entityName |
string |
The entity type. |
| role |
string |
The role of the entity within the utterance. |
| startCharIndex |
integer |
The index within the utterance where the extracted entity starts. |
ErrorResponse
Error response when invoking an operation on the API.
| Name | Type | Description |
|---|---|---|
| errorType |
string |
ExampleLabelObject
A labeled example utterance.
| Name | Type | Description |
|---|---|---|
| entityLabels |
The identified entities within the example utterance. |
|
| intentName |
string |
The identified intent representing the example utterance. |
| text |
string |
The example utterance. |
LabelExampleResponse
Response when adding a labeled example utterance.
| Name | Type | Description |
|---|---|---|
| ExampleId |
integer (int64) |
The newly created example ID. |
| UtteranceText |
string |
The example utterance. |
OperationStatus
Response of an Operation status.
| Name | Type | Description |
|---|---|---|
| code |
Status Code. |
|
| message |
string |
Status details. |
OperationStatusType
Status Code.
| Value | Description |
|---|---|
| Failed | |
| FAILED | |
| Success |