Thunai Brain Streaming Integration - User Guide
Brain Streaming Integration allows you to upload structured data into Thunai Brain using custom-defined schemas. You can specify fields, set a primary key, and choose whether to append new data or overwrite existing records.
Data can be streamed from various programming languages, including Python, Java, .NET, and Node.js. Once uploaded, Thunai’s chat agent can retrieve information based on the defined primary key, making your knowledge base more dynamic and accessible.
Step 1: Create a Streaming Topic
- Click the Profile icon in the top-right corner and select Settings.
- From the Settings page, go to the Configuration tab in the left menu.
- Select Streaming and click Generate.
- Enter a Topic Name and click Generate Topic to create it.
Step 2: Configure Streaming Details
1. Open the Brain Tab
- In the sidebar menu, click on Brain.
2. Initiate Data Upload
- Click the Add button at the top-right corner of the Brain page.
- Choose Upload File.
3. Open Streaming Configuration
- Select the Streaming tab to open the Streaming Configuration page.
4. Define the Streaming Schema
Fill in the required details:
- Name – A name for your schema.
- Description – Short description of the data.
- Schema Fields – Define your data structure in JSON format.
Primary Key – Choose a field from the schema to act as the primary key.
Note: The primary key must be included in your schema fields.
Operation Modes:
- Append – Adds new data while keeping existing records.
- Overwrite – Replaces records that share the same primary key.
5. Save the Schema
- Click Save to finalize.
- Your schema is now ready to receive data.
Step 3: Manage Streaming Schemas
1. View Recent Schemas
- Go to the Recent Schema tab in the Brain section.
- You’ll see a list of your previously created schemas.
2. Edit or Delete
Each schema appears as a card.
Click the three-dot menu (⋮) on a card to:
- Edit – Modify schema fields.
- Delete – Remove the schema.
Step 4: Upload Data to Brain via Streaming
1. Copy Producer Code
- In the Recent Schema tab, find your schema card.
- Click Show Producer.
- Select a code sample (Python, Java, .NET, or Node.js).
- Click Copy to copy the code.
2. Run Producer Code
- Paste the code into your IDE or code runner.
- Execute it to stream data into Brain.
3. Data Upload
- Data will be uploaded according to your chosen mode: Append or Overwrite.
Step 5: Retrieve Uploaded Data in Chat
Once data is streamed into Brain, you can query it through chat.
Send a query that references the primary key.
The system will:
- Look up the matching record.
- Retrieve associated data.
- Provide a response using the stored content.