I am testing the example math tutor code from the docs but the run status is stuck on either queue or in_progress. The same assistant is working in the playground.
from openai import OpenAI
import os
import dotenv
import docx
from time import sleep, ctime
dotenv.load_dotenv()
openai_api_key = os.getenv("OPEN_KEY")
client = OpenAI(api_key=openai_api_key)
assistant = client.beta.assistants.retrieve(assistant_id="MY_ASSISSTANT_ID")
thread = client.beta.threads.create()
message = client.beta.threads.messages.create(
thread_id=thread.id,
role="user",
content="I need to solve the equation `3x + 11 = 14`. Can you help me?"
)
run = client.beta.threads.runs.create(
thread_id=thread.id,
assistant_id=assistant.id,
instructions="Please address the user as Jane Doe. The user has a premium account."
)
run = client.beta.threads.runs.retrieve(
thread_id=thread.id,
run_id=run.id
)
print(client.beta.threads.messages.list(thread_id=thread.id))
print(run)
counter = 0
while run.status != "completed":
print(f"[{ctime()}]: Working... {run.status}")
if counter % 10 == 0:
print(f"\t\t{run}")
counter += 1
sleep(5)
print(client.beta.threads.messages.list(thread_id=thread.id))
The API Reference says the run should almost instantly be moved to in_progress. If this is due to a lot of requests going in shouldn’t it fail?
What happened today to the Assistant API, Custom GPTs and OpenAI systems in general? They were very degraded but the report was “all systems operational”… Do you have a report or something? Would be great.
I’m still seeing the error, it seems to only happen when I create runs in a Flask app instead of a Jupyter notebook. Here’s the commands:
message = message_manager.create_message(thread_id=thread['id'], role="user", content=content)#message object is created
run = run_manager.create_run(thread_id=thread['id'], assistant_id='fake_id')#assistant is run on message from user
I run this same code in my Flask app and the status gets stuck in ‘queued’ but running in notebook it completes automatically. I’m using the same string for the content variable. Thanks in advance for your help:)
I’m using it with curl in php and have the same problem (I think, not really a coder). But according to my log the last entry is always in_progress.
“status”:“queued”, …
and a second later “status”:“in_progress”, … nothing after that.
I am also experiencing this issue calling via python. As others have said the playground still works fine. This began for me as I was integrating Functions calls. It looks like all of my previous runs have the “expired” status.
similar issue - for some reason I cannot fathom, the first run to the thread completes almost instantaneously but a second remains queued forever with no status or usage update, even though the thread shows that an answer was returned.
while run.status == "queued" or run.status == "in_progress":
print(run.status)
run = client.beta.threads.runs.retrieve(
thread_id=thread.id,
run_id=run.id,
)
time.sleep(5)
Here after printing 5/6 times “in_progress” it is getting stuck there only without returning any error or any movement of the code.
But in the GUI of thread, it can be seen that the correct response is being generated.