Can't add "assistant" role message in assistant api

I’m trying to use the Assistants API - it seems client.beta.threads.messages.create only works with role=“user” but not role=“assistant”. Is there any way to add as in the chat api a previous message history directly?


You maybe able to use threads enabled by OpenAI.

Ensure you are using &

no, you can only create user messages. The assistant prompt is given only in the assistant config que you create it.

1 Like

okay so basically for those of us who use gpt to finish a conversation by feeding it something it already said

we should not use the assistants api? …that kinda sucks …but i guess…

I second this – I am trying to implement a caching mechanism, so that if a user asks for a response to U1,A1,U2, and the response was A2, the cache would store A2. Next time for the same sequence of messages U1,A1,U2, I would find the response A2 in the cache, and now I want to insert A2 into the thread so everything afterwards looks as if the assistant indeed produced A2.

[notation U1, A1 etc are user, asst msgs respectively]

1 Like

I tried createAndRun to see if that would trigger an Assistant reply without a user message and it does not work.

OpenAI team, we need an endpoint that triggers an assistant reply based on current Thread state. I’m specifically trying to get the Assistant to start the conversation, based on the Assistant instructions.

what I’m doing is feeding the previous conversation as part of the user message (specifying what the assistant said previously). Not ideal

That is what threads do. They provide the whole context to the assistant. You add a user message, run the thread, get messages from the assistant, add a new user message and run the thread again…

You want the assistant to proactively start a conversation ? Any trigger that would make the assistant start, would be a user message. But what is your use case ?

I have a settings where I want to continue a previous conversation, but without using the thread memory.

As far as I know, assistants can only be used with threads. Before assistants I developed a session class that was essentially the same as a thread.
What I did different, was to create a conversation summary and storing that to feed to the model Summary + new input - > assistant output
But that works with the chat model, not with assistants

Facing exactly the same issue. Would be nice if the Create message method would support the assistant role and not only user.