I am using the assistants api. When a run in the thread expires, I cannot continue to add messages to the thread. An error like this occurs:
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “Can’t add messages to thread_xxxxxxxxxxxx while a run run_xxxxxxxxxxxis active.”, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}
I understand that I can solve this problem by deleting the current thread and creating a new one, but this would result in the loss of the conversation history with the user. I would like to only delete the expired run, or change its status to ‘cancelled’, so that I can continue the conversation with the user in the original thread without losing the conversation history.
However, I haven’t found an API to delete a run.
I tried using the ‘Cancel a run’ interface to change the status to ‘cancelled’, but ‘expired’ cannot be changed to ‘cancelled’, as shown by this error:
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “Cannot cancel run with status ‘expired’.”, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}.
How should I solve this problem?