Assistant run status is always in queued

Hi there, i am trying to use the assistant. I actually have this code, and for some reason the status is always “queued”. Any help please?

my_thread = client.beta.threads.create()
my_thread_message = client.beta.threads.messages.create(
    thread_id=my_thread.id,
    role="user",
    content="would you explain the meaning of happiness?",
    )

my_run = client.beta.threads.runs.create(
    thread_id=my_thread.id,
    assistant_id=my_assistant_Novakorp.id,
    )

while my_run.status in ["queued", "in_progress"]:
        keep_retrieving_run = client.beta.threads.runs.retrieve(
            thread_id=my_thread.id,
            run_id=my_run.id
        )
if keep_retrieving_run.status == "completed":
            
            all_messages = client.beta.threads.messages.list(
                thread_id=my_thread.id
            )
            Respuesta = all_messages.data[0].content[0].text.value

Have you funded the account with real money and can make successful calls to chat completions?

Hi Thanks for your help, yes, i do have money and i am using the api key with completions in other projects …

have you tried client.beta.threads.runs.create_and_poll? Refer https://platform.openai.com/docs/assistants/how-it-works/polling-for-updates

1 Like

hi wellswang, yeah that worked!!! thank so much!

1 Like