I keep getting a blank response from my assistant; this happens intermittently. I will check the status of the run. When it’s complete, I will pretty_print the value of the response.
def get_response(thread):
return client.beta.threads.messages.list(thread_id=thread.id, order="asc")
# Pretty printing helper
def pretty_print(messages):
print("# Messages")
for m in messages:
print(f"{m.role}: {m.content[0].text.value}")
print()
pretty_print(get_response(thread))
For example, sometimes this will return
user: Write a short poem.
assistant: Jack and Jill went over the hill.
And sometimes this will return:
user: Write a short poem.
It seems the assistant is returning “complete” on status, but hasn’t really done anything. Is my assistant lazy? (Just kidding, but is this a known bug? Is there a way to check and retry if I get this error?)