I’m trying to make my chatgpt through the api to answer a question and generate a word document with the answer’s content, but it says it can’t do it. I have also tried telling it to generate an empty word document but it doesn’t work either. When I ask it to generate a word document I get the response: I’m sorry, that’s not possible. How else can I assist you?
Here’s my code:
<code>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
)
</code>
<code>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
)
</code>
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
)
After a while I run this code to access the new messages:
<code>msgs = client.beta.threads.messages.list(
thread_id=thread.id
)
data = msgs.model_dump_json()
json_object = json.loads(data)
</code>
<code>msgs = client.beta.threads.messages.list(
thread_id=thread.id
)
data = msgs.model_dump_json()
json_object = json.loads(data)
</code>
msgs = client.beta.threads.messages.list(
thread_id=thread.id
)
data = msgs.model_dump_json()
json_object = json.loads(data)
But it tells me it cannot generate the file, even when I tell it to put some contents on it.