I have an assistant that I call the following way
await openai.beta.threads.messages.create(thread.id, {
role: 'user',
content: generateUserDefaultMessage({
challenge,
}),
});
const run = await openai.beta.threads.runs.createAndPoll(thread.id, {
assistant_id: assistantService.getAssistant().id,
instructions: generateAssistantDefaultAnalysis(),
response_format: zodResponseFormat(
AssistantAnalysis,
'ranalysis'
),
});
Now from the DOC I see I need to do
if (run.status === 'completed') {
const messages = await openai.beta.threads.messages.list(run.thread_id) ;
const message = messages.data?.at(-1);
// message is my message
But how do I access the parsed version like the doc for GPT suggest ?
Is there some failure in my implementation ?