Assistants API create and delete chat

Hi everyone. I’m new at this API, and I was wondering what’s the best way to create a new coversation, get Assistants’ output for the last message (I’m few-shooting it) and then delete it as fast as possible to make sure that no message can influence another.
I’d appreciate it if somebody came up with a more efficient solution. I already tried asking GPT to forget the chat, but it only seems to work in ChatGPT-4 for some reason, and I need it to also work for 3.5 and 4o.

I would create a new thread every time you send a message. That way each message is isolated to a thread.

https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages

1 Like

Is every thread a new conversation with ChatGPT? I thought it was just appending to an already existing one.

Threads are independent containers and do not have context of each other. When you append a message into a thread then it would have context of previous messages within that thread.

A visualization of this is within ChatGPT when you create a new chat on the left hand side. Each of those are threads and do not know the context of each other, but within a chat you can ask questions based on earlier parts of the conversation.

2 Likes

I need to reply to this. I noticed the same, but also across other AI platforms, which before didn’t exist or was not a problem. . It means it was done strategically, so people can create more mistakes, waste more time. and enforce us to pay for API to resolve " a prov lem" It is incredible how instead to get better service, quality and service is just getting worse

All these problems would be solved if ChatGPT knew how it worked. It doesn’t know enough about OpenAI APIs, and if I ask it about prompt engineering, it doesn’t give a clear answer. I think OpenAI avoids training GPTs on data that could contain a part of their source code, so noone can access it through them.

Do I need to delete these threads manually or do they get deleted when the program steps out of the function in which they are defined?

The threads are persistent beyond the function in which they are created. Further there is no current thread.list function; meaning you cannot programmatically list the threads that you have created. At least not in a straight forward way.

You can go through the threads through the ui. If you do not delete the thread, they automatically get deleted in a set period of time (i think it’s 30 days if memory serves me correctly)

Hth

1 Like