你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Examples - Batch

Adds a batch of labeled example utterances to a version of the application.

POST {Endpoint}/luis/authoring/v3.0-preview/apps/{appId}/versions/{versionId}/examples
POST {Endpoint}/luis/authoring/v3.0-preview/apps/{appId}/versions/{versionId}/examples?enableNestedChildren={enableNestedChildren}

URI Parameters

Name In Required Type Description
appId
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).

versionId
path True

string

The version ID.

enableNestedChildren
query

boolean

Toggles nested/flat format

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

Request Body

Name Type Description
exampleLabelObjectArray

ExampleLabelObject[]

Array of example utterances.

Responses

Name Type Description
201 Created

BatchLabelExample[]

A string array determining which labeled example utterances were added successfully.

Other Status Codes

BatchLabelExample[]

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

ErrorResponse

Error Response.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

Examples

Successful Batch Add Labels request

Sample request

POST {Endpoint}/luis/authoring/v3.0-preview/apps/2370fb9d-7dbc-4898-a361-a742cf290766/versions/0.1/examples?enableNestedChildren=False


[
  {
    "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
BatchLabelExample

Response when adding a batch of labeled example utterances.

EntityLabelObject

Defines the entity type and position of the extracted entity within the example.

ErrorResponse

Error response when invoking an operation on the API.

ExampleLabelObject

A labeled example utterance.

LabelExampleResponse

Response when adding a labeled example utterance.

OperationStatus

Response of an Operation status.

OperationStatusType

Status Code.

BatchLabelExample

Response when adding a batch of labeled example utterances.

Name Type Description
error

OperationStatus

Response of an Operation status.

hasError

boolean

value

LabelExampleResponse

Response when adding a labeled example utterance.

EntityLabelObject

Defines the entity type and position of the extracted entity within the example.

Name Type Description
children

EntityLabelObject[]

The identified entities within the example utterance.

endCharIndex

integer

The index within the utterance where the extracted entity ends.

entityName

string

The entity type.

role

string

The role the entity plays in 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

EntityLabelObject[]

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

The newly created example ID.

UtteranceText

string

The example utterance.

OperationStatus

Response of an Operation status.

Name Type Description
code

OperationStatusType

Status Code.

message

string

Status details.

OperationStatusType

Status Code.

Name Type Description
FAILED

string

Failed

string

Success

string