I’m trying to create a file via the assistant API a few different ways and getting an error: TypeError: Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got function()
Here’s my code:
const response = await fetch(fileURL);
if (!response.ok) {
throw `HTTP Response Code: ${response.status}`;
}
const arrayBuffer = await response.arrayBuffer();
const uint8Array = new Uint8Array(arrayBuffer);
const readableStream = Readable.from(uint8Array);
const selection = await openai.files.create({
file: readableStream,
purpose: "assistants",
});
I’m not sure how to get the file from the URL to the API; what am I doing wrong here?
Thanks!