In this short tutorial, we introduce the Conversation tool and go through the process of creating your first conversation.
You create your free instance of Watson services through IBM® Bluemix®, so you need a free Bluemix account to get started. (Bluemix is IBM's cloud platform. For details, see What is Bluemix?)
Go to the Conversation service on Bluemix and either sign up for a free account or log into your Bluemix account.
After you log in, type
conversation-tutorial in the Service name field, click Create, and then click Launch tool.
Your first step in the Conversation tool is to create a workspace.
A workspace is a container for the artifacts that define the conversation flow for an application.
In the Conversation tool, click Create.
Give your workspace the name
Conversation example and click Create. Youʼll land on the Intents tab of your new workspace.
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.
Make sure you're on the Intents tab. (You should already be there, if you just created the workspace.)
Click Create new.
Name the intent
hello as a User example and press Enter.
Examples tell the Conversation service what kinds of user input you want to match the intent. The more examples you provide, the more accurate the service can be at recognizing user intents.
Add four more examples and click Create to finish creating the #hello intent:
Create another intent named #goodbye with these five examples:
see you later
You've created two intents, #hello and #goodbye, and provided example user input to train Watson to recognize these intents in your users' input.
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.
In the Conversation tool, click the Dialog tab.
Click Create. You'll see one node.
conversation_start in the Enter a condition field of this node. Then select the conversation_start (create new condition).
Add the response,
Welcome to the Conversation example!. Click anywhere outside the dialog node to save your changes.
The dialog editor also added a node with the condition
anything_else, which handles user input that doesn't match any other nodes. Don't worry about this node for now.
You created a dialog node that is triggered by the condition
conversation-start, 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.
You can test your dialog at any time to verify the dialog. Let's test it now.
Click the icon to open the "Try it out" pane. You should see your welcome message.
Now let's add nodes to handle our intents between the
conversation_start node and the
Click the + icon below the
conversation_start node. This creates a node that is evaluated when
conversation_start is false.
#hello in the Enter a condition field of this node. Then select the #hello (create new condition) option.
Add the response,
Good day to you..
Click the + icon below this new
#hello node to create another node. This time, specify
#goodbye as the condition, and
OK! See you later. as the response.
You built a simple dialog to recognize and respond to both hello and goodbye inputs. Let's see how well it works.
Click the icon to open the "Try it out" pane. There's that reassuring welcome message.
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.
Try the following input:
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.
That's it. You created a simple conversation with two intents and a dialog to recognize them.
This was a simple example. For a real application, you'll need to define some more interesting intents, some entities, and a more complex dialog.