deepgram / deepgram-dotnet-sdk

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

Implement HTTP Webcast Example + Model Params When Null #270

Closed davidvonthenen closed 7 months ago

davidvonthenen commented 7 months ago

Example for doing HTTP Webcast from BBC to LiveClient.

This exposed some params that need to be null'able when certain options are not set.

coderabbitai[bot] commented 7 months ago

Walkthrough

The update enhances the solution with two new projects for HTTP and Streaming functionalities. It also modifies various models to support nullable types for improved data handling flexibility. Additionally, a sample application has been added to demonstrate live streaming service integration and transcript processing using Deepgram's API, showcasing practical implementation and usage.

Changes

File Path Change Summary
Deepgram.Dev.sln Added "http" and "Streaming" projects, including references and build configurations.
Deepgram/Models/Live/v1/Alternative.cs Changed Confidence to nullable double.
Deepgram/Models/Live/v1/Channel.cs Made Alternatives property nullable.
Deepgram/Models/Live/v1/Metadata.cs Updated RequestId, ModelUUID, ModelInfo to allow null values.
Deepgram/Models/Live/v1/ModelInfo.cs Updated Arch, Name, Version to allow null values.
Deepgram/Models/Live/v1/ResultResponse.cs Made Duration, IsFinal, SpeechFinal, Start, and Type nullable.
Deepgram/Models/Live/v1/Word.cs Changed Start, End, Confidence to nullable types.
Deepgram/Models/PreRecorded/v1/Topic.cs Made Text property nullable.
Deepgram/Factory/HttpClientFactory.cs Added logging for HttpClient instance creation.
examples/analyze/intent/Program.cs Modified logging settings, increased timeout, and added cancelToken parameter.
examples/streaming/http/Program.cs Added functionality for live streaming service integration and transcript processing.
examples/streaming/http/Streaming.csproj New project for .NET 6.0, includes references, enables nullable, copies preamble.wav.

Recent Review Details **Configuration used: CodeRabbit UI**
Commits Files that changed from the base of the PR and between db50b7c2e12c869a41158dce1f465f3fd5b99007 and ecba0fd512121f44a8aa7e0cbb0c8f8520b25e48.
Files selected for processing (12) * Deepgram.Dev.sln (3 hunks) * Deepgram/Factory/HttpClientFactory.cs (1 hunks) * Deepgram/Models/Live/v1/Alternative.cs (1 hunks) * Deepgram/Models/Live/v1/Channel.cs (1 hunks) * Deepgram/Models/Live/v1/Metadata.cs (1 hunks) * Deepgram/Models/Live/v1/ModelInfo.cs (1 hunks) * Deepgram/Models/Live/v1/ResultResponse.cs (1 hunks) * Deepgram/Models/Live/v1/Word.cs (1 hunks) * Deepgram/Models/PreRecorded/v1/Topic.cs (1 hunks) * examples/analyze/intent/Program.cs (3 hunks) * examples/streaming/http/Program.cs (1 hunks) * examples/streaming/http/Streaming.csproj (1 hunks)
Files skipped from review as they are similar to previous changes (6) * Deepgram.Dev.sln * Deepgram/Models/Live/v1/Alternative.cs * Deepgram/Models/Live/v1/ResultResponse.cs * Deepgram/Models/Live/v1/Word.cs * examples/streaming/http/Program.cs * examples/streaming/http/Streaming.csproj
Additional Context Used
GitHub Check Runs (4)
test (8.0.x) success (6)
Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'.
test (7.0.x) success (6)
Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'.
test (6.0.x) success (6)
Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'.
build success (10)
Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'. --- Deepgram/Factory/HttpClientFactory.cs: [warning] 27-27: Possible null reference argument for parameter 'name' in 'HttpClient IHttpClientFactory.CreateClient(string name)'.
Additional comments not posted (13)
Deepgram/Models/Live/v1/Channel.cs (1)
`14-14`: Making the `Alternatives` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives.
Deepgram/Models/PreRecorded/v1/Topic.cs (1)
`21-21`: Making the `Text` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives.
Deepgram/Models/Live/v1/ModelInfo.cs (3)
`14-14`: Making the `Arch` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives. --- `21-21`: Making the `Name` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives. --- `28-28`: Making the `Version` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives.
Deepgram/Models/Live/v1/Metadata.cs (3)
`14-14`: Making the `RequestId` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives. --- `21-21`: Making the `ModelUUID` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives. --- `28-28`: Making the `ModelInfo` property nullable enhances flexibility in handling cases where data might not be available. This change aligns well with the PR objectives.
examples/analyze/intent/Program.cs (4)
`8-8`: The addition of `Deepgram.Logger` import is appropriate for enhanced logging capabilities in this example. --- `20-20`: Setting the logging level to `Debug` is a good practice for detailed output in development environments. Ensure this is configurable for production use. --- `40-40`: Increasing the timeout to 120 seconds is appropriate for operations that might take longer. Ensure this value meets the expected operation times.
Verification successful --- The timeout of 120 seconds in `Program.cs` is significantly higher than the default 30 seconds used in other parts of the codebase. This suggests that the operations in `Program.cs` might require more time, possibly due to their complexity or data intensity. It is recommended to validate this timeout setting based on the actual operation times to ensure it is neither excessive nor insufficient.
Scripts Executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Verify that the 120 seconds timeout is sufficient and not excessive for the operations performed. grep -R "CancelAfter" . ``` Length of output: 1240 --- --- Script: ```shell #!/bin/bash # Extract the value of Constants.DefaultRESTTimeout grep "DefaultRESTTimeout" ./Deepgram/Abstractions/AbstractRestClient.cs ``` Length of output: 1787 --- --- Script: ```shell #!/bin/bash # Find the definition of Constants.DefaultRESTTimeout grep -R "DefaultRESTTimeout =" . ``` Length of output: 129
--- `50-50`: Passing the `cancelToken` to the `AnalyzeFile` method is a good practice to handle potential long-running operations gracefully.
Deepgram/Factory/HttpClientFactory.cs (1)
`19-19`: The addition of a logging statement for `HttpClient` creation is a good practice for monitoring and debugging.
--- 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.` 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 a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@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.