arrow_back

Design Conversational Flows for your Agent

Sign in Join
Test and share your knowledge with our community!
done
Get access to over 700 hands-on labs, skill badges, and courses

Design Conversational Flows for your Agent

Lab 1 hour 30 minutes universal_currency_alt 1 Credit show_chart Introductory
info This lab may incorporate AI tools to support your learning.
Test and share your knowledge with our community!
done
Get access to over 700 hands-on labs, skill badges, and courses

GSP791

Google Cloud self-paced labs logo

Overview

Contact Center AI can increase customer satisfaction and operational efficiency by improving call deflection rates, and achieve shorter handling, while making overall operations faster and more effective.

Call deflection allows you to automatically route calls to different destinations based on certain conditions. For example, you can deflect calls to a different queue, phone number, or voicemail if the caller is outside of operating hours or if the estimated wait time is too long.

What you'll learn

In this lab you'll learn how to use Dialogflow to create a conversational interface and perform the following tasks:

  • Design end-user's intentions.
  • Build a conversational agent for an online travel agency.
  • Define intents for our online travel agency use case to match typical user queries.

Lab scenario

You have been asked to build a plan to increase the Net Promoter Score and increase customer satisfaction. With Contact Center AI you are able to increase call availability, remove complicated menu systems, and achieve shorter handling times. The heart of Contact Center AI is its conversational core, whose human-like interactions are redefining the possibilities of AI-powered conversation.

Dialogflow is one of the core components of Contact Center AI. Dialogflow will identify customer intent and determine what to say and do next. With this you are able to increase call availability and achieve shorter handling times, thus increasing your Net Promoter Scores and customer satisfaction.

Dialogflow components

Agents

A Dialogflow agent is a virtual agent that handles conversations with your end users. It is a natural language module that understands the nuances of human language. Dialogflow translates end user text or audio during a conversation to structured data that your apps and services can understand. You design and build a Dialogflow agent to handle the types of conversations required for your system.

A Dialogflow agent is like a human call center agent. You train them both to handle expected conversation scenarios, and your training does not need to be overly explicit.

Intents

An intent categorizes an end-user's intention for one conversation turn. For each agent, you define many intents, where your combined intents can handle a complete conversation. When an end-user writes or says something, which is referred to as an end-user expression, Dialogflow matches the end-user expression to the best intent in your agent. Matching an intent is also known as intent classification.

For example, you could create a weather agent that recognizes and responds to end user questions about the weather. You would likely define an intent for questions about the weather forecast. If an end user says "What's the forecast?", Dialogflow would match that end user expression to the forecast intent. You can also define your intent to extract useful information from the end user expression, like a time or location for the desired weather forecast. This extracted data is important for your system to perform a weather query for the end user.

Intents example diagram

A basic intent contains the following:

  • Training phrases: These are example phrases for what end users might say. When an end user expression resembles one of these phrases, Dialogflow matches the intent. You don't have to define every possible example, because Dialogflow's built-in machine learning expands on your list with other similar phrases.
  • Action: You can define an action for each intent. When an intent is matched, Dialogflow provides the action to your system, and you can use the action to trigger certain actions defined in your system.
  • Parameters: When an intent is matched at runtime, Dialogflow provides the extracted values from the end user expression as parameters. Each parameter has a type, called the entity type, which dictates exactly how the data is extracted. Unlike raw end user input, parameters are structured data that can easily be used to perform some logic or generate responses.
  • Responses: You define text, speech, or visual responses to return to the end user. These may provide the end user with answers, ask the end user for more information, or terminate the conversation.

The following diagram shows the basic flow for intent matching and responding to the end-user:

Flow for intent matching and responding to the end user

Entities

Each intent parameter has a type, called the entity type, which dictates exactly how data from an end user expression is extracted.

Dialogflow provides predefined system entities that can match many common types of data. For example, there are system entities for matching dates, times, colors, email addresses, and so on. You can also create your own custom entities for matching custom data.

Contexts

Dialogflow contexts are similar to natural language context. If a person says to you "they are orange", you need context to understand what "they" is referring to. Similarly, for Dialogflow to handle an end user expression like that, it needs to be provided with context to correctly match an intent.

Using contexts, you can control the flow of a conversation. You can configure contexts for an intent by setting input and output contexts, which are identified by string names. When an intent is matched, any configured output contexts for that intent become active. While any contexts are active, Dialogflow is more likely to match intents that are configured with input contexts that correspond to the currently active contexts.

Follow-up intents

You can use follow-up intents to automatically set contexts for pairs of intents. A follow-up intent is a child of its associated parent intent. When you create a follow-up intent, an output context is automatically added to the parent intent and an input context of the same name is added to the follow-up intent. A follow-up intent is only matched when the parent intent is matched in the previous conversational turn. You can also create multiple levels of nested follow-up intents.

Dialogflow provides many predefined follow-up intents for common end user replies like "yes", "no", or "cancel". You can also create your own follow-up intents to handle custom replies.

Fulfillment for integrations

By default, your agent responds to a matched intent with a static response. If you're using one of the integration options, you can provide a more dynamic response by using fulfillment. When you enable fulfillment for an intent, Dialogflow responds to that intent by calling a service that you define. For example, if an end-user wants to schedule a haircut on Friday, your service can check your database and respond to the end-user with availability information for Friday.

Each intent has a setting to enable fulfillment. If an intent requires some action by your system or a dynamic response, you should enable fulfillment for the intent. If an intent without fulfillment enabled is matched, Dialogflow uses the static response you defined for the intent.

When an intent with fulfillment enabled is matched, Dialogflow sends a request to your webhook service with information about the matched intent. Your system can perform any required actions and respond to Dialogflow with information for how to proceed.

Design your intents

Take five minutes and write down the intents for the lab use case. The key here is the training phrases associated with the intents: These are example phrases for what end-users might say. In this use case they can be as follows:

Intent: Change a name on a reservation

Training Phrases:

  1. I want to change name on my itinerary
  2. Change name on my reservation
  3. Change name
  4. I want to change my name on my hotel reservation

Think of other possibilities and write them down. The key here is to increase call availability, remove complicated menu systems and achieve shorter handling times. By having Contact Center AI handle these intents we can achieve these goals.

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab---remember, once you start, you cannot pause a lab.
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To view a menu with a list of Google Cloud products and services, click the Navigation menu at the top-left. Navigation menu icon

Task 1. Enable the API

In this task, you enable the Dialogflow API.

  1. In the Google Cloud console, in the Navigation menu (Navigation menu icon) click APIs & Services > Library.
  2. Search for Dialogflow API.
  3. Click the Dialogflow API in the results, and then click Enable.

Task 2. Create your first Dialogflow agent

In this task, you create the agent named "pigeon-travel".

  1. Open the Dialogflow Console.

  2. If required, sign in with the Google button. Make sure to select the lab credentials provided to you for this lab. Click Allow.

  3. Accept the Terms of Service.

  4. Click Create Agent.

  5. Add the following agent information and leave the remaining settings as thier default:

Field Value
Agent Name pigeon-travel
Default Time Zone America/Denver
**Google Project **
  1. Click Create.

Click Check my progress to verify the objective. Build an Agent

The Dialogflow console menu

The Dialogflow, Intents page opens. On the left is the menu pane and on the Dialogflow simulator. This lets you test your agent by speaking or typing messages.

Note:If you're working on a smaller screen and the menu is hidden, click the Menu icon (Menu icon) in the upper left corner.

The settings icon (settings icone) takes you to the current agent's settings.

The Intents page shows the list of intents for the agent. By default, Dialogflow agents start with two intents. Your agent matches Default Fallback Intent when it doesn't understand what your users say. The Default Welcome Intent greets your users. These can be altered to customize the experience.

Query your agent

Agents can be described as NLU (Natural Language Understanding) modules. These can be included in your app, product, or service and transform natural user requests into actionable data.

Try your agent

  1. In the simulator on the right, click into the text field that says Try it now, type Hi, and press ENTER.

You just spoke to your Dialogflow agent! The Default Welcome Intent is preconfigured to understand basic greetings and to reply with a generic response.

Note: If you didn't see the default welcome response, click Save to trigger the agent training and try entering "Hi" again.

Now replace the generic greeting with something that lets your users know who you are.

  1. Click the default Welcome Intent in the middle of the console.

The default Welcome Intent is now visible at the top of the console.

  1. Scroll down to the Responses section. Remove all predefined responses by clicking the trash icon in the corner of the table that contains the responses.
  2. Confirm the response section is empty.
  3. Click Add Response, then click Text Response and add the following responses:
  • Welcome to Pigeon Travel. I can assist you with making a reservation or modifying a reservation. Which would you like ?
  • Hello there. I can assist you with making a reservation or modifying a reservation. How may I help you today ?
  1. Click Save.

  2. Try it by entering Hi or Hello in the agent simulator and see how it responds.

You would customize the Default Fallback Intent the same way you just customized the default Welcome Intent.

In real life, in addition to the default responses, you would need custom intents to answer specific queries.

Task 3. Create your first intent

Dialogflow uses intents to categorize a user's intentions. Intents have Training Phrases, which are examples of what a user might say to your agent. For example, someone wanting to change their name on a reservation may say "I want to change name on my itinerary", "I need to change my name on the booking" or "Can I change name on my reservation?". All these queries are unique but have the same intention: to change their name on a reservation.

To cover this query, create a name.reservation intent:

  1. Click the next to Intents in the left menu.

  2. Set Intent name to name.reservation.

  3. In the Training Phrases section, click Add Training Phrases and enter the following, pressing enter after each entry:

  • I want to change my name on my itinerary.
  • Can I change my name on my reservation?
  • I need to change my name on the booking.
  • I want to change my name on my hotel reservation.
  1. In the Responses section, click Add Response.

  2. Under Text Responses, enter the following response in the text field: Sure I can help you to change your name on the reservation.

  3. Click Save. You may also notice the messages Agent Training started and Agent Training completed on the bottom right of the screen. This lets you know that Dialogflow is retraining your agent model based on the phrases you added.

  4. Once training is done, try it using the simulator on the right by asking the question: change name on booking?

Your agent now responds to the query correctly with Sure I can help you to change your name on the reservation..

Notice that even though your query was a little different from the training phrases, Dialogflow still matched the query to the right intent, which in this case is the name.reservation intent as shown in the simulator output.

Dialogflow uses training phrases as examples for a machine learning model to match users' queries to the correct intent. The machine learning model checks the query against every intent in the agent, gives every intent a score, and the highest-scoring intent is matched. If the highest scoring intent has a very low score, the fallback intent is matched.

Click Check my progress to verify the objective. Create your first intent

Task 4. Extract data with entities

In this section you'll learn how to extract data from a user's query to let them change their name on the reservation. For this example, the agent will not only need to know that a user wants to change their name but also the reservation number and the new name.

Add parameters to your intents

Parameters are important and relevant words or phrases in a user's query that are extracted so that your agent can provide a proper response.

  1. Click Intents in the left pane.

  2. Click name.reservation.

  3. In the Responses section, change the Text Response to: Sure I can help you to change your name on the reservation. Can I have your first name?.

  4. Click SAVE.

  5. Click Intents in the left pane.

  6. Hover over the name.reservation intent and click Add follow-up intent then choose custom.

  7. Click the newly created follow-up intent name.reservation - custom.

  8. Name the intent name.reservation-getname at the top of the intent page.

  9. Add the following as Training Phrases:

  • sam
  • john
  • mary
  1. Under Action and Parameters, click the value @sys.person in the entity column.

  2. In the dialog that opens, type @sys.given-name in the Filter field.

  3. Select @sys.given-name.

  4. In the Responses section, enter Thank you $given-name. and then click Save.

  5. Once the agent is done training, click Intents in the left menu.

  6. Click the expander arrow next to the name.reservation intent.

Click Check my progress to verify the objective. Create custom intent

Use parameter data

Try it

  1. Now, query your agent with change name on booking in the simulator in the right panel.

You should see the simulator ask for your first name.

  1. Now, in the query enter your first name and you will now have a personalized message to the user.

This is all great, but don't forget that you still need to extract other parameter values like last name and reservation number.

Task 5. Use slot-filling

Although you have updated the response to include the first name parameter, how can you ensure that you get all that info from the user? The answer is slot-filling. The agent needs to make sure that if the user does not provide this info, it will need to prompt the user to provide it.

  1. Click Intents in the left menu.

  2. Click the expander arrow next to the name.reservation intent.

  3. Click the intent name.reservation-getname.

  4. In the Actions and parameters section, enter the following parameters:

  • For the first parameter, click New parameter and set the following fields. Leave all others as the default.
Field Value
Required Checked
Parameter name reservationnumber
Entity @sys.number
Value $reservationnumber
Prompts What is your reservation number?
  • For the second parameter, click New parameter and set the following fields. Leave all others as the default.
Field Value
Required Checked
Parameter name newname
Entity @sys.number
Value $newname
Prompts What is the new name for the reservation?
  1. In the Responses section, change the text response to: Thank you $$given-name. I have changed the name on reservation number $$reservationnumber to be $newname.

  2. Click Save.

  3. Try it in the simulator by typing the question: change name on booking and follow along.

Click Check my progress to verify the objective. Use slot-filling

Task 6. Export your agent

In this section you export your agent as a zip file so that you can import it later when you start the next lab. This way you can reuse the intents and entities you've configured so far.

  1. In the left pane, click Settings (⚙) next to pigeon-travel.

  2. In the pigeon-travel page that opens, click the Export and Import tab.

  3. Click EXPORT AS ZIP. This download's your agent to your device as a zip file.

Congratulations!

You have learned how to use Dialogflow to create a conversational interface and design the end-user's intentions.

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated November 18, 2024

Lab Last Tested October 30, 2023

Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

This content is not currently available

We will notify you via email when it becomes available

Great!

We will contact you via email if it becomes available