Quick Start with Chat Table

Build Intelligent Conversational Applications in Minutes with JamAI Base Chat Tables

1. Introduction

This guide will help you quickly get started with JamAI Base chat tables using the Python SDK. You'll learn how to create a simple chat application similar to the example provided.

2. Prerequisites

  • Python 3.11 or above

  • JamAI Base account

  • Personal Access Token (PAT)

  • Project ID

3. Installation

pip install jamaibase

4. Basic Setup

Get your Personal Access Token (PAT) here:

How to generate PAT

Get your Project ID here:

How to get Project ID

5. Creating a Chat Agent (UI First)

Go to JamAI Base web interface chat table tab

Navigate to "Agents" section, click + to create new agent.

Name the new agent "example_agent"and select LLM model.

You can further configure your agent in UI but it will not be covered in this tutorial.

Example of some configuration you can do:

  • Set system prompt

  • Set multiple parallel agent

  • Configure RAG settings

  • Set up knowledge base

6. Creating Chat Sessions

Each chat session is created by duplicating your base agent table. Here's how to do it:

7. Basic Chat Interaction

8. Simple Implementation Example

9. Key Features

  • Streaming Responses: Use stream=True for real-time responses

  • Session Management: Each chat creates a new table instance

  • Inheritance: New chats inherit settings from the base agent

  • History Preservation: Chat history is maintained in the table

10. Best Practices

  • Create a new chat session for each conversation

  • Handle exceptions during table creation

  • Store chat IDs for session management

  • Clean up unused chat tables periodically

11. Complete Runnable Example

Here's a complete, standalone example that you can copy, paste, and run:

How to Run:

  1. Save the code in a file (e.g., chat_demo.py)

  2. Install required packages:

  1. Replace the following values:

    • your_project_id with your actual Project ID

    • your_pat_token with your Personal Access Token

    • example_agent with your agent ID created in the UI

  2. Run the application:

This example provides:

  • A simple chat interface

  • Streaming responses

  • New chat session creation

  • Basic error handling

Note: Make sure you have created your agent in the JamAI Base UI before running this code, as it relies on duplicating an existing agent table.

This example serves as a great starting point for building more complex chat applications with JamAI Base.

Last updated

Was this helpful?