I am uploading my PDF to OpenAI, and then creating an assistant by providing it instructions and attaching it to the file.id of the uploaded PDF.
const file = await openai.files.create({
file: fileStream,
purpose: "assistants",
});
console.log(file);
const assistant = await openai.beta.assistants.create({
instructions:
"You are a quiz generator, make use of your knowledge based on the pdf to generate a quiz for the user based on the specifications.",
model: "gpt-3.5-turbo-1106",
tools: [{ type: "retrieval" }],
file_ids: ["file-NLj0Kes2UrQGXxv5TcF5JbFP"],
});
How can I proceed further to generate a response?
Say the user uploads the PDF and asks to generate a quiz of 5 mcq type questions. Then the AI should give the desired output.
I do know that I need to create a thread, and then create a run and then retrieve run. If this is the correct way to go then help me through the process, or if there is another way then help me understand that too.