Hacker News new | ask | show | jobs
by AgentME 822 days ago
This was one of the limitations of the Assistants API that made me entirely ignore it up until now.

I am curious if the Assistants API lets you edit/remove/retry messages yet. I don't see anything implying this has changed. It's annoying that the Assistants API doesn't give you enough control to support basic things that the ChatGPT app does.

2 comments

Like the other commenter said, edit/remove/retry messages can be implemented by the API client already. The API doesn't maintain state so every new message in a "conversation" includes previous messages as context. To edit a message you would re-submit the conversation history with the desired changes.

I get what you're asking for though. It would be nice if this was easier. But that would require OpenAI changing their API model to one where conversation history is stored on their server. It would be more of a "ChatGPT conversation API" then just an GPT-4/3.5 API.

That is what "assistant api" is, you create a thread and add new user message to the thread. The messages are stored on the server.

There is an API to modify messages, though I am not sure of its constraints.

Edit/remove/retry is just including the whole conversation over again (IIUC this is even how the app works.) It's part of why the API is so expensive
The Assistants API doesn't let you recreate the conversation (with edits or not) because you can't (re)create messages with role=assistant.
This was indeed true in the beginning, and I don’t know if this has changed. Inserting messages with Assistant role is crucial for many reasons, such as if you want to implement caching, or otherwise edit/compress a previous assistant response for cost or other reason.

At the time I implemented a work-around in Langroid[1]: since you can only insert a “user” role message, prepend the content with ASSISTANT: whenever you want it to be treated as an assistant role. This actually works as expected and I was able to do caching. I explained it in this forum:

https://community.openai.com/t/add-custom-roles-to-messages-...

[1] the Langroid code that adds a message with a given role, using this above “assistant spoofing trick”:

https://github.com/langroid/langroid/blob/main/langroid/agen...

Not true
How do you create messages as role assistant?