9 Ways To Make Your Dialogflow Agents More Reliable

Josh Barkin
Being Janis
Published in
9 min readDec 16, 2019

--

If you like this story, consider taking my Dialogflow Course.

Dialogflow has proven to be the most popular conversational AI used by chatbot makers but it’s not a magic bullet. Simply connecting a Dialogflow agent to a customer experience doesn’t give your business superpowers. Dialogflow provides you with technology you can use to automate your understanding of messages sent by users, but you’ll need to understand how to make use of the technology so it works reliably and produces business results.

1. Understand what NLP can do and it’s limitations

Having a clear understanding of what NLP can and can’t do is your first step to benefiting from the technology and having it work reliably.

If you drank the Kool Aid when Mark Zuckerberg pitched developers and investors on bots at the F8 conference in 2016, I’ll reset your expectations. You can’t really chat with a business like a friend. In real life, a conversational experience with a friend can take a number of complex turns, yet go on forever without a hitch. You can write your friends long and cryptic messages and they can decipher your messages, and if they don’t understand a message you sent, they can simply ask you to clarify what you mean. Dialogflow enables your business to be efficient at three things:

  1. Understanding that one message can mean the same thing as other messages because they have been grouped together (in Intents).
  2. Setting the context for a group of Intents means you can understand that messages are within a dialog. A message of “Yes” from a user can mean different things depending on the context, for example. Dialogs should be short and goal-oriented though. A funnel that guides a user through a series of questions can help you collect data and the context can be maintained as you prompt users for responses and receive responses.
  3. Getting usable data out of free form messages. For example, if a user says “I need 2 pizzas”, 2 can be a variable. It could be 1,2,3, or any number to indicate some quantity of pizzas, but you can extract that information from the user’s message, store that number temporarily in Dialogflow in a parameter, or export that data to another system where it’s standardized in a database so you can act on, or use data reliably.

2. Don’t train everything!

For those of you who have worked with Dialogflow before, you already know that training AI is an ongoing process, but in my opinion, more AI training time doesn’t necessarily translate to a smarter chatbot. Time simply allows you to collect enough meaningful data and categorize that data so you can benefit from it in a meaningful way. If you try and train every message you receive, you risk producing inaccurate responses and it will be a nightmare to manage. Create a focused set of Intents and ensure that your training phrases are directly related to the goal of the Intent. A set of 50+ intents that can answer frequently asked questions (for sales and customer service) is a good use of Dialogflow.

A set of Intents to capture common messages and questions relating to eCommerce

You should have, at a minimum, 10 training phrases in each Intent so you can reliably trigger the Intent and deliver the right response.

Having a set of “Small talk” Intents isn’t going to solve any business problems, but does give your bot some personality and can delight your users. For example, if a user says “Thanks”, you’ll probably want to have an Intent to understand that message (including variations of thanks), and simply acknowledging the user with an automated response of “You’re welcome” is both delightful and engaging.

3. Make Intents easy to manage

Dialogflow doesn’t have a folder system for Intents, so that means you’ll need to get creative in how you name your Intents so it’s easy to manage. A good strategy is to name your Intents so they follow a clear, hierarchal structure. I generally name my Intents so they are grouped together, making it easy to access similar, or related Intents.

I like to include version numbers in the Intent names. If you replace an Intent with a different Intent then Dialogflow will only look at the Intent name, not any of the other parts of the Intent to determine if the Intent is replaced. Version numbers allow me to maintain multiple versions of the same Intent, and then I can simply delete Intents I no longer need, or if I want to revert back to an older version of the same Intent, I can delete a newer version of it by referring to a version number.

4. Create lots of Entities

The most basic definition of an entity is that it’s a list of possible values. Dialogflow has built-in entities so you don’t have to create a list of every country for example. You can just highlight a country name in your training phrase and give it the @sys.geo-country entity, and then you only need one training phrase. A user’s country can be variable. I go overboard with my entities because even certain words can be expressed in different ways. In this example, a user may express that they want to change an order, but even the word “change” could be expressed differently from one user to the next. You can see how I’ll make even this word variable.

If you can capture the different utterances that mean change then you can increase the accuracy that the user will trigger the right Dialogflow Intent and you can accurately respond. I just need one training phrase like “make a change to my order” and I’ll assign the word change my custom @order-change Entity.

5. Use Different Entity Values In Your Training Phrases

If you create an Entity with a number of different possible values, make sure you refer to the entity by using different values in your training phrases. For example, let’s say you run an eCommerce business and create a custom entity called @shipping-countries and it’s a list of countries your business will ship to. There might be a number of ways users ask your bot about shipping, and you might have a number of different phrases in your intent (At least 10). Each phrase should be different, but if you refer to a different value in your entity (the different countries that you ship to), this will improve matching and you’ll help ensure that Dialogflow triggers the right Intent by more deeply mapping an entity value to training phrases that refer to the Entity.

6. Mask Failure

Every Dialogflow agent has a Default Fallback Intent and when your bot doesn’t have a response for a user, you’ll trigger this Intent. Your users will hit this Intent probably more often than you like, at least in the early stages when you’re just starting to train your Dialogflow agent, but you can make your Dialogflow agent appear to be more reliable by only triggering this Intent periodically instead of every time the user sends a message that has no trained response. Simply roll over the Default Fallback Intent and add a follow-up intent. From the menu that pops up select Fallback and you’ll add a follow-up intent that is also a fallback!

The first time a user sends a message the bot doesn’t understand, I’ll simply respond with a random message like “Got your message” or “Can you rephrase that?”. Then, if they send another message right after that and the bot doesn’t understand that either, I’ll respond with “I’ve passed that message on to the team”, and in the third fallback follow-up intent, I don’t include any response at all for the user! This way I’m able to handle bot failure more gracefully. Even though the bot didn’t have a response to the user’s message, the bot still appears to be intelligent. Because these follow-up fallback intents are connected, context is maintained through successive messages. You could add more follow-ups too if you want, but at least you don’t have to respond with “Sorry I didn’t get that” every time the bot can’t respond to a message. You can mask failure and funnel users through that and by doing so, turn a negative experience for the user into a positive and reliable experience.

At the very least, consider multiple fallback messages and rotate them so that any misunderstanding doesn’t seem like messaging’s equivalent to an error 404 page on the web. You, nor your users want to hit a dead end, but if your fallback responses are creative enough, then you might just delight users with the unexpected.

7. Refocus users

When communication with your bot breaks down in the middle of a conversational funnel, you can respond with two messages in succession. The first is the fallback message and the second is a reminder of the context.

In this sense, you’re able to move the focus back to your goals and not let the misunderstanding become a distraction in your user experience. You can accomplish this by adding a “Follow-up Intent” that’s a fallback and in that Intent simply have two responses.

Add two follow-up Intents that connect to the fallback Intent, one for yes, and the other for no.

Now when you ask the user if they are still interested in whatever it was you’re selling them and they respond “Yes” (or some variation of yes), you’ll know the context of their response.

8. Make Help Obvious and Accessible

A good strategy is to tell the user right at the beginning of a conversation that if they get stuck they can always just ask for help. You’re giving them an escape path right away that is universally understood. When your bot receives a request it doesn’t understand, you can serve up your creative fallback message, followed by a second reminder that help is one input away.

Just because a bot fails at providing a response desired by the user, it doesn’t mean an intelligent response can’t be provided to the user.

9. Take a Hybrid Approach

Don’t rely on Dialogflow to automate your entire experience. If you have that mindset then you’re going to be disappointed (At least for the foreseeable future). There will always be scenarios when NLP can’t respond, no matter how much time you invest in training your AI. It’s just the nature of the beast. Users may send messages to see how smart your bot is and break it, or users simply will write long messages that are too complex for today’s technology to determine intent. Let Dialogflow be your front line for marketing and support and take on your FAQ and be positioned to take over live when needed. Fortunately, you can pause your Dialogflow responses if a user triggers any Dialogflow Intent and get notified when it’s your turn to solve problems better solved by humans.

The technology is still relatively new but it’s always evolving. Rest assured that Google doesn’t want to lose the AI race to companies like Microsoft and Amazon and so they will continue to invest heavily in the development and evolution of Dialogflow.

Before you go

If you like this story, consider taking my Dialogflow Course.

Already a member of the Janis Community on Facebook? If not, you should join!

I’m a Co-founder at Janis.ai, a SaaS platform that helps businesses integrate conversational AI and manage a path to automation. Janis helps non-technical teams connect AI, train AI, monitor AI for problems and fix problems fast. Businesses adopt AI faster, and through intuitive AI management tools and system integrations, achieve their automation goals for marketing and customer support.

--

--

Josh Barkin
Being Janis

Building conversational AI platforms since 2016