-
Notifications
You must be signed in to change notification settings - Fork 111
Description
Summary
The necessary client object for pre-recorded transcription is not exposed via the DeepgramClient.
What happened?
System
Operating Environment: Linux Fedora 42 KDE Plasma 6.5 (Clean Install)
Python Version: 3.13 (running in a dedicated VENV)
Deepgram SDK Version: 5.3.0
Description
I am attempting to migrate a transcription script to use the latest Deepgram Python SDK (v5.3.0). Despite ensuring a clean install, explicit version control, and trying all documented import paths, the final API call consistently fails with an AttributeError.
Constant Error and Tried Syntax
The issue is that the necessary client object for pre-recorded transcription is not exposed via the DeepgramClient.
The script consistently fails at the API call, indicating missing attributes, regardless of the syntax used:
| Syntax Attempted | Resulting Error |
|---|---|
self.deepgram.listen.prerecorded.transcribe_file(...) |
AttributeError: 'ListenClient' object has no attribute 'prerecorded' |
self.deepgram.prerecorded.transcribe_file(...) |
AttributeError: 'DeepgramClient' object has no attribute 'prerecorded' |
self.deepgram.listen.transcribe_prerecorded(...) |
AttributeError: 'ListenClient' object has no attribute 'transcribe_prerecorded' |
Summary of Failed Imports (Context for Internal SDK Issue)
We also confirm that the following canonical imports failed, indicating a likely package structure issue in the v5.3.0 build for this environment:
from deepgram.models import PrerecordedOptions(Failed withModuleNotFoundError)from deepgram.source import FileSource(Failed withModuleNotFoundError)
Request: Please advise on the correct syntax for the transcribe_file method using raw bytes (request=audio_bytes) for SDK v5.3.0, or confirm if this is a known packaging bug requiring a fix or a downgrade.
Steps to reproduce
- Installation:
pip install deepgram-sdk==5.3.0(Confirmed viapip show deepgram-sdk). - Audio Load: Loading audio as raw bytes (
audio_bytes = audio_file.read()) to bypassFileSourceimport issues. - Client Initialization:
self.deepgram = DeepgramClient(api_key=DG_KEY).
Minimal code sample
import os
import sys
from deepgram import DeepgramClient
DG_KEY = os.getenv("DEEPGRAM_API_KEY")
try:
# 1. Initialize client
client = DeepgramClient(api_key=DG_KEY)
# 2. Prepare audio bytes (Mocking a small file read)
# The actual audio file (75MB) is loaded as bytes via file.read()
audio_bytes = b'dummy_audio_data'
# 3. Call the API (This is the line that fails with AttributeError)
print("Attempting API call...")
response = client.listen.transcribe_prerecorded(
request=audio_bytes,
options={
"model": "nova-2",
"diarize": True,
"language": "en"
}
)
print("Success:", response)
except AttributeError as e:
print(f"FAILED with AttributeError: {str(e)}")
# Expected output: 'ListenClient' object has no attribute 'transcribe_prerecorded'
except Exception as e:
print(f"An unexpected error occurred: {str(e)}")Logs / traceback
Transport
HTTP
API endpoint / path
/v1/listen/prerecorded
Model(s) used
nova-2
How often?
Always
Is this a regression?
- Yes, it worked in an earlier version
Last working SDK version (if known)
No response
SDK version
5.3.0
Python version
3.13
Install method
pip
OS
Linux (x86_64)
Environment details
Link to minimal repro (optional)
No response
Session ID (optional)
No response
Project ID (optional)
No response
Request ID (optional)
No response
Code of Conduct
- I agree to follow this project’s Code of Conduct