deepgram / deepgram-go-sdk

Go SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
31 stars 27 forks source link

Updates Examples With New Package Names, Adds Warning, Fix Thread Panic #252

Closed dvonthenen closed 2 months ago

dvonthenen commented 2 months ago

Proposed changes

Addresses: https://github.com/deepgram/deepgram-go-sdk/issues/251

This PR does three things:

Tested on all examples.

Types of changes

What types of changes does your code introduce to the community Go SDK? Put an x in the boxes that apply

Checklist

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

coderabbitai[bot] commented 2 months ago

[!IMPORTANT]

Review skipped

Review was skipped due to path filters

Files ignored due to path filters (48) * `examples/manage/balances/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/manage/invitations-new-RENAME/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/manage/invitations/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/manage/keys/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/manage/members/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/manage/projects/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/manage/scopes/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/manage/usage/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/callback/callback/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/callback/endpoint/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/file-new-RENAME/Bueller-Life-moves-pretty-fast.mp3` is excluded by `!**/*.mp3`, `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/file-new-RENAME/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/file/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/intent/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/sentiment/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/stream/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/summary/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/topic/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/rest/url/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/websocket/http/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/websocket/microphone-new-RENAME/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/websocket/microphone/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/websocket/replay/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/speech-to-text/websocket/test/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/rest/file-new-RENAME/hello-world/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/rest/file/hello-world/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/rest/file/woodchuck/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/rest/stream/hello-world/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/rest/stream/woodchuck/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/rest/writer/hello-world/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/rest/writer/woodchuck/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/websocket/interactive/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `examples/text-to-speech/websocket/simple/main.go` is excluded by `!examples/**`, `!!tests/expected_failures/**` * `pkg/api/speak/v1/websocket/default.go` is excluded by `!!tests/expected_failures/**` * `pkg/api/speak/v1/websocket/interfaces/constants.go` is excluded by `!!tests/expected_failures/**` * `pkg/api/speak/v1/websocket/interfaces/interfaces.go` is excluded by `!!tests/expected_failures/**` * `pkg/api/speak/v1/websocket/interfaces/types.go` is excluded by `!!tests/expected_failures/**` * `pkg/api/speak/v1/websocket/router.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/common/v1/common.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/interfaces/utils.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/interfaces/v1/utils.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/listen/client.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/listen/v1/websocket/client.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/listen/v1/websocket/constants.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/speak/client.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/speak/v1/rest/client.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/speak/v1/websocket/client.go` is excluded by `!!tests/expected_failures/**` * `pkg/client/speak/v1/websocket/constants.go` is excluded by `!!tests/expected_failures/**`

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent updates to the Deepgram Go SDK involve various import path changes, package refactoring, function deprecations, and updates to logging and error handling. Key modifications include reorganizing client packages for better consistency, adding recovery mechanisms for panic situations, adjusting SDK versioning, and refining the instantiation processes across different API interfaces including manage, listen, speak, and websocket.

Changes

Files/Directories Change Summary
examples/manage/* Updated import paths from rest to manage in all main.go files.
examples/speech-to-text/rest/* Switched API package from prerecorded/v1 to listen/v1/rest.
examples/speech-to-text/websocket/* Changed imports from live/v1/interfaces to listen/v1/websocket/interfaces and updated client instantiation.
examples/text-to-speech/rest/* Updated import path from speak/v1 to speak/v1/rest and modified client instantiation processes.
examples/text-to-speech/rest/writer/* Updated import paths and client instantiation in hello-world and woodchuck modules.
examples/text-to-speech/websocket/* Refactored text input sending process for better readability in interactive and simple modules.
pkg/client/speak/v1/websocket/* Updated log messages and function names for clarity and consistency.
pkg/client/interfaces/v1/utils.go Updated SDK version constant from "v1.2.0" to "v1.4.0".
pkg/client/listen/client.go Added and deprecated aliases for listenv1rest.Client and listenv1ws.Client to streamline client usage.
pkg/client/listen/v1/websocket/* Added deferred recovery functions to handle panics in Client struct methods.
pkg/client/speak/client.go Added deprecation notice for NewWithDefaults function and introduced NewRESTWithDefaults.
pkg/client/listen/v1/websocket/constants.go Introduced error constant ErrFatalPanicRecovered for handling fatal panics.
pkg/client/speak/v1/websocket/constants.go Introduced error constant ErrFatalPanicRecovered for handling fatal panics.

Sequence Diagram(s)

The changes do not include specific new features or modifications to the control flow that would necessitate sequence diagrams for better understanding. The updates largely revolve around refactoring and error-handling improvements without altering the primary interactions between components in a manner that significantly changes the overall behavior or architecture.


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?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.