| copyright | lastupdated | ||
|---|---|---|---|
|
2017-05-10 |
{: shortdesc: .shortdesc} {: new_window: target="_blank"} {: tip: .tip} {: pre: .pre} {: codeblock: .codeblock} {: screen: .screen} {: javascript: .ph data-hd-programlang='javascript'} {: java: .ph data-hd-programlang='java'} {: python: .ph data-hd-programlang='python'} {: swift: .ph data-hd-programlang='swift'}
{: #gettingstarted}
In this short tutorial, we introduce the {{site.data.keyword.conversationshort}} tool and go through the process of creating your first conversation. {: shortdesc}
- Go to the {{site.data.keyword.conversationshort}} service and either sign up for a free {{site.data.keyword.Bluemix_notm}} account or log in.
- After you log in, type
conversation-tutorialin the Service name field of the {{site.data.keyword.conversationshort}} page, click Create, and then click Launch tool.
{: #create-workspace}
Your first step in the {{site.data.keyword.conversationshort}} tool is to create a workspace.
A workspace is a container for the artifacts that define the conversation flow for an application.
- In the {{site.data.keyword.conversationshort}} tool, click Create.
- Give your workspace the name
Conversation exampleand click Create. Youʼll land on the Intents tab of your new workspace.
{: #create-intents}
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. -
Type
helloas a User example and press Enter.Examples tell the {{site.data.keyword.conversationshort}} service what kinds of user input you want to match the intent. The more examples that 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:
good morninggreetingshihowdy
- Create another intent named #goodbye with these five examples:
byefarewellgoodbyeI'm donesee you later
You created two intents, #hello and #goodbye, and provided example user input to train {{site.data.keyword.watson}} to recognize these intents in your users' input.
{: #build-dialog}
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 {{site.data.keyword.conversationshort}} tool, click the Dialog tab.
-
Click Create. You'll see one node.
-
Type
conversation_startin 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 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.
Now let's add nodes to handle our intents between the conversation_start node and the anything_else node.
-
Click the + icon below the
conversation_startnode, which creates a node that is evaluated whenconversation_startis false. -
Type
#helloin 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
#hellonode to create another node. This time, specify#goodbyeas the condition, andOK! 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
Helloand press Enter. The output indicates that the #hello intent was recognized, and the appropriate response (Good day to you.) appears. -
Try the following input:
goodbyehowdysee yagood morningsayonara
{{site.data.keyword.watson}} can recognize your intents even when your input doesn't exactly match the examples that you included. The dialog uses intents to identify the purpose of the user's input regardless of the precise wording that is 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.
{: #download-workspace}
You can download the finished example workspace. Import the workspace {: new_window} into the {{site.data.keyword.conversationshort}} tool to compare against what you created.
{: #next-steps}
This tutorial is built around a simple example. For a real application, you'll need to define some more interesting intents, some entities, and a more complex dialog.
- Try the advanced tutorial
{: new_window} to add entities and clarify a user's purpose.
- See Developing your application
{: new_window} to integrate this dialog into an application.





