Professional Documents
Culture Documents
IBM Watson
Assistant Lab
Exercise Guide
Overview
The purpose of this lab is to introduce you to the Watson Assistant and to show to you the overall
requesting process to the service and the resulting response.
Tutorial
These instructions are referenced from https://console.bluemix.net/docs/services/conversation/getting-
started.html#gettingstarted, taken 5 May 2018.
After you create a Watson Assistant service instance, you'll land on the Manage page of the service
dashboard.
On the Manage page, click Launch tool.
Step 2: Create a 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.
We're going to define four intents for a pizza store called La Piccola Pizza:
1. Order pizza
2. Payment
3. Greeting
4. Cancel order
Make sure you're on the Intents tab. (You should already be there, if you just created the workspace.)
1. Click Add intent.
2. Name the intent order, and then click Create intent.
3. Type ‘Can I order pizza?’ into the Add user example field, and then press Enter.
Examples tell the Watson Assistant 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.
An entity represent a class of object or a data type that is relevant to a user's purpose. By recognizing the
entities that are mentioned in the user's input, the Watson Assistant service can choose the specific actions
to take to fulfill an intent.
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.
We're going to define six entities for La Piccola Pizza:
1. Contact person
2. Crust type
3. Order type
4. Payment method
5. Pizza type
6. Size
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 intents, each with a single node.
1. In the Watson Assistant tool, click the Dialog tab.
2. 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.
3. Click the Welcome node to open it in the edit view. We will use slot to gather information of
user’s name and allow multiple response.
4. Click Customize, click the Slots and Multiple responses toggle to turn it on, then click Apply.
5. Click Add slot and define the following slot to get user’s name and save it as $person
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" panel. You should see your welcome message.
Now let's add nodes to handle our intents between the Welcome node and the Anything else node.
1. Click the More icon ( ) on the Welcome node, and then select Add node below.
2. Name it as Order Pizza then type #order in the If bot recognizes field. We’ll need to collect
seven data for ordering pizza:
Pizza type
Size
Crust type
Quantity
Order Type
Location; optional, if the order is for delivery
Email
3. Open Order Pizza node, then choose Customize. Click the Slots and Multiple responses toggle to
turn it on, then click Apply.
4. Click Add slot and define the following slots to get the data
Check for Save it as If not present, ask
@pizza_type $pizza_type We have Cheeseburger, Black Pepper Beef, Hawaiian
Chicken, Meat Lovers, and Tuna Melt. Which one do you
prefer?
@size $size What size do you prefer? There are personal, regular and
large size.
@crust_type $crust_type Would you like to have Black Double Cheesy, Black
Original, Black Sausage, Double Cheesy, Original, or
Sausage type of crust?
@sys-number $quantity How many pizzas do you want to order?
@order_type $order_type Would you like to take away or delivery?
@sys-location $location Please input your address
@contact_person $email Please input your valid email address
5. @sys-location is only required for delivery service. Click setting icon on slot @sys-location
6. Click the More icon ( ) then choose Enable Condition. Then fill out the form as follow then save
it. It’ll set the slot location as required if user choose to order for delivery.
We’ve finished setting the slots for required data. We’ll create the conditional response once
we’ve collected all required data.
7. Click Add response then fill with the following data
If bot recognizes Respond with
$order_type == "delivery" || Great! I'll make an order for you. $quantity $size $pizzaType pizza with
$order_type == "Delivery" $crustType on behalf of $person. It will be delivered in 30minutes.
$order_type == "takeaway" Great! I'll make an order for you. $quantity $size $pizzaType pizza with
|| $order_type == "take $crustType on behalf of $person. It will be ready at
away" || $order_type == <?now().plusMinutes(15)?>
"Take away" || $order_type
== "Take Away"
We’ve finished with node Order Pizza. You can try the result
8. Let’s create another node, called Pay Order then type #payment in the Enter a condition
9. Turn on the multiple response, then add three responds.
If user define payment by cash
If user define payment by card
If user does not define the payment method
Now you will be able to choose destination node, select Pay Order node then choose Respond.
11. Create new node called Cancel then type #cancel as the condition. For this node, we will
implement simple text response. Therefore, just put Okay. I will cancel your order. as the
response.
That's it. You created a simple conversation with four intents and a dialog to recognize them.
END OF TUTORIAL
NOTES
NOTES
© Copyright IBM Corporation 2014.