OpenAI( api_key='xxxxxxxxxxxxxxxxxxxxx', ) thread = client.beta.threads.create() message = client.beta.threads.messages.create( thread_id=thread.id, role="user", content=message ) run = client.beta.threads.runs.create( thread_id=thread.id, assistant_id="asst_xxxxxxxxxxxxxxxxx", ) completed = False while not completed: # ステータスの取得 run = client.beta.threads.runs.retrieve(thread_id=thread.id, run_id=run.id) print("run.status:", run.status) if run.status == 'completed': completed = True else: time.sleep(5) messages = client.beta.threads.messages.list( thread_id=thread.id, order = "desc", # 降順 ) # SyncCursorPage オブジェクトをリストに変換 message_list = list(messages) messageを投げる => 待つ => threadのmessage_listを取得する