Customer support calls require buyer brokers to have the client’s account info to course of the caller’s request. For instance, to offer a standing on an insurance coverage declare, the assist agent wants coverage holder info such because the coverage ID and declare quantity. Such info is commonly collected within the interactive voice response (IVR) circulation in the beginning of a buyer assist name. IVR techniques have usually used grammars based mostly on the Speech Recognition Grammar Specification (SRGS) format to outline guidelines and parse caller info (coverage ID, declare quantity). Now you can use the identical grammars in Amazon Lex to gather info in a speech dialog. You can too present semantic interpretation guidelines utilizing ECMAScript tags inside the grammar information. The grammar assist in Amazon Lex offers granular management for accumulating and postprocessing consumer enter so you’ll be able to handle an efficient dialog.
On this put up, we evaluation the grammar assist in Amazon Lex and creator a pattern grammar to be used in an Amazon Join contact circulation.
Use grammars to gather info in a dialog
You possibly can creator the grammar as a slot kind in Amazon Lex. First, you present a algorithm within the SRGS format to interpret consumer enter. As an optionally available second step, you’ll be able to write an ECMA script that transforms the data collected within the dialog. Lastly, you retailer the grammar as an XML file in an Amazon Easy Storage Service (Amazon S3) bucket and reference the hyperlink in your bot definition. SRGS grammars are particularly designed for voice and DTMF modality. We use the next pattern conversations to mannequin our bot:
Dialog 1
IVR: Hiya! How can I enable you to in the present day?
Person: I wish to examine my account stability.
IVR: Certain. Which account ought to I pull up?
Person: Checking.
IVR: What’s the account quantity?
Person: 1111 2222 3333 4444
IVR: For verification functions, what’s your date of beginning?
Person: Jan 1st 2000.
IVR: Thanks. The stability in your checking account is $123 {dollars}.
Dialog 2
IVR: Hiya! How can I enable you to in the present day?
Person: I wish to examine my account stability.
IVR: Certain. Which account ought to I pull up?
Person: Financial savings.
IVR: What’s the account quantity?
Person: I wish to discuss to an agent.
IVR: Okay. Let me switch the decision. An agent ought to have the opportunity that will help you along with your request.
Within the pattern conversations, the IVR requests the account kind, account quantity, and date of beginning to course of the caller’s requests. On this put up, we evaluation find out how to use the grammars to gather the data and postprocess it with ECMA scripts. The grammars for account ID and date cowl a number of methods to offer the data. We additionally evaluation the grammar in case the caller can’t present the requested particulars (for instance, their financial savings account quantity) and as a substitute opts to talk with an agent.
Construct an Amazon Lex chatbot with grammars
We construct an Amazon Lex bot with intents to carry out frequent retail banking features similar to checking account stability, transferring funds, and ordering checks. The CheckAccountBalance
intent collects particulars similar to account kind, account ID, and date of beginning, and offers the stability quantity. We use a grammar slot kind to gather the account ID and date of beginning. If the caller doesn’t know the data or asks for an agent, the decision is transferred to a human agent. Let’s evaluation the grammar for the account ID:
The grammar has two guidelines to parse consumer enter. The primary rule interprets the digits offered by the caller. These digits are appended to the output by way of an ECMA script tag variable (out
). The second rule manages the dialog if the caller desires to speak to an agent
. On this case the out
tag is populated with the phrase agent. After the foundations are parsed, the out tag carries the account quantity (out.AccountNumber
) or the string agent
. The downstream enterprise logic can now use the out
tag deal with the decision.
Deploy the pattern Amazon Lex bot
To create the pattern bot and add the grammars, carry out the next steps. This creates an Amazon Lex bot referred to as BankingBot
, and two grammar slot varieties (accountNumber
, dateOfBirth
).
- Obtain the Amazon Lex bot.
- On the Amazon Lex console, select Actions, then select Import.
- Select the file
BankingBot.zip
that you just downloaded, and select Import. Within the IAM Permissions part, for Runtime position, select Create a brand new position with primary Amazon Lex permissions. - Select the bot
BankingBot
on the Amazon Lex console. - Obtain the XML information for accountNumber and dateOfBirth. (Observe: In some browsers you’ll have to “Save the hyperlink” to obtain the XML information)
- On the Amazon S3 console, add the XML information.
- Navigate to the slot varieties on the Amazon Lex console, and click on on the
accountNumber
slot kind - Within the slot kind grammar choose the S3 bucket with the XML file and supply the item key. Click on on Save slot kind.
- Navigate to the slot varieties on the Amazon Lex console, and click on on the
dateOfBirth
slot kind - Within the slot kind grammar choose the S3 bucket with the XML file and supply the item key. Click on on Save slot kind.
- After the grammars are saved, select Construct.
- Obtain the supporting AWS Lambda and Navigate to the AWS Lambda console.
- On the create perform web page choose Creator from scratch. As primary info please present the next: perform identify
BankingBotEnglish
, and RuntimePython 3.8
. - Click on on Create perform. Within the Code supply part, open
lambda_funciton.py
and delete the present code. Obtain the code and open it in a textual content editor. Copy and paste the code into the emptylambda_funciton.py
tab. - Select deploy.
- Navigate to the Amazon Lex Console and choose
BankingBot
. Click on on Deployment after which Aliases adopted byTestBotAlias
- On the Aliases web page choose languages and navigate to English (US).
- For supply choose
BankingBotEnglish
, for Lambda model or alias choose$LATEST
- Navigate to the Amazon Join console, select Contact flows.
- Obtain the contact flow to combine with the Amazon Lex bot.
- Within the Amazon Lex part, choose your Amazon Lex bot and make it obtainable to be used within the Amazon Join contact flows.
- Choose the contact circulation to load it into the appliance.
- Ensure that the appropriate bot is configured within the “Get Buyer Enter” block. Add a cellphone quantity to the contact circulation.
- Select a queue within the “Set working queue” block.
- Take a look at the IVR circulation by calling in to the cellphone quantity.
- Take a look at the answer.
Take a look at the answer
You possibly can name in to the Amazon Join cellphone quantity and work together with the bot. You can too take a look at the answer immediately on the Amazon Lex V2 console utilizing voice and DTMF.
Conclusion
Customized grammar slots present the power to gather various kinds of info in a dialog. You have got the pliability to seize transitions similar to handover to an agent. Moreover, you’ll be able to postprocess the data earlier than working the enterprise logic. You possibly can allow grammar slot varieties by way of the Amazon Lex V2 console or AWS SDK. The aptitude is on the market in all AWS Areas the place Amazon Lex operates within the English (Australia), English (UK), and English (US) locales.
To study extra, confer with Utilizing a customized grammar slot kind. You can too view the Amazon Lex documentation for SRGS or ECMAScript for extra info.
In regards to the Authors
Kai Loreck is knowledgeable companies Amazon Join guide. He works on designing and implementing scalable buyer expertise options. In his spare time, he could be discovered taking part in sports activities, snowboarding, or mountain climbing within the mountains.
Harshal Pimpalkhute is a Product Supervisor on the Amazon Lex staff. He spends his time attempting to get machines to interact (properly) with people.