Is api not working? I get the error run is active right from the second request to the specified thread_Id

I’m running the API and I’m getting the following errors:

HTTP Code: 500 Result: Error: 400 Can't add messages to thread_xxxxxxxxxx while a run run_xxxxxxxxxx is active.

How can I get around this? I tried retries, timeouts, but nothing helps :frowning: run seems to “stick” for a while. Is there any way to save thread_id but try in another run? Tell me how do you solve this? I have been suffering for a few days now. Thanks!

1 Like

List runs. https://platform.openai.com/docs/api-reference/runs/listRuns

Cancel run. https://platform.openai.com/docs/api-reference/runs/cancelRun

Check your bill.

2 Likes

Can you please tell me if my thread thread_id will be saved when cancel run? I know that for me the option is to send a message to a new thread, but then I will lose the history of the message with the user.

Thanks

Threads exist somewhat separately from a run.

You continue to add to a thread by attaching it to an assistant run and then running based on a user input.

You can also pull down the thread with “list messages” and see what’s in it. I expect that if failed, a user/assistant pair would not have been added. It should just have the user message that you previously added. You can correct what combination of documents, functions, code interpreter was causing it to wait for more input or iterating for hundreds of steps, and submit the user input again.

Or return back to chatcompletion and write your own code that is not out of control…

1 Like

Sorry, I don’t really know what this is about and I’m not good at programming at all :frowning:

If I understood correctly, I should try to do a “CANCEL RUN” on failures, and send the message again to the same thread with the same threadid, right?

In summary:

  1. The run will expire after 10 minutes if not cancelled
  2. The thread won’t be deleted if the run is cancelled
1 Like

Fortunately for those that don’t program, assistants have about 30 different methods to all choreograph in concert with code.

It’s a Rube Goldberg machine of silliness.

When you have to whip up some new script for the fail or edge cases, that doesn’t bode well for making a user interface for it - as well as having no idea what the bill would be.

Whereas chat completion, you can stuff it with just 10 past conversation turns (now that hitting a context limit would be very hard, but assistants tries to hit that limit anyway), inject your own embeddings database that is just what is relevant, and start getting tokens displayed in two seconds.

1 Like

So it’s better not to use Assistants? It’s not reliable? And it’s better to use your BD and manage the process more?

I seem to have it worked out in case of errors to quickly cancel RUN and the dialog continues, thanks a lot guys!

And I also want to note that this error started yesterday when OpenAI started having some problems again…

If you need an AI to act as an independent agent to make dozens of calls to functions, or to be loaded up with thousands of words of documentation, to check back later and get an answer, it might be a solution for an AI that can be a number-crunching code-interpreting crumb-nuncher that finally gives a better answer than the 0-shot AI alone, but it is neither a “less code easy solution” nor a product you could offer as an API developer that is cost-conscious, or to satisfy someone that just wants to chat with a robot.

1 Like

That is, if I do an undo RUN, the dialog will only remember 10 subsequent conversations and then stop remembering the context (conversation history). Right?

At first I was really very happy for the Assistants API then just when I was about to implement and remove the Completion codebase I had set up. There just popped a lot of unanswered questions that don’t have their answers in the docs or anywhere. I came across a Community post that seems to highlight all those major questions. It seems by leaving the chat completion where we have full control to Assistants API we acknowledge that OpenAI should just come up with their own version of input and output tokens: Why is it that I can’t set the max token I need used up for a call?

Initially these questions didn’t come to mind, just popped yesterday when I wanted to set up for the Assistants API and leave the Chat Completion. I don’t have any problem with hooking their endpoint to delete older message so at any point a thread only has a total of number of conversion arrays I need it to have. I don’t have issues with that or the Retrieval tool, the problem I have is OpenAI not providing the control over token usage. Having chosen GPT-4 Turbo 128K doesn’t mean I want threads to consume upto that amount without me setting the tokens from my end like I would do with Chat Completion.

Maybe this will be addressed in the future updates to the beta Assistants API but for now it’s just not worth it pushing to production.

1 Like

But I can’t work on the API at all :frowning: Tell me do you work on the API? Are you having any problems?

Now I’m getting another error :frowning: How do I get around this? Are there any options available? I created a bot that can’t communicate because of errors and I’m losing money :frowning:

At first I was getting the error “run is active”. Now I get another error

HTTP Code: 500 Result: Error: Error processing thread: failed, Thread ID: thread_wQwXbvfyjTD7pqohMjK4ko3r, Run ID: run_ctzbO3VuvJyDpka2iL7evs4P

You can help me, please? :pray:

I would recommend you try this with gpt-3.5-turbo - not the 1106 models.

The new preview models seem to often be timing out while returning no results.

With a service that can rely on multiple calls to a model, the effect is amplified.

500 - internal failure

1 Like