By Frank Nimphius
Building good chatbots is a mixture of art and technology. The art of developing chatbots lies in the conversation design, which is usually not what software developers have been trained to do.
It is human nature that conversations are not typically straightforward. Topics may change in the middle of an interaction or, if we don’t understand a question, we may ask for clarification.
Though the human brain is far from being a fast supercomputer, which is able to analyze millions of records in fractions of a second, it is a real genius when it comes to understanding context and putting together 1 + 1 to become 2, even if parts of the information are missing.
Because artificial intelligence is not yet on the level of human intelligence, chatbots need good conversational design to ensure that context changes are handled and human users are safely guided through a conversation.
If your conversation design cannot prevent users from getting stuck in a bot conversation, the least it can do is to show users a way to free themselves from being locked in.
This article discusses techniques you can use in Oracle Digital Assistant to guide users in situations where they don’t know how to proceed with a conversation or change the topic.
Oracle Digital Assistant is the next generation of the Oracle chatbot platform. It manages and coordinates multiple smaller-scoped skills in a composite chatbot solution that assists users in completing multitask conversations.
The use case for the hands-on exercise in this article is a simplified version of a pizza ordering bot. You don’t build the complete digital assistant solution but the skill only, for which a starter bot is provided.
Below are the prerequisites for following along with the hands-on steps in this article:
Follow these initial hands-on steps to start the service and import, train, and test the bot.
What you just did: By importing the OraclePizza2019(1.0).zip file, you installed and then trained the pizza bot sample skill. You are going to use the imported Instant Apps web form later in the hands-on exercise.
Before you fix the imported skill’s conversation issue, first experience the problem from a user perspective.
What happened: The pizza skill validates the pizza type selection against a value- list entity. The entity contains values and synonyms for the pizzas that a user can order. When you input a wrong pizza type, the entity validation fails and the prompt is displayed again. The implementation in the sample keeps you in an infinite validation loop with no exit. So the first thing you need to do to improve the user experience is to implement an exit strategy.
Input components in Oracle Digital Assistant have two properties in common:
To escape the validation loop, all you need to do is define a maxPrompts property value and configure the cancel action transition.
Figure 1: Transitions element with cancel action
What you just did: In this part of the hands-on exercise, you interrupted the validation loop by setting the maxPrompts parameter and defining a cancel transition that handles the invalid user input when the value set for maxPrompts is exceeded. Still, the user experience is not great.
Note: Instead of canceling the pizza order, you could have navigated the request to a state that provides detailed help. This exercise will eventually do that, so please bear with me for the moment.
In this part of the hands-on tutorial, you are going to display a list of values instead of only displaying an input prompt to the user. After all, good user guidance is a great recipe for a positive user experience.
Figure 2: Adding a list of actions to the pizza type prompt
What you just did: In this part of the hands-on instructions, you improved the user experience by providing good guidance on the choices of pizza. Still, if users insist on a pizza type that is not in the menu, the behavior of the bot is not such that it provides sufficient information. For example, the System.CommonResponse component that is used in the askPizzaType state supports page ranging to display a reduced list of values when the potential list of values is too long to display without requiring users to scroll. In this case, the user assumption that salami is a valid pizza type may appear to be correct. So you need to provide a bit more guidance in the prompts, which is what you will do next.
Note: Selecting a value from the list or typing a value contained in the list would navigate the user to the next state, which is to specify a size for the pizza. But we are not at that point yet.
Using Apache FreeMarker expressions in Oracle Digital Assistant, you can display text messages conditionally. So for the next user experience adjustment, after the first failed user input attempt, you are going to tell the user that the provided pizza type is not valid and that only a pizza from the menu list can be chosen.
text: “What pizza do you like?”to (all in a single line)
text: "<#if system.invalidUserInput == 'true'>Sorry, \"${system.message .messagePayload.text}\" is not a valid pizza type. Please choose a value from the menu. What pizza do you like?"Note: The value string above is provided in the starter folder of the download resources for this article. You can find it in a text file named step-44_textProperty.txt.
What you just did: Apache FreeMarker is an open source templating engine and expression language that is used in the Oracle Digital Assistant dialog flow. The internal invalidUserInput system variable is set to true after the first failed attempt of a user to provide a valid data input. The Apache FreeMarker <#if>-directive is then used to repeat the provided user message along with a text message explaining what the user should do next.
So far, so good; but as long as there is better, just good is not enough. With your improvements, the pizza skill nicely guides users on what to do, and it still cancels the pizza order when the value in the maxPrompts property, which defines the maximum number of failed user input attempts, is exceeded. Instead of the chatbot automatically exiting the validation loop, let’s make the user do so intentionally.
Figure 3: Adding conditionally displayed buttons for canceling and getting help
What you just did: In this part of the hands-on exercise, you created two global buttons that are displayed after the first time a user fails to provide a valid data input. Instead of using Apache FreeMarker expressions to display the buttons, you used the onInvalidUserInput property (line 57 of Figure 3) of the System.CommonResponse component. Each button triggers an action that is mapped to an action transition: cancel (line 63) and help (line 64). Now the skill behavior is that the user remains in the validation loop until one of the two buttons is clicked.
Often users don’t need help but just a better interface. This is especially true when users get stuck in a longer conversation flow. They don’t appreciate provided help that interrupts the conversation for them and makes them start over.
Oracle Instant Apps are reusable microscoped web applications you build declaratively for use in the context of a skill bot conversation. At runtime, instant apps are executed in the mobile device’s web view or a browser window outside of the conversational channel.
Oracle Instant Apps lets bot designers create instant apps to provide users with an easy way for entering structured form data into a bot conversation. When stuck in a bot conversation, users tend to be frustrated with the conversational medium. This is where Oracle Instant Apps can improve the user mood and user experience.
Figure 4: Content to delete from the dialog flow
Property | Value |
sourceVariableList | "pizzaType,pizzaSize" |
variable | "instantAppReturn" |
id | "oraclepizzahelp " |
title | "Oracle Pizza Help" |
description | "Use web form to complete your order" |
linkLabel | "Click to complete order" |
cancelLabel | "Cancel order" |
prompt | "Complete your order in a web form" |
cancel | "cancelPizzaOrder" |
textReceived | "cancelPizzaOrder" |
Figure 5: GettingHelp configuration to launch Oracle Instant Apps
Figure 6: setPizzaType configuration
Property | Value |
state name | setPizzaSize |
variable | "pizzaSize" |
value | "${instantAppReturn.value.pizzaSize} " |
next | "askPizzaType" |
Figure 7: setPizzaSize state
Figure 8: Oracle Instant Apps launch UI
What you just did: In this part of the hands-on exercise, you implemented user help in the form of an instant app. Now, when a user fails to provide a valid data input when prompted for the pizza type or pizza size, the displayed Help button launches an instant app, which allows the user to use a web-based input form to complete the order. Any value that the user provides within the bot conversation is already set in the form. Using a web form for providing help unlocks users by providing them an environment they are familiar with. When the user closes the instant app by clicking the Order button, control is passed back to the bot along with the user-selected values. The setPizzaType and setPizzaSize states copy the values returned from the Oracle Instant Apps form to the dialog flow variables used within the chatbot conversation.
Another option to assist users in escaping the validation loop and to successfully complete a task (such as pizza ordering in this hands-on exercise) is to pass the conversation to a human agent. Oracle Digital Assistant integrates with human agent support such that the same conversation and channel can be used for a human to interact with the user. After the human agent helps the user, control is then passed back to the bot.
With human agent integration, you now know about three levels of escalation for unlocking users in a bot conversation: written help, Oracle Instant Apps, and human agent integration.
Imagine that, when asked to select a pizza type, a user types Ask Trust Bank, what is my balance, just to check if he can afford a big pizza with everything on it. In this case, the user is not locked because he understands the order process for a pizza. It’s just that the user has a question he needs to get resolved first. Here, the expected bot behavior is that, temporarily, the user is allowed to exit the existing conversation.
Subflows, which in Oracle Digital Assistant are referred to as nonsequitur navigation, are automatically handled by Oracle Digital Assistant smart request routing. If Oracle Digital Assistant has a “Trust Bank” skill defined, the user is able to exit and return to the pizza ordering conversation. So there is nothing more that bot designers need to code for.
In this article, you improved the user experience of a skill in Oracle Digital Assistant by providing options for users to continue the bot conversation when they don’t know how to provide correct input for a bot response. Conversational design is an important skill to learn for any bot developer because it helps keep users on a happy path when they are working with a bot. Understanding how to allow users to escape the validation loop and to get help is just one important design discipline.
DOWNLOAD the bot for this article.
LEARN more about Oracle Digital Assistant.
READ an Oracle TechExchange article about escaping the validation loop.
Illustration by Wes Rowell