Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Get Models #262

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

davidvonthenen
Copy link
Contributor

@davidvonthenen davidvonthenen commented Jul 31, 2024

Proposed changes

This implements the Get Models API. Example can be found at example/manage/models.

Types of changes

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

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update or tests (if none of the other choices 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.

  • I have read the CONTRIBUTING doc
  • I have lint'ed all of my code using repo standards
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

NA

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive command-line application for managing Deepgram projects and models.
    • Enhanced API capabilities with new structures and functions for retrieving model information, including speech-to-text and text-to-speech models.
  • Documentation

    • Updated README.md to include a reference to "Models" under the "Management API" section.

Copy link

coderabbitai bot commented Jul 31, 2024

Walkthrough

This update enhances the Deepgram Go SDK by introducing comprehensive model management functionalities. It includes a command-line application for interacting with models, new data structures for handling speech technologies, and API methods for retrieving and managing model data. Additionally, improvements to the documentation provide users with direct access to these new features, facilitating better understanding and utilization of model management capabilities.

Changes

Files Change Summary
README.md Added reference to "Models" under the "Management API" section with a link to examples in the Deepgram Go SDK.
examples/manage/models/main.go Introduced a command-line application for managing Deepgram projects and models, including functionality for listing and retrieving model information.
pkg/api/manage/v1/interfaces/types.go Added new types for STT and TTS models, encapsulating their attributes and enabling structured results.
pkg/api/manage/v1/models.go Implemented API methods for managing models, including functions for listing and retrieving models globally and by project.
pkg/api/version/manage-version.go Introduced new constants defining URI patterns for accessing models and project-specific models, enhancing API functionality.

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
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • 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 Configuration 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8636069 and 4dbc6b9.

Files selected for processing (5)
  • README.md (1 hunks)
  • examples/manage/models/main.go (1 hunks)
  • pkg/api/manage/v1/interfaces/types.go (2 hunks)
  • pkg/api/manage/v1/models.go (1 hunks)
  • pkg/api/version/manage-version.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • README.md
Additional comments not posted (22)
pkg/api/version/manage-version.go (4)

33-33: LGTM!

The addition of ModelsURI is consistent with other URI patterns in the file.


34-34: LGTM!

The addition of ModelsByIDURI is consistent with other URI patterns in the file.


35-35: LGTM!

The addition of ModelsProjectURI is consistent with other URI patterns in the file.


36-36: LGTM!

The addition of ModelsProjectByIDURI is consistent with other URI patterns in the file.

examples/manage/models/main.go (7)

1-14: LGTM!

The initial setup and imports are correct and follow standard practices.


16-25: LGTM!

The main function's initial setup is correct and follows standard practices.


27-41: LGTM!

The project listing logic and error handling are correct.


43-65: LGTM!

The model listing logic and error handling are correct.


67-74: LGTM!

The model retrieval logic and error handling are correct.


76-98: LGTM!

The project model listing logic and error handling are correct.


100-107: LGTM!

The project model retrieval logic and error handling are correct.

pkg/api/manage/v1/models.go (6)

20-23: LGTM!

The ListModels function correctly wraps the GetModels function.


25-39: LGTM!

The GetModels function correctly retrieves models and uses appropriate logging levels.


41-55: LGTM!

The GetModel function correctly retrieves a model by ID and uses appropriate logging levels.


57-60: LGTM!

The ListProjectModels function correctly wraps the GetProjectModels function.


62-75: LGTM!

The GetProjectModels function correctly retrieves models associated with a project and uses appropriate logging levels.


78-92: LGTM!

The GetProjectModel function correctly retrieves a project model by ID and uses appropriate logging levels.

pkg/api/manage/v1/interfaces/types.go (5)

94-105: LGTM!

The Stt struct is well-defined and follows Go conventions.


107-114: LGTM!

The Metadata struct is well-defined and follows Go conventions.


116-125: LGTM!

The Tts struct is well-defined and follows Go conventions.


388-392: LGTM!

The ModelsResult struct is well-defined and follows Go conventions.


394-403: LGTM!

The ModelResult struct is well-defined and follows Go conventions.

lukeocodes
lukeocodes previously approved these changes Aug 1, 2024
@davidvonthenen davidvonthenen changed the title Implement Get Models [HOLD] Implement Get Models Aug 1, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4dbc6b9 and 9490990.

Files selected for processing (5)
  • README.md (1 hunks)
  • examples/manage/models/main.go (1 hunks)
  • pkg/api/manage/v1/interfaces/types.go (3 hunks)
  • pkg/api/manage/v1/models.go (1 hunks)
  • pkg/api/version/manage-version.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • README.md
Additional context used
GitHub Check: Go Tests
examples/manage/models/main.go

[failure] 44-44:
not enough arguments in call to mgClient.ListModels


[failure] 77-77:
not enough arguments in call to mgClient.ListProjectModels

Additional comments not posted (7)
pkg/api/version/manage-version.go (1)

32-36: LGTM!

The new URI constants for models are well-defined and enhance the API's capability to handle model-related operations.

pkg/api/manage/v1/interfaces/types.go (6)

94-105: LGTM! The Stt struct is well-defined.

The struct captures essential attributes for speech-to-text functionalities.


107-114: LGTM! The Metadata struct is straightforward and useful.

This struct effectively encapsulates metadata details for models.


116-125: LGTM! The Tts struct is comprehensive.

The struct includes necessary fields for text-to-speech functionalities and metadata.


276-279: LGTM! The ModelRequest struct is simple and effective.

This struct is well-suited for handling model requests with the option to include outdated models.


393-397: LGTM! The ModelsResult struct is well-designed.

The struct effectively encapsulates lists of STT and TTS models.


399-408: LGTM! The ModelResult struct is comprehensive and detailed.

This struct includes all necessary fields to represent a model and its metadata.

examples/manage/models/main.go Outdated Show resolved Hide resolved
examples/manage/models/main.go Outdated Show resolved Hide resolved
pkg/api/manage/v1/models.go Outdated Show resolved Hide resolved
@davidvonthenen davidvonthenen changed the title [HOLD] Implement Get Models Implement Get Models Aug 14, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9490990 and 5700744.

Files selected for processing (5)
  • README.md (1 hunks)
  • examples/manage/models/main.go (1 hunks)
  • pkg/api/manage/v1/interfaces/types.go (3 hunks)
  • pkg/api/manage/v1/models.go (1 hunks)
  • pkg/api/version/manage-version.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • README.md
Files skipped from review as they are similar to previous changes (2)
  • examples/manage/models/main.go
  • pkg/api/version/manage-version.go
Additional comments not posted (12)
pkg/api/manage/v1/models.go (6)

22-35: LGTM!

The ListModels function correctly wraps the GetModels function, maintaining simplicity and clarity.


37-71: Well-implemented function with robust error handling.

The GetModels function is well-structured, with appropriate logging and error handling. The use of json.Marshal and nil checks ensures reliability.


73-96: Function GetModel is correctly implemented.

The function correctly retrieves a model by ID, with comprehensive logging for debugging purposes.


98-112: LGTM!

The ListProjectModels function correctly wraps the GetProjectModels function, maintaining simplicity and clarity.


114-149: Well-implemented function with robust error handling.

The GetProjectModels function is well-structured, with appropriate logging and error handling. The use of json.Marshal and nil checks ensures reliability.


151-175: Function GetProjectModel is correctly implemented.

The function correctly retrieves a model by ID within a project, with comprehensive logging for debugging purposes.

pkg/api/manage/v1/interfaces/types.go (6)

94-105: Type Stt is well-defined.

The Stt struct provides comprehensive fields for speech-to-text functionalities, with appropriate JSON tags.


107-114: Type Metadata is well-defined.

The Metadata struct provides additional metadata fields for models, with appropriate JSON tags.


116-125: Type Tts is well-defined.

The Tts struct provides comprehensive fields for text-to-speech functionalities, with appropriate JSON tags.


276-279: Type ModelRequest is well-defined.

The ModelRequest struct includes a boolean field for including outdated models, with appropriate JSON and URL tags.


393-397: Type ModelsResult is well-defined.

The ModelsResult struct provides fields for lists of STT and TTS models, with appropriate JSON tags.


399-408: Type ModelResult is well-defined.

The ModelResult struct provides comprehensive fields for a specific model, with appropriate JSON tags.

@davidvonthenen davidvonthenen merged commit 4de178e into deepgram:main Aug 14, 2024
3 checks passed
@davidvonthenen davidvonthenen deleted the implement-get-models branch August 14, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants