Use uploaded file as context in answer api

Hi, I want to upload pdf file, and then use it as a context for my questions, for example “which colors are mentioned in this file”. I uploaded a file successfully, it answers with file id, but how can I connect it with answer api? What should I add to openAi.chat.completions.create as param?
I want to ask a few questions about every file, so I want them to use as little tokens as possible, I don’t want to paste all the file content in every question.

const response = await openAi.files.create({
    file: pdfFile,
    purpose: "assistants",
  });

await openAi.chat.completions.create({
    model: "gpt-3.5-turbo",
    messages: [
      {
        role: "user",
        content: params.prompt,
      },
    ],
  });
1 Like