Integrate AI Task and Knowledge Base
Science & Technology
Introduction
In this article, we will explore how to access the raw answer produced by your bot when a user queries a knowledge base. This integration allows for greater control over the responses given to users and enhances the overall interaction experience.
Setting Up Your Knowledge Base
To begin, we will set up a web search knowledge base using the web search option found in the knowledge base menu. This configuration enables the bot to search the entire web when prompted by a user’s question.
Main Workflow Configuration
Place a Standard Node: Back in our main workflow, we will insert a standard node. Inside this node, we will utilize a raw input card to prompt the user for a question. A simple label such as "Question" will suffice.
Enable Knowledge Answering: To allow users to query the knowledge base, we must enable the knowledge answering feature on this node. This will facilitate searches across the web.
Manual Answering: Next, we will access the knowledge agent menu and enable the manual answering option. This setting is crucial for retrieving an answer from the bot and for applying any modifications before it is sent to the user.
Utilizing AI Task
Now, let’s introduce the powerful features of Botpress:
Inserting an AI Task: From the card tray, drag an AI task directly into our node. In the task instructions, direct the bot to summarize the user's input in two sentences.
AI Task Input: For the AI task input, we will use a specific formula that retrieves the raw answer from our previous knowledge base query. This raw answer serves as the foundation for the summary that will eventually be displayed to the user. Ensure to store this output in a variable named
user_answer
, which can be referenced later.Sending the Final Answer: To display the bot’s answer to the user, place a send message card in the node. The message will simply send the contents of the
user_answer
variable, allowing users to view the processed response.
Testing the Configuration
To test the setup, launch your bot in the emulator. Start by greeting the bot and asking a question, such as, "What is a burrito?" The bot will search the web for an answer, summarize it into two sentences via the AI task, and return this refined message to the user.
For deeper insight into the process, you can also display the raw answer before it is manipulated. Insert another send message card with the formula that retrieves the raw answer and test the workflow again. This will show the user the detailed information sourced by the bot and clarify the origin of the answer.
This exploration of raw information aids in understanding how your bot operates, enhances transparency, and can pave the way for further improvements in user experience.
Happy bot building!
Keywords
- AI Task
- Knowledge Base
- Web Search
- Manual Answering
- User Experience
- Botpress
FAQ
Q: What is an AI task in Botpress?
A: An AI task in Botpress is a feature that allows developers to instruct the bot to manipulate user input or response data, enabling customized interactions.
Q: How can I integrate a knowledge base with my bot?
A: You can integrate a knowledge base by setting it up in the knowledge base menu and enabling the relevant features to allow the bot to search and summarize information.
Q: What does enabling manual answering do?
A: Enabling manual answering allows developers to intervene and modify the bot’s responses before they are sent to the user, ensuring more relevant and accurate answers.
Q: How can I view the raw answer generated by the knowledge base?
A: By placing a send message card with a specific formula that retrieves the raw answer, you can display the information before it is summarized or manipulated by the bot.
Q: Why is it important to understand the raw answer?
A: Understanding the raw answer helps developers see where the information is coming from and how the bot formulates its responses, assisting in refining the user experience.