TypeError with new whisper-1

my python with whisper-1 works fine before using:

audio_file = open(“audio_in.mp3”, “rb”)
transcript = openai.Audio.transcribe(“whisper-1”, audio_file).

After upgraded openai from 0.27.8 to 1.2.0, running same python using:

from openai import OpenAI
client = OpenAI()

audio_file = open(“audio_in.mp3”, “rb”)
transcript = client.audio.transcriptions.create(
model=“whisper-1”,
file=audio_file
)

I got error message:

model=“whisper-1”,
^^^^^^^^^^^
TypeError: Transcriptions.create() takes 1 positional argument but 2 were given.

How to fix this?

1 Like

I got the same problem, but it works with POST: https://platform.openai.com/docs/api-reference/audio/createTranscription

I have had the same issue. Basically very simple code written based on provided api code samples but after cleaning it all up I had some extra brackets

transcript = client.audio.transcriptions.create(
    model="whisper-1", 
    file=audio_file
)
text = transcript['text']

That code works for me

2 Likes

Really works :grinning:, python basics. Btw, I need to use .text instead of [‘text’]. Maybe I should get another version of python. I’m using 3.7.3.

Thanks for the above solutions, I fixed it by add a code:

transcript = client.audio.transcriptions.create(
model=“whisper-1”,
file=audio_file,
response_format=“text”
)