Is there any way to get confidence level , maybe using metrics from cloudwatch or creating new metrics to get it?
The answer is NO. AWS LEX does not provide the confidence level for the matched intent. Not sure why but this is a big shortcoming in my opinion. Most of the intent engines like Google Dialogflow, Microsoft LUIS, IBM Watson, provide the confidence information but LEX does not. You can see there is no confidence field in the Lex response to a lambda funciton as mentioned in the official documenataion
{
"currentIntent": {
"name": "intent-name",
"slots": {
"slot name": "value",
"slot name": "value"
},
"slotDetails": {
"slot name": {
"resolutions" : [
{ "value": "resolved value" },
{ "value": "resolved value" }
],
"originalValue": "original text"
},
"slot name": {
"resolutions" : [
{ "value": "resolved value" },
{ "value": "resolved value" }
],
"originalValue": "original text"
}
},
"confirmationStatus": "None, Confirmed, or Denied (intent confirmation, if configured)"
},
"bot": {
"name": "bot name",
"alias": "bot alias",
"version": "bot version"
},
"userId": "User ID specified in the POST request to Amazon Lex.",
"inputTranscript": "Text used to process the request",
"invocationSource": "FulfillmentCodeHook or DialogCodeHook",
"outputDialogMode": "Text or Voice, based on ContentType request header in runtime API request",
"messageVersion": "1.0",
"sessionAttributes": {
"key": "value",
"key": "value"
},
"requestAttributes": {
"key": "value",
"key": "value"
},
"recentIntentSummaryView": [
{
"intentName": "Name",
"checkpointLabel": Label,
"slots": {
"slot name": "value",
"slot name": "value"
},
"confirmationStatus": "None, Confirmed, or Denied (intent confirmation, if configured)",
"dialogActionType": "ElicitIntent, ElicitSlot, ConfirmIntent, Delegate, or Close",
"fulfillmentState": "Fulfilled or Failed",
"slotToElicit": "Next slot to elicit
}
]
}