Knowledge Base
Let's add some "Knowledge" to our Workflow.
Prerequisites
To move forward, you don't need to have a specific workflow ready, but to grasp the topic better, we strongly encourage you to follow along starting from our previous guide.
Why do we need a Knowledge Base?
As demonstrated in the previous guide, creating a simple AI chatbot isn't rocket science. But what happens when you want the chatbot to access additional data from which it can retrieve information and provide answers?
In other words, what if we aim to set up a Q/A (Question and Answer) workflow? For these types of workflows, we can utilize a Knowledge Base, where we upload files from which the chatbot can extract information and answer our questions.
Add Document Search block
As you already know, Buildel provides many blocks for different purposes. One of the blocks that can utilize Knowledge Base is Document Search block.
You can locate the Document Search block under the Memory category. Go ahead and add it, then connect it to the chat block using the I/O connections.
Similar to the chat block, the document search block has numerous options. However, to get it working, we only need to specify the Knowledge
property, and we can leave the rest as the default settings.
You can create a Knowledge Base by visiting the Knowledge Base subpage, or, as shown in our video, use the functionality directly within the document-search block.
After that, lets update a System Message in our chat block. Add at the end "Use available tools to answer questions".
You might wonder, "What exactly are these tools?" This is an excellent question. Anything that we connect to the chat block via I/O connection can be used by the chat as an external tool and can be invoked whenever the chat deems it necessary. We take advantage of a feature named Function calling.
Finally, let's add a file to our knowledge base. Click on "Browse file to upload" and upload your file to our memory. In this example, we used 20_popular_movies.
Behind the scenes, Buildel will extract content from the file, divide it into chunks, and store it in a specially prepared vector database.
Try out our Knowledge Base!
Great, everything is set up. Let's give it a try.
As you can see, our workflow is functioning! Initially, when we sent "Hello", the Chat provided a basic greeting. However, when we inquired about movies, the Chat lacked sufficient information and opted to utilize our tool.
You can also see what the chat sent to the Document Search block. The first message displayed in the text output block is "Search most popular movies."
If you're curious to see how the document search block responds to the chat, simply add an additional Text Output block and connect it to the Document Search output.