#Can't get Whisper to work

1 messages · Page 1 of 1 (latest)

echo yarrow
#

For some reason I can't get Whisper to work. I've copied the documentation exactly, but it always gives the same error.
I'm working on this project in Node.js.
Here is my current code:

let transcript = openai.createTranscription({
    file: fs.createReadStream(audioFile),
    model: "whisper-1",
}).then(response=>{
    console.log(`Response recieved! ${response.text}`);
});

Here is the error I keep getting. It's saying there is no model parameter, but it's clearly there in the code above (model: "whisper-1"):

C:\DiscordBots\BloomingBot\node_modules\openai\dist\common.js:39
        throw new base_1.RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
              ^

RequiredError: Required parameter model was null or undefined when calling createTranscription.
    at exports.assertParamExists (C:\DiscordBots\BloomingBot\node_modules\openai\dist\common.js:39:15)
    at Object.<anonymous> (C:\DiscordBots\BloomingBot\node_modules\openai\dist\api.js:561:22)
    at Generator.next (<anonymous>)
    at C:\DiscordBots\BloomingBot\node_modules\openai\dist\api.js:21:71
    at new Promise (<anonymous>)
    at __awaiter (C:\DiscordBots\BloomingBot\node_modules\openai\dist\api.js:17:12)
    at Object.createTranscription (C:\DiscordBots\BloomingBot\node_modules\openai\dist\api.js:557:108)
    at Object.<anonymous> (C:\DiscordBots\BloomingBot\node_modules\openai\dist\api.js:1211:75)
    at Generator.next (<anonymous>)
    at C:\DiscordBots\BloomingBot\node_modules\openai\dist\api.js:21:71 {
  field: 'model'
}
echo yarrow
#

Update:
It seems like my OpenAI npm was quite old, so I updated it to the newest version.
After doing this, it started giving me the error const configuration = new Configuration({ TypeError: Configuration is not a constructor.
I checked the documentation and updated my code accordingly, so I now have:

const OpenAI = require("openai");
const openai = new OpenAI({
    apiKey: apiKey,
    organizationId: organizationId,
});

This doesn't give me any errors, but it doesn't autocorrect openai related things and it's saying TypeError: openai.createTranscription is not a function

Any help? 🙏 The official documentation either seems outdated, or not applicable to my project.