Can't get the assistant reply

Hi there,
I just started to use API so sorry if my question is a dumb one, also I’ve tried to search for past messages with this topic I wasn’t able to find it.

I basically made a copy and paste of a tutorial I watched on YT (, I got credit but what I can read on the terminal is the thread id, the message content of the user but I ain’t got the assistant reply.

If I the assistant in the playground it works without any issue.

Any (precious) suggestions?

Thank you so much.

The response won’t be immediate. We need mechanism like polling, in a simple term out program should ask the back end the execution status in a reasonable rate. Once the status is “completed”, you can proceed with getting the “messages”.

Below is my implementation in Python. I also have one callback function to adjust the interval to wait programmatically, but you can ignore them at this point.

    async def __polling(
        thread_id: str,
        run_id: str,
        interval: int = 1,
        timeout: int = 180,
    ) -> str:
        _elapsed_time = 0
        while True:
            await asyncio.sleep(interval)
            retrieve = cls.backend.beta.threads.runs.retrieve(
                thread_id=thread_id, run_id=run_id
            status = retrieve.status
            if status in [
                return retrieve
            _elapsed_time += interval
            if _elapsed_time >= timeout:
                return retrieve
            if callback is not None:
                interval = callback(interval)
1 Like

Hi Jonah and thanks for your reply.
I didn’t read anything about polling to get an assistant’s reply. Can you lead me to the knowledge base? I thank you again.

Polling for updates

In order to keep the status of your run up to date, you will have to periodically retrieve the Run object. You can check the status of the run each time you retrieve the object to determine what your application should do next. We plan to add support for streaming to make this simpler in the near future.

View it together with diagram below, basically we have to try it over and over again until the run.status is queued or in_progress.

1 Like

Hey Jonah sorry for being late with my reply but it seems that I can’t access to OpenAI Forum anymore on Safari (it keeps saying “Could not retrieve your user details. Do you have an active account? and I just can’t do nothing”.
I got your point and I succeeded to get the assistant’s reply, while monitoring the run status.
Thanks again!

1 Like

Congratulations :tada: Glad to hear that.
And I also experience the same difficulty to access this forum with Firefox.

1 Like