https://platform.openai.com/docs/assistants/tools/file-search/quickstart
Following along I have this code
import OpenAI from "openai";
const openai = new OpenAI();
import path from 'path';
import fs from 'fs';
async function main() {
const assistant = await openai.beta.assistants.create({
name: "Financial Analyst Assistant",
instructions: "You are an expert financial analyst. Use you knowledge base to answer questions about audited financial statements.",
model: "gpt-4o",
tools: [{ type: "file_search" }],
});
}
main();
const fileStreams = ["oil.txt", "secret.txt"].map((path) =>
fs.createReadStream(path),
);
console.log(fileStreams);
// Create a vector store including our two files.
const account = async () => {
let vectorStore = await openai.beta.vectorStores.create({
name: "Financial Statement",
});
};
account();
//await openai.beta.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, fileStreams)
fs and path are both underlined in red; so i'm not sure i've imported /installed them properly. Secret and oil are in the parent directory, as per the image
I get the following error:
return fs_1.default.createReadStream(path);
^
TypeError: Cannot read properties of undefined (reading 'createReadStream')
at C:\Users\pitts\Desktop\Git\tester assistant\fileRead.js:62:25
at Array.map (<anonymous>)
at Object.<anonymous> (C:\Users\pitts\Desktop\Git\tester assistant\fileRead.js:61:45)