Cloud
Studio Interface
Knowledge Base

Knowledge Base

Studio Explorer

The Botpress Knowledge Base is a powerful tool that allows users to manage and access organizational knowledge in one central location.

It has been designed to replace the traditional Q&A system and enable users to upload various sources of information, including PDFs, Text Document, and website URLs.

Enabling the Knowledge Base Agent

You need to enable the Knowledge Base Agent to use the Knowledge Base feature in Botpress.

Click on the Agent Tab in the Explorer on the left panel of the studio. You will find the Knowledge Base Agent in the list of available agents. Click on the Enable button to enable the Knowledge Base Agent.

Creating a Knowledge Base

Studio Explorer

To create a Knowledge Base, click on the Add Knowledge Base Icon in the Explorer on the left panel of the studio. You can create folders and organize your knowledge bases as per your preferences.

Description

When you create a Knowledge Base in Botpress, it's important to provide a brief description that explains what the Knowledge Base is about and what kind of information it contains.

This helps the system understand what type of questions to expect and gives it a better chance of finding the right answers for your users.

How to write the description

Let's say you work at a company that sells different types of home appliances, such as refrigerators, washing machines, and ovens. You can create a Knowledge Base in Botpress to help your customer support team quickly find information and answers to common questions about these products.

When creating the Knowledge Base, you would provide a brief description that outlines the purpose and scope of the Knowledge Base.

For example, "This Knowledge Base provides information and support for our home appliances product line, including troubleshooting tips, user manuals, and frequently asked questions."

This description helps the NLU engine understand the focus of the Knowledge Base and identify the relevant sources of information to answer customer queries, such as "How do I clean the filter in my washing machine?" or "What should I do if my oven is not heating up properly?"

Knowledge Sources

1. Documents

The Documents KB Source allows users to upload various file formats, including PDFs, HTML files, TXT files, DOC files, and DOCX files. This feature enables users to create a comprehensive Knowledge Base by incorporating different types of documents, such as manuals, guides, reports, and more.

Let's consider a scenario where a company deals with medical equipment. The organization's support team frequently encounters inquiries about the usage and maintenance of their products. To address this, they decide to utilize the Documents Knowledge Source in Botpress to provide customers with easy access to relevant information.

Using this feature, the team uploads a range of files related to their medical equipment, such as PDF manuals, HTML guides, and TXT documents containing troubleshooting steps. They organize these documents into appropriate categories, such as "Product Manuals", "Troubleshooting Guides", and "Usage Instructions", ensuring that customers can find the information they need quickly.

For instance, if a user searches for "How to calibrate the XYZ device," Botpress will search through the uploaded documents, and return the relevant instructions from the Knowledge Base.

Supported File Formats

  • PDF documents are commonly used for manuals, guides, and other types of documentation. With Botpress, you can upload PDFs to your Knowledge Base, making it easy for employees to search for and access the information they need.
  • HTML documents are used for web pages and other online content. By uploading HTML documents to Botpress, you can make this web content accessible to employees who may not have internet access.
  • TXT files are Text Document documents, similar to the ones supported by the Text Document Knowledge Base. However, TXT files can contain more complex formatting, such as tables and images. By uploading TXT files to Botpress, you can make this type of content searchable and easily accessible.
  • DOC and DOCX files are commonly used for word processing documents, such as memos and reports. By uploading these files to Botpress, you can make them searchable and easily accessible to employees.

File Limits
You can upload upto 100 documents to the Knowledge Base, with a size limit of 50MB per document. This feature is designed for optimal utilization.

2. Website

The Web Pages KB Source allows users to upload website s to their Knowledge Base. This feature enables users to create a comprehensive Knowledge Base by incorporating different types of web content, such as articles, blog posts, and online forums.

Add from URLs

To add a web page to your Knowledge Base, you can simply enter the URLs (one URL per line, max 350 character / url) in the Add from URLs field. Botpress will automatically retrieve the content from the web page and add it to your Knowledge Base.

Add from Site Map

You can also add multiple web pages to your Knowledge Base by entering the Site Map URL. This file contains a list of URLs that you want to add to your Knowledge Base. Botpress will automatically retrieve the content from these web pages and add them to your Knowledge Base.

3. Search The Web

When using the Web Search Knowledge Base Source, you have the ability to specify the websites to include or exclude from your search. This allows you to customize the search to meet your specific requirements. Here are three options you can consider:

On which websites should we search on?

  • Search on specific websites: You can provide a list of website domains that you want the Botpress NLU engine to include in its search. For example, if you want to focus on retrieving information from trusted sources within your organization, you can include domains and subdirectories like "yourcompany.com" or "internalknowledgebase.com/specific-section". This ensures that the search is targeted to specific websites relevant to your Knowledge Base.
  • Search the entire web: If you select this option, the Botpress NLU engine will conduct searches across the entire web. This is useful when you want to gather information from a wide range of sources, including external websites and online communities. It enables you to access a broader set of information that may be helpful to your Knowledge Base.
  • Exclude specific websites from the search: Sometimes, you may want to exclude certain websites from the search results. This option allows you to specify a list of website domains that should be excluded from the search. For example, if you want to filter out unreliable sources or competitor websites, you can exclude their domains from the search. This ensures that the search focuses on credible and relevant information.

Filter search results by time period

When utilizing the Web Search Knowledge Base Source, you can further enhance your search capabilities by filtering search results based on a specific time period. This feature allows you to narrow down the results to obtain the most relevant and up-to-date information for your Knowledge Base.

To enhance your web search capabilities and filter search results by time period, you can utilize the following options:

  • Do not filter based on time: Selecting this option ensures that the search results are not filtered based on a specific time period. It includes all available information without any time restrictions.
  • Pages discovered in the last 24 hours: By choosing this option, the search results will focus on web pages that have been discovered or indexed within the past 24 hours. This allows you to access the most recent information available on the web.
  • Pages discovered in the last 7 days: Selecting this option narrows down the search results to web pages that have been discovered or indexed within the past 7 days. It helps you stay updated with recent developments and information.
  • Pages discovered in the last 30 days: This option filters the search results to include web pages that have been discovered or indexed within the past 30 days. It provides a slightly broader time range for retrieving recent information.

By utilizing these options, you can tailor the time period for your web search and ensure that the search results align with your Knowledge Base requirements. Whether you prefer real-time updates or a broader range of recent information, these options help you refine your search results accordingly.

4. Text Document

The Text Document KB Source allows users to create/add plain textual information, such as FAQs, guides, and manuals. This Knowledge Base replaces Botpress's old Q&A system and is designed to provide users with quick access to information on various topics.

Here's an example of how the Text Document Knowledge Base could be used in a company that sells different types of home appliances, such as refrigerators, washing machines, and ovens:

Let's say that the customer support team at this company receives a lot of questions about how to troubleshoot common problems with their products. The team decides to create a Knowledge Base in Botpress to provide quick and easy access to this information.

Using the Text Document Knowledge Base, the team creates a series of Text Document documents that contain troubleshooting tips for each type of product. They organize these documents by title (e.g., "Refrigerators," "Washing Machines," "Ovens") and add description for common issues (e.g., "Not cooling," "Won't spin," "Not heating up").

So, when users search for a specific problem like My refrigerator is not cooling, Botpress's Natural Language Understanding (NLU) functionality will retrieve the relevant response from the Text Document Knowledge Base, providing users with the necessary troubleshooting information.

5. Tables: Organized Information

You can connect your tables of data to a knowledge base, allowing users to directly search for information. This can be especially invaluable for vast datasets, as it provides a straightforward and user-friendly method to retrieve data.

Benefits

By integrating tables into your knowledge base, end-users can readily ask for and receive information straight from your table data. As a bot builder, you will appreciate the ease with which this can be implemented on Botpress.

Requirements

Prior to proceeding, ensure you have the following:

  1. A table of data
  2. Knowledge Agent should be enabled
  3. Mark at least one column in your data table with a Searchable property.
  4. Have a Knowledge Base with a source set to Table, and select the table that will be utilized for this feature.

The Searchable property can be enabled either during the creation of a column or later on by right-clicking the column, selecting "Edit", and toggling on Searchable.

Usage Example

If you have a table of organized data, users can ask questions like:

  • "How many X are there?"
  • "What is the Y of X?"
  • "Show me X that have Y."
  • "How X is Y?"

For instance, if you're running a chair e-shop, users can get product information by asking:

  • "How many chairs are there?"
  • "What is the price of your red velvet chair?"
  • "Show me products priced at $20."

Manual Answer Option

If you prefer to review and curate answers before they get sent, you can toggle on the "Answer Manually" option in the Knowledge Agent.

Limitations

Keep in mind that the feature may not provide accurate counts for "How many [products / items / rows]"-type questions. Internally, the Knowledge Base runs a search before delivering answers, and since not all results are returned, the actual counts might be off.

Storage Quota

The Knowledge Base feature in Botpress is designed to provide users with quick access to information on various topics. However, the amount of information that can be stored in the Knowledge Base is limited by the storage quota.

The storage quota is the maximum amount of data that can be stored in the Knowledge Base.

Limit
All Workspaces have a free limit of 100MB Vector Database Storage, which applies to all bots in the Workspace. This amount is equivalent to about 20,000 PDF pages. This amount can be increased. Learn more (opens in a new tab)

Enabling/Disabling KB on Capture Information cards

In Botpress, you have the ability to enable or disable the Knowledge Base feature for specific Capture Information cards - it is enabled by default.

To enable the Knowledge Base on a Capture Information Card:

  1. Locate the Capture Information Card.
  2. In the Inspector panel, look for the option called Knowledge Base.
  3. In the "Search all KBs" field, you can choose either specific KBs to search in, or you can choose "Disable Search"

By enabling this option, you allow the Knowledge Base to provide answers during the interaction when the user is asked for a response. If the user's input is relevant to the information stored in the Knowledge Base, Botpress's Natural Language Understanding (NLU) will retrieve the corresponding answer from the Knowledge Base and display it to the user. The conversation then proceeds to the next step of capturing information. This feature helps to enhance the user experience by providing quick and accurate answers sourced from the Knowledge Base when appropriate.

If you disable the Knowledge Base feature on the Capture Info action in Botpress, the system will not utilize the Knowledge Base to provide answers during the interaction.

Disabling the Knowledge Base means that when users are prompted for a response and their input matches a query that could be answered using the Knowledge Base, Botpress's NLU will not retrieve answers from the Knowledge Base. Instead, the conversation will continue without incorporating information from the Knowledge Base.

By disabling the Knowledge Base, you essentially exclude it as a potential source of information for those specific cards. This may be useful if you want to handle user responses differently or if you prefer to rely on other mechanisms to provide answers or capture information in those particular cards.

Let's consider an example of a chatbot for a travel agency. The bot is designed to capture information from users regarding their travel preferences and provide relevant recommendations. The bot uses the Capture Info action in certain cards to gather specific details from users.

Example 1: Enabling the Knowledge Base

Node: Capture Destination
Action: Capture Info
Scenario: The user is asked to provide their desired travel destination.
Included Knowledge Bases: Search all KBs

User Input: "I want to go to Paris."

Response: The bot's Natural Language Understanding (NLU) recognizes that the user's input is relevant to the Knowledge Base. It retrieves information from the Knowledge Base related to travel destinations and displays an appropriate answer: "Paris is known for its romantic atmosphere, iconic landmarks such as the Eiffel Tower, and vibrant cultural scene."

The conversation then proceeds to the next step of capturing additional information, such as travel dates or budget.

Example 2: Disabling the Knowledge Base

Node: Capture Transportation
Action: Capture Info
Scenario: The user is asked to specify their preferred mode of transportation for travel.
Included Knowledge Bases: Disable Search

User Input: "I prefer to travel by train."

Response: Since the Knowledge Base feature is disabled for this card, the bot's NLU does not consult the Knowledge Base. It simply captures the user's response without incorporating any information from the Knowledge Base.

The conversation continues to the next step based on the specific logic or action defined for that card, without utilizing the Knowledge Base to provide answers or additional information.

In both examples, enabling or disabling the Knowledge Base on the Capture Info action determines whether the bot incorporates Knowledge Base information into the conversation flow or relies solely on other mechanisms to handle user responses.

Removing the references

To disable auto-generated references, utilize the Execute Code card with the following code:

workflow.kbAnswerWithoutRef = event.preview.split("References:")[0].

Then, input @kbAnswerWithoutRef into your text or capture card. Make sure to create the variable kbAnswerWithoutRef in your workflow.

Scoping the Knowledge Base by Folders

You can scope the Knowledge Base by folders to limit the search to specific folders. This allows you to focus on a particular area of interest and retrieve relevant information from the Knowledge Base.

Learn more about Scoping the Knowledge Base with Folders

Handle No Answer in KB

If no answer is found in the KB, you want to add a default message to handle that case. You can add a transition/expression card and add the following:

!event.state.agentVariables.KnowledgeAgent.turn.answer

This will make the bot check if there is a value in the "answer" field; if not, then this transition/expression card will be fired. Connect this card to a node with the message you want to show.

Debugging

If your bot is not returning the expected results you can try debugging it in a few different ways:

1. Check the Logs

The logs will show you the exact query that was sent to the Knowledge Base and the results (including source name, content preview, amount of tokens used by the content, row metadata if the source is a table) if there are any matches.

With that information you can try refining what is sent to the Knowledge Base or the content itself.

2. Check the Emulator answers

Automatic answers from the Knowledge Base - answers that the bot displays without the need of a Text card - contain citations in their body.

By hovering a citation you can see the source name (or its type if unnamed), the page, document or table name, the exact page number (for documents) or the row number (for tables), and a preview of the content.

With that information you can try refining the Knowledge Base content or the associated metadata (names and descriptions).