Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli/audio): file format detection failing for whisper #733

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

thiswillbeyourgithub
Copy link
Contributor

@thiswillbeyourgithub thiswillbeyourgithub commented Nov 8, 2023

Fix for #333

My initial problem

My case is using openai api audio.transcriptions.create -f audio.mp3. Without the fix the returned value is Error: Error code: 400 - {'error': {'message': "Unrecognized file format. Supported formats: ['flac', 'm4a', 'mp3', 'mp4', 'mpeg', 'mpga', 'oga', 'ogg', 'wav', 'webm']", 'type': 'invalid_request_error', 'param': None, 'code': None}}.

What the cause was

The issue was that using BufferReader to read from the audio file was not keeping the name attribute so the file detection code on the server side was failing.

Quality

My fix is a viable workaround but a more invasive fix would be better. I found numerous other posts with this kind of issue for a while :

so I think this quick non invasive fix would be a good idea.

Edit: confirmed this fix is still relevant for 1.2.0. I'm on linux using python 3.9.0 for this test.

@thiswillbeyourgithub thiswillbeyourgithub requested a review from a team as a code owner November 8, 2023 15:59
@thiswillbeyourgithub thiswillbeyourgithub changed the title fix: file format detection failed for whisper fix: audio file format detection failing for whisper via CLI Nov 8, 2023
Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
@RobertCraigie RobertCraigie changed the title fix: audio file format detection failing for whisper via CLI fix(cli/audio): file format detection failing for whisper Nov 10, 2023
@RobertCraigie RobertCraigie changed the base branch from main to next November 10, 2023 17:21
@RobertCraigie RobertCraigie merged commit 01079d6 into openai:next Nov 10, 2023
1 check passed
@stainless-bot stainless-bot mentioned this pull request Nov 10, 2023
@RobertCraigie
Copy link
Collaborator

Thanks for the PR!

stainless-bot pushed a commit that referenced this pull request Nov 10, 2023
Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants