Let’s all raise a cup of coffee to toast the success of Oracle Mobile and Chatbot!

A few years ago, Oracle unveiled Oracle Mobile Cloud Service (MCS), the first step in our ambitious mobile-first strategy. MCS enjoyed tremendous success, in some cases helping customers garner industry accolades for their mobile apps.  Both Forrester and Gartner recognized MCS as an industry leader. Impressive? You bet. But it was only the beginning.

“Oracle is in the Leaders quadrant this year, which is a move from the Challengers quadrant in 2016. Oracle has achieved a significant increase in MADP sales, primarily from its Oracle Applications installed base. It continues to build on its platform with chatbot support and expanded analytics, and to enhance its high-productivity development tool” (Gartner)

Just a few weeks after launching Oracle Cloud Platform for Mobile and Chatbots Oracle earns a spot in Gartner’s Magic Quadrant for Mobile App Development Platforms. 

No matter what your favorite hot drink is – whether you’re a flat white person or a short macchiato or a ‘long-black-with-a-dash-of-hot-milk” like me today I’d like to conduct a bit of an experiment with you. Have you ever asked a Conversational Bot driven by AI to order coffee for you? No? Well today you can with the Oracle Coffee Bot! Are you ready?

  1. Hopefully you have a Facebook account. If you don’t I’m sorry at the moment the CoffeeBot is available for the following channels: Facebook Messanger and Amazon Alexa. We’re working to make it accessible from a simple Web Page or within a Mobile App.
  2. Search for @anzcoffeebot in Messenger to find the page easily or open the CoffeeBot Page in a separate tab and click “Send Message”. This Bot was originally built for Telstra Vantage hence the name “TelstraCoffee” 🙂
  3. Well now all you have to do is ask your “BaristaMadeBot” what you’re after and just converse with it!
  4. Has the Bot submitted your order? Awesome! We’ve received your order, you can see it yourself here. If there was a Barista serving coffee now at a Coffee Cart near you you’d enjoy your coffee or tea. Don’t worry the ANZ Digital Experience team wants to meet you, so we’ll try and set up a Coffee Cart powered by the Oracle Coffee Bot in your city. Just let us know!

I hope you had a bit of fun with the Bot. If you want to know what runs in the “backstage” of the Coffee Bot and how Oracle Mobile Cloud enables you to build intelligent chatbots that connect to any backend system please continue reading. You won’t be disappointed!

Intent and Entities

Some of you might have read my previous post around Natural Language Processing and its building blocks: Intents, Utterances and at last but not least Entities. You’d remember that an Intent is what enables the Bot to do what the user wants it to do. Well in the Coffee Bot scenario the main intent is to order coffee or tea so what we need to do first is create the “OrderCoffee” intent and enter a set of utterances which are the common phrases that might typically be used to order coffee.

Can you make me a skinny cappuccino please?

Can you get me a long black no milk please?

A short macchiato with soy milk

Do you have english breakfast? 

Can I get a coffee?

I need coffee!! Now!

(....)

Below we ask for a skinny cappuccino.

coffee

Cappuccino is a type of coffee and skinny is a type of milk. They are what in NLP we call Entities or more exactly “cappuccino” is one of the possible values of the Entity “CoffeeType”. “Skinny” is just one of an array of synonyms for “skin” which is a value of “MilkType” entity list.

Synonims

Entities add context to the Intent itself therefore we need to associate “MilkType” and “CoffeeType” to the Intent “OrderCoffee”.

IntentEntities

Once we’ve created the Intents, the Entities and associated the right Entities to the right Intents we need to design the Dialog Flow that manages the interaction of the Bot with the User.

The Dialog Flow

A conversation with a chatbot goes through a particular flow and you can think of the conversation having different states and context.  The flow defines what should happen next based on an input and the flow itself  is implemented in the platform as a state machine. A state machine can be thought as a process flow or a workflow and each step of this workflow is often identified as a state. So what we need to do in the Dialog Flow Designer of Oracle Intelligent Bots is:

  1. declare the variables that we’re going to use in the flow as well as the type of each variable (it can be a primitive type like string or an Entity like “MilkType”). This section is called Context
  2.  define the logic of the Bot through a list of States. A state is an activity, a unit of work performed by a Component. System Components are built in and do standard things like setting variable values or sending output to the user. Custom Components which developers write in order to implement custom logic (like calling back-end systems) are generally hosted in Mobile Cloud Service and are accessed via REST APIs. Components take properties in input. The number and type of properties of a State will be determined by the Component. Transitions determine where the flow proceeds from after the State is executed. You can reference a specific State to navigate to or you can leave the transitions empty and the flow will proceed from top to bottom in the flow definition

Let’s have a closer look at some of the states.

First we need to determine the Intent. The System.Intent component is responsible to detect the right intent and then transition to the next state in order to fulfill the user’s intent.

states:
 intent:
   component: "System.Intent"
   properties:
     confidenceThreshold: 0.3
     variable: "coffeeIntent"
   transitions:
    actions:
      Geeting: "bePolite"
      OrderCoffee: "setCoffeeTea"
      Finish Demo: "finishDemo"
      AskForMenu: "showCoffeeMenu"

 

The states below are used to extract what the user has provided in input (tea or coffee, cappuccino or long black or macchiato, skinny or soy or no milk). The entities extracted from the user input are placed in the variables declared initially and are used through the flow by the components.

 setCoffeeTea:
   component: "System.SetVariable"
   properties:
     variable: "coffeeTea"
     value: "${coffeeIntent.value.entityMatches['ValidDrinks'][0]}"
   transitions: {}
 setCoffeeType:
   component: "System.SetVariable"
   properties:
     variable: "coffeeType"
     value: "${coffeeIntent.value.entityMatches['CoffeeType'][0]}"
   transitions: {}
 setMilkType:
   component: "System.SetVariable"
   properties:
     variable: "milkType"
     value: "${coffeeIntent.value.entityMatches['MilkType'][0]}"
   transitions: {}

If the entities are not found in the user input then the the flow proceeds through the  questions required to complete what we call in NLP “entity slotting“. Below after checking if the requested drink contains milk we ask the user what kind of milk he prefers.

milkTypes:
  component: "System.Text"
  properties:
    prompt: "Would you like regular, light or soy milk?"
    variable: "milkType"
  transitions:
    next: "anyComments"

PlaceOrder Custom Component

Once the Bot has filled in all the Entities “slots” required to submit the order to the Barista the custom component “placeOrder” is invoked and the necessary variables passed in input as properties.

 placeOrder:
   component: "placeOrder"
   properties:
     coffeeType: "${coffeeType.value}"
     customerName: "${customerName.value}"
     coffeeCart: "1"
     milkType: "${milkType.value}"
     comments: "${comments.value}"
   transitions:
     actions:
       success: "resetAll"
       fail: "resetAll"

I will dive into Custom Components Development in a separate thread, for now let’s just say that a custom component is a reusable unit of work that exeutes your self-written business logic within a Node container (like Mobile Cloud Service). You build custom components for all kind of custom functionality your bot needs but also for accessing backend services to query data and write data. In the Coffee Bot scenario the “placeOrder” custom component reads the properties passed in input (coffee type, customer name, milk type, coffee cart) and inserts a record in the Orders table of Mobile Cloud Service DB.

A generic REST service is responsible to read the orders from the database that are displayed to the Barista in a custom JET UI.

Orders

Look forward to receiving your order 🙂  Thanks for reading and until next post!

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s