Leveraging your knowledge base FAQ content to train your bot

Contents

  1. Overview
  2. Create a Knowledge Base in your Dialogflow account
  3. Connect Knowledge Documents to your Knowledge Base
  4. Enable your Knowledge Base for your agent
  5. Add a Dialogflow node connected to your Knowledge Base
  6. NLP Bot connected to a Knowledge Base in action

1. Overview

Your Knowledge Documents (for example, FAQs or articles) contain information that may be useful during conversations with end-users.
You can use that valuable information, by creating an NLP bot much faster leveraging a knowledge base content that you already have!

Dialogflow provides features for connecting your Knowledge Documents. Those features use that information when looking for a response to an end-user expression by parsing the Knowledge Documents to find automated responses.

In a few words, all the information that you have in your FAQ site (for example) can be used to train a bot and expand the scope of questions that your bot can answer automatically by using Dialogflow nodes in your bots connected to Knowledge Bases in your Dialogflow account.

In this article, we will learn to:

  • Create a Knowledge Base in your Dialogflow account
  • Connect your Knowledge Documents to a Knowledge Base
  • Enable your Knowledge Base for being used in your bot
  • Add a Dialogflow node connected to your Knowledge Base

Let’s get started!

2. Create a Knowledge base in your Dialogflow account

Knowledge Connector is the feature in Dialogflow that parse Knowledge Documents (for example, FAQs or articles) to find automated responses. To configure them, you have to define one or more Knowledge Bases, which are collections of Knowledge Documents.

Let’s jump into our Dialogflow console and see how to set it up.
You can use an existing agent or create a new one. Please see this article for more details about how to create an intent.

Because Knowledge Connector is a Beta feature within Dialogflow, you must first enable the beta features in your agent’s settings at the “Gear” icon. Let’s see in the following video how to do it.

1625

Enable Beta features

Now, you are ready to create your first Knowledge Base. Select “Knowledge (beta)” from the left pane, and click Create Knowledge Base. Give it a name and save it.

1625

Create Knowledge Base

After creating the Knowledge base you will see that this base automatically appears for being selectable in your Dialogflow node, at your bot path in Instabot. Instabot Dialogflow node gets in real-time the changes that you are saving changes in your Dialogflow account, at the google cloud.
Let’s see how it looks.

1625

Knowledge base in your Dialogflow node

But for now, that Knowledge Base is empty. You will need to provide Dialogflow the Knowledge Documents with the information to be used to answer visitors’ questions. We will learn how to connect Knowledge Documents in the item below.

3. Connect Knowledge Documents to your Knowledge Base

Once you have identified the Knowledge Documents that you want to use, the next step is to connect/upload those documents to your Knowledge Base.

By clicking on the “Knowledge (Beta)” option in the right pane, you will see the knowledge base created in the previous step.
Click on the knowledge base name, in our example “FAQ test”, and then click on the option “No knowledge document has been created yet. Create the first one.”
When creating a knowledge document, Dialogflow will request the following information:

  • Document name
  • Knowledge type (FAQ or Extractive Question Answering)
  • Mime type (Text/HTML or Text/CSV)

If you select Text/CSV then you will need to provide a CSV file.

  • This file can be located in a cloud storage, and in this case, you will choose the option “File on a cloud storage” and provide the cloud storage URL OR
  • This file can be located locally on your computer. In this case, you will upload it from your computer.

If you select Text/HTML then you will need to provide the URL where is located your information, for example, your FAQ’s site.

In the following two videos, you can see how to create Knowledge Documents into your Knowledge base. In the first video, we will upload a FAQ CSV file with the duo “Question-Answer” and in the second one, we will introduce a URL to our Instabot FAQ documentation site.

Please note that Dialogflow requires that CSV fulfill some format requirements. You will find more information in this link

1625

Create a knowledge document from CSV

1625

Create a knowledge document from URL

You can review how Dialogflow parsed the Questions-Answers on each Knowledge Document by clicking on the “View Details” link beside the Knowledge Document name.
Please note that by default, your Questions-Answers are enabled, but if you want, you can disable some of them, and also you can convert them to intents

1625

View the knowledge document details

The last step for having your knowledge documents ready to be used on your NLP bot is to click on Add Response link to enable automated responses. That’s all, just save.

1625

Adding response from knowledge base

Please note that Dialogflow automatically set the response with the parameter $Knowledge.Answer[1], just leave it as it is to use the answers included in your Knowledge Documents.

4. Enable your Knowledge Base for your agent

By default, Knowledge Bases are created as enabled, so all detect intent requests can find automated responses using your Knowledge Bases. Alternatively, you can specify one or more Knowledge Bases in your detect intent requests.
In addition, you have the option to disable a Knowledge Base keeping all the information ready for the next time that you want to re-enable it.
Please see the following video to know how to enable/disable a Knowledge Base.

1625

How to enable/disable a Knowledge Base

5. Add a Dialogflow node connected to your Knowledge Base

Now that you set Knowledge Documents up in your Dialogflow account, you are ready to use them in your bot by adding a Dialogflow node in your bot path.

For the following example, we made a copy from an existing bot that contains a Dialogflow node using intents.
In this new bot, we will update the Dialogflow node for selecting our FAQ test knowledge base. The logic related to the Fallback Intent is the same: Default Fallback Intent is mandatory and can not be de-selected.
As you can see in the following video, when we select the knowledge base, Instabot adds an option to the bot path with the knowledge base name. Because the answers will be handled by Dialogflow logic mapping the visitors’ questions to the content of the Knowledge Documents (Question-Answer duo), we just need to define the next step in the path. In this case, we choose to re-direct to the multiple-choice node which will ask visitors if they have another question.

1625

Add a Dialogflow node connected to a Knowledge Base

6. NLP bot connected to a Knowledge Base in action!

We are ready now to see how works our NLP bot, using a Dialogflow node connected to a Knowledge Base.
Let’s remember the Questions-Answers that we have in the Knowledge Documents in our Dialogflow account so that we can check how the bot maps the visitor’s question to FAQs and responds with the correct answer.

1620

Dialogflow Knowledge Document content

Now, let’s see the bot in action! Please note that the visitor is not using the exact same question, even so, the bot recognizes the intention and maps them to the correct FAQ.

961

Dialogflow node connected to a Knowledge Base in action

If you need help with anything here, please email us at [email protected]!


What’s Next