So i have a React project. Back-end is Firebase where we use OpenAI SDK for file analysis. The problem is that I get this error
400 Additional properties are not allowed (‘file[path]’ was unexpected)
and it doesn’t matter what I do…
type or pas.https.onCall(async (data, context) => {
const { file, fileName, docId, userId } = data;
try {
console.log(`Starting analysis for file: ${fileName}`);
console.log('Uploading to OpenAI...');
const openAIFile = await openai.files.create({
file: file,
purpose: 'assistants'
});
console.log('File uploaded successfully to OpenAI');
console.log('Creating vector store...');
const vectorStore = await openai.beta.vectorStores.create({
name: `Analysis for ${fileName}`,
});
openai.beta.vectorStores.fileBatches.createAndPoll(vectorStore.id, {
file_ids: [openAIFile.id]
});te code here
and here is the component
type const analyzeFile = httpsCallable(functions, 'openAi-analyzeFile');
const result = await analyzeFile({
file: file,
fileName: file.name,
docId: docRef.id,
userId: user.uid
});
console.log('Analysis result:', result.data);
return result.data;
});