Fetches the intent recognition result and the scoring from NLP and ML engines.
To use this API, the app needs the Bot Builder API scope of Intent and Entity Detection.
POST https://{{host}}/api/v1.1/rest/bot/{{BotID}}/findIntent?fetchConfiguredTasks=false
Query Parameters
Parameter | Description |
---|---|
host | Environment URL, for example, https://bots.kore.ai |
BotID | Bot ID. You can access it from the General Settings page of the bot. |
fetchConfiguredTasks | true if you want to fetch the intents from configured tasks in the bot and false if you want to fetch only for the published tasks |
Body Parameters
Parameter | Description |
---|---|
parentIntent | To support Multiple Intent Models |
input | The user utterance to find the matching intents Example: Create a task |
streamName | The user utterance to find the matching intents Example: Create a task Note: Utterances greater than 3,000 characters in length are not allowed |
Authorization
Invoke the API with JWT in the header with the following syntax:
auth: {{JWT}}
Bot Language
Optionally, if multi-language is enabled for the Bot, you need to pass the bot-language header with the language code, eg en, zh_cn etc.. If the language code is not passed for a multi-lingual Bot, then the default language of the Bot will be considered.
bot-header: {{lang-code}}
Response content type
application/json
Sample Request
curl -X POST \ 'https://{{host}}/api/v1.1/rest/bot/{{BotID}}/findIntent?fetchConfiguredTasks=false' \ -H "Content-Type:application/json" \ -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}'\ -H "bot-language:{{lang-code}}" \ -d '{ "parentIntent": "{{parent intent}}", "input": "{{user utterance}}", "streamName": "{{bot name}}" }'
Sample Response
{ "request": { "input": "book a ticket", "streamName": "Public APIs" }, "response": { "usedtime": 313, "debugTitle": "Intent Match Successful: 'Book a ticket'", "result": "successintent", "messageStoreId": "xxx", "bot": "Public APIs", "botid": "st-6ecb5ba2-5e31-5a40-b918-8cbee40f3fdb", "task": "Book a ticket", "taskId": "dg-18219164-c11c-5605-9c29-d2e632ec3646", "intentStatus": "published", "subType": "dialog", "input": [ "book a ticket" ], "identifiedVia": "cs em", "language": "en", "userId": "u-5dad2ccd-b271-5c00-a338-2e6e25e1ec91", "time": "2019-06-27T11:48:28.250Z", "_id": "f-19f149a6-25e3-5c85-8793-679bfd26acf5", "traits": {}, "toneAnalysis": {}, "nlProcessing": { "originalInput": "book a ticket", "canonical": "book a ticket", "wordAnalysis": [ { "word": "book", "ignored": false, "pos": "Verb_infinitive ", "role": "MAINVERB ", "original": "book", "processedWord": "book" }, { "word": "a", "ignored": true, "pos": "Determiner ", "original": "a", "processedWord": "a" }, { "word": "ticket", "ignored": false, "pos": "Noun_singular ", "role": "MAINOBJECT ", "original": "ticket", "processedWord": "ticket" } ] }, "ml": { "namedEntityRecognition": [] }, "fm": { "definitive": [ { "count": 2, "score": 11643.33, "botid": "st-6ecb5ba2-5e31-5a40-b918-8cbee40f3fdb", "botname": "Public APIs", "activity": "Book a ticket", "activityType": 1, "exactcount": 2, "labelsize": 2, "ignorewords": 1, "mask": 66306, "words": { "book": [ "0-1" ], "ticket": [ "0-3" ] }, "priority": 2, "tense": 8192, "mainRoles": 10, "sentencelength": 3, "ignorewordlist": { "a": 1 }, "maskEntity": 66306, "firstwordmatch": "book", "details": { "0": { "1": { "labelword": "book", "inputwords": { "1": "book" }, "wordindex": [ 1 ], "foundexact": true, "bestwordindex": 1, "role": 2, "pos": 2200096997376, "tense": 8192, "ageLevel": 1, "commonness": 6 }, "2": { "labelword": "ticket", "inputwords": { "3": "ticket" }, "wordindex": [ 3 ], "foundexact": true, "bestwordindex": 3, "role": 8, "pos": 2147483680, "tense": 8192, "ageLevel": 1, "commonness": 5 } } }, "hasNoun": true, "hasVerb": true, "ageLevel": 1, "foundFmEngine": true, "scoreBreakdown": { "wordMatch": 500, "exactWords": 60, "coverage": 2000, "sentenceBonus": 4000, "positionBonus": 733.33, "orderBonus": 100, "spreadBonus": 800, "roleBonus": 2900, "faqQuestionBonus": 0, "mlMatchBonus": 0, "tasktypeBonus": 50, "matchBonus": 500, "phraseJoinPenalty": 0 }, "matchType": "definite", "task": "Book a ticket", "state": "published", "foundVia": "wordMatch" } ] }, "finalResolver": { "ranking": [ { "taskId": "dg-18219164-c11c-5605-9c29-d2e632ec3646", "intent": "Book a ticket", "activityType": "dialog", "state": "published", "totalScore": 11643.33, "scoring": { "count": 2, "score": 11643.33, "botid": "st-6ecb5ba2-5e31-5a40-b918-8cbee40f3fdb", "botname": "Public APIs", "activity": "Book a ticket", "activityType": 1, "exactcount": 2, "labelsize": 2, "ignorewords": 1, "mask": 66306, "words": { "book": [ "0-1" ], "ticket": [ "0-3" ] }, "priority": 10, "tense": 8192, "mainRoles": 10, "sentencelength": 3, "ignorewordlist": { "a": 1 }, "maskEntity": 66306, "firstwordmatch": "book", "details": { "0": { "1": { "labelword": "book", "inputwords": { "1": "book" }, "wordindex": [ 1 ], "foundexact": true, "bestwordindex": 1, "role": 2, "pos": 2200096997376, "tense": 8192, "ageLevel": 1, "commonness": 6 }, "2": { "labelword": "ticket", "inputwords": { "3": "ticket" }, "wordindex": [ 3 ], "foundexact": true, "bestwordindex": 3, "role": 8, "pos": 2147483680, "tense": 8192, "ageLevel": 1, "commonness": 5 } } }, "hasNoun": true, "hasVerb": true, "ageLevel": 1, "foundFmEngine": true, "scoreBreakdown": { "wordMatch": 500, "exactWords": 60, "coverage": 2000, "sentenceBonus": 4000, "positionBonus": 733.33, "orderBonus": 100, "spreadBonus": 800, "roleBonus": 2900, "faqQuestionBonus": 0, "mlMatchBonus": 0, "tasktypeBonus": 50, "matchBonus": 500, "phraseJoinPenalty": 0 }, "matchType": "definite", "csMatch": true }, "identifyingEngines": { "fm": true }, "csMatch": true, "intentMatchVia": "wordMatch" } ], "userInput": "book a ticket", "winningIntent": [ { "intent": "Book a ticket", "taskId": "dg-18219164-c11c-5605-9c29-d2e632ec3646", "activityType": "dialog", "state": "published", "score": 11643.33 } ], "entities": [] } }, "streamId": "st-6ecb5ba2-5e31-5a40-b918-8cbee40f3fdb", "streamName": "Public APIs", "seqLogId": "f-19f149a6-25e3-5c85-8793-679bfd26acf5", "_id": "f-19f149a6-25e3-5c85-8793-679bfd26acf5", "name": "Public APIs", "input": [ "book a ticket" ] }