Dialogflow ES Knowledge Connector

Managing Large Dialogflow ES Bots

This article provides an overview of the Dialogflow ES Knowledge Connector.

How to create a Knowledge Connector bot based on your WordPress website

These are the steps to create a knowledge connector bot in Dialogflow.

Install the Export all URLs plugin

First install export all URLs plugin.

Download the URLs in CSV format

Inside your WordPress admin, download the URLs in CSV format.

You need to do a couple of things to prepare the CSV file for importing into Dialogflow.

a) delete the third colum (categories)

b) delete the top header row as it is not required

Enable beta features

Now, inside Dialogflow, create a new agent and make sure you have enabled Beta features.

Set knowledge results preference to max

In the Knowledge section, set the knowledge results preference to max.

Create Knowledge Base

Create a new knowledge base and give it a suitable name.

I have named mine KB.

Create Knowledge Document

Inside your knowledge based, create a new knowledge document.

Upload exported CSV file

In the popup dialog, fill in the information as described in the image.

Document name: choose a suitable name. I have called mine exported_urls.

Knowledge type: FAQ

Mime type: text/csv

Data source: Upload file from computer

Now upload the CSV file that we created. Make sure the CSV file doesn’t have the header row or a third column. Dialogflow expects a two column CSV file where the first column is the question and the second column is the answer.

In our case, the article title will be the question (column 1) and the article URL will be the answer (column 2).

When the upload completes, you will see that the new knowledge document has been added to the knowledge base.

Use knowledge answers in the response blocks

You will see that the new knowledge document looks quite a bit like a Dialogflow intent.

In the response blocks, use the knowledge answers. $Knowledge.Answer[1] means the first answer from the knowledge base for a given query.

So add two more text response blocks and change the responses to $Knowledge.Answer[2] and $Knowledge.Answer[3] respectively, meaning we want the second and third answer for the given query.

Note: if there are fewer than 3 answers, Dialogflow will simply send whatever responses are available to the integration channel.

Integrate with Telegram

Now use the 1-click integration with Telegram and follow the integration steps from this article.

Why I avoid the Knowledge Connector feature

Another way to quickly create a Dialogflow ES chatbot from a CSV file would be to create an Intent based FAQ bot using my BotFlo app.

An intent based FAQ bot has quite a few advantages over the Knowledge Connector.

How to create an intent based FAQ bot for your WordPress website

The steps for creating an intent based FAQ bot also starts with the Export all URLs plugin.

You need to use my online tool BotFlo to be able to do this. I explain the steps in this article.

Knowledge Connectors Pros

Now that we have something to compare it with, we can take a look at the pros and cons of the Dialogflow Knowledge Connector feature.

There are a couple of big pros with using the knowledge connector

  • you can get the top N intent matches. So if you need your FAQ bot to behave a little like a search engine, the knowledge connector will help
  • you can build an FAQ chatbot based on your website content with just a few clicks (at least in theory)

Knowledge Connector Cons

However, there are quite a few cons with using the knowledge connector for an FAQ bot, and you should know about them before using the feature.

You cannot add additional training phrases

You cannot add more training phrases to get better matches.

For example, suppose someone is searching for “dialogflow pass parameters between intents”

I have an article which goes over this in detail, but the keywords are not mentioned in the title anywhere.

Let us see what we get from the knowledge based FAQ bot:

And this is the answer from the intent based FAQ bot:

Neither of the answers are very relevant.

However, I can add it as a training phrase in my intent based FAQ bot intent.

Let us try the same query again with the intent based FAQ bot.

Note that in the knowledge based bot, we cannot edit anything inside the knowledge document. It is read only.

You cannot add entities

As you look at the knowledge document, you also find an important feature missing. You cannot add entities into a knowledge document.

Dialogflow used to be called API.AI initially. Suppose someone used API.AI in their search term, we can handle this by creating an entity which can handle the words dialogflow as well as API.AI.

In fact, I have seen people use all of the following when trying to type Dialogflow:

  • dialogflow (correct)
  • api.ai (correct)
  • api ai (ok)
  • dialogueflow
  • dialogue flow
  • dialog bot
  • dialog chat

You could turn these common misspellings into an entity, and make your intent based FAQ bot more powerful. This isn’t possible in the knowledge based FAQ bot.

You cannot use contexts

FAQ bots don’t have a lot of need for followup intents and such.

However, sometimes they are necessary for certain answers. In those situations, the knowledge connector based bot will not help.

On the other hand, you can easily add contexts into any intent in an intent-based FAQ bot. I have seen clients use followup intents to ask if the answer was useful. And if the user said no, they would be automatically redirected to live chat.

You cannot use negative training phrases

Negative training phrases allow you to trigger the fallback intent for phrases which are very similar to an intent’s training phrase but actually means something very different.

You cannot easily convert user utterance into training phrase

You might know that you can convert a user utterance into an intent training phrase with a single click in an intent based FAQ bot. This isn’t possible in a knowledge based FAQ bot. A big benefit of using Dialogflow and other AI bot frameworks is that they “learn” from these user utterances and get better with more data. This benefit is lost in knowledge connector based bots.

Intent based FAQ Bots vs Knowledge Connector FAQ Bots Summary

The table below summarizes the difference between intent-based and knowledge-based FAQ chatbots in Dialogflow.

Intent Based FAQ BotKnowledge Based FAQ Bot
How we build itUsing intents and training phrasesUsing the knowledge base feature
Support for multiple responses for the same queryNoYes
Multiple training phrases per intentYesNo
Supports entities in training phrasesYesNo
Support for contexts (and follow up)YesNo
Easy to construct rich responses (e.g. for Dialogflow Messenger)YesNo
Use term reinforcement for adding weights to specific words and phrasesYesBlackbox
Allows us to minimize intra-intent variance and maximize inter-intent variance (as recommended by Google)YesBlackbox


About this website

I created this website to provide training and tools for non-programmers who are building Dialogflow chatbots.

I have now changed my focus to Vertex AI Search, which I think is a natural evolution from chatbots.

Note

BotFlo was previously called MiningBusinessData. That is why you see that watermark in many of my previous videos.

Leave a Reply