Oracle by Example brandingOracle OpenWorld 2019 Hands-On Lab - From Zero to Chatbot and Digital Assistant in Under Two Hours

In this lab, you'll learn how to design a skill and assemble and tune a digital assistant in Oracle Digital Assistant.

  • A skill is an individual chatbot that is focused on a specific set of capabilities (e.g. helping customers order food from a specific restaurant).
  • A digital assistant is a master chatbot containing multiple specialized skills. When a user engages with the digital assistant, the digital assistant evaluates the user input and routes the conversation to the appropriate skill. You can populate your digital assistant with skills from the Skill Store and with skills you have designed yourself.

Here’s the scenario for this lab:

You’re part of a project team building a digital assistant to allow your customers to better engage with the various businesses in a major shopping center.

This is the early stage of building the digital assistant and currently it supports use cases for a bank and a major retail store. The next stage of the project is to add a skill to support the new pizzeria that is opening up.

Here is what you need to do:

  • Complete the pizza skill and test it to ensure it can handle real-world pizza orders.
  • Add this skill to the shopping center digital assistant and then fine-tune the digital assistant's routing behavior.
  • If you have time, expose this digital assistant on the shopping center's website for easy access.

section 0Before You Begin

What Do You Need?

To complete this lab, you need:

  • An Oracle Digital Assistant (ODA) cloud instance. You can get one using either of the following approaches:
    • Setting up a trial instance.

      By having your own instance, you can continue this lab after the event and even build your own digital assistant.

    • Using a shared instance that has been provisioned for this event.

      If you select this option, you can dig into the lab with less setup time.

      This instance will be used by other participants in the hands-on lab.

  • These files:

    If you are using your own instance, download these files now.

    If you are using shared instance, these files will already be imported into your instance.

Option A: Set Up a Trial Instance

Get an Oracle Cloud Account

Before you can get a trial ODA instance, you need an Oracle Cloud account. If you don't already have one, go to oracle.com/oow19freetier to sign up.

  • Please sign up with the email you used to register for Oracle World
  • Please chose Phoenix as the home region.
  • You should get an email within a few minutes to confirm the account.
  • Once you have done so you can sign in Oracle Cloud Sign in

Provision an Oracle Digital Assistant Instance

  1. Once logged in to Oracle Cloud, click the navigation menu Navigation menu icon in the top left corner, scroll down to and expand Platform Services, and then click Digital Assistant.
    Description of oci_console_platform_menu.png follows
  2. Click Instances.
  3. Click Create Instance.
  4. In the Details section of the Instance area, fill in the following details:
    • Instance Name: Enter a name that reflects usage of the environment. For example, for a development environment, you might use something like oda-dev1.

      You can use a name of up to 20 characters. It must start with a letter, and can contain only letters, numbers and hyphens (-). It cannot end with a hyphen (-).

      Use a different name for each environment you create.

    • Description: (Optional) Enter a brief description of what the instance will be used for.
    • Notification Email: Status reports are sent to this email, including notice of when your instance has been created.
    • Region: Select Phoenix.
    • Tags: (Optional) Add tags and assign tags to this service.
  5. Use the following placement tag from Oracle: ODAPHX_CODE_2019
    1. In the Special Instructions section of the Instance area, select the I have special instructions from Oracle checkbox.
    2. Input your placement tag.
  6. Click Next.
  7. Review the instance details, then click Create.

    There will be a short wait before you receive an email confirming that your Digital Assistant instance is ready for you to sign into.

    If it takes more than a few minutes to finish, try refreshing the page in the browser.

  8. Once the instance is created, click the menu icon and select Digital Assistant UI Designer.
    screenshot showing a panel for a Digital Assistant instance. On the right side of the panel is an options menu, which is selected, showing options for Digital Assistant UI Designer, Add Tags, and Delete.

    A new browser tab will be opened with the Digital Assistant Designer UI.

    a screenshot showing the home page of Oracle Digital Assistant

Import the Starter Skill and Digital Assistant to Your Instance

Now let's prepare our demo environment by setting up the starter pizza skill and starter shopping centre digital assistant.

Import the Pizza Skill:

  1. With the Oracle Digital Assistant UI open in your browser, click main menu icon to open the side menu.
  2. Click Development and select Skills.
  3. Click main menu icon again to collapse the side menu.
  4. Import the skill by clicking the Import Skill button that is highlighted in red in the screenshot below.
    a screenshot of the Skills page. In the top navigation bar of the page there are buttons for Instant Apps and Import Skill.
  5. Navigate to OOW2019HOLPizzaSkill(1.0).zip on your system and click Open.
  6. In the Skills dashboard, select the OOW 2019 HOL Pizza Skill tile to open the skill designer.

    If you don't quickly spot the ODA 2019 HOL Pizza Skill, type HOL Pizza into the Filter field located above the New Skill tile.

Import the Starter Digital Assistant

  1. With the Digital Assistant UI open in your browser, click main menu icon to open the side menu.
  2. Click Development and select Digital Assistants.
  3. Click main menu icon again to collapse the side menu.
  4. Click Import Digital Assistant.
  5. Navigate to ODA_HOL2019.zip on your system and click Open.
  6. In the Digital Assistants dashboard, select the ODA_HOL2019 tile to open the digital assistant (or DA, for short) in the designer.

    If you can't spot the ODA_HOL2019 DA, type ODA_HOL2019 into the Filter field located above the New Digital Assistant tile.

By importing the ODA_HOL2019 DA, you have added a digital assistant and two skills to your instance:

  • ODA_HOL_2019 (digital assistant)
  • RetailBot (skill)
  • FinancialBot (skill)

You are now ready for the main part of the lab. Skip ahead to the Clone Copies of the Starter Skill and Digital Assistant section.

Option B: Use the Shared Instance

Log In to the Shared Instance

  1. In your browser, navigate to http://bit.ly/ODAHOLInstance2.
  2. Log in to the instance using the credentials provided by your lab instructor.

After successfully logging in, you will land on the ODA home page.

Clone Copies of the Starter Digital Assistant and Skill

Before you get to work, you need to create your own copies of the starter digital assistant and a starter skill.

Clone the Starter Digital Assistant

  1. Click main menu icon to open the side menu.
  2. Click Development and select Digital Assistants.
  3. Click main menu icon again to collapse the side menu.
  4. In the Filter field above the New Digital Assistant tile, type HOL to quickly locate the ODA_HOL2019 digital assistant.
  5. In the tile for ODA_HOL2019, open its Options menu (menu icon), and select Clone.
  6. In the Clone Digital Assistant dialog, enter a value for Display Name using the form <your_initials>_ODA.

    For example, if your initials are AB, you'd name the skill AB_ODA.

  7. Click Clone.

Clone the Starter Skill

  1. With the Oracle Digital Assistant UI open in your browser, click main menu icon to open the side menu.
  2. Click Development and select Skills to open the Skills dashboard.
  3. Click main menu icon again to collapse the side menu.
  4. In the Filter field above the New Skill tile, type HOL P to quickly locate the OOW 2019 HOL Pizza Skill.
  5. In the tile for OOW 2019 HOL Pizza Skill, click the Options menu (menu icon) and select Clone.
    screenshot showing the Skills page in ODA. There is a tile for New Skill and a tile for PizzaSkill. Within the tile for PizzaSkill, the Options menu is selected, and it shows menu items for Edit, New Version, Clone, etc.
  6. In the Clone Skill dialog, enter a value for Display Name using the form <your_initials>_PizzaSkill.

    For example, if your initials are AB, you'd name the skill AB_PizzaSkill.

  7. Select the Open cloned skill bot afterwards checkbox.
  8. Click Clone.

    The cloned skill should open in the designer. This will be the starting point for the next section of the lab.

    screenshot showing the skill designer with a skill called PK_PizzaSkill. The left side of the screen has 10 icons, the first of which is selected. The main content area buttons labeled +Intent and More. Below that are entries for CancelPizza and OrderPizza. CancelPizza is selected. To the right of that are details for CancelPizza.

section 1Design the Pizza Skill

In this part of the lab, we'll complete development of the pizza skill that has been started for us. After familiarizing ourselves with the starter skill, we'll:

  • Add a new intent to register complaints.
  • Add logic to the skill's dialog flow to integrate the new intent.
  • Create an entity for pizza size.
  • Train and test the skill.
  • Publish the skill so that it can be used in a digital assistant.

Explore the Skill's Intents and Entities

Before we get to work, let's take a quick look at the intents and entities in the partially-developed pizza skill.

  • Intents are classifications of what users want to do, such as order a pizza.
  • Entities are types of information that you expect in the user input for a given intent, such as the size of pizza the user wants to order.

You should see your clone of the skill open in the skill designer. In the left of the designer, the Intents icon (the Intents icon) should be selected.

Now do the following:

  1. Scroll through the page to look at the details for the currently selected intent (CancelPizza).
  2. Click the OrderPizza intent and quickly scan the Examples section, which contains utterances such as "Can I order a Pizza?".

    These phrases will be used to train the skill's model to understand the various ways someone might ask to order a pizza.

  3. In the left navigation for the designer, select the Entities icon.
  4. Select the PizzaCrust entity and look at how it is configured.

    As you can see, this entity consists of a list of values that reflect the types of crust that a user might want for their pizza. If a user enters one of these values in their initial request, the skill won't prompt them for that detail later.

  5. Now select PizzaType and see how it is configured.

Train and Test the Skill

  1. Locate the Train (Train bot icon) on the top right side of the page.
    Screenshot of the part of the page that shows the Validate and Train buttons
  2. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.
  3. Find the Skill Tester icon (the Skill Tester icon) in the bottom of the skill's left navigation bar and click it.
  4. In the tester's Message field, type I want to order pizza, press Enter.

    You should see a prompt to order a pizza and a list of pizzas that you can select from.

    Screenshot of the tester showing a conversation that begins with 'I want to order pizza', followed by a response of 'ok lets get that order sorted' and a menu of pizzas

    Feel free to try some other phrases of your own for ordering pizza. You may have varying success since at this point the model is only trained with a small number of phrases.

  5. Click the Reset button at the top of the tester window and then close the tester.

Create the File Complaint Intent

Now we'll add a new intent for customers who want to register complaints.

  1. In the left navigation for the designer, select the Intents icon.
  2. Click the + Intent button.
  3. In the Conversation Name field, type File Complaint.
  4. In the Name field, type FileComplaint.
  5. Copy the example sentences below, paste them into the Enter your example utterances here field, and press the Enter key. (You can copy and paste them all at once.)
    • I am upset
    • you charged me too much!
    • I want to file a complaint
    • I am not happy with my recent order
    • my order arrived an hour late
    • you sent the wrong pizza
    • My pizza was cold
    • That pizza was awful!
    • I want to speak with a manager
    • Can I raise a complaint?

    You'll notice that it's fine for utterances to have inconsistent punctuation and capitalization.

Retrain the Skill and Test the New Intent

To enable the skill to understand the new intent along with the previous intents, you need to retrain it. You'll also want to test the new intent to see if it matches with your input phrases.

  1. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.
  2. To do a quick test of the new intent, click the Try it Out! label (screenshot of the Try It Out label), which is to the right of the intent's Description panel.

    The Try Out Intents/Q&A dialog appears.

  3. Select Intent.
  4. In the Message field of the dialog, type I have a complaint and click Send and see how well it matches with the available intents.
    a screenshot of the Try Out Intents/Q&A dialog. It shows the chat message 'I have a complaint'. Below that is a table with rows for the OrderPizza, FileComplaint, and CancelPizza intents. In the right column of each row is a confidence score. For FileComplaint it shows 100%. For the others, it shows 0.
  5. Now enter I need to talk with a manager and click Send.

    For this phrase, FileComplaint should have the highest confidence score, but the other intents might have scores above 0.

    a screenshot of the Try Out Intents/Q&A dialog. It shows the chat message 'I need to talk with a manager'. Below that is a table with rows for the OrderPizza, FileComplaint, and CancelPizza intents. In the right column of each row is a confidence score. For FileComplaint it shows 64.6%. For Cancel Pizza, it is 42.3%. For OrderPizza,it is 6.77%.
  6. Now enter I want to complain and click Send.
    a screenshot of the Try Out Intents/Q&A dialog. It shows the chat message 'I want to complain'. Below that is a table with rows for the OrderPizza, FileComplaint, and CancelPizza intents. In the right column of each row is a confidence score. For FileComplaint it shows only 14.3%. For Cancel Pizza, it is 11.1%. For OrderPizza,it is 8.55%.

    As you can see the confidence scores for this phrase are particularly low, even though we know it's for a complaint. Let's use this opportunity to enhance the training examples.

  7. Make sure that the FileComplaint radio button next is selected and then click Add Example.
  8. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.
  9. Now, back in the Try Out Intents/Q&A dialog, click Send to retry "I want to complain".

    At this point, you should see a very high confidence score for the FileComplaint intent, which is no surprise. Let's try a similar phrase with "complain" in it to see if the new utterance helps.

  10. Now enter I'm going to have to complain and click Send.

    This utterance should also match most closely with FileComplaint, but there might not be so much separation between it and OrderPizza, so we should add this one to the training utterances as well.

  11. Make sure that the FileComplaint radio button is selected and then click Add Example.
  12. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.

This process of testing, checking intent resolution, and adding new phrases is necessary to properly train the skill. Typically you would do this over many iterations and include many different users.

Add an Entity

When a customer orders a pizza, they will want to tailor it to their needs and taste, with size, crust, and type all being variable elements. As such, these elements need to be specified. In our pizza skill, they are represented by entities.

So far we have custom entities for pizza type and pizza crust. Now we'll create one for pizza size.

Create an Entity for Pizza Size

  1. In the left navigation for the designer, select the Entities icon.
  2. Click the Add Entity button to create a new entity.
  3. In the Name field, change the value to PizzaSize.
  4. In the Configuration section, in the Type dropdown, select Value list.
  5. Click the Add Value button.
  6. For Value, type Small.
  7. For Synonyms, type Personal, press Tab, and type smallest.
  8. Click Create.
  9. Following the pattern in the previous four steps, add the value Medium and the synonym middle.
  10. Following the same pattern, add the value Large and the synonyms Big, grande, and biggest.
    a screenshot of the Entities page for the pizza skill. On the left side of the page are entries several entities, and the PizzaSize entry is selected. On the right side of the page, values (and their synonyms are shown for Small, Medium, and Large.

Add PizzaSize to a Composite Bag Entity

To simplify the collection of all of the user input that is required to order a pizza, we're going to use a composite bag entity. With a composite bag entity, the skill recognizes any entity values supplied in the original input and prompts the user for any required entities that are missing.

The PizzaBag composite bag entity has already been created, and it contains items for PizzaType, PizzaCrust, and DeliveryTime (the latter of which is based on the Time system entity). Now let's add PizzaSize to PizzaBag.

  1. Select the PizzaBag entity.
  2. Click Add Bag Item button.
  3. On the Add Bag Item page, fill in the following values:
    • Name: PizzaSize
    • Type: Entity
    • Entity Name: PizzaSize (If prompted in a popup, select Overwrite.)
    • Maximum User Input Attempts: 4
    • Error Message: Sorry, '${system.entityToResolve.value.userInput!'this'}' is not a valid pizza size.
  4. Scroll down in the dialog and click Add Prompt button.
  5. For the value, enter What size do you want your pizza to be? and press Enter.
  6. Again, click Add Prompt button.
  7. For the value, enter Please choose small, medium, or large. and press Enter.
  8. At the top of the dialog, click Close.

Here is what the PizzaBag composite bag should look like in the designer:

Screenshot showing the Entities page in the designer. On the left side of the page is a list of entities, including PizzaBag, PizzaCrust, PizzaSize, and PizzaType. The PizzaBag entity is selected. On the right side of the page, are the Description and Configuration sections. Within the Configuration section, the value of the Type field is Composite Bag, and the Bag Items sub-section contains items for PizzaSize, PizzaType, PizzaCrust, and DeliveryTime.

Note: For an entity to be recognized when parsing the user input message, it needs to be associated with an intent. If you select the Intents tab and then select the OrderPizza intent, you can see that PizzaBag has already been associated with that intent.

Screenshot showing the Entities page in the designer. On the left side of the page is a list of entities, including PizzaBag, PizzaCrust, PizzaSize, and PizzaType. The PizzaBag entity is selected. On the right side of the page, are the Description and Configuration sections. Within the Configuration section, the value of the Type field is Composite Bag, and the Bag Items sub-section contains items for PizzaSize, PizzaType, PizzaCrust, and DeliveryTime.

Update the Dialog Flow with the New Intent

Next we need to update the design of the dialog flow to handle user complaints. The dialog flow is where we choreograph interaction between the skill and its users.

We'll add logic to check if the user is attempting to file a complaint and then map the appropriate action to that attempt. We'll also update the conversation to display the details of the completed order.

  1. Click Dialog Flow icon.
  2. Above the unresolved state, add the new FileComplaint state:
      fileComplaint:
        component: "System.Output"
        properties:   
          text: "We are sorry to hear you are upset. Soon we will have a complaint form. In the meantime, feel free to call us directly."
        transitions:
          return: "done"

    Important: Make sure that you get the indentation exactly right. Each state starts with two spaces of indentation. With each additional level of indentation, you add two more spaces. Also, when inserting text, make sure that the proper indentation on the next line is preserved.

  3. Within the intent state, add the following transition to map the FileComplaint state with the FileComplaint intent:
            FileComplaint: "fileComplaint"

    After you have inserted that transition action, this is what the state should look like:

      intent:
        component: "System.Intent"
        properties:
          variable: "iResult"
        transitions:
          actions:
            OrderPizza: "startOrderPizza"
            CancelPizza: "cancelOrder"
            FileComplaint: "fileComplaint"
            unresolvedIntent: "unresolved"

    Here the System.Intent component, which is used to resolve the user's input, is now also going to check whether the FileComplaint intent was the top resolved intent. If so, the conversation will move to the fileComplaint state and continue from there.

  4. Lastly, to show the user that the skill correctly understood the order, change the showPizzaOrder state's text property to:
    text: "OK, so we are getting you a ${pizza.value.PizzaSize} ${pizza.value.PizzaType} at ${pizza.value.DeliveryTime.date?long?number_to_time?string('HH:mm')}.  This will be on our ${pizza.value.PizzaCrust} crust."

    When you are done, this is how the state should look:

      showPizzaOrder:
        component: "System.Output"
        properties:
          text: "OK, so we are getting you a ${pizza.value.PizzaSize} ${pizza.value.PizzaType} at ${pizza.value.DeliveryTime.date?long?number_to_time?string('HH:mm')}.  This will be on our ${pizza.value.PizzaCrust} crust."
        transitions: 
          return : "showPizzaOrder"

Validate and Train the Pizza Skill

  1. Click the Validate button to validate the skill's dialog flow.

    (The Validate button is in the top navigation, next to the Train button.)

  2. If validation fails, delete the code in the dialog flow, replace it with the contents of the PizzaSkill_BotML.txt file, and validate the flow again.
  3. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.

Test the Pizza Skill

Now let's try some things in the tester to see how the skill responds.

  1. Find the Skill Tester icon (the Skill Tester icon) in the bottom of the skill's left navigation bar and click it.
  2. Type I want to order a medium pizza in the Message field and press Enter.
  3. Click the Intent/QnA tab and observe the Entity Matches section.

    You'll notice that the PizzaSize value is set to Medium:

    Screenshot of the skill tester. On the left side, there is a conversation between the user and the skill. On the right side, the Intent/Q&A tab is selected, there is a graph showing the OrderPizza intent having a match of 100%, and there are entity matches shown for PizzaSize and PizzaBag. For PizzaSize, it shows Value:Medium.
  4. Click the Reset button.
  5. Now try Can I place an order for a medium cheese pizza to be delivered at 9:00 PM.

    As you can see, the skill recognizes values for all of the required entities and expedites the order without further prompting. The PizzaCrust entity is optional, so it defaults to regular crust.

    Note: You are not prompted for PizzaCrust because the PizzaBag composite bag entity is configured to not prompt for pizza crust and to use the regular crust as the default.

    Screenshot of the skill tester. There is a conversation between the user and the skill. The response to the user is 'ok let's get that order sorted' and 'Ok, so we're getting you a Medium cheese at 21:00. This will be on our regular crust.'
  6. Click Reset.
  7. Now let’s try one with a gluten-free crust by typing: I'd like a small veggie lovers pizza delivered at 8:00pm, also can you please make it gluten-free?
    Screenshot of the skill tester. On the left side, there is a conversation between the user and the skill. The response to the user is 'ok let's get that order sorted' and 'Ok, so we're getting you a Small Veggie at 20:00. This will be on our gluten free crust.'
  8. Click Reset.
  9. Now try Can I place an order for a medium cheese pizza to be delivered at 10:00 PM.

    As you can see, the delivery time value is validated. This is handled in the PizzaBag composite bag entity definition.

    Screenshot of the skill tester. There is a conversation between the user and the skill. The response to the user is 'ok let's get that order sorted' and 'Sorry, we only deliver up to 9:30 PM.'
  10. Click Reset.
  11. Now try Can I place an order for a small medium cheese pizza to be delivered at 9:00 PM.

    Since you provided two values for pizza size, it asks you to specify which one.

  12. Click Small to complete the order.
  13. Click Reset.
  14. Next try I want a small cheese pizza.

    The skill asks at what time to deliver the pizza.

  15. Don't enter a time. Instead, to see how the skill reacts when the user changes his mind mid-stream, type actually make it large and press Enter.
  16. When the skill repeats the question about delivery time, type 9:00 PM.

    This is what the conversation should look like:

    Screenshot of the skill tester. On the left side, there is a conversation between the user and the skill. After the user has entered '9:00pm', the response from the skill is 'OK so we are getting you a Large cheese at 21:00. This will be on our regular crust.'

    As you can see, the skill was able to incorporate the change in the order and continue without missing a beat.

  17. Click Reset and close the tester.

Note: Due to the non-deterministic nature of the natural language processing (NLP) models, it's possible that some intents may resolve slightly differently from what you see in these steps.

Publish the Skill

Now that we have completed and tested the skill, it's time to add it to our digital assistant. But first we need to publish it:

  1. Click main menu icon to open the side menu.
  2. Click Development and select Skills.
  3. Click main menu icon again to collapse the side menu.
  4. In the Skills dashboard, find the tile for your pizza skill.
  5. Click the skill's Options menu (menu icon) and select Publish.
    Screenshot showing the pizza skill tile with the Options menu opened, and several menu items displayed, of which Publish is the 4th
  6. On the Publish Skills page, click Publish.
  7. Once you have published the skill, note the icon on the skill's tile that shows it is now read-only.
    Screenshot showing the tile for the pizza skill. In the upper right part of the tile is an icon, the alt text of which is 'Published: Skill bot is read-only'

Congrats! Your skill is now ready to be added to a digital assistant!


section 2Set Up the Shopping Center Digital Assistant

Digital assistants are virtual personal assistants that users can interact with using natural language. When a user engages with the digital assistant, the digital assistant evaluates the user input and routes the conversation to the appropriate skill.

Among other things, the digital assistant:

  • Greets the user upon access.
  • Upon user request, lists what it can do and provides entry points into the given skills.
  • Routes explicit user requests to the appropriate skill.
  • Handles interruptions to flows.
  • Handles disambiguation.
  • Handles requests to exit the bot.

Explore the Digital Assistant

The starter DA that you just cloned consists of two skills – FinancialBot and RetailBot. Later, you'll add your copy of the OOW 2019 HOL Pizza Skill to the DA.

To familiarize yourself with the DA, try it out by following these steps:

  1. Click main menu icon to open the side menu.
  2. Click Development and select Digital Assistants.
  3. Click main menu icon again to collapse the side menu.
  4. On the Digital Assistants dashboard, find the tile for <your_initials>_ODA and select it to open it up in the designer.
  5. Ensure the Skills icon is selected (the Skills icon).

    Notice that FinancialBot and RetailBot are listed there.

  6. Select the RetailBot skill and browse the attributes of its description and interaction model.
  7. Select the FinancialBot skill and browse the attributes of its description and interaction model.
  8. Select the Intents icon.
  9. Note the three intents.

    These are built in to all digital assistants. Here's what they are for:

    • exit: applies when the user signals the desire to exit the current conversation or context in the digital assistant.
    • help: applies when the user asks for help or orientation.
    • unresolvedIntent: applies to user input that doesn't match well with the exit and help intents.
  10. Click the Settings icon and select the Configurations tab to take a look at some of the parameters you can adjust to tune and personalize the behavior of your digital assistant.

    Of particular interest are the various Confidence Threshold settings. Later on, we'll change one of these settings to show how that affects intent resolution.

  11. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.
  12. Find the tester icon (the Digital Assistant Tester icon) in the bottom of the DA's left navigation bar and click it.
  13. In the tester's Message field, type help me, press Enter, and note the DA's greeting and initial menu.

    A menu appears showing what you can do with each skill in the digital assistant (at the moment there are two skills). Depending on your screen size, you may need to click the < and > icons to horizontally scroll between the cards for each skill.

  14. Click the Reset button.
  15. Now try entering Do I have enough money in my savings account, pressing Enter, and observing the response.

    As you can see, the digital assistant finds its way directly to the FinancialBot and gives you a response without any extra prompts.

  16. Click the Reset button.
  17. Close the tester.

Add the Pizza Skill to the DA

With a new pizzeria opening in the shopping center, we want the digital assistant to support this merchant as well. So let's add the pizza skill to our digital assistant and then train the digital assistant so that it can work with the new skill:

  1. In your DA, select the Skills icon.
  2. Click Add Skill button.
  3. Find the tile for your copy of the pizza skill.

    Note: The skill won't appear there if you haven't completed the Publish the Skill part of the lab.

  4. In the tile for your skill, click Add Skill icon.
  5. Click the Close button in the top right of the Skill Catalog.
  6. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.

section 3Personalize Your Digital Assistant

Once you have created a digital assistant and added skills to it, you can customize some of the aspects of the digital assistant, such as the prompts related to the digital assistant’s help and exit intents.

System Intents and Prompts

You can customize the built-in system intents and the prompts that are driven by them.

First, let's add some utterances to the built-in help intent:

  1. In your DA, select the Intents icon.
  2. Select the help intent.
  3. In the Examples section, add the following utterances:
    • Can someone help me
    • What can you do
    • What things do you do
    • What can I ask you

The digital assistant comes with configurable prompts to respond to various types of user input. These prompts can be modified in the DA's configuration settings.

Let's modify the DA's help prompt:

  1. In the DA, click the Settings icon and select the Configurations tab.
  2. Scroll down to the Conversation Parameters section of the page.
  3. Modify the value of Digital Assistants Help Prompt to Welcome! I can do following things for you:
  4. Click Train bot icon, click Submit, and then wait a few seconds for the training to complete.

Test the Utterances and Modified Prompt

To see the new utterances and prompt in action:

  1. Click the tester icon (the tester icon).
  2. In the tester's Message field, type Can someone help me, press Enter, and note the DA's response.
  3. Click Reset and close the tester.

section 4Evaluate Routing Behaviors

Before putting the digital assistant into production, let’s use the tester to evaluate various aspects of its routing behavior.

  • Open the tester by clicking the tester icon (the Digital Assistant Tester icon).

Ambiguous Utterance

  1. In the tester's Message field, type What is my balance? and press Enter.

    Here’s the conversation:

    Screenshot showing the digital assistant tester. After the user input ('What is my balance?') is the DA's response (The text 'Do you want to go to:' followed by options for GiftCardBalance in Sport Store, Balances in Digital Bank, and None of the above.)

    As you can see, the digital assistant is unsure of what the user wants to do, so it provides a prompt asking the user to choose among the Sport Store (which is the invocation name for the RetailBot skill) and Digital Bank skill intents.

  2. Click the Routing tab and scroll down.

    Notice the evaluation in the Intent Calls section that leads to this response:

    Screenshot showing the Intent Calls section of the Routing tab of the DA tester. The significant details are described in the ensuing text.

    Both the candidate skills got high scores (100%). And then for each of those skills, the router identified a candidate flow that also scored highly (also 100%).

    Since the GiftCardBalance and Balances candidate flows exceed the confidence threshold, and since difference between their scores is less than the Confidence Win Margin value (10%), the digital assistant asks the user to choose between those intents.

  3. Leave the conversation in the tester open (don't reset).

Context Awareness

  1. In the conversation in the tester, select Balances in Digital Bank.
    Screenshot showing the digital assistant tester. After the user input ('Balances in Digital Bank') is the DA's response (The text 'For which account do you want your balance' followed by options for savings, checking, and credit card.)
  2. Select checking.
    Screenshot showing the digital assistant tester. After the user input ('checking') is the DA's response ('The balance in your checking account (903423-123) is $2334.56')
  3. Type How much do I have in my savings?

    Here is the response:

    Screenshot showing the digital assistant tester. After the user input ('How much do I have in my savings') is the DA's response ('The balance in your savings account (258293-832) is $2610.56')
    .

Notes on What We Just Did

As you can see, the user starts with the question "What is my balance?", goes through a prompt to disambiguate between the Digital Bank skill and the Sport Store skill, and eventually gets her checking account balance. Then the user enters "What is my balance?" again, but this time doesn't have to navigate through any disambiguation prompts. The info in the Routing tab helps to explain why.

Also note that in the Rules section of the Routing tab, you see the following:

Screenshot of the Rules section of the Routing tab. It shows the detail 'Current context matches with very high confidence. Other skill flows are ignored.'

So, even though there are matching intents from the Sport Store skill, they are ignored. The Intent Calls section shows all of the matching intents, but the entry for “Current Context”, which contains only the Digital Bank skill’s Balances intent, is decisive.

Screenshot showing the Intent Calls section of the Routing tab of the DA tester. For Candidate Skills, Digital Bank and Sports Store match. For Current Context, Digital Bank's Balances intent matches. For Candidate Flows, Digital Bank's Balances intent matches.

Non sequitur

Non sequitur refers to interrupting a conversation flow by changing the subject. Here's an example where such interruptions occur because the user needs info from one skill to complete the flow in another skill.

  1. In the tester, click Reset.
  2. Now type I want to order a small cheese pizza and press Enter.

    Pizza Skill is invoked and here is the response:

    Screenshot showing the digital assistant tester. After the user input ('I want to order a small cheese pizza') is the DA's response ('ok lets get that order sorted' followed by 'When can we deliver that for you?')
  3. To simulate the user suddenly being unsure if he has enough money, type the following: oh, do I have enough money on my credit card?

    At this point the DA detects that the intent corresponds to the Digital Bank skill and offers the user options for cancelling the order and switching to Balances in Digital Bank:

    Screenshot showing the digital assistant tester. After the user input ('oh, do I have enough money on my credit card?') is the DA's response ('Do you want to go to', followed by options for 'CancelPizza in PizzaSkill', 'Balances in Digital Bank now' and 'None of the above'.
  4. Select Balances in Digital Bank.
     Screenshot showing the digital assistant tester. After the user input ('Yes') is the DA's response ('The balance in your credit card account (4352-3423-1234-5239) is $-208.88' followed by 'Your remaining credit is $4791.12' followed by 'Do you want to resume OrderPizza in Pizza King now?' followed by Yes and No options.

    The user is presented with his financial details, thus completing that flow. At that point, the DA asks if it can return back to the pizza skill.

  5. Select Yes.
    Screenshot showing the digital assistant tester. After the user input ('Yes') is the DA's response ('When can we deliver that for you')

    The DA returns to the pizza skill and resumes the conversation where you left it:

  6. Type 9:00 PM and press Enter.
    Screenshot showing the digital assistant tester. After the user input ('9:00 PM') is the DA's response ('Ok so we are getting you a Small cheese at 21:00. This will be on our regular crust')
  7. Click Reset.

In this sequence, you started ordering a pizza, confirmed you had enough money in your account, and finished ordering the pizza.

Tune Confidence Thresholds to Optimize Routing Behavior

You can adjust various confidence thresholds to affect routing behavior. For example, you might want user input to have a particularly high confidence score for an intent before it is matched with that intent.

Here's an example that illustrates the impact that tuning of confidence thresholds can have.

  1. In the tester, type Can you cancel my pizza order into the Message field and press Enter.

    Your results should look something like this:

    Screenshot of the tester showing input of 'can you cancel my pizza order', followed by a response of 'Do you want to go to' and menu items for CancelPizza in Pizza Skill, CancelOrder in Retail Skill, and None of the Above.
  2. Select the Routing tab and scroll down to the Intent Calls section.
    Screenshot of the tester showing the Routing tab. In the Intent Calls section, there are matches for Pizza Skill and Retail Skill.

    As you can see, the input generates matches for both Pizza Skill and Retail Skill, thus explaining the choice that is given to the user in the conversation.

    Now we'll change the threshold setting for candidate skills to see what effect this has.

  3. Click Reset and close the tester.
  4. Click the Settings icon, select the Configurations tab, and scroll down to the Routing Parameters section.
    Screenshot of the Settings page for a digital assistant. The Configurations tab is selected. In the Routing Parameters section of the page, the Candidate Skills Confidence Threshold property is highlighted.
  5. Change the Candidate Skills Confidence Threshold value to 0.9.
  6. Click the Digital Assistant Tester icon, click Reset, type Can you cancel my pizza order into the Message field, and press Enter.

    This time you should see very different results. Notice now how the digital assistant went immediately to order cancellation in the pizza skill.

    Screenshot of the tester showing input of 'can you cancel my pizza order', followed by a response of 'Your order is canceled'. In the Routing Tab, Pizza Skill is the only Candidate Skill that matches with a score over 90%.

    In the Routing tab, there is no longer a match for Sport Store.

    Screenshot of the tester's Routing tab, where the pizza skill is the only Candidate Skill that matches with a score over 90%.

    Now that you can see the impact that this setting has, it's best to return its value to a more realistic level.

  7. Click Reset and close the tester.
  8. Click the Settings icon, select the Configurations tab, and scroll down to the Routing Parameters section.
  9. Change the Candidate Skills Confidence Threshold value back to 0.4.

section 5Explore and Evaluate Skill Insights

Now let's take a look at ways to harvest insights from user interactions with the digital assistant.

  1. Click main menu icon to open the side menu.
  2. Click Development and select Skills.
  3. Click main menu icon again to collapse the side menu.
  4. Open your pizza skill.

  5. Click Insights (The Insights icon) in the left navbar.

    In the Conversations tile, you should see that there have been several conversations logged (from completed conversations you had when testing the pizza skill and digital assistant).

    Let's run through some more conversations to create some more varied insights data.

  6. Click the Skill Tester icon (the Skill Tester icon) in the left navbar.
  7. Start the conversation by entering Hi and then take a look at the skill response.

    As you can see, the skill has not been trained to handle this greeting, so the conversation completes in an unresolved state.

    Screenshot of the tester showing input of 'Hi', followed by a response of 'I don't understand. What do you want to do?'. In the Conversations tab, is a graphic showing that the intent state is called first and then the unresolved state is called.
  8. Click Reset.
  9. Now enter I would like to order a special pizza.

    A list of pizzas should appear.

  10. Instead of selecting a pizza, enter the following sentences, one after the other:
    • that's not what I am looking for
    • need something special actually
    • how about a sandwich

    You'll notice that the skill shows that it's not able to place an order.

    Now we'll use Insights to understand how well the skill managed those conversations and whether can identify any problems the user may have encountered.

  11. Close the tester.
  12. Click Insights (The Insights icon) in the left navbar.

    In the Conversations tile, you should see that two more conversations completed since you last looked at this report.

    Comparing with the state of the report before we added those two conversations, we can assume that:

    • The "Hi" conversation resulted in an unresolved intent, as we previously noticed in the Conversation tab of the tester.
    • The other conversation resulted in a completed "OrderPizza" conversation.

    The Conversations report doesn't differentiate between a conversation which completes with an order and a conversation that completes through the skill's handling of incorrect input. To better understand these differences, we have to drill down further.

  13. In the bar graph in the Intents panel, click the bar for OrderPizza to display detail on those conversations.

    You should then see something like what's in the following image:

  14. Click the Conversations tab to display summaries of logged conversations.

    You'll notice that the first one in the list of these conversations (the most recent) was our attempt to order "a special pizza".

    You can click View Conversation link for any of the entries in that list to see the conversation in chat form.

  15. Now click the Paths tab.

    Here we'll use the dropdowns to filter our results so that we can focus on specific patterns.

  16. From the Intent dropdown, select OrderPizza.
  17. From the Outcomes dropdown, select Completed.

    You should see something like the following:

  18. From the Final State dropdown, select showPizzaOrder to show the conversations that resulted in a pizza being ordered.
  19. Now, from the same dropdown, select maxError.

    There's a single conversation that ended with the maxError state. In that conversation, the previous state is resolveEntities. From that information, we can guess that the skill has moved to maxError because the appropriate user input couldn't be captured for all of the required entities.

Congratulations on completing the main part of the lab. If you have some time left, you can move on to the next part to deploy your digital assistant on a web page.


section 6Bonus Section: Add the Digital Assistant to the Web Channel

Channels carry the chat back and forth from users on various messaging platforms to the digital assistant.

In this part of the lab, we'll configure and publish our DA through a web channel, install a sample client application, and run and test it against the DA.

Download Node.js and the ODA Client Samples

  • Node.js (https://nodejs.org/en/download/).
  • The ODA Client samples for JavaScript v19.1.5.

    To get them, navigate to http://bit.ly/amcedownloads, scroll down to the ODA Client SDKS section, select oda-client-sdk-js-samples-19.1.5.0.zip for download, and accept the Oracle Technology Network license agreement.

    screenshot showing the ODA Client SDKs section of a web page. It contains a table with 6 items. The sixth row, which contains a download for oda-client-sdk-js-samples-19.1.5.0.zip								is circled in red.

Create a New Channel

  1. Click main menu icon to open the side menu.
  2. Click Development and select Channels.
  3. Click main menu icon again to collapse the side menu.
  4. On the Users tab, click + Channel.
    Screenshot showing a small section of the Channels page. The Users tab is selected. The Add Channel button is the first item in the tab.
  5. In the Create Channel dialog, fill in the Name field using the form <your_initials>_Channel
  6. From the Channel Type dropdown, select Web.

    The completed dialog might look something like this:

    Screenshot of the Create Channel dialog. It's Name, Description, and App Display name fields are filled out. The Channel Type field is set to Web.
  7. Click Create.

    Once created, you are returned to the page for the channel.

    Screenshot of the Channels page with none of the fields filled in. The Route To field is the first field in the list of fields.
  8. Open the Route To dropdown menu, enter your DA name in the Filter box, and select your DA.
  9. Switch Channel Enabled to ON.
  10. Copy the the value of the App Id field to a text file.

    You will use it later on in this lab while running the sample client application.

Set Up the Web Channel on Your Local Machine

For purposes of this lab, we'll set up using your machine's localhost instead of using a public-facing web server.

  1. Find the oda-client-sdk-js-samples-19.1.5.0.zip file that you just downloaded and extract its contents.
  2. Open a terminal window or command prompt and navigate to the chat-sample-web directory of the contents of the extracted zip.
  3. Run the following command:
    npm install
  4. Start the sample ChatSample app by running the following command:
    node server.js

    After running this command, you should see a message indicating that the server is listening on port 3000.

    Screenshot of a terminal window. It contains a line showing that 'node server.js' has been called and the ensuing output ('listening on port 3000')

Test the DA on the Web Channel

  1. Open a new browser window and navigate to http://localhost:3000.
  2. Enter the app ID that was generated when you created the channel (and which you copied to a text file) and click Continue.
    Screenshot of a web browser. In the address bar, it shows 'localhost:3000'. The page has some label text ('Mobile Cloud Enterprise' and 'Cloud'), a text field, and a Continue button.
  3. In the next screen, click the Chat with your BOT button.

    The Web Messenger widget should appear in the right side of your browser window.

    Screenshot of a web browser.  The page has some label text ('Mobile Cloud Enterprise', 'Cloud', 'Welcome', and 'This sample app shows how to use the Oracle Intelligent BOT SDK to embed chat function in a web app'. Below that are buttons for 'Chat with your BOT' and 'Clear Chat'). To the right is a chat window.
  4. Start communicating with the DA by asking for help and/or making specific requests, such as ordering pizza and checking account balances.
    A screenshot of a chat window showing a conversation starting with 'What can you do for me today?' and continuing with a welcome message and a menu of options provided by the Digital Bank and Pizza King skills (though the latter is cut off on the right margin of the window).

You have now introduced your DA to its public by hooking it up to a web interface.


more informationWant to Learn More?