Skip to main content

Create a Chat

You can create a chat using the create_chat method with the assistant_id of the assistant you want to use.

import taskingai

chat = taskingai.assistant.create_chat(
assistant_id="YOUR_ASSISTANT_ID",
name='New Chat'
)

The method returns a Chat object, representing the newly created chat session with the assistant.

You can also add some metadata to the chat session by passing a dictionary to the metadata parameter, inorder to store additional information about the chat session.

chat = taskingai.assistant.create_chat(
assistant_id="YOUR_ASSISTANT_ID",
name='New Chat',
metadata={
"user_country": "Australia",
"user_age": "25",
},
)

The metadata can be used to store any information that you want to associate with the chat session.

info

Each time a new chat is created, it utilizes the memory configuration of the assistant to create the chat memory. After this point, even if the memory configuration of the assistant changes, the chat memory does not alter accordingly. Changes to the assistant's memory configuration will only affect new chats created after such changes, as they will adopt the updated memory scheme.