Вот мой код:
Код: Выделить всё
messages = [
{
'role': 'user',
'content': [
{'type': 'text', 'text': 'Generate an empty word document.'},
{"type": "text", "text": "json"}
]
}
]
assistant = client.beta.assistants.retrieve(assistant_id)
thread = client.beta.threads.create(
messages=messages
)
run = client.beta.threads.runs.create(
thread_id=thread.id,
assistant_id=assistant.id
)
Код: Выделить всё
msgs = client.beta.threads.messages.list(
thread_id=thread.id
)
data = msgs.model_dump_json()
json_object = json.loads(data)
Подробнее здесь: https://stackoverflow.com/questions/786 ... d-document