Skip to main content

Create 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 create_chat method returns a Chat object, which represents the newly created chat session with the assistant.

You can also add metadata to the chat session by passing a dictionary to the metadata parameter. This allows you to store additional information about the chat session, which may be useful for analytics or personalized interactions.

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 you want to associate with the chat session. This can help you keep track of user-specific data that may be useful in further interactions.