Knowledge Base

In Rivalz, Knowledge is a collection of documents. A knowledge base can be integrated into an application as a retrieval context.

How to create your first knowledge base

1. Prerequisites

  • Saving vector data can be an expensive process, so credits are required to create a knowledge base. However, we’ve got you covered! When you create an account, you’ll receive 500 USD in free credits. Visit here to learn How to claim your free credit.

  • Select the document you need to upload in PDF format.

  • API secret key to authenticate. If you don't have one, please refer to the "Get API Secret key" section to obtain it.

2. Setup the SDK

To install the SDK, run the following command for your preferred language:

  • Python

  • Nodejs

3. Initialize the client

To initialize the client with your secret token, you have two options:

  1. Using a .env file with SECRET_TOKEN variable

  2. you can pass the secret token directly to the client during initialization

  • Python: Use the python-dotenv package to load the token from .env file

  • Nodejs: Use the dotenv package to load the token from .env file

4. Create a knowledge base

Use the create_rag_knowledge_base method to create a knowledge base. This method takes the path to the PDF document and the name of the knowledge base as arguments.

This method will return the knowledge base details as a JSON object, including the unique knowledge base ID. You can use this ID for future queries on the knowledge base.

The embedding process may take some time depending on the size of the document. This process will be processed off request and you can check when the process is done by checking the status of the knowledge base.

Full code example

  • Python

  • Nodejs

Congratulations! You have successfully created your first knowledge base.

Last updated