Closed davidvonthenen closed 4 months ago
[!WARNING]
Rate limit exceeded
@dvonthenen has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 37 seconds before requesting another review.
How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.Commits
Files that changed from the base of the PR and between 94d34754fe33e28845f0666f45e7b4f27d910c2a and f038bf5e70e22979d5c54d4036a9799bab602196.
The changes streamline and update the functionality across several packages in the codebase. Key modifications include simplifying WebSocket initialization, updating request handling methods, embedding RESTClient types for more consistent API usage, and marking fields as deprecated. These transformations bring more uniformity, improve error handling, and prepare the code for future updates.
File Path | Change Summary |
---|---|
examples/text-to-speech/.../main.go |
Replaced speak.NewWebSocket call with speak.NewWebSocketWithDefaults for simplified parameters. |
pkg/api/manage/v1/manage.go |
Changed Client.Client field to Client.RESTClient during initialization. |
pkg/api/speak/v1/rest/speak.go |
Removed logging statement fmt.Printf("retVal: %v\n", retVal) from performAction function. |
pkg/client/analyze/v1/client.go |
Updated DoText and DoURL methods to use c.Do instead of custom c.HTTPClient.Do execution blocks. |
pkg/client/common/v1/common.go |
SetupRequest method now sets the "Content-Type" header to "application/json"; ProcessRequest method removed; HandleResponse method now logs HTTP response handling. |
pkg/client/common/v1/types.go |
Changed Client struct to embed RESTClient using an alias instead of rest.Client ; added type RESTClient = rest.Client . |
pkg/client/interfaces/v1/types-stream.go |
Deprecated Tier field in LiveTranscriptionOptions struct, indicating future removal. |
pkg/client/listen/v1/rest/client.go |
Updated DoStream method to use RESTClient methods for request setup and execution. |
pkg/client/manage/v1/client.go |
Updated APIRequest method to use c.Do for executing HTTP requests, affecting header setting and response processing. |
pkg/client/rest/v1/rest.go |
Added SetupRequest function to prepare REST requests; updated Do function to handle HTTP and Deepgram-specific errors. |
pkg/client/speak/v1/rest/client.go |
Modified DoText method to use JSON encoding for text, adjusted request setup to use JSON text, updated comments and logging, and added handling of response headers using HTTPClient and HandleResponse . |
sequenceDiagram
participant Main
participant Speak
Note right of Main: Old Flow
Main->>Speak: speak.NewWebSocket(ctx, "", cOptions, ttsOptions, callback)
Note right of Main: New Flow
Main->>Speak: speak.NewWebSocketWithDefaults(ctx, ttsOptions, callback)
sequenceDiagram
participant Client
participant Common
Note right of Client: Old Flow
Client->>Common: c.HTTPClient.Do(ctx, req, func(res *http.Response) error { ... })
Note right of Client: New Flow
Client->>Common: c.Do(ctx, req, resBody)
sequenceDiagram
participant Client
Note right of Client: New Flow
Client->>Note: Tier in LiveTranscriptionOptions <br>Deprecated: This field will be <br>removed in a future release.
These diagrams provide a visual guide to key changes in control flow and functional updates in the codebase. They illustrate both old and new implementation flows to highlight differences.
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
This addresses which internal client to use in which situation. It turned out that the Common Client was being used in just about every situation and that the REST client, which is a lower-level client (although not being used), had a more restricted options set.
This clears up the confusion in the SDK and also makes the various level of client (API specific [most specific] - common - rest - HTTP [most general]). These are all internal changes not exposed to the user.
Tested all examples and they seem to work just fine.
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
Refactor
Client
structs to useRESTClient
for more consistent request handling across the system.Bug Fixes
performAction
function to clean up console output.Tier
field inLiveTranscriptionOptions
, preparing for future removal.Enhancements