Share via


Prediction - Get Slot Prediction

取得應用程式位置的預測。

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 參數

名稱 位於 必要 類型 Description
appId
path True

string

uuid

應用程式識別碼。

Endpoint
path True

string

支援的認知服務端點 (通訊協定和主機名,例如: https://westus.api.cognitive.microsoft.com) 。

slotName
path True

string

應用程式位置名稱。

log
query

boolean

指出是否要記錄端點查詢。

show-all-intents
query

boolean

指出是要傳回回應中的所有意圖,還是只傳回最上層的意圖。

verbose
query

boolean

指出是否要取得實體預測的額外元數據。

要求標頭

名稱 必要 類型 Description
Ocp-Apim-Subscription-Key True

string

要求本文

名稱 必要 類型 Description
query True

string

要預測的查詢。

dynamicLists

DynamicList[]

此要求的動態建立清單實體。

externalEntities

ExternalEntity[]

此要求的外部預測實體。

options

PredictionRequestOptions

為此要求定義的自定義選項。

回應

名稱 類型 Description
200 OK

PredictionResponse

所提供查詢的預測。

Other Status Codes

Error

非預期的錯誤。

安全性

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

範例

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
    }
  }
}

定義

名稱 Description
DynamicList

定義清單實體的延伸模組。

Error

表示發生的錯誤。

ErrorBody

表示發生的錯誤定義。

ExternalEntity

定義擴充已經存在實體的用戶預測實體。

Intent

表示意圖預測。

Prediction

表示查詢的預測。

PredictionRequest

表示預測要求參數。

PredictionRequestOptions

預測要求的自定義選項。

PredictionResponse

表示預測回應。

RequestList

定義要附加至現有清單實體的子清單。

Sentiment

情感分析的結果。

DynamicList

定義清單實體的延伸模組。

名稱 類型 Description
listEntityName

string

要擴充的清單實體名稱。

requestLists

RequestList[]

要附加在擴充清單實體上的清單。

Error

表示發生的錯誤。

名稱 類型 Description
error

ErrorBody

表示發生的錯誤定義。

ErrorBody

表示發生的錯誤定義。

名稱 類型 Description
code

string

錯誤碼。

message

string

錯誤訊息。

ExternalEntity

定義擴充已經存在實體的用戶預測實體。

名稱 類型 Description
entityLength

integer

預測實體的長度。

entityName

string

要擴充的實體名稱。

resolution

使用者提供了自定義解析,以傳回作為實體的預測。

score

number

使用者提供作為實體預測分數傳回的分數。

startIndex

integer

預測實體的開始字元索引。

Intent

表示意圖預測。

名稱 類型 Description
childApp

Prediction

分派應用程式的預測。

score

number

引發意圖的分數。

Prediction

表示查詢的預測。

名稱 類型 Description
alteredQuery

string

拼字檢查后的查詢。 只有在開啟拼字檢查且發現拼字錯誤時,才設定 。

entities

字典,表示引發的實體。

intents

<string,  Intent>

字典,表示引發的意圖。

sentiment

Sentiment

情感分析的結果。

topIntent

string

最高評分意圖的名稱。

PredictionRequest

表示預測要求參數。

名稱 類型 Description
dynamicLists

DynamicList[]

此要求的動態建立清單實體。

externalEntities

ExternalEntity[]

此要求的外部預測實體。

options

PredictionRequestOptions

為此要求定義的自定義選項。

query

string

要預測的查詢。

PredictionRequestOptions

預測要求的自定義選項。

名稱 類型 Description
datetimeReference

string

用於預測日期時間實體的參考 DateTime。

preferExternalEntities

boolean

如果發生重疊,是否要讓外部實體解析覆寫預測。

PredictionResponse

表示預測回應。

名稱 類型 Description
prediction

Prediction

所要求查詢的預測。

query

string

用於預測的查詢。

RequestList

定義要附加至現有清單實體的子清單。

名稱 類型 Description
canonicalForm

string

子清單的正式形式。

name

string

子清單的名稱。

synonyms

string[]

標準形式的同義字。

Sentiment

情感分析的結果。

名稱 類型 Description
label

string

情感分析結果的標籤。

score

number

查詢的情感分數。