Search code examples
amazon-web-servicesaws-sdkamazon-cloudwatchamazon-lex

Capturing missed utterances


Does anybody know if it is at all possible to capture missed utterances? I don't see the missed ones being logged into CloudWatch. I know that you can view them in the Lex Console after 24 hours, but I'm trying to capture them with data attached to them.

As of right now the console only gives you what the missed utterances is, how many times it was said, and when the last time it was said. I want the rest of the "Data" attached to these missed utterances; for example what customer said it.

Does anybody know if this is possible with AWS or the SDK(.NET) currently with a lambda or something like that?


Solution

  • Missed slot inputs can be caught and logged in your Lambda.
    I suggest using sessionAttributes to keep track of something like last_elicit and you can determine if that slot was not filled, then log the missed input from inputTranscript any way you want.

    I often force the slot to be filled by what ever is in inputTranscript and then handle it myself, because I found that Lex sometimes ignores legitimate slot inputs.


    Missed Intent inputs are handled by Lex and responded to automatically.

    The only control you have in Lex with handling missed Intent inputs is to customize the responses. Go to your Lex Console, under the "Editor" Tab, look at the bottom left for "Error Handling",

    enter image description here

    Open that menu and you will see: enter image description here

    Lex prepares one of these "Clarification Prompts" and returns that without passing anything to your Lambda Function.

    That is why you cannot log any information about missed intent utterances with a basic set up of Lex. So here's a more complicated set up using two Lambda Functions:

    enter image description here

    This "Pre-Lex Lambda" acts as a Proxy between your users and your Lex bot. This means you do not use Lex's built in Channel settings, and you have to build your own integrations between your Channels and the "Pre-Lex Lambda".

    Then you also need to use either PostContent or PostText to pass your user's input to your Lex bot.

    After setting this up you will finally be able to catch the Lex response for one of the Clarification Prompts, and then log your own details about the missed intent input.


    Helpful References:
    AWS SDK for .NET
    SDK .NET API Docs for Lex
    SDK .NET API Docs for Lambda
    Example setting up a Lambda using SDK(.NET)