Hello,
I’m reporting a small inconsistency in the “Speech to text” documentation.
In the documentation, there is this excerpt:
from openai import OpenAI
client = OpenAI()
audio_file = open("/path/to/file/speech.mp3", "rb")
transcription = client.audio.transcriptions.create(
model="gpt-4o-transcribe",
file=audio_file,
response_format="text"
)
print(transcription.text)
However, running this leads to an AttributeError
, because transcription
will actually be of type str
. This is expected, as confirmed by the implementation of audio.transcriptions.create
which expects a str
return when response_format
equals "text"
.
A quick fix would be to change the print(transcription.text)
to print(transcription)
in the documentation.
thx!