amazon-lex

What is Amazon Lex inbuilt slot type for description or notes?


I have configured my AWS Lex bot to 'Schedule A Meeting' and 'Add Notes' tasks.

While meeting scheduling I have a slot 'Meeting Description' where user can add single word to a sentence. Similarly for adding notes I have 'Notes'.

For this slot I am not finding any inbuilt slot type like 'AMAZON.Description' or anything which can store a word or a sentence. I tried with 'AMAZON.VideoGame', 'AMAZON.FoodEstablishment' etc. But found intermittent issue with those. Some times they work and some times they don't.

Does any body know what type of slot type I can use for my case? Please share.


Solution

  • You will want to use a Custom SlotType if you want to catch an input of anything.

    When you "train" this SlotType by giving it values, you should include a wide variety, such as numbers, single letters, single words, phrases, and whole sentences.

    Even that won't always catch what you want though. So even better than that, is to use your Lambda Function to parse and validate the entire input yourself. And most likely, just set your slot value to be the entire input string.

    For example:

    User: "Add to my notes"
    Bot: "Ok, what would you like me to save in your notes?"
    User: "Buy more toilet paper."

    Now the user expects the entire phrase to be in the note. You will have to use utterances in your Custom SlotType like this:

    I want to {note}
    Go {note}
    Buy {note}
    {note}

    Those utterances will sometimes leave out some words and in the example, place only "more toilet paper" without the "buy" as your slot value. This is why you will want to parse the entire input yourself. So in Lambda you can get the entire input from inputTranscript.

    userInput = event.inputTranscript            // "Buy more toilet paper"
    slotNote = event.currentIntent.slots.note    // "more toilet paper"
    

    Then you can compare those two and do some fancy validation yourself, or just save the user input directly into the note slot.

    userInput = event.inputTranscript            // "Buy more toilet paper"
    event.currentIntent.slots.note = userInput   // overwrites note slot value with correct full user input.