Tips. Insight. Offers. Are You In?
In this post, I'm going to look at the new Knowledge Connectors feature in Google Dialogflow. As I look at the features in more detail I'm assuming you understand the more common Dialogflow terms and features -
agents,
intents &
entities.
It's also important to remember this feature is in beta.
The Problem
We've been working on chatbot projects for many years now and a large number of our chatbot projects have shared a similar requirement: the ability to answer a large number of questions on a particular subject. This may be to answer technical questions about a product offering or to offer information for a particular service.
Often the information related to these types of questions is held on our chatbot customer's own websites as FAQ pages or in specific PDFs or unstructured text documents.
These types of knowledge bases can often hold large amounts of information and so technically they will provide answers to thousands of chatbot questions.
The challenge for a successful chatbot is utilising this often unstructured information to understand a question and provide the correct answer. To meet this challenge we can look at 2 approaches; the traditional one and using the new Dialogflow Knowledge Connectors.
The Solution
Traditional Approach
Stepping back a bit it's important to briefly go over the traditional approach to creating chatbot conversational ability. There are a number of different
chatbot frameworks out there such as Google Dialogflow, IBM Watson, Microsoft Bot, Rasa etc and they all largely use the same concepts. A user submits a voice or text query and this utterance will be matched to an intent and any entities extracted. The matched intent would either provide a static response or rely on some form of application layer to perform the required action to provide the response to the user.
This approach can be easy. However, things can get complex and difficult to manage if the scope of intents is very large and or/ the information is constantly being updated. If we want to support questions with knowledge base information then each question needs to be created as an intent and the correct response formulated. This can lead to problems such as:
- Problems with the Intent Classification model grow causing more incorrect classifications.
- The amount of effort required to keep adding more training data to the model to ensure that the accuracy of the Intent classification remains high. Fortunately, Dialogflow provides a training UI in the web console to help keep track of any misclassified utterances, analyzing them and adding these to the training data, however, this does take time.
- Creating and managing intents to support new information in document stores.
Knowledge Connectors
Knowledge connectors are a beta feature released in 2019 to complement the traditional intent approach. When your agent doesn't match an incoming user query to an intent then you can configure your agent to look at the knowledge base(s) for a response.
The knowledge datasource(s) can be a document(currently supported content types are text/csv, text/html, application/pdf, plain text) or a web URL which has been provided to the Dialogflow agent.
Using Knowledge Connectors
To be able to use knowledge connectors, you will need to click "Enable beta features and APIs" on your agent's settings page.
Its also worth mentioning that Knowledge connector settings are not currently included when exporting, importing, or restoring agents. I'm hoping that this is something currently being put in place by the Dialogflow team.
Knowledge connectors can be configured for your agent either through the web console or using the client library that is available in Java, node.js & python. You can also configure from the command line.
To create a knowledge base from the web console, login to Dialogflow & then go to the knowledge tab. The process is fairly straightforward and involves providing a knowledge base name then adding a document to the knowledge base.
You can read more information creating a knowledge base here
After you've done that then you just need to add an intent and return the response. It's also worth keeping in mind you can send all the usual response types and that means including rich responses which I think is pretty cool.
Trying out knowledge connectors
Ok, so its time to try out these wondrous new knowledge connectors. There are 2 different types of knowledge base document type: FAQ & Extractive Question Answering. These choices govern what type of supported content can be used. There are also a number of caveats for each content type which
you can read more about this here
Based on these 2 document types I looked at a couple of common use cases which we often encounter at The Bot Forge and correlate well with the document types supported:
- Chatbot FAQ functionality using an existing FAQ webpage in a fairly structured format to provide answers from.
- Chatbot FAQ functionality using information in an unstructured format to provide answers from.
I carried out my tests using a blank Dialogflow agent with beta features enabled.
1- An FAQ Knowledge Base (Knowledge Type: FAQ)