-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
I am attempting to use the Deepgram transcription API in my Python code, but I am encountering an error related to the audio_file
parameter. When I make a request to the transcription endpoint, I receive the following error message:
litellm.APIConnectionError: Unsupported type for audio_file: <class '_io.BytesIO'>
I have tested all available models (e.g., nova-2
), and the error persists for every request. The goal is to integrate Deepgram with OpenWebUI using OpenAI Endpoints, but this error prevents successful transcription.
Relevant log output
{
"error": {
"message": "litellm.APIConnectionError: Unsupported type for audio_file: <class '_io.BytesIO'>\nTraceback (most recent call last):\n File \"/usr/lib/python3.13/site-packages/litellm/main.py\", line 4911, in atranscription\n init_response = await loop.run_in_executor(None, func_with_context)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.13/concurrent/futures/thread.py\", line 59, in run\n result = self.fn(*self.args, **self.kwargs)\n File \"/usr/lib/python3.13/site-packages/litellm/utils.py\", line 949, in wrapper\n result = original_function(*args, **kwargs)\n File \"/usr/lib/python3.13/site-packages/litellm/main.py\", line 5090, in transcription\n response = base_llm_http_handler.audio_transcriptions(\n model=model,\n ...<19 lines>...\n headers={},\n )\n File \"/usr/lib/python3.13/site-packages/litellm/llms/custom_httpx/llm_http_handler.py\", line 926, in audio_transcriptions\n binary_data = self.handle_audio_file(audio_file)\n File \"/usr/lib/python3.13/site-packages/litellm/llms/custom_httpx/llm_http_handler.py\", line 881, in handle_audio_file\n raise TypeError(f\"Unsupported type for audio_file: {type(audio_file)}\")\nTypeError: Unsupported type for audio_file: <class '_io.BytesIO'>\n. Received Model Group=nova-2\nAvailable Model Group Fallbacks=None LiteLLM Retried: 1 times, LiteLLM Max Retries: 2",
"type": "None",
"param": "None",
"code": "500"
}
}
Code Snippet
Here’s the Python code I’m using to call the API:
import requests
file_path = "D:/test.mp3"
filename = "test.mp3"
with open(file_path, "rb") as file:
response = requests.post(
url="http://0.0.0.0:4000/v1/audio/transcriptions",
headers={
"Authorization": "Bearer sk-xxxxxxxx"
},
files={"file": (filename, file, "audio/mp3")},
data={"model": "nova-2"},
)
print(response.text)
config.yml file
model_list:
- model_name: nova-2
litellm_params:
model: deepgram/nova-2
api_key: os.environ/DEEPGRAM_API_KEY
model_info:
mode: audio_transcription
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
v1.63.3
Twitter / LinkedIn details
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working