-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Weird interaction change with OpenAI Client and files #942
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
Comments
Please see the migration guide for v1: #742 It looks like your code snippet is still written for the v0, which has a different API. Note also the documentation on file uploads: https://github.com/openai/openai-python#file-uploads |
I'm quite confused wasnt this migration supposed to be plug and play?
|
Makes me think did the old client support |
cc @morgante, do you think we could auto-migrate this case? @Lord-Haji can you share the code you have now? |
@Lord-Haji Can you share a minimal reproduction / repo with a sample that worked before? If so, I think we can set up an auto-migration. |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
I had a webapp running which was using the openai==0.27.7 I recently was working on revamping it and switched to the new openai client. I thought it'll be just plug and play with the new Interface like how GPT works. I tried changing my approach a few times but kept getting weird file format errors everytime. Not an issue on the file end since the same one works on the older api for the same.
Totally an issue on the new client
To Reproduce
` def transcribe(self):
# transcript_text = openai.Audio.transcribe("whisper-1", self.audio_file)["text"]
transcript_text = client.audio.transcriptions.create(
model = "whisper-1",
file = self.audio_file
)["text"]
self.transcript = transcript_text
@app.post("/transcribe_audio") async def transcribe_audio(audio_file: UploadFile = File(...)): if audio_file.filename.endswith((".mp3", ".wav", "m4a", "mp4", "mpeg", "mpga", "oga", "ogg", "webm")): audio_query = AudioQuery(audio_file) transcript_text = audio_query.transcribe() return {"transcript": transcript_text} else: raise HTTPException(status_code=400, detail="Invalid file type. Please upload a file in a supported format")
Code snippets
OS
Windows
Python version
Python v3.11.4
Library version
openai v1.0.1
The text was updated successfully, but these errors were encountered: