-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed as not planned
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationopenai apiRelated to underlying OpenAI APIRelated to underlying OpenAI API
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
Note: This is not an issue with the library, but rather the official documentation on the OpenAI website.
Under Step 2 in [https://platform.openai.com/docs/assistants/tools/file-search](this doc), this block of code is shown:
const fileStreams = ["edgar/goog-10k.pdf", "edgar/brka-10k.txt"].map((path) =>
fs.createReadStream(path),
);
// Create a vector store including our two files.
let vectorStore = await openai.beta.vectorStores.create({
name: "Financial Statement",
});
await openai.beta.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, fileStreams);In the last line, uploadAndPoll expects a JSON object of the format { files: Uploadable[]; fileIds?: string[] }. However, in the given example, we directly pass in fileStreams, an object of type Uploadable[].
The last line in the documentation should then be updated to
await openai.beta.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, { files: fileStreams });To Reproduce
Attempt to run the code segments provided in the documentation.
Code snippets
No response
OS
macOS
Node version
Node v22.11.0
Library version
openai v4.72.0
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationopenai apiRelated to underlying OpenAI APIRelated to underlying OpenAI API