-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
400 'file' is a required property when Creating File in CloudFlare Worker #804
Comments
Has anyone else experienced this? This is a product level blocker on my end and I'm willing to assist in the fix. |
Thanks for reporting, we'll take a look soon. In the meantime, you might try methods other than |
I came up against this as well. I was trying to upload a PDF, but couldn't get the lib to accept anything other than a FsFileStream from It'd be nice if it could accept a regular Readable stream, not just a file stream from After looking at the code, my workaround was to make something that would pass through const file = {
type: 'application/pdf',
name: 'test.pdf',
filename: 'test.pdf',
lastModified: new Date().getTime(),
arrayBuffer: () => convertThingYouHaveToBuffer(),
// It doesn't use these, but it needs them to work around type checking
size: 1,
text: () => '',
slice: () => [],
} |
@benogle I've tried that and am still getting the same error. Here is my code: const id = uuidv4();
await env.DOC_BUCKET.put(id, trainingStr);
const obj = await env.DOC_BUCKET.get(id);
const file = {
type: "application/jsonl",
name: "training.jsonl",
filename: "training.jsonl",
lastModified: new Date().getTime(),
arrayBuffer: async () => await obj.arrayBuffer(),
// It doesn't use these, but it needs them to work around type checking
size: 1,
text: async () => await obj.text(),
slice: (): any => [],
};
const res = await llm.files.create({
file,
purpose: "fine-tune",
}); |
Sorry we haven't been able to take a look at this yet. We've been backed up with other things but do hope to get to it in the next month or so. |
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
I get the following error when I try to create a file from a CloudFlare worker environment.
I'm able to successfully create a file from a vanilla nodejs environment. I've also confirmed that CURL requests are working.
To Reproduce
Run the following code in a CloudFlare worker environment.
Code snippets
No response
OS
macOS
Node version
v18.0.0
Library version
4.38.5
The text was updated successfully, but these errors were encountered: