Closed davidvonthenen closed 3 months ago
The changes encompass modifications to configuration files, client implementations, and various handler structures across the Deepgram SDK. Key adjustments include the introduction of new WebSocket and REST client functionalities, restructuring of callback and channel handling mechanisms, and updates to error messaging constants. These alterations collectively enhance the SDK's ability to manage real-time audio processing and transcription while improving code organization and maintainability.
Files | Change Summary |
---|---|
.golangci.yaml |
Updated linter paths and added new paths for websocket files; reinstated linter configuration for a specific file. |
examples/speech-to-text/websocket/... |
Modified Deepgram client instantiation method in main.go files; newly introduced simple streaming application in http_channel/main.go ; adjustments in microphone handling for WebSocket connections. |
pkg/api/listen/v1/websocket/... |
Enhanced DefaultCallbackHandler with new debug fields; renamed MessageRouter to CallbackRouter with updated methods; introduced new DefaultChanHandler and ChanRouter for WebSocket events. |
pkg/client/analyze/v1/... |
Changed client instantiation from general to REST-specific client; modified client structure to utilize REST methods. |
pkg/client/common/v1/... |
Added constants for socket operations and error handling; introduced WebSocketHandler interface for managing WebSocket connections; restructured Client type to RESTClient for clarity. |
pkg/client/listen/... |
Deprecated older client aliases and introduced new functions with clearer naming conventions for WebSocket and REST clients. |
pkg/client/speak/v1/... |
Updated client instantiation logic to transition to REST-specific methods. |
sequenceDiagram
participant User
participant WSClient
participant DeepgramAPI
User->>+WSClient: Connect()
WSClient->>DeepgramAPI: Establish WebSocket Connection
DeepgramAPI-->>-WSClient: Connection Established
WSClient->>User: Connection Successful
User->>WSClient: Send Audio Data
WSClient->>DeepgramAPI: Transmit Audio
DeepgramAPI-->>WSClient: Transcription Results
WSClient->>User: Display Transcription
User->>WSClient: Disconnect()
WSClient->>DeepgramAPI: Close Connection
DeepgramAPI-->>WSClient: Connection Closed
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Proposed changes
Addresses: https://github.com/deepgram/deepgram-go-sdk/issues/215
This implements a mechanism for using Go channels to get callbacks to events. This has been requested numerous times (example). This was deferred work since the project began, but there have been enough requests to make this a reality. This feature is required for upcoming STS work, so we need to get it in early to shake out any bugs.
Advantages of using the channel method:
This preserves the existing callback using the functions method.
This implements two examples:
examples/speech-to-text/http_channel
examples/speech-to-text/microphone_channel
Types of changes
What types of changes does your code introduce to the community Go SDK? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
NA
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation