Objective:
The objective of this tutorial is to develop a simple conversation app to greet anyone for specific keywords like Hello and bye, as shown in the below screen shot.
Overview:
Conversation service is one of the module in IBM Watson cognitive services which helps to quickly build and deploy chatbots. Conversation is maintained by chatbots that understand natural language and deploy them on messaging platforms and websites, on any device. The features of this service include the following:
Developer friendly
Easy to begin, easy to use. Get faster time to value, and integrate across channels, networks and environments.
Enterprise grade
Conversation features a reliable infrastructure that scales with individual use cases. Platform support from IBM gives you the backing you need.
Robust and secure
Own your data. IBM protects your privacy, allowing you to opt out of data sharing. Built on IBM Cloud and featuring reliable tooling with industry-leading security.
Steps:
1. Go to the Conversation service (https://console.eu-gb.bluemix.net/catalog/services/conversation/) and either sign up for a free Bluemix account or log in.
2. After you log in, type conversation-tutorial in the Service name field of the Conversation page and click Create.
Step 1: Launch the tool:
3. After you create the service instance, you'll land on the dashboard for the instance. Launch the Conversation tool from here. Click Manage, then Launch tool.
You might be prompted to log in to the tool separately. If so, provide your IBM Bluemix credentials to log in.
Step 2: Create a workspace:
4. Now create a workspace. A workspace is a container for the artifacts that define the conversation flow.
5. In the Conversation tool, click Create.
6. Give your workspace the name Conversation tutorial and click Create. Youʼll land on the Intents tab of your new workspace.
Step 3: Create intents
7. An intent represents the purpose of a user's input. You can think of intents as the actions your users might want to perform with your application. For this example, we're going to keep things simple and define only two intents: one for saying hello, and one for saying goodbye.
8. Make sure you're on the Intents tab. (You should already be there, if you just created the workspace.)
9. Click Create new. Name the intent "hello".
10. Type hello as a User example and press Enter.
Examples tell the Conversation service what kinds of user input you want to match to the intent. The more examples you provide, the more accurate the service can be at recognizing user intents.
On hitting Enter, you will see the below confirmation message.
11. Add four more examples and click Done to finish creating the #hello intent:
• good morning
• greetings
• hi
• howdy
12. Create another intent named #goodbye with these five examples:
• bye
• farewell
• goodbye
• I'm done
• see you later
13. You've created two intents, #hello and #goodbye, and provided example user input to train Watson to recognize these intents in your users' input.
Step 4: Build a dialog
14. A dialog defines the flow of your conversation in the form of a logic tree. Each node of the tree has a condition that triggers it, based on user input. We'll create a simple dialog that handles our #hello and #goodbye intents, each with a single node.
Adding a start node
15. In the Conversation tool, click the Dialog tab. Click Create.
You'll see two nodes:
Welcome: Contains a greeting that is displayed to your users when they first engage with the bot.
Anything else: Contains phrases that are used to reply to users when their input is not recognized.
16. Click the Welcome node to open it in the edit view.
17. Replace the default response with the text, Welcome to the Conversation tutorial!.
You created a dialog node that is triggered by the welcome condition, which is a special condition that indicates that the user has started a new conversation. Your node specifies that when a new conversation starts, the system should respond with the welcome message.
Testing the start node
19. You can test your dialog at any time to verify the dialog. Let's test it now.
Adding nodes to handle intents
21. Now let's add nodes to handle our intents between the Welcome node and the Anything else node.
23. Type #hello in the Enter a condition field of this node. Then select the #hello option.
24. Add the response, Good day to you.
26. Click the More icon on this node and then select Add node below to create a peer node. In the peer node, specify #goodbye as the condition, and OK. See you later! as the response.
Testing intent recognition
27. You built a simple dialog to recognize and respond to both hello and goodbye inputs. Let's see how well it works.
29. At the bottom of the pane, type Hello and press Enter. The output indicates that the #hello intent was recognized, and the appropriate response (Good day to you.) appears.
30. Try the following input:
• bye
• howdy
• see ya
• good morning
• sayonara
30. Watson can recognize your intents even when your input doesn't exactly match the examples you included. The dialog uses intents to identify the purpose of the user's input regardless of the precise wording used, and then responds in the way you specify.
Result of building a dialog
31. That's it. You created a simple conversation with two intents and a dialog to recognize them.