Skip to content

Commit

Permalink
fixed bugs in whisper api
Browse files Browse the repository at this point in the history
  • Loading branch information
Leask committed Jun 27, 2024
1 parent e8a26e4 commit f174b7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/speech.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const init = async (options) => {
const openai = new OpenAI(options);
if (options?.tts) {
clients.tts = openai.audio.speech;
clients.toFile = OpenAI.toFile;
}
if (options?.stt) {
clients.stt = openai.audio.transcriptions;
Expand Down Expand Up @@ -175,8 +176,8 @@ const sttOpenAI = async (audio, options) => {
withCleanupFunc: true,
});
const result = await clients.stt.create({
content, model: 'whisper-1', response_format: 'text',
...options?.params || {},
file: await clients.toFile(content), model: 'whisper-1',
response_format: 'text', ...options?.params || {},
});
await cleanup();
return result;
Expand Down

0 comments on commit f174b7c

Please sign in to comment.