Links
🧪

Knowledge base AI (experimental)

Chatlayer's AI knowledge base tool allows your bot to generate concise answers after scraping your content. Build an FAQ flow to your bot was never easier!
The Chatlayer AI knowledge base is currently only available for selected customers. If you're interested in trying it out, get in touch with us.
How is the Chatlayer knowledge base AI working? First, you add the content that your bot will scrape to retrieve the answer to the customer's question. The AI engine behind it will generate an answer based on this content. Second, you design a flow to display that answer.
A bot that uses knowledge base AI browses content to retrieve an answer and displays it in a conversational flow .
Learn how to set up your own knowledge base AI in the steps below 👇

Create your knowledge base

A knowledge base is a store of information or data that is available to draw on. It can be constituted of different pieces of content (e.g. URLs, files).
In this section, you'll learn how to select then add content to create your knowledge base.

Select relevant content

In order to get the best possible results from your knowledge base AI, it's important to keep a few guidelines in mind when selecting content:
  • Only include data that is relevant to the questions from users. If you have a PDF with 100 pages, of which only 1 is relevant for customers, extract that page, and upload it separately.
  • In PDFs and URLs, complicated layouts might decrease the quality of the results
  • The knowledge base AI isn't good at understanding data from a table. Don't use knowledge base to upload database files.
  • Currently, knowledge base AI isn't able to process any images, video's or other media types
  • Currently, if your website requires JavaScript to be loaded, it can't be read by the knowledge base
  • If the URL has scraping protection activated, such as Incapsula, the webpage won't be able to be added to your knowledge base AI
Now, you know better what content your bot would scrape. Let's see how to add it to your bot.

Add content

First of all, your bot needs to access your content. To do this, you need to add content to your bot which will constitute your knowledge base.
To add content to your bot:
  1. 1.
    Navigate to the Knowledge base section inside of your bot.
The Knowledge Base section of your bot.
  1. 2.
    Click the Add content button at the top right corner of the screen. A window pops up from where you can add your content.
Add content to your knowledge base.
There are 2 types of content you can add for your bot to scrape:
  • Documents, uploaded from your computer. These can be:
    • CSV files: (support coming soon).
    • PDF files: (e.g. product descriptions, FAQ documents, training documentation, ...).
  • URLs from publicly available websites. There are two options when you add URLs:
    • Only this page: only use the exact page that the URL links to.
    • Entire domain: use the page the URL links to and all linked pages.
  1. 3.
    Add your content.
  2. 4.
    Once it's done, the content will show up in the Contents table. This table shows the name of your content, its type, its status, when it was added and when it was last synced. A status can be a green check mark for active, or a red cross when something went wrong.
  1. 5.
    Repeat this until you've added all the content that you would like your bot to know.
  2. 6.
    If you click on the three dots at the end of the row, you can:
    • Open your URL in a new tab (or preview your document if the content fits this type) .
    • Sync your URL (i.e. update it with the latest changes).
    • Delete your content.
Now, your knowledge base displays your content and is ready to be used inside conversations. Let's see how to build a flow that displays the answer.

Build a knowledge base flow

Once your bot has access to all relevant content, it's time to build a flow where your bot will know when to browse this knowledge base to provide an answer to your customer's question.
Since Chatlayer's knowledge base is using AI to generate an answer based on the content, making a knowledge base flow will happen in 2 steps:

Generate the answer

The flow step to generate an answer based on the knowledge base will happen inside an Action bot dialog.
To generate an answer from the knowledge base:
  1. 1.
    Drop an Action bot dialog in your canvas. For this example, we will name this dialog "Generate answer".
Many customers will preferably have their knowledge base flow happening after the bot did not understand what was asked, as a fallback option. To do this, go to your Not Understood dialog, change its dialog type to Action, and continue by following the steps below.
  1. 2.
    Click on Knowledge base
Add a Knowledge base action dialog to generate an answer.
  1. 3.
    Fill in the fields accordingly. You can configure:
    • Variable: the answer from the knowledge base will be stored as a variable. In the first field, you can choose the name of that variable.
    • No results: if the question that the user asks cannot be answered by the knowledge base AI, a bot dialog will be triggered. You can select which bot dialog in this dropdown.
    • Failure: if there is a problem with the knowledge base AI, and it returns an error, you can select a bot dialog which the user will be led to. By default, users will be routed to the Error Occurred bot dialog.
  1. 3.
    Save your changes
You bot can now scrape the knowledge base and generate an answer based on it. But it cannot yet display that answer. Let's see how to change that.

Display the answer

To display the AI-generated answer from the knowledge base:
  1. 1.
    Open the Action dialog that you've just created.
  2. 2.
    At the bottom of the dialog, add a Go To that goes to a bot dialog that you can create from within the dropdown. In this example, we will call this dialog "KB result".
Add dialog that displays the generated answer.
  1. 4.
    Save your changes.
  2. 5.
    Open the newly created "KB result" dialog
  3. 6.
    Add a text message that contains the variable you chose to save the knowledge base AI answer into. By default, this is {knowledgebase.answer}.
  1. 4.
    Save your changes.
All done! Your knowledge base AI bot is now ready to be used 👏

Use the knowledge base content URL in an answer

When your bot retrieves an answer from your knowledge base, this answer exists within a variable that also contains a link to the source of this answer. This source is either a PDF name or link to an URL. In the case of an URL source, this URL link can typically be used as a button within the bot conversation.
Example of a knowledge base source URL used within a conversation as a button.

Find your knowledge base session data

To find your knowledge base session data:
  1. 1.
    Create your knowledge base using a URL as content.
  2. 2.
    Build your knowledge base AI flow.
  3. 3.
    Test your bot by asking something for which the bot can retrieve a result.
  4. 4.
    In the Test your bot window, click on the Debugger button.
  5. 5.
    Scroll down the Debugger tab until you find the session data called knowledgebase.
Find the knowledge base session data inside your Debugger tab.
The knowledgebase object contains a few fields:
  • answer: the answer that can be used in a text message in your bot
  • retrieved: an array of all the content that was used to formulate the answer. For each array item, the following data is stored:
    • type: type of the source: "URL" or "DOC"
    • name: filename of the document or link of the URL
    • content: snippet of the content that was used to generate the answer

Display the knowledge base content URL in a button

You can use the URL of a knowledge base answer in a button, so that the user can learn more about a specific answer.
To use the knowledge base URL within an answer:
  1. 1.
    Create your text message.
  2. 2.
    Add a button that displays the following variable: knowledgebase.retrieved[0].name. In this variable, name means that we're capturing the URL, [0] means that we're doing this for the first item of the retrieved array. Your bot message should look similar to this one:
Use the knowledge base content URL within a button
Your final result should be similar to this:
Example of a knowledge base source URL used as a button.

Build a powerful, hybrid bot

Bots can become really powerful if you use a mix of intents (answers designed by your team) and knowledge base (AI-driven answers). In this sense, your bot will be hybrid because it uses answers generated both by humans and machine.
  • If you connect your Knowledge base AI Action dialog to your Not Understood dialog and add no other content to your bot, all questions from users will be answered directly by your knowledge base AI.
  • If you have other intents in your bot, the intents will be triggered whenever there is a match with the expression from a user. Only when something is said by the user that isn't a match with any intent, the Not Understood dialog and thus knowledge base AI will be triggered.