Oct 26, 2017 2:49:39 PM by Brendan Tierney
Oracle recently announced their Oracle Intelligent Bot application just before Oracle Open World, coming as part of the Oracle Cloud Enterprise Suite cloud service.
Chatbots are part of our future in the ever-increasing mobile and connected world, where people have gotten used to using various messaging applications to communicate with their friends, work, their bank, etc. This article will give an overview of how to use the Oracle Intelligent Bot service to create a simple bot for making appointments with a doctor’s practice, and will also cover some of the key concepts and important terms used when creating a chatbot.
The topic of chatbots has been very popular in recent months and the recent Oracle Open World featured several presentations and hands-on labs giving an overview of how the Oracle Intelligent Bot works.
There have been some mixed reactions on the usefulness of these type of applications. But like them or not, chatbots are a core application that many companies and websites around the world have been using for many years now. Over the past 12 months or so we have seen the technologies behind chatbots becoming more focused on the use of Natural Language Processing (NLP), Machine Learning, and Artificial Intelligence (AI).
Chatbots will not replace all of your existing applications, but they do serve a particular type of application and customer service interaction very well. I’m sure we have all experienced the little pop-up window on various shopping websites, asking if you have any additional questions. Can you imagine the number of phone calls that customers make to retail establishments, banks, and other types of service organizations? The call volume can lead to longer response times as more and more customers try to access the call center. These companies could hire more and more staff to service these calls, but the economics of it just isn’t worth it.
As an alternative, just think if customers could engage with a company in an automated manner, where the majority of their questions and requests could be handled, and only in the odd case would the customer be passed to a customer service representative. Everyone would be happy, from the customer who gets what they want quickly, to the company providing the service where they can service many thousands of requests per minute.
The following are the main terms used or associated with chatbots. These will be illustrated later in the article.
Intent: The user’s intention. A chatbot must be able to understand all the different ways a customer might say the same thing. For example, there are many different ways to ask for your current bank balance. An intent is like a use case, a particular scenario that your bot will process. Examples include Check Balance, Transfer Money, Track Spending, Make a Payment, etc. You provide examples of the various ways the customer can ask for their balance. These are called ‘utterances’. You provide example phrases as training data and the bot will learn from them, (using NLP and AI), to determine what the customer is asking for.
Entities: Intents have parameterised variable elements that allow for different values. For example, when asking for the balance of my account, the variable could be the type of bank account (deposit, current/checking, savings, etc.).
Natural Language Processing (NLP) and Artificial Intelligence (AI) drive a contextual dialogue with users, taking the intents and the utterances and transforming them into machine learning models, the results of which can then be applied to the user inputs in the chatbot.
Conversation Flow: An interaction between a person and the bot isn’t just a series of unrelated, separate questions and responses. It is a conversation, and, as with any human-to-human conversation, there is a flow that brings you through a defined process or series of steps in order to finally process your request. The conversation flow guides the interaction between the chatbot and the user.
To use the Oracle Cloud Enterprise Suite cloud service you will need an Oracle Cloud account and a subscription for the service. Alternatively, you can sign up for a trial account and get some credit towards trying out the various cloud services. Be forewarned that the free credit will run out very quickly for this cloud service.
When you initiate the creation of the service (Figure 1), you will be prompted to enter some basic information: the name of the service, the region, number of users, and number of employees. Most of the other information will be populated based on the cloud account.
Figure 1 – Creating a New Mobile Environment Service Instance.
It will take a bit of time for related services to be created (from seconds to minutes to hours; it depends!) You can monitor this process from the dashboard, where the status of the services will move from Initialized to having a status of Active. You will also receive an email when the service has finally been created.
Once your service is created, you can log into the Oracle Cloud Enterprise Suite cloud service and proceed to creating your bot, clicking on the big green circle with ‘New Bot’ under it, as shown in Figure 2. Enter the name of the bot, along with a description.
Figure 2 – Creating a bot.
Having created the bot application, the next thing for you to do is to setup the various elements and allow it to work. This include the creation of the intents and entities and configuring the conversation dialogue. When creating your first and maybe even your first few bots it is advisable to build up and test each component until you are fully familiar with the all the various steps. Care should be taken over the next 12 months or more, as the Oracle Chatbot product team has a series of enhancements coming that will slightly change the look-and-feel of various components for creating the bot. For example, they are planning a workflow interface for creating the conversation dialogue, while the current release (used for this article) requires code.
The first step is to set up the intents. Intents are like a series of tasks that can be recognized from customer input and completed by the bot. Our chatbot demo/practice involves interacting with a doctor’s office. In this setting, the intents we want would include making an appointment, changing an appointment, booking tests, etc. To create an intent, click on the green button, provide a name for the intent, and fill in some basic descriptive information.
Next we need to provide the utterances--the series of statements or questions that will be used by our bot to identify the intent. These should be typical phrases that people use to make their request. For example, to book an appointment with the doctor, we could ask in a variety of ways. As the developer of the bot you will need to think about the users of the bot and essentially script the various ways of asking for an appointment. See Figure 3 for examples of this.
Figure 3 – Creating an Intent.
When you’re creating the initial bot, it will be impossible to think of all ways people might make their request. But over time you can add more. It is these different ways of asking or requesting the intent that will be used to train the bot using AI and ML. This will in turn allow the ML and AI to then process a phrase that is similar but not identical to the supplied list of phrases. Oracle currently suggests that a list of 10 to 15 different intent phrases be used to train the models. The more intent phrases you can add will mean a more accurate model. After entering all your phrases, click on the training button (top right hand side of screen) to generate the preliminary model for your bot for these intents. Adding new phrases over time will allow the bot to become more and more accurate.
You can also define entities (variables) that can be used across intents to give meaning or context for the task in question (Figure 4). In our example, for a doctor’s practice, we can have entities that indicate the name of the doctor, the medical specialty, the date and time for an appointment, what the appointment is for, etc. The Oracle bot solution comes with a number of standard entities already defined. These out-of-the-box entities include Address, Currency, Duration, etc. For making an appointment with a doctor, your added entities would include Patient, what Doctor, Date and Time of appointment, and any special requirements for the appointment. As you can imagine, the thought process of defining all of these intents and entities can be time consuming, but with practice at building chatbots it will become easier.
Figure 4: Creating entities
The final step needed is to design the conversation flow for the bot. All interactions with the bot will involve some type of conversation and specify how that conversation can go from intent to intent.
A conversation flow in our example might be something like:
Me: I’d like to make an appointment
Bot: With a doctor or the practice nurse
Me: With a doctor
Bot: What specialty do you require?
Me: I think I have a chest infection
Bot: When do you need an appointment?
Bot: We have the current times available: A, B, C, D
Me: Time A
Bot: These doctors are available: X, Y, Z
Me: Doctor X
Bot: Your appointment is at A with doctor X, see you then!
The current way of implementing this is using a flavor of YAML known in the documentation as BotML. This allows you to define a series of steps for the bot to follow and it comes with a large number of predefined steps included out-of-the-box. Your job as the bot designer/builder is to define the conversation flow using the existing steps and scripting up new ones that are required specifically for your bot.
Oracle has stated that they hope to have a workflow type of tool available by the end of 2017 or early 2018 for designing the conversation flow. This will be a greatly welcomed feature, as scripting the conversation flow can be tedious and error prone using the scripting language.
After creating the bot, the next step is to test it. You can use the built-in capabilities of the Oracle Intelligent Bot tool to test that the various components work. Or perhaps you might want to test the bot in the wild. To do this we can REST enable the bot to create POST and GET end points. You can also test the bot using Facebook Messenger (developer.facebook.com, see Figure 5) and other similar tools. You have to set up your account and obtain the secure connection details; go back to the Oracle Intelligent Bot application and record these details using the Create Channel screen (see bottom right of Figure 5). This will generate a URL and a verify token which you can then paste into your Facebook page. You bot will then be available on the Facebook page you have created and you can test out your chatbot.
Figure 5 – Setting up bot with Facebook Messenger
Chatbots will play a big part in the application development world over the coming years. The sooner we can all adopt and try them out, the quicker we will start to see the benefits. There is a wide range of application areas for chatbots, and they can be used to greatly simplify customer interactions and increase the level of customer engagement. Oracle Intelligent Bot, part of the Oracle Mobile Enterprise Suite, allows you to build your own chatbots in the cloud and then to easily expose and integrate them into many of the existing communication tools, devices, and websites.
Written by Brendan Tierney
Brendan Tierney, Oracle ACE Director, is an independent consultant and lectures on Data Mining and Advanced Databases in the Dublin Institute of Technology in Ireland. He has 22+ years of extensive experience working in the areas of Data Mining, Data Warehousing, Data Architecture and Database Design. Brendan has worked on projects in Ireland, UK, Belgium and USA. Brendan is the editor of the UKOUG Oracle Scene magazine and deputy chair of the OUG Ireland BI SIG. Brendan is a regular speaker at conferences across Europe and the USA and has written technical articles for OTN, Oracle Scene, IOUG SELECT Journal and ODTUG Technical Journal.
Brendan has published the following books with Oracle Press book