In this code pattern we will create a web based chat bot, but the twist here is that we'll be using voice input and output. For the conversation dialog we'll of course be using Watson Assistant, but we'll also be using Watson Speech To Text to capture the user's voice, and lastly we'll use Watson Text To Speech to playback the chatbots response to the user. The web application itself is built on top of JQuery and Python Flask.
When the reader has completed this code pattern they will understand how to:
Click on one of the options below for instructions on deploying the app.
Follow the script below for a sample path in an insurance domain, or configure your own dialog under Watson Assistant.
Voice Bot: Hello. How can I help you?
User Reply: I am trying to buy an insurance
Voice Bot: You have come to the right place We offer you a smart, affordable and convenient way to safeguard the future for you and your family. Can I ask you a couple of questions to come up with the best plan for you?
User Reply: ok sure
Voice Bot: Please tell me your Name followed by Date Of Birth and Annual Income
User Reply: This is Mary
Voice Bot: Please enter your Date of Birth
User Reply: 2nd June 1945
Voice Bot: Your annual income?
User Reply: 1200000 dollars
Voice Bot: Do you smoke?
User Reply: Nope I dont
Voice Bot: Please tell me your gender
User Reply: Female
Voice Bot: Enter a protection type
Select one among Basic Life Cover, Fixed Income Protection or Increasing Income Protection.
User Reply: Life Cover
Voice Bot: What premium payment frequency would you prefer? Monthly, Quarterly, Half Yearly or Yearly?
User Reply: Monthly
Voice Bot: What term would you want to go for? Enter a range between 10 years to 35 years.
User Reply: 8 years
Voice Bot: Please enter a term ranging between 10 years to 35 years.
User Reply: 12
Voice Bot: Your yearly premium for 12 years under the Basic Life Cover plan is 67767 dollars. Do you want to try any other options or go ahead with buying this?
User Reply: No What is Basic Life Cover?
Voice Bot: On death during the Policy term, Sum Assured as a lump sum is paid to the nominee and the policy terminates.
User Reply: ok Thanks
Voice Bot: Have a great day
This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.