Set up your FAQ flow using a generative knowledge base AI

Learn how to set up your own knowledge base AI and use it in a flow to cover any FAQ.

Please note that you can choose to have a generative or non-generative knowledge base. Not sure of the difference between the two? Make sure that you have a read.

Create your knowledge base

In this section, you'll learn how to select then add content to create your knowledge base.

If you're using the non-generative option, you will only be able to update CSV files that have a specific format. Lean more on How to set up your non-generative 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. Navigate to the Knowledge base section inside of your bot.

  1. Click the Add content button at the top right corner of the screen. A window pops up from where you can add your content.

There are 2 types of content you can add for your bot to scrape:

  • Documents, uploaded from your computer. These can be:

    • CSV files: are the only ones supported for non-generative knowledge bases, using a specific format. Read more here.

    • 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. Add your content.

  2. 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. Repeat this until you've added all the content that you would like your bot to know.

  2. 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 retrieve an answer based on the content, making a knowledge base flow will happen in 2 steps:

  1. Retrieve the answer: if you're using a generative knowledge base, this means that the bot with generate an answer based on the content. If you're using a non-generative AI, this means that the bot will just display the pre-defined answer.

  2. Display the answer: show the bot answer within a text block.

Retrieve the answer

The flow step to retrieve a response based on the knowledge base will happen inside an Action bot block.

To retrieve an answer from the knowledge base:

  1. Drop an Action block in your canvas. For this example, we will name this block "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 block, change its block type to Action, and continue by following the steps below.

  1. Click on Knowledge base.

  1. 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 block will be triggered. You can select which block in this dropdown.

    • Failure: if there is a problem with the knowledge base AI, and it returns an error, you can select a block which the user will be led to. By default, users will be routed to the Error Occurred block.

  1. Save your changes.

You bot can now scrape the knowledge base and retrieve 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 answer from the knowledge base:

  1. Open the Action block that you just created.

  2. At the bottom of the block, add a Go-to to a block that you can create from within the dropdown. In this example, we will call this block "KB result".

  1. Save your changes.

  2. Open the newly created "KB result" block.

  3. 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. Save your changes.

All done! Your knowledge base AI bot is now ready to be used 👏

Use the knowledge base 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.

Please remember that non-generative knowledge bases can only use .csv files.

Find your knowledge base session data

To find your knowledge base session data:

  1. Create your knowledge base using a URL as content.

  2. Build your knowledge base AI flow.

  3. Test your bot by asking something for which the bot can retrieve a result.

  4. In the Test your bot window, click on the Debugger button.

  5. Scroll down the Debugger tab until you find the session data called knowledgebase.

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

    • tags: any tags that were retrieved that are associated to the content source.

  • contentType: type of the source: "URL" or "DOC"

  • contentUrl: URL of the source that was used. If a domain was scraped as content, this URL will refer to the specific page from which the answer was retrieved.

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. Create your Text message.

  2. Add a button that displays the following variable: knowledgebase.contentUrl. Your bot message should look similar to this one:

Your final result should be similar to this:

Last updated