You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirm this is an issue with the Python library and not an underlying OpenAI API
This is an issue with the Python library
Describe the bug
When using openai_client.audio.transcriptions.create) with an in-memory file (io.BytesIO), the function fails unless the .name attribute is manually set to a valid filename with a supported extension (e.g., audio.wav or audio.mp3).
This requirement is not documented, and the resulting error is confusing (e.g., AttributeError). This is especially problematic when handling file uploads in memory, such as from Telegram bots or web clients.
To Reproduce
importiofromopenaiimportAsyncOpenAIopenai_client=AsyncOpenAI(api_key=OPENAI_API_KEY)
# Simulating an audio file from memory (e.g., from a Telegram bot)audio_bytes=io.BytesIO(b"audio binary data here")
# This will fail unless you set `audio_bytes.name = "audio.wav"awaitopenai_client.audio.transcriptions.create(
model="whisper-1", file=audio_bytes
)
Code snippets
OS
windows
Python version
python v3.11.4
Library version
openai v1.75.0
The text was updated successfully, but these errors were encountered:
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
When using
openai_client.audio.transcriptions.create)
with an in-memory file (io.BytesIO
), the function fails unless the.name
attribute is manually set to a valid filename with a supported extension (e.g.,audio.wav
oraudio.mp3
).This requirement is not documented, and the resulting error is confusing (e.g.,
AttributeError
). This is especially problematic when handling file uploads in memory, such as from Telegram bots or web clients.To Reproduce
Code snippets
OS
windows
Python version
python v3.11.4
Library version
openai v1.75.0
The text was updated successfully, but these errors were encountered: