Assistant API returns empty text.value in the "assistant" message object

Hi, I am working on a chatbot application using OpenAi Assistant API. After creating the user “Message” and creating a “Run”, I make a request to “Retrieve Messages List” to get the “Assistant Response”. I managed to achieve all of that but the “Assistant Message” object has an empty value. When making more than one call, I get the text.value of the assistant.

So what I am assuming is that the “Assistant Message” object is created once I create the “Run” without the value. Once the value is ready, the object is being updated.

The first way that comes to my mind to handle this is to use WebSocket and listen to the message object update. Once I confirm the value is set, I can send it back to my client where we will have a WebSocket connection as well. However, I found that OpenAi does not support a WebSocket connection.

I would appreciate your thoughts on this…

As of now you need to poll the run status and wait for a finished result (cancelled, expired, failed, completed) and then retrieve the message(s) afterwards.

https://platform.openai.com/docs/assistants/how-it-works/run-lifecycle

2 Likes

It looks like a good approach for the time being. Thank you for your reply @RonaldGRuckus.