-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
According to the document Uploading Your Batch Input File. I tried the following code:
import fs from "fs";
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
const file = await openai.files.create({
file: fs.createReadStream("batchinput.jsonl"),
purpose: "batch",
});
console.log(file);
}
main();However, it outputs the error:
TSError: ⨯ Unable to compile TypeScript:
worker/generate.ts:18:4 - error TS2322: Type '"batch"' is not assignable to type '"fine-tune" | "assistants"'.
18 purpose: "batch",
~~~~~~~
node_modules/openai/resources/files.d.ts:119:5
119 purpose: 'fine-tune' | 'assistants';
~~~~~~~
The expected type comes from property 'purpose' which is declared here on type 'FileCreateParams'
Maybe the type batch is missing in this line of the openai package source code:
openai-node/src/resources/files.ts
Line 185 in 7196ac9
| purpose: 'fine-tune' | 'assistants'; |
We can fix it by adding batch
purpose: 'fine-tune' | 'assistants' | 'batch';To Reproduce
Easy to reproduce: look at official documentation page - https://platform.openai.com/docs/guides/batch/2-uploading-your-batch-input-file
Run above code in nodejs / typescript.
Code snippets
No response
OS
macOS
Node version
v20.11.0
Library version
v4.42.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working