The <Chat /> component is used to create custom AI chats using APIs from Open AI and Anthropic.

<Chat
  postData="ai-chat"
  height={300}
/>

<Chat /> Data Specification

The <Chat /> component sends the following data by default to the Python function specified in postData:

  • prompt: The text input by the user

  • thread_id: The thread ID of the conversation with the AI. This is updated to a new value when the user presses the “Start new thread” button.

  • is_new_conversation: Whether a new conversation has started. This is updated to true when the user presses the “Start new thread” button.

If you want to send additional data or overwrite the default data, use the variables property.

Properties

postData
string
required

The name of the Python function or SQL file

variables
{ [key: string]: any }

Variables to pass to the Python function or SQL file. Declare them using the defineState() function.

height
number

The height of the component in pixels.