Error when adding 'timestamp_granularities' to Whisper API

When adding timestamp_granularities to the whisper API, I get:
TypeError: Transcriptions.create() got an unexpected keyword argument 'timestamp_granularities'

The code I’m running to do this is straight from the documentation here:
https://platform.openai.com/docs/api-reference/audio/createTranscription?lang=python

audio_file = open(“sample.mp3”, “rb”)
transcript = openai_client.audio.transcriptions.create(
file=audio_file,
model=“whisper-1”,
response_format=“verbose_json”,
timestamp_granularities=[“word”]
)

When removing timestamp_granularities=["word"], the code completes fine and as expected:

audio_file = open(“dream-machine-test.mp3”, “rb”)
transcript = openai_client.audio.transcriptions.create(
file=audio_file,
model=“whisper-1”,
response_format=“verbose_json”,
)

print(transcript)

Has timestamp_granularities been depreciated? I have confirmed I’m using openai 1.51.2 , is there something I’m missing here?

Very much appreciate the help.

You need to upgrade to the recent version. I have openai-1.52.0
and timestamp_granularities works fine

2 Likes

Thanks! This was related to the version I mistakenly thought I was up to date.