Should a run be waiting for tool_output, it takes 10 minutes before to expire. In that time it is not possible to fire another run in that thread.
It would be very usefull to delete pending run in a thread expecially when debugging threads with assistants using functions tool.
Is there a way to kill the pending run (without delete a thread)?
The API Reference for Assistants offers you this method:
If it is waiting for a tool return, Iâd wonder if the thread is left in a state of internal messages that are invisible, still expecting a tool if you attach to another assistant and run. The permanence and storage of internal iterations is not made clear.
Thank you very much. I wasânt aware of it.
Do you know a reference for function template writing? I doânt know how to declare parameters such as mode=âtextâ (this is a constant parameter needed by the function to format output as text when called by openai Assistant) in order to call a python function?
I still have a small (!) problem. I can see the last pending runs in the current Thread:
for i in range(len(self.client.beta.threads.runs.list(thread_id).data)):
print(self.client.beta.threads.runs.list(thread_id).data[i])
but I didânt understood the python syntax to delete the self.client.beta.threads.runs.list(thread_id).data[i] run
May be Iâm dumb (or better, take it for granted
-) ) but I canno t derive the python call from REST syntax:
POST
https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/cancel
the following syntax seems not to work:
client.beta.threads.runs.delete(run.id)
Solved. I found the python code at following:
The correct syntax is:
client.beta.threads.runs.cancel(run.id,thread_id=thread_id)
https://platform.openai.com/docs/api-reference/runs/cancelRun
Guys OPEN AI is having an API to cancel the existing run.The above link is the openai documentation for cancelling the run.
Had the same problem, a run being stuck in ârunningâ (despite actually expired), after cancelling via API the run was stuck in âcancellingâ⌠What solved it for me was:
In the assistants playground switching the response format from âtextâ to âjsonâ, request a new answer, which I got, then switch back to âtextâ. Hope this helps.
