#when do i need a run?

1 messages · Page 1 of 1 (latest)

soft yoke
#

So basically i created an assistant, i created a thread for it and attached the file_search and all the files in a vector db, which i can see worked in the openai ui:

now i simply want to ask questions that are contained in that file.
but this is in_progress forever:

  const run = await openai.beta.threads.runs.create(chatBot?.threadBotId!, {
    assistant_id: chatBot?.assistantId!,
    instructions: message,
  });
  console.log("run started", run);
  const res = await openai.beta.threads.runs.retrieve(
    chatBot?.threadBotId!,
    run.id
  );

  while (res.status !== "completed") {
    console.log("waiting, current status", res.status);
    await sleep(5000);
  }
  const messages = await openai.beta.threads.messages.list(
    chatBot?.threadBotId!,
    {
      limit: 1,
    }
  );
  console.log(messages);

i think im doing something wrong because if i do the same in the openai playground the response is way quicker? So i want to ask my assistant questions regarding the file it knows. Can someone help me out? 😦