Custom slot
A custom slot type in AWS Lex is a user-defined type of slot that allows you to specify a list of possible values that the slot can take. Unlike built-in slot types, which are predefined by AWS and cover common categories like dates, cities, and numbers, custom slot types let you define your own set of values for a slot. This is useful when we have specific domain-specific entities or concepts that we want our bot to recognize and extract from user input. We can create custom slot types and populate them with values relevant to our application’s context.
Example
For example, if we are creating an order-taking bot for a burger restaurant, the custom slot type “BurgerSize” is created to capture the size preference of the burger chosen by the user. In AWS Lex, when we define a custom slot type like {burgerSize}
, we would need to specify the possible values for that slot type. For example, the values for {burgerSize}
could be “Small,” “Medium,” and “Large.”
When the bot initiates the conversation and prompts the user with, “Welcome to Burger King! What size burger would you like to order today?” and the user responds with “Medium,” the bot will recognize that the user’s response corresponds to the {burgerSize}
slot type. It will then extract the value “Medium” and proceed to process the order accordingly, understanding that the user wants a burger of medium size.
In this way, the custom slot type allows the bot to gather specific information from the user about their order, ensuring a seamless and personalized ordering experience.
Quiz
To test your understanding, you can solve the following quiz: