Retrieval of Thread Message When Ready

I have a paralegal chatbot built with Bubble io (no-code). I can create the thread, message, run it but I cannot set up a webhook in the Open AI platform to let my app know when the response is ready and finished to retrieve it. I set up a 20 sec delay but sometimes it is not enough and it retrieves the user prompt. Is there another way to fix it?

with assistants api you can query the status of the run and get the messages when the status shows completed. keep an eye out for other statuses that would indicate a non-successful termination.

1 Like

You can see this code for how you could set up a “wait_for_run()” function:

(This is code for an Agent class that wraps the Assistant API in Langroid)

1 Like

Im going to try and incorporate something similar in no-code.

Thanks for the help!