Assistant message with file attached giving random answers

Hey there,

I have written some NodeJS code that uses the latest API SDK. I create a thread, upload a file, ask a question about the file, referencing the file, and then run the thread. The result is always a random answer. It clearly doesn’t read the file at all. I have tried a docx and a pdf.

I have tried attaching the file separately as a message, but subsequent messages can’t access the file and responds with things like, “I can’t find a file to read.”

I tried using the assistant playground. I uploaded a file, and ask questions, and get the same behavior. Random answers. When I push the AI as to why it’s making up answers, it tells me there was a miscommunication of some sort.

My document store clearly shows the files have been uploaded, have a valid size and name.

Any help on how to get this working would be amazing, thank you.


  1. create a new thread:

thread = await openai.beta.threads.create();

  1. i upload a file:
openaiFile = await openai.files.create({
      file: singleFile,
      purpose: "assistants",
  1. create a message with a question about the file, and attach the file that request.
const response = await openai.beta.threads.messages.create(
            role: "user",
            content: message,
            attachments: filelisting
  1. Run the thread.
await openai.beta.threads.runs.createAndPoll(threadId, {
    assistant_id: process.env.OPENAI_ASSISTANT_ID,
  1. Read the result:
const messagesList = await openai.beta.threads.messages.list(threadId);