Introducing Alexa Conversations

Alexa Conversations is a relatively new feature of the Alexa platform that enables richer and more flexible multi-turn conversations than what the original dialog model could ever achieve. At this time, Alexa Conversations is generally available in the “en_US” locale and in beta for “en-AU”, “en-CA”, “en-IN”, “en-GB”, “de-DE”, “ja-JP”, “es-ES”, and “es-US”.

Alexa Conversations, much like the dialogs we created in Chapter 4, Creating Multi-Turn Dialogs, work toward the goal of achieving some sort of task, such as planning a interplanetary vacation. Along the way, there is a back and forth exchange between Alexa and the user in which questions asked by Alexa are answered by the user, ultimately arriving at the completion of the task.

Where Alexa Conversations differs from dialogs is that Alexa Conversations are backed by an artificial intelligence engine that expands a conversation model defined by the Alexa developer, to cover conversations that the developer may have never imagined.

Creating a Better Dialog

To illustrate the power of Alexa Conversations, consider the following trip-planning dialog:

User: Let’s plan a trip

Alexa: Where do you want to go?

User: Mars

Alexa: When will your trip start?

User: June 9th

Alexa: When will your trip end?

User: June 16th

Alexa: I’ve got you down for a trip to Mars between June 9th and June 16th. Is that correct?

User: Yes

Alexa: Great! Enjoy your trip to Mars!

This kind of dialog is what we created in Chapter 4, Creating Multi-Turn Dialogs using Alexa dialogs. It handles the essential case where the user wishes to plan a trip and Alexa interviews the user to find out details of the trip. It works well, as long as the user doesn’t go off-script.

For example, what might happen if instead of sticking to the designed dialog, the user were to take a slight tangent along the way, asking about the weather:

User: Let’s plan a trip

Alexa: Where do you want to go?

User: What’s the weather like on Jupiter?

Alexa: Star Port 75 Travel doesn’t offer travel to the weather like on Jupiter. Where else would you like to go?

Oops! Alexa didn’t understand the question. Alexa asked the user where they want to go, but then the user asked a question about the weather on Jupiter. At this point, Alexa expects the user to specify a destination, but instead heard “What’s the weather like on Jupiter?” This fails validation with the destination slot (because the phrase “weather like on Jupiter” isn’t one of the entries in the PLANETS slot type) and results in a confusing response from Alexa.

Or what if the user changes their mind on a previously given answer? Consider the following dialog:

User: Let’s plan a trip

Alexa: Where do you want to go?

User: Mars

Alexa: When will your trip start?

User: June 9th

Alexa: When will your trip end?

User: June 16th

Alexa: I’ve got you down for a trip to Mars between June 9th and June 16th. Is that correct?

User: I want to visit Saturn instead

Alexa: Okay, let’s start over. How can I help you?

Once all of the slots have been filled, Alexa just needs confirmation of the trip details. The user decides on a different destination, which Alexa incorrectly interprets as a negative response, and sends an intent request for the ScheduleTripIntent intent with a confirmation status of “DENIED”.

As you can see, standard Alexa dialogs have a few shortcomings. But Alexa Conversations can do better. Alexa Conversations is an alternative approach to designing multi-turn conversations. With Alexa Conversations, you define a conversation model that includes handful of sample dialog—each representing a possible exchange between a user and Alexa. Then you feed the conversation model to Alexa’s AI engine which expands the conversation model to include many more dialogs that could happen.

Before we start on our Alexa Conversations skill, let’s cover a few basic concepts that you’ll encounter as you define a conversation model.

Understanding the Conversation Models

These are the most important Alexa Conversations concepts to grasp:

  • Dialogs
  • Events and Utterance Sets
  • Actions
  • Acts (Request and Response)
  • Types

Dialogs are the fundamental element of a conversation. They describe the back and forth exchange between Alexa and the user to ultimately achieve some task. As you define a conversation model for your skills, you will create a dialog that itself will contain one or many sample dialogs describing different paths that the discussion can take toward achieving the task.

Events are triggers that are external to a skill, most often something that the user says. Events are defined around utterance sets which list several possible things a user may say to trigger the event.

An action is something that represents some aspect of the skill’s behavior. Some examples of actions include when Alexa says something to the user, when the skill expects an event, or the confirmation of some other action. You can also define your own custom actions for your skill, most commonly as a means of transferring data to your skill’s fulfillment code.

There are two kinds of acts: request and response acts. Request acts provide semantic meaning to an event. Events themselves are only triggered in response to an utterance spoken by a user. But a request act applies meaning to what was spoken. For example, if the user says, “I want to visit Pluto,” then an event will be triggered and an inform request act will be associated with the event, enabling Alexa to understand that the user is providing information to the conversation.

Response acts, on the other hand, apply semantic meaning to a response action. For example, if the response has Alexa saying, “Are you sure you want to visit Pluto?” a human may understand that as Alexa asking for confirmation, but it requires that the response be associated with a confirmation act for the conversation model to understand the response’s role in the dialog.

Finally, types represent some information or concept within the context of a dialog. Both request and response acts themselves are defined as types in Alexa Conversations. But more commonly, you’ll think of types as some custom type that you’ll use to carry data around in the course of a conversation. Custom types like the PLANETS type we defined in Chapter 3, Parameterizing Intents with Slots can be used in Alexa Conversations, but you can also define record types as part of the conversation model that act as holders for a conversation’s context. For example, you might define a custom type that holds trip details that are given by the user in the course of planning a trip.

Those basic concepts will become more apparent as you build your Alexa Conversations skill. Speaking of which, let’s get started on that right now.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset