Assistant API: How to append new user message in an existing thread?

The doc said that the thread is persistant one and you can append new user messages into it, but I see no API doing this.
So do I need to recreate a new thread every turn of chat? (I’m implementing a chat-like app).
But if I create a new thread every turn, it seems I cannot pass assitant messages to the thread, so is it possible to implement chat session by using thread itself?

I need help with a similar issue. Following this thread as well.

1 Like

Oh I know, I found it in the messages API here:

Will try it now and see if it works.

1 Like

On the documentation page for Assistants (click here to check it) you may see that it shows how to create and add messages to a Thread with and ID.

You can also retrieve information of a Thread and manage Threads and specific messages inside a unique thread.

Hope this helps!! :sweat_smile:

2 Likes

If I have a telegram bot for example, how do I think of a thread? Is it persistent forever for the lifetime of that user or per session?

If it’s meant forever, I am assuming, my system needs to store the thread ID along with user ID so that whenever user comes back and sends a message, I can use the same ID again and continue the conversation?

Also, what if I want to reset conversation? Delete and recreate thread is the way to go or are there any other ways?

u can reset convo by /start command or something so when user hit commad it should erase the memory,

u can define a varibel under this so every time user hit coomand it should redefine variabel every time

@dp.message_handler(commands=[‘start’, ‘help’])
global conversation_history

Oh I know the telegram side of things. I already have all that. I’m now experimenting with the assistants API which provides thread memory feature automatically (without me having to store history of messages and take care of truncating it when the history grows into bigger size than model context length etc).

That’s what I’m trying to understand.