Partager via


Examples - Add

Adds a labeled example utterance in a version of the application.

POST {Endpoint}/luis/api/v2.0/apps/{appId}/versions/{versionId}/example

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.

Request Header

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

string

Request Body

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.

Responses

Name Type Description
201 Created

LabelExampleResponse

The ID of the created example utterance.

Other Status Codes

ErrorResponse

Error Response.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

Examples

Successful Add Label request

Sample request

POST {Endpoint}/luis/api/v2.0/apps/86226c53-b7a6-416f-876b-226b2b5ab07b/versions/0.1/example


{
  "text": "whats the weather in buenos aires?",
  "intentName": "WeatherInPlace",
  "entityLabels": [
    {
      "entityName": "Place",
      "startCharIndex": 21,
      "endCharIndex": 34
    }
  ]
}

Sample response

{
  "UtteranceText": "whats the weather in buenos aires?",
  "ExampleId": -11
}

Definitions

Name Description
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.

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

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.