ThinkBase Documentation

Seamlessly integrate powerful RAG capabilities into your applications.

Introduction

ThinkBase empowers developers to build advanced RAG (Retrieval-Augmented Generation) systems with ease. Upload your documents, configure your knowledge base, and integrate a powerful chat interface into your application in minutes. ThinkBase provides both a pre-built, customizable chat component and a flexible SDK for custom solutions.

Getting Started

Step 1: Create a Project
Log in to your ThinkBase dashboard and create a new project. This will be the container for your documents and configuration.

Step 2: Upload Documents & Configure
Upload your documents (e.g., PDFs, TXT, DOCX). After uploading, you can adjust the chunk size and overlap to optimize the retrieval process for your specific data.

Step 3: Start Embedding
Once configured, start the embedding process. ThinkBase will process your documents and create vector embeddings, making them ready for semantic search.

Step 4: Generate API Key
Navigate to your project settings and generate an API key. This key is required to authenticate requests from your application.

Installation

Install the ThinkBase client and React components from npm.

npm install thinkbase

Usage

1. Chat Component

For a quick and easy setup, use our pre-built `Chat` component. Import it into your React application and provide your API key.

import { Chat } from 'thinkbase';

export function MyChat() {
  return (
    <Chat
      apiKey="YOUR_API_KEY"
      welcomeText="How can I assist you today?"
      options={["Marketing", "Sales", "Contact"]}
      headerText="ThinkBase Bot"
    />
  );
}

Component Props

PropTypeDescription
apiKeyStringYour project API key. (Required)
welcomeTextStringInitial message from the bot.
optionsArrayArray of strings for suggestion chips.
headerTextStringText for the chat header.
headerTextColorStringColor of the header text.
headerImgStringURL for the header image/avatar.
headerColorStringBackground color of the header.
bodyTextSizeNumberFont size for the chat body text in pixels.
bodyColorStringBackground color of the chat body.
botImgStringURL for the bot's message avatar.
msgBgBotStringBackground color for bot messages.
msgBgUserStringBackground color for user messages.
msgTextColorStringText color for messages.
msgRadiusNumberBorder radius for message bubbles in pixels.
outerFrameRadiusNumberBorder radius for the outer chat frame in pixels.
footerColorStringBackground color of the chat footer/input area.
inputTextColorStringText color for the input field.

2. SDK

If you need to build a custom user interface, you can use the `ThinkBaseClient` SDK.

Initialization

import {ThinkBaseClient} from "thinkbase";

const client = new ThinkBaseClient({
  apiKey: "YOUR_API_KEY",
});

Methods

Send a message and get a response from the RAG system.

const response = await client.sendMessage("your message here");
// response will contain the bot's reply

Retrieve the message history for the current client.

const history = await client.getMessages();
// history will be an array of message objects

Delete messages history for the current client.

const result = await client.deleteMessages();
// Successfully deletes all message history

Client Identification

ThinkBase automatically handles user session management. When an end-user sends their first message, a unique client ID is generated and stored in a browser cookie. All subsequent messages are associated with this ID, allowing for persistent chat history across sessions for each user.