Unleashing A.I.-Powered Conversation With IBM Watson
One of the primary goals of artificial intelligence research over the past several decades has been to develop machines that are capable of having a natural conversation.
Recent advancements have made that goal a reality.
Consequently, chatbots have been getting a lot of hype over the past year. And while the hype tends to over-promise current capabilities, we are certainly witnessing a true revolution.
A revolution towards the conversational U.I.
Rise of the Conversational User Interface
Conversation is the most natural interface for human beings, it’s how we’ve been communicating between each other since the dawn of time.
And if you’re a marketing, customer service, or user experience professional there’s no escaping the impact chatbots are — and will continue — having on your world.
From text-only apps to concierge robots, the conversational U.I. is taking over and it’s here to stay.
And for good reason, chatbots are teasing businesses with massive cost savings while simultaneously providing a better customer experience. What’s not to love?
The 15-Minute Chatbot
IBM’s Watson Conversation service provides an easy and extensible platform to get started on your first chatbot, so let’s dive into an example.
It’ll only take a few minutes.
This application (originally developed by IBM’s Watson Developer Cloud) uses a natural language processing service to analyze text to determine the user’s intent. And it works for both text and voice.
Support for multiple languages.
You may also want to take note that these systems can support multiple languages simultaneously.
In addition to English, the Conversation service also currently supports French, Italian, Spanish, German, Traditional Chinese, Simplified Chinese, Brazilian Portuguese, and Dutch.
Your A.I. Copilot
Using an A.I. platform to instantly analyze and determine the intent of a natural language command can provide a wide range of really powerful uses.
In this guide we’re going to use it in the context of a smart car.
So let’s get right to it…
If you’d like to see the source code, here’s our fork of the application on GitHub.
The End Result
The steps in this guide will create an application similar to the following (You can also preview a live version of it here):
Some of the major highlights of this app include:
- Natural language input — Speak or type in a command, the system figures out your intent
- Spoken responses — Responses are audibly spoken in natural language
- Quick input — Select from a list of intents currently configured in the system
And this is just the beginning, this application can be extended in many different ways — it’s only limited by your imagination and business needs.
How it works.
To analyze — spoken or written — commands in natural language and automatically determine their intent, this application uses three cloud-based services from IBM Watson.
- Conversation — Natural language processing to automate interactions with the user
- Speech-to-Text — Convert natural spoken language into text
- Text-to-Speech — Convert text into audible natural spoken language
What You’ll Need
Before you create the Watson services, let’s get the system requirements covered.
Download the source repository.
To start, let’s download the source files.
Note: You’ll need a git client installed on your computer for this step.
Simply move to the directory you want to use for this demo and run the following commands in a terminal…
Terminal
# Download source repository
git clone http://ift.tt/2mjMaIF
cd ibm-watson-conversation-service
At this point, you can keep the terminal window open and set it aside for now…we’ll need it in a later step.
Name the application.
Right away, let’s nail down a name for your new conversational app.
manifest.yml
...
# Application name
- name: xxxxxxxxxxxxxxx
...
Replace xxxxxxxxxxxxxxx
in the manifest.yml
file with a globally unique name for your instance of the application.
The name you choose will be used to create the application’s URL — eg. http://ift.tt/2mEnZHP.
Create a Bluemix account.
Go to the Bluemix Dashboard page (Bluemix is IBM’s cloud platform).
If you don’t already have one, create a Bluemix account by clicking on the “Sign up” button and completing the registration process.
Install Cloud-foundry.
One of the steps in this guide require a command line session, so you’ll need to install the Cloud-foundry CLI tool.
Open a terminal session with Bluemix.
Once the Cloud-foundry CLI tool is installed, you’ll be able to log into Bluemix through the terminal.
Terminal
# Log into Bluemix
cf api http://ift.tt/QKImQk
cf login -u YOUR_BLUEMIX_ID -p YOUR_BLUEMIX_PASSOWRD
Replace YOUR_BLUEMIX_ID
and YOUR_BLUEMIX_PASSOWRD
with the respective username and password you created above.
Step 1: Create the Application Container
Go to the Bluemix Dashboard page.
Once you’re signed in and see your Dashboard, click on the “Create app” button.
In this demo, we’ll be using a Node application, so click on “SDK for Node.js.”
Then fill out the information required, using the application name you chose in What you’ll need — and hit the “Create” button.
Set the application memory.
Before we move on, let’s give the application a little more memory to work with.
Open up your application.
Then click on the “Runtime” tab and adjust the “MBs per Instance” setting. Set it to 512 and hit “Save.”
Step 2: Create the Conversation Service Instance
Next, let’s set up your Conversation service.
Open your application again.
Click on the “Connections” tab. And since this is a brand new application, it should be empty. But you should see a “Connect New” button — click it.
You should now see a long list of services. Click “Watson” in the Categories filter and then click on “Conversation” to create an instance of that service.
Go ahead and choose a Service Name that makes sense for you — eg. Conversation-Demo
. For this demo, the “Free” Pricing Plan will do just fine. And by default, you should see your application’s name listed in the “Connected to” field.
Click the “Create” button when ready. And enter the Name and Pricing Plan you chose into the manifest.yml
file.
manifest.yml
...
# Conversation Service
Conversation-Demo:
label: conversation
plan: free
...
- services:
- Conversation-Demo
...
If needed, replace both instances of Conversation-Demo
with your Service Name and free
with your Pricing Plan.
Feel free to “Restage” your application when prompted.
Enter service credentials.
After your Conversation instance is created, click on the respective “View Credentials” button.
And that will pop up a modal with your details.
Copy/paste your credentials into the respective portion of your .env
file (in the source code).
.env
# Environment variables
...
CONVERSATION_USERNAME=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
CONVERSATION_PASSWORD=xxxxxxxxxxxx
Replace xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
with the username listed and xxxxxxxxxxxx
with the respective password.
Create a Workspace
The Conversation service supports multiple Workspaces and you’ll need to create one for this application.
Click on your Conversation service.
On the next page, click on the “Launch tool” button.
Log into the Conversation Tooling site using the same username and password you created for Bluemix in What you’ll need.
And let’s create your new Workspace. For this demo, we already have a Workspace preconfigured, so click on “Import.”
Select the car_workspace.json
file from the training
folder in the source code you downloaded in What you’ll need. And import “Everything.”
After the import, you should see your new Workspace listed on the Workspaces dashboard.
And all you need now is the Workspace ID. To get that click on the “View Details” link.
And then copy/paste the Workspace ID into the .env
file.;
.env
...
# Environment variables
WORKSPACE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
...
Your Conversation service instance is now ready. So far so good!
Step 3: Create the Speech-to-Text Instance
Note: This service is optional. To use it and speak your commands into the application, you’ll need a microphone configured for your computer.
Now, let’s set up your Speech-to-Text service.
Open your application again.
Click on the “Connections” tab — then click on the “Connect New” button.
Click “Watson” in the Categories filter and then click on “Speech-to-Text” to create an instance of that service.
Go ahead and choose a Service Name that makes sense for you — eg. Speech to Text-Demo
. For this demo, the “Standard” Pricing Plan will do just fine. And by default, you should see your application’s name listed in the “Connected to” field.
Click the “Create” button when ready. And enter the Name and Pricing Plan you chose into the manifest.yml
file.
manifest.yml
...
# Speech to Text
Speech to Text-Demo:
label: speech_to_text
plan: standard
...
- services:
...
- Speech to Text-Demo
...
If needed, replace both instances of Speech to Text-Demo
with your Service Name and standard
with your Pricing Plan.
Feel free to “Restage” your application when prompted.
Enter service credentials.
After your Speech-to-Text instance is created, click on the respective “View Credentials.”
And that will pop up a modal with your details.
Copy/paste your credentials into the respective portion of the .env
file.
.env
...
# Optional: enable Speech to Text
SPEECH_TO_TEXT_USERNAME=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
SPEECH_TO_TEXT_PASSWORD=xxxxxxxxxxxx
...
Replace xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
with the username listed and xxxxxxxxxxxx
with the respective password.
Your Speech-to-Text service is now ready, so let’s move onto the next service.
Step 4: Create the Text-to-Speech Instance
Now, let’s set up your Text-to-Speech service.
Open your application again.
Click on the “Connections” tab — then click on the “Connect New” button.
Click “Watson” in the Categories filter and then click on “Text-to-Speech” to create an instance of that service.
Go ahead and choose a Service Name that makes sense for you — eg. Text to Speech-Demo
. For this demo, the “Standard” Pricing Plan will do just fine. And by default, you should see your application’s name listed in the “Connected to” field.
Click the “Create” button when ready. And enter the Name and Pricing Plan you chose into the manifest.yml
file.
manifest.yml
...
# Text to Speech
Text to Speech-Demo:
label: text_to_speech
plan: standard
...
- services:
...
- Text to Speech-Demo
...
If needed, replace both instances of Text to Speech-Demo
with your Service Name and standard
with your Pricing Plan.
Feel free to “Restage” your application when prompted.
Enter service credentials.
After your Text-to-Speech instance is created, click on the respective “View Credentials” button.
And that will pop up a modal with your details.
Copy/paste your credentials into the respective portion of the .env
file.
.env
...
# Optional: enable Speech to Text
TEXT_TO_SPEECH_USERNAME=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
TEXT_TO_SPEECH_PASSWORD=xxxxxxxxxxxx
...
Replace xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
with the username listed and xxxxxxxxxxxx
with the respective password.
Your Text-to-Speech service is now ready, so let’s fire up the app.
Step 5: Launch It!
Everything is ready to go, so let’s put the application to work.
Launch the application.
To bring the application to life, simply run the following command — making sure the terminal is in the repository directory and signed into Bluemix.
Terminal
cf push
This command will upload the files, configure your new application and start it.
Note: You can use the same cf push
command to update the same application after it’s originally published.
Take a look.
After the server has started, you’ll be able to open the application in your browser at the respective URL.
The application should look something like this…
Play around with it and get a feel for its capabilities. Click on the “What can I ask?” button to see what the system is currently trained for.
And you can add new capabilities through the Workspace Tooling interface from step #2.
Troubleshooting
If you’re having any problems with the application, be sure to check out the logs…
Just click on the “Logs” tab within your application page.
Congratulations — You’re now a chatbot pro!
Take it to the Next Level
Hopefully this post has convinced you that it’s pretty easy to put together a versatile chatbot using IBM Watson. But this is just the start.
Take what you picked up here and apply it to your business processes — can you deploy a chatbot for customer support, pre-sales, staff training, a mobile app? The sky’s the limit.
You can dig deeper into the Conversation service at the Watson Developer documentation.
Enjoy!
- Building Voice-Enabled Products With Amazon Alexa
- Cognitive Customer Engagement Using IBM Watson
- Harnessing Visual Data Using Google Cloud
- Building a Recommendation Engine Using Microsoft Azure
- Predicting Marketing Campaign Response Using Amazon Machine Learning
And be on the lookout for future issues, they come out every other Monday.
Keyword Gigaom
1 Comments
Good post. I learn something totally new and challenging on blogs I stumble upon on a daily basis. It will always be interesting to read articles from other authors and practice something from their websites...
ReplyDeleteChatbot Company in Dubai
Chatbot Companies in Dubai
Chatbot Development
Chatbot Companies
AI Chatbot Development
Chatbot Companies in UAE
Chatbot Company in Chennai
Chatbot Company in Mumbai
Chatbot Company in Delhi
Chatbot Development Companies