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 thinkbaseUsage
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
| Prop | Type | Description |
|---|---|---|
| apiKey | String | Your project API key. (Required) |
| welcomeText | String | Initial message from the bot. |
| options | Array | Array of strings for suggestion chips. |
| headerText | String | Text for the chat header. |
| headerTextColor | String | Color of the header text. |
| headerImg | String | URL for the header image/avatar. |
| headerColor | String | Background color of the header. |
| bodyTextSize | Number | Font size for the chat body text in pixels. |
| bodyColor | String | Background color of the chat body. |
| botImg | String | URL for the bot's message avatar. |
| msgBgBot | String | Background color for bot messages. |
| msgBgUser | String | Background color for user messages. |
| msgTextColor | String | Text color for messages. |
| msgRadius | Number | Border radius for message bubbles in pixels. |
| outerFrameRadius | Number | Border radius for the outer chat frame in pixels. |
| footerColor | String | Background color of the chat footer/input area. |
| inputTextColor | String | Text 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 replyRetrieve the message history for the current client.
const history = await client.getMessages();
// history will be an array of message objectsDelete messages history for the current client.
const result = await client.deleteMessages();
// Successfully deletes all message historyClient 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.