I'm noticing that you set your variable results
twice:
results = client.beta.threads.messages.create(
thread_id = thread.id,
role = "user",
content = question
)
So the content of your first results
variable should be the output you see in your second run.
Then you have:
while run.status not in ["completed", "failed"]:
But you only set a new value for results
if the status is completed
. That makes me fairly confident your second run had status
as failed
. I can't tell you why it failed because you didn't print any of the logs from the assistant. Could you try printing client.beta.threads.messages.list(thread_id=thread.id)
?