Build A Simple Local Knowledge Base Chat Application (RAG-powered chatbot)

Let’s get hands-on and create a simple chatbot with a knowledge base.

Step 1: Registering Knowledge

Navigate to the "Knowledge" tab on the top. You will see the creation option.

Select "Import from file" to upload the document. Here, I will use Nvidia's latest paper ChatQA 2: Bridging the Gap to Proprietary LLMs in Long Context and RAG Capabilities as an example. After uploading, click "Next".

For RAG, texts will be converted into vectors. To retrieve similar vectors (which are, relevant text contents), we will need a threshold by which we can judge whether each knowledge (text) should be adopted or not, based on the similarity score. What we have done is we modified this threshold for more selective results.

Then, Click "Save & Process", wait a few seconds, and click "Go to Documents".

Now, You can see all the text files have been successfully registered and are available to be referenced.

Step 2: Create an application

Go to Studio > Create from Blank then Select the Chatbot type, and you can name it anything you like.

In the "Instructions" input box on the left, you can write a prompt for the chatbot. Click the "Add" button next to "Context" to add files from the knowledge base.

Once everything is set up, click "Publish" to save and you can directly click "Run App" to run the application.

By asking questions related to ChatQA 2 from the paper, we can see that the bot utilized the documents in the knowledge base and provided accurate answers, demonstrating the effectiveness of RAG. With this, a simple RAG chatbot is successfully created.

Last updated