Dela via


Prediction - Get Slot Prediction

Gets the predictions for an application slot.

POST {Endpoint}/luis/prediction/v3.0/apps/{appId}/slots/{slotName}/predict
POST {Endpoint}/luis/prediction/v3.0/apps/{appId}/slots/{slotName}/predict?verbose={verbose}&show-all-intents={show-all-intents}&log={log}

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).

slotName
path True

string

The application slot name.

log
query

boolean

Indicates whether to log the endpoint query or not.

show-all-intents
query

boolean

Indicates whether to return all the intents in the response or just the top intent.

verbose
query

boolean

Indicates whether to get extra metadata for the entities predictions or not.

Request Header

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

string

Request Body

Name Required Type Description
query True

string

The query to predict.

dynamicLists

DynamicList[]

The dynamically created list entities for this request.

externalEntities

ExternalEntity[]

The externally predicted entities for this request.

options

PredictionRequestOptions

The custom options defined for this request.

Responses

Name Type Description
200 OK

PredictionResponse

The prediction for the supplied query.

Other Status Codes

Error

Unexpected error.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

Examples

Successful Get Slot Predictions From Endpoint Via Post request

Sample request

POST {Endpoint}/luis/prediction/v3.0/apps/{Application Id}/slots/{Slot Name}/predict


{
  "query": "forward to frank 30 dollars through HSBC",
  "options": {
    "datetimeReference": "2015-02-13T13:15:00.000Z"
  },
  "externalEntities": [
    {
      "entityName": "Bank",
      "startIndex": 36,
      "entityLength": 4,
      "resolution": {
        "text": "International Bank"
      }
    }
  ],
  "dynamicLists": [
    {
      "listEntityName": "Employees",
      "requestLists": [
        {
          "name": "Management",
          "canonicalForm": "Frank",
          "synonyms": []
        }
      ]
    }
  ]
}

Sample response

{
  "query": "forward to frank 30 dollars through HSBC",
  "prediction": {
    "topIntent": "give",
    "intents": {
      "give": {
        "score": 0.943442
      }
    },
    "entities": {
      "Employees": [
        [
          "frank"
        ]
      ],
      "number": [
        30
      ],
      "money": [
        {
          "units": "Dollar",
          "value": 30
        }
      ],
      "Bank": [
        {
          "text": "International Bank"
        }
      ]
    },
    "sentiment": {
      "label": "positive",
      "score": 0.9163064
    }
  }
}

Definitions

Name Description
DynamicList

Defines an extension for a list entity.

Error

Represents the error that occurred.

ErrorBody

Represents the definition of the error that occurred.

ExternalEntity

Defines a user predicted entity that extends an already existing one.

Intent

Represents an intent prediction.

Prediction

Represents the prediction of a query.

PredictionRequest

Represents the prediction request parameters.

PredictionRequestOptions

The custom options for the prediction request.

PredictionResponse

Represents the prediction response.

RequestList

Defines a sub-list to append to an existing list entity.

Sentiment

The result of the sentiment analysis.

DynamicList

Defines an extension for a list entity.

Name Type Description
listEntityName

string

The name of the list entity to extend.

requestLists

RequestList[]

The lists to append on the extended list entity.

Error

Represents the error that occurred.

Name Type Description
error

ErrorBody

Represents the definition of the error that occurred.

ErrorBody

Represents the definition of the error that occurred.

Name Type Description
code

string

The error code.

message

string

The error message.

ExternalEntity

Defines a user predicted entity that extends an already existing one.

Name Type Description
entityLength

integer

The length of the predicted entity.

entityName

string

The name of the entity to extend.

resolution

A user supplied custom resolution to return as the entity's prediction.

score

number

A user supplied score to return as the entity's prediction score.

startIndex

integer

The start character index of the predicted entity.

Intent

Represents an intent prediction.

Name Type Description
childApp

Prediction

The prediction of the dispatched application.

score

number

The score of the fired intent.

Prediction

Represents the prediction of a query.

Name Type Description
alteredQuery

string

The query after spell checking. Only set if spell check was enabled and a spelling mistake was found.

entities

A dictionary representing the entities that fired.

intents

<string,  Intent>

A dictionary representing the intents that fired.

sentiment

Sentiment

The result of the sentiment analysis.

topIntent

string

The name of the top scoring intent.

PredictionRequest

Represents the prediction request parameters.

Name Type Description
dynamicLists

DynamicList[]

The dynamically created list entities for this request.

externalEntities

ExternalEntity[]

The externally predicted entities for this request.

options

PredictionRequestOptions

The custom options defined for this request.

query

string

The query to predict.

PredictionRequestOptions

The custom options for the prediction request.

Name Type Description
datetimeReference

string

The reference DateTime used for predicting datetime entities.

preferExternalEntities

boolean

Whether to make the external entities resolution override the predictions if an overlap occurs.

PredictionResponse

Represents the prediction response.

Name Type Description
prediction

Prediction

The prediction of the requested query.

query

string

The query used in the prediction.

RequestList

Defines a sub-list to append to an existing list entity.

Name Type Description
canonicalForm

string

The canonical form of the sub-list.

name

string

The name of the sub-list.

synonyms

string[]

The synonyms of the canonical form.

Sentiment

The result of the sentiment analysis.

Name Type Description
label

string

The label of the sentiment analysis result.

score

number

The sentiment score of the query.