Hi.
Current version, we need to the state of run with polling.
It may increase server and client resouce.
https://platform.openai.com/docs/api-reference/runs/createRun
It is nice to set webhook url to receive a message when the state changed.
Like below
curl https://api.openai.com/v1/threads/thread_abc123/runs \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v1" \
-d '{
"assistant_id": "asst_abc123"
"webhook_url": "https://www.mydomain.com/webhook/openai"
}'
The payload is good like that
{
"assistant_id": "xxx",
"thread_id": "xxxx",
"state": "cancelling"
}
What do you think?