Assistant replied nothing not even role

here is my code to chat with Assistant I already created.

assistant = client.beta.assistants.retrieve(assistant_id=assistantid)
print(assistant.name)
thread = client.beta.threads.create()

message = client.beta.threads.messages.create(
    thread_id=thread.id, role="user", content="What can you help me with?")

run = client.beta.threads.runs.create(thread_id=thread.id,
                                      assistant_id=assistant.id)

run_status = client.beta.threads.runs.retrieve(thread_id=thread.id, run_id=run.id)
print(run_status.status)
messages = client.beta.threads.messages.list(thread_id=thread.id)


print(client.beta.threads.messages.retrieve(message_id=messages.data[0].id,
                                            thread_id=thread.id))
for message in reversed(messages.data):
  print(message.role, ": ", message.content[0].text.value)

Can Anyone tell me about this Why it’s not give any response?

I think my assistant is facing some issue because I same issue. It was working fine previously but suddenly do not giving any reply.

1 Like

Same here actually.

It worked before. But now When tested it again. It stops working.

do you have any idea why this happens, any clue?

I suggest using, at first, a simple try+except statement for every OpenAI call. Something like replacing your first line

try:
   assistant = client.beta.assistants.retrieve(assistant_id=assistantid)
except Exception as e:
  print(f"\nGot a retrieve error : {e}")

You can then use a more specific set of catching exceptions. You can see the types of exceptions the OpenAI python github repo (in the README)