Getting validation error when adding message to thread with role='assistant'

in the docs assistant seems to be permitted
But I’m getting this error:
BadRequestError: Error code: 400 - {‘error’: {‘message’: “1 validation error for Request\nbody → role\n value is not a valid enumeration member; permitted: ‘user’ (type=type_error.enum; enum_values=[<RoleParam.USER: ‘user’>])”, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}

while invoking this:
thread_id = ‘thread_IrgXPc3of0zkHY9vKzMTicc0’
thread = client.beta.threads.retrieve(thread_id)
message = client.beta.threads.messages.create(
thread_id=thread_id,
role=‘assistant’,
content=‘hi there’,
)

1 Like

You can only add user roles. Assistant is disallowed.

Thus you cannot multi-shot, nor can you shorten the conversation of threads.

This is likely so that developers, which OpenAI apparently views as an adversary, cannot put simulated assistant responses in to get better behaviors, nor to reduce costs or the length of threads by reloading shorter versions.

The tool ID system is also clearly to disable another method of injecting your own knowledge.

Warning OpenAI: make a system for idiots, and only idiots will use it.

1 Like

I’m encountering the same issue!

Our company operates a chat-based call center where human agents interact with customers. Alongside our human agents, we have an AI assistant that provides suggestions for responses. However, these AI-generated suggestions aren’t always used; if our agents find them unsuitable, they reply with their own answers. For this process to work effectively, it’s essential that we have the capability to include messages tagged as ‘assistant’ in our system.

Therefore, for us to effectively integrate the Assistant API, it’s vital that it supports the submission of multiple conversation threads to maintain context continuity.

I noticed in the documentation that currently, the role field only supports the ‘user’ tag. I’m looking forward to the inclusion of an ‘assistant’ role soon!

2 Likes

Hello, I noticed that too, do you have advice how to do a few shot example for the assistant if not through messages?

Thank you

One way we though about bypassing this is to feed the conversation in the instructions and than prompt for a reply, as assistant role is not permitted. But this obviously is not ideal

1 Like