Build conversation flows with multi-valued slots in Amazon Lex
Multiple pieces of information are often required to complete a task or to process a query. For example, when talking to an insurance agent, a caller might ask, “Can you provide me quotes for home, auto, and boat?” The agent recognizes this as a list of policy types before continuing with the conversation. Automation of such conversations requires that bots recognize and process multiple values as well. Previously, developers had to use multiple slots to capture each value in the list. In addition, they had to write code to compile these values into a list. Now, we announce support for multi-valued slots in Amazon Lex. Developers can use the multi-valued slot to directly capture multiple values contained in a single response. Amazon Lex automatically maps the list of values to the multi-valued slot. Additional processing isn’t required, and the bot design is simplified.
This post shows how you can use multi-valued slots to capture user input that contains a list of values.
Want to learn more about Amazon Lex? These posts might interest you: |
Build an Amazon Lex bot
This post uses the following conversation to model a bot:
Caller: I’d like to get insurance quotes.
Agent: Sure, for what policies?
Caller: Home, auto, and boat.
Agent: Got it. Let me get those for you.
The first step is to build an Amazon Lex bot with intents to support transactions such as insurance quotes, payments, and address updates. The GetInsuranceQuotes
, MakePayment
, and UpdateServiceAddress
intents perform these tasks. When a user makes a request that the bot can’t process with any of these intents, the fallback intent is triggered to respond. For this post, we focus on GetInsuranceQuotes
to cover the multi-valued slot functionality.
Build an intent with a multi-valued slot
To build an intent with a multi-valued slot, complete the following steps:
- On the Lex V2 console, create the
GetInsuranceQuotes
intent. - Create a custom
insuranceType
slot type with values home, auto, boat, life, and motorcycle. - Navigate to
GetInsuranceQuotesIntents
and add a slotinsuranceRequested
of typeinsuranceType
. - On the advanced slot settings for the
insuranceRequested
slot, select Multi-valued slot.
- Choose Update slot.
- Choose Build to build the bot.
Now let’s define the sample utterance for the intent GetInsuranceQuotes
. You can use a single slot reference to capture a list of multiple values, both in the sample utterance and slot elicitation.
Test the bot with a multi-valued slot
You can test the bot on the Amazon Lex console with both text and speech inputs.
You can extend the design to provide dynamic responses to information requested by the customer. For example, you can provide calculated quotes for life, home, and auto insurance. These quotes may be available in a third-party system, which you can look up using an AWS Lambda function. For more information, see Using AWS Lambda with Amazon Lex. The following screenshot shows a sample Lambda function code snippet.
You can also enable the user to take action from the bot response by providing a URL to complete the next steps (“Click this link to process your life insurance quote”).
You can now supply multiple values for a slot with higher accuracy for five or fewer values, through speech or text. Any values not contained in the slot type (such as medical
, home
, auto
, and boat
) are dropped. For more information about parsing API responses, see Slot.
Conclusion
Multi-value slots enable you to automate conversations in the customer service domain. With the new Amazon Lex multi-valued slots feature, you can easily capture a list of values provided by a user without the need for additional logic. For more information about incorporating multi-valued slots into your bots, see the Amazon Lex documentation.
About the Authors
Sandeep Srinivasan is a Product Manager on the Amazon Lex team. As a keen observer of human behavior, he is passionate about customer experience. He spends his waking hours at the intersection of people, technology, and the future.
[Vindy] Vinod Jagannathan is a Software Development Manager at Amazon AI. He manages the team that innovates, builds and expands the NLU capabilities of Amazon Lex. Off work, Vindy enjoys playing volleyball, Cricket, and learning the musical instrument Sarod.
Tania Khattar is a Software Development Engineer at Amazon AI. She focuses on building and expanding the NLU capabilities of Amazon Lex. When not building software, she enjoys engaging in creative activities and visiting new places.
Tags: Archive
Leave a Reply