Deepgram V3 Python SDK Release Notes
The V3 Python SDK for Deepgram has been released, and the main README has been updated to reflect changes throughout the repository. This release includes significant updates, particularly in the walkthroughs and examples.
New Examples in the Repository
The repository now includes many examples, accessible under the examples
directory. These examples cover:
- Live audio transcription
- Management APIs
- Pre-recorded audio transcription
Notable examples include uploading a file to Deepgram and posting a URL to Deepgram with an audio file hosted behind it. All examples can be found in the repository, and the release notes can be accessed by clicking "Releases" and then "V3" on the right-hand side.
Key Features of the Release
Threading and Synchronization
The V3 SDK has undergone a significant overhaul compared to the previous version 2. Most examples in the repo now use the threaded or sync version of the Python SDK, providing greater control over IO input and how it's pushed to the Deepgram server. This allows for better control over data pushing to the Deepgram server and improved management of IO input.
Async/Await Method
The release also includes the use of the async/await method, making it easier to work with asynchronous code.
Logging Levels
Simple features like logging levels have been updated, allowing for:
- Additional tracing
- Verbose logging levels (from informational messages to buffer exchanges and more)
- Enhanced debugging and troubleshooting capabilities
Key Highlights of the Release
The V3 SDK has undergone a significant overhaul compared to the previous version 2. The main highlights of this release include:
- Support for both threaded and synchronous classes and functions
- Use of the async/await method
- Updated logging levels for better debugging and troubleshooting
Examples in the Repo
Live Stream Example
Located in the streaming
folder, there are two examples:
HTTP broadcast
: takes an HTTP broadcast and pushes it to the Deepgram platform.Local microphone
: uses the local microphone to pick up audio and pushes it to the Deepgram platform.
To run the microphone example, use python main.py
. The example demonstrates the capabilities of the Deepgram platform, including manipulating the audio stream.
Code Artifacts
The code shows how to extend the functionality and manipulate the audio information. For example:
- [Insert examples of code artifacts]
Creating a Deepgram Client and Instantiating a Live Client
To create a Deepgram client and instantiate a live client, follow these steps:
- Create the main function and instantiate a live client.
- Set up the message hooks, including:
on_transcript
: receives transcription messageson_metadata
: receives metadataon_error
: receives error messages
- Hook up Deepgram events to the message hooks.
Starting the WebSocket Connection and Recording Audio
To start the WebSocket connection and record audio, follow these steps:
- Get the live options.
- Start the WebSocket connection.
- Instantiate a microphone.
- Hook the
send
function from the WebSocket client to the microphone. - Start the microphone, and microphone data is sent to the Deepgram platform.
Management APIs (CRUD Operations)
The management APIs provide CRUD (Create, Read, Update, Delete) operations for various entities, including:
- Balances
- Invitations
- Keys
- Members
- Projects
- Scopes
- Usage
Examples of CRUD operations include:
- Listing projects
- Sending an invite
- Grabbing all invites
- Deleting an invite
All examples are located in the examples
folder of the root repository. The examples are intended to be complete and will evolve to include more and better examples. Feedback is always welcome.