Here is how I approached this. The messages are segregated by assistant.id. To make this clearer when you see the results I changed the code shown earlier to show the results as follows: I am keeping this example simple, but as you can see the thread simply contains the conversation between assistants and any humans that are in the loop. The thread mirrors the conversation window you have when you are working with ChatGPT.
# Show the final results
messages = client.beta.threads.messages.list(thread_id=thread.id)
# Save the text of the messages so that they can be printed in reverse order
messageStore = []
for message in messages:
if message.assistant_id == assistantCritic.id:
assistantName = "Critic: "
elif message.assistant_id == assistantWriter.id:
assistantName = "Writer: "
messageStore.append(assistantName+message.content[0].text.value)
#To make it more readable print the messages in reversed order
for message in reversed(messageStore):
print(message)