I am trying to create a file in a Cloudflare Worker’s context. This is using the beta API for Assistants.
const blob = new Blob(["Lorem Ipsum"], { type: "text/plain" });
const formData = new FormData();
formData.append("file", blob, "test_story.txt");
formData.append("purpose", "assistants");
console.log("formData:", JSON.stringify(formData));
const myfile = await openai.files.create(formData);
But I get 400 HTTP Error with a complaint that file is required.
Question: Is it possible to use this API like this? Cloudflare Workers do not have access to the file system so the OpenAI’s examples don’t apply, as I can’t use “fs” to read in the file. This should be equivalent I think but it doesn’t seem to be the case.
Any ideas?