Bug
TranscriptionDiarized models both duration and task as required, but the diarized_json transcription response can omit both fields.
A direct response from the OpenAI API contained text, segments, and usage, but no duration or task properties.
This causes two problems:
TranscriptionDiarized.duration() throws OpenAIInvalidDataException: duration is not set.
TranscriptionDiarized.validate() fails because an absent task does not match the expected transcribe value.
Reproduction
Audio file: https://github.com/openai/whisper/blob/main/tests/jfk.flac
A direct request to the OpenAI audio transcriptions endpoint with response_format=diarized_json returned:
{
"text": "And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.",
"segments": [
{
"type": "transcript.text.segment",
"text": " And so my fellow Americans, ask not what your country can do for you,",
"speaker": "A",
"start": 0.0,
"end": 7.499999999999999,
"id": "seg_0"
},
{
"type": "transcript.text.segment",
"text": " ask what you can do for your country.",
"speaker": "A",
"start": 8.15,
"end": 10.3,
"id": "seg_1"
}
],
"usage": {
"type": "tokens",
"total_tokens": 431,
"input_tokens": 110,
"input_token_details": {
"text_tokens": 0,
"audio_tokens": 110
},
"output_tokens": 321
}
}
The response contains no duration nor task property.
Expected behavior
duration and task should be optional in TranscriptionDiarized, since it can be absent from a valid API response.
Bug
TranscriptionDiarizedmodels bothdurationandtaskas required, but thediarized_jsontranscription response can omit both fields.A direct response from the OpenAI API contained
text,segments, andusage, but nodurationortaskproperties.This causes two problems:
TranscriptionDiarized.duration()throwsOpenAIInvalidDataException:durationis not set.TranscriptionDiarized.validate()fails because an absenttaskdoes not match the expectedtranscribevalue.Reproduction
Audio file: https://github.com/openai/whisper/blob/main/tests/jfk.flac
A direct request to the OpenAI audio transcriptions endpoint with
response_format=diarized_jsonreturned:{ "text": "And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.", "segments": [ { "type": "transcript.text.segment", "text": " And so my fellow Americans, ask not what your country can do for you,", "speaker": "A", "start": 0.0, "end": 7.499999999999999, "id": "seg_0" }, { "type": "transcript.text.segment", "text": " ask what you can do for your country.", "speaker": "A", "start": 8.15, "end": 10.3, "id": "seg_1" } ], "usage": { "type": "tokens", "total_tokens": 431, "input_tokens": 110, "input_token_details": { "text_tokens": 0, "audio_tokens": 110 }, "output_tokens": 321 } }The response contains no
durationnortaskproperty.Expected behavior
durationandtaskshould be optional inTranscriptionDiarized, since it can be absent from a valid API response.