with a function to create a thread and run that looks like this
def create_thread_and_run(assistant_id, message_content, user_id):
# Retrieve assistant
assistant = client.beta.assistants.retrieve(assistant_id)
metadata = {
"user_id": str(user_id),
"assistant_id": str(assistant_id),
"assistant_name": str(assistant.name),
}
# Create thread and run the assistant
run = client.beta.threads.create_and_run(
assistant_id=assistant_id,
thread={
"messages": [{"role": "user", "content": message_content}],
"metadata": metadata,
},
)
return run
def retrieve_thread(thread_id):
thread = client.beta.threads.retrieve(thread_id)
return thread
the expected output is as follows
if I call to the retrieve_thread function it should return the thread with metadata, but it returns a thread with empty metadata.
what am I doing wrong?