-
Notifications
You must be signed in to change notification settings - Fork 65
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
Implements Models API #445
Implements Models API #445
Conversation
WalkthroughThe recent updates to the Deepgram API client significantly enhance its functionality and usability. New response types, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DeepgramClient
participant API
User->>DeepgramClient: Initiate model retrieval
DeepgramClient->>API: Fetch models
API-->>DeepgramClient: Return model data
DeepgramClient-->>User: Display list of models
sequenceDiagram
participant User
participant DeepgramClient
participant API
User->>DeepgramClient: Request project-specific models
DeepgramClient->>API: Fetch models for project
API-->>DeepgramClient: Return project models
DeepgramClient-->>User: Display project models
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 19
Outside diff range, codebase verification and nitpick comments (4)
deepgram/clients/manage/v1/async_client.py (4)
244-258
: Expand the docstring forlist_project_models
.The docstring is minimal and could be expanded to provide more details about the function's purpose and parameters.
""" List all models for the current project. + Args: + project_id (str): The ID of the project. + timeout (Optional[httpx.Timeout]): The timeout setting for the request. + addons (Optional[Dict]): Additional options for the request. + headers (Optional[Dict]): Headers to include in the request. + **kwargs: Additional keyword arguments. """
259-287
: Improve the docstring forget_project_models
.The docstring should include details about the parameters and the return value.
""" Gets a list of models for the current project. Reference: https://developers.deepgram.com/docs/model-metadata + Args: + project_id (str): The ID of the project. + timeout (Optional[httpx.Timeout]): The timeout setting for the request. + addons (Optional[Dict]): Additional options for the request. + headers (Optional[Dict]): Headers to include in the request. + **kwargs: Additional keyword arguments. + + Returns: + ModelsResponse: A response object containing the list of models. """
321-335
: Expand the docstring forlist_models
.The docstring is minimal and could be expanded to provide more details about the function's purpose and parameters.
""" Please see get_models for more information. + Args: + timeout (Optional[httpx.Timeout]): The timeout setting for the request. + addons (Optional[Dict]): Additional options for the request. + headers (Optional[Dict]): Headers to include in the request. + **kwargs: Additional keyword arguments. """
336-362
: Improve the docstring forget_models
.The docstring should include details about the parameters and the return value.
""" Gets a list of models available. Reference: https://developers.deepgram.com/docs/model-metadata + Args: + timeout (Optional[httpx.Timeout]): The timeout setting for the request. + addons (Optional[Dict]): Additional options for the request. + headers (Optional[Dict]): Headers to include in the request. + **kwargs: Additional keyword arguments. + + Returns: + ModelsResponse: A response object containing the list of models. """
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (11)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/response.py (2 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
Files skipped from review due to trivial changes (1)
- deepgram/clients/manage/client.py
Additional context used
Ruff
deepgram/clients/manage/__init__.py
32-32:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/clients/manage/v1/__init__.py
32-32:
.response.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.response.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
examples/manage/models/main.py
7-7:
logging
imported but unusedRemove unused import:
logging
(F401)
24-24: f-string without any placeholders
Remove extraneous
f
prefix(F541)
examples/manage/async_models/main.py
8-8:
logging
imported but unusedRemove unused import:
logging
(F401)
25-25: f-string without any placeholders
Remove extraneous
f
prefix(F541)
deepgram/clients/__init__.py
171-171:
.manage.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
172-172:
.manage.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/__init__.py
163-163:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
164-164:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/client.py
167-167:
.clients.ModelResponse
imported but unusedRemove unused import
(F401)
168-168:
.clients.ModelsResponse
imported but unusedRemove unused import
(F401)
deepgram/clients/manage/v1/response.py
35-35: Undefined name
Dict
(F821)
35-35: Undefined name
Any
(F821)
35-35: Undefined name
Any
(F821)
Additional comments not posted (18)
examples/manage/models/main.py (3)
1-4
: LGTM!The file header and initial imports are correct.
9-13
: LGTM!The imports and dotenv loading are correct.
76-78
: LGTM!The main entry point is correct.
examples/manage/async_models/main.py (1)
16-21
: Ensure API key is securely loaded.The API key is currently an empty string. Ensure it is securely loaded from environment variables or a secure source.
- deepgram: DeepgramClient = DeepgramClient("", config) + api_key = os.getenv("DEEPGRAM_API_KEY") + deepgram: DeepgramClient = DeepgramClient(api_key, config)deepgram/client.py (3)
266-268
: Docstring update forlisten
property.The updated docstring improves clarity by specifying that it returns a "Listen dot-notation router."
273-275
: Docstring update forread
property.The updated docstring improves clarity by specifying that it returns a "Read dot-notation router."
280-282
: Docstring update forspeak
property.The updated docstring improves clarity by specifying that it returns a "Speak dot-notation router."
deepgram/clients/manage/v1/response.py (5)
117-138
: Ensure correct type conversion inStt
class.The
__getitem__
method in theStt
class should ensure thatlanguages
is converted to a list of strings.
140-150
: Ensure correct type conversion inMetadata
class.The
Metadata
class is well-defined and follows the structure of the other response classes.
153-173
: Ensure correct type conversion inTts
class.The
__getitem__
method in theTts
class should ensure thatmetadata
is converted to a list ofMetadata
objects.
179-199
: Ensure correct type conversion inModelResponse
class.The
__getitem__
method in theModelResponse
class should ensure thatmetadata
is converted to a list ofMetadata
objects.
202-218
: Ensure correct type conversion inModelsResponse
class.The
__getitem__
method in theModelsResponse
class should ensure thatstt
andtts
are converted to lists ofStt
andTts
objects, respectively.deepgram/clients/manage/v1/client.py (6)
245-259
: Docstring forlist_project_models
method.The docstring for the
list_project_models
method is clear and concise.
260-288
: Docstring forget_project_models
method.The docstring for the
get_project_models
method is clear and concise.
290-320
: Docstring forget_project_model
method.The docstring for the
get_project_model
method is clear and concise.
322-336
: Docstring forlist_models
method.The docstring for the
list_models
method is clear and concise.
337-363
: Docstring forget_models
method.The docstring for the
get_models
method is clear and concise.
365-393
: Docstring forget_model
method.The docstring for the
get_model
method is clear and concise.
b372254
to
c7a86a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range, codebase verification and nitpick comments (1)
examples/manage/async_models/main.py (1)
8-8
: Remove unused import.The
logging
module is imported but not used in the code.- import logging
Tools
Ruff
8-8:
logging
imported but unusedRemove unused import:
logging
(F401)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (11)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/response.py (2 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- deepgram/clients/manage/client.py
- deepgram/clients/manage/v1/async_client.py
Additional context used
Ruff
deepgram/clients/manage/__init__.py
32-32:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/clients/manage/v1/__init__.py
32-32:
.response.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.response.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
examples/manage/models/main.py
7-7:
logging
imported but unusedRemove unused import:
logging
(F401)
24-24: f-string without any placeholders
Remove extraneous
f
prefix(F541)
examples/manage/async_models/main.py
8-8:
logging
imported but unusedRemove unused import:
logging
(F401)
25-25: f-string without any placeholders
Remove extraneous
f
prefix(F541)
deepgram/clients/__init__.py
171-171:
.manage.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
172-172:
.manage.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/__init__.py
163-163:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
164-164:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/client.py
167-167:
.clients.ModelResponse
imported but unusedRemove unused import
(F401)
168-168:
.clients.ModelsResponse
imported but unusedRemove unused import
(F401)
Additional comments not posted (20)
examples/manage/models/main.py (2)
60-63
: Fix incorrect variable usage.The loop should iterate over
listProjModels
instead oflistModels
.- for stt in listModels.stt: + for stt in listProjModels.stt: - for tts in listModels.tts: + for tts in listProjModels.tts:Likely invalid or redundant comment.
73-75
: Improve exception handling.Consider logging the exception for better debugging.
- print(f"Exception: {e}") + logging.error(f"Exception: {e}")Likely invalid or redundant comment.
examples/manage/async_models/main.py (5)
25-25
: Remove extraneous f-string prefix.The
f
prefix is unnecessary here as there are no placeholders in the string.- print(f"ListProjects failed.") + print("ListProjects failed.")Tools
Ruff
25-25: f-string without any placeholders
Remove extraneous
f
prefix(F541)
22-34
: Check for empty project response.The code assumes that
projectResp.projects
is not empty. Add a check to handle the case where no projects are returned.+ if not projectResp.projects: + print("No projects found.") + sys.exit(1)Tools
Ruff
25-25: f-string without any placeholders
Remove extraneous
f
prefix(F541)
36-47
: Handle case where no models are found.The code should handle the case where
listModels
is notNone
butlistModels.stt
andlistModels.tts
are empty.+ if not listModels.stt and not listModels.tts: + print("No models found.")
56-65
: Fix incorrect variable usage.The code uses
listModels
instead oflistProjModels
when iterating over project models.- for stt in listModels.stt: + for stt in listProjModels.stt: - for tts in listModels.tts: + for tts in listProjModels.tts:
74-76
: Improve exception handling.Log the exception details using the
logging
module for better debugging.- print(f"Exception: {e}") + logging.error(f"Exception occurred: {e}", exc_info=True)deepgram/clients/__init__.py (1)
171-172
: AddModelsResponse
andModelResponse
to__all__
.The static analysis hint suggests these imports are unused. To make them available for external use, add them to the
__all__
list.+ __all__ = [ + ... + "ModelsResponse", + "ModelResponse", + ]Tools
Ruff
171-171:
.manage.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
172-172:
.manage.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/__init__.py (1)
163-164
: AddModelsResponse
andModelResponse
to__all__
.The static analysis hint suggests these imports are unused. To make them available for external use, add them to the
__all__
list.+ __all__ = [ + ... + "ModelsResponse", + "ModelResponse", + ]Tools
Ruff
163-163:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
164-164:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/clients/manage/v1/response.py (5)
117-138
: LGTM!The
Stt
class is well-defined with appropriate type hints and functionality.
140-151
: LGTM!The
Metadata
class is well-defined with appropriate type hints and functionality.
153-174
: LGTM!The
Tts
class is well-defined with appropriate type hints and functionality.
179-218
: LGTM!The
ModelResponse
andModelsResponse
classes are well-defined with appropriate type hints and functionality.
5-5
: Import missing type hints.The
Dict
andAny
types are used but not imported.from typing import List, Optional, Dict, AnyLikely invalid or redundant comment.
deepgram/clients/manage/v1/client.py (6)
30-31
: LGTM!The imports for
ModelResponse
andModelsResponse
are necessary for the new functionality.
245-259
: LGTM!The
list_project_models
method is well-defined with appropriate functionality and error handling.
260-288
: LGTM!The
get_project_models
method is well-defined with appropriate functionality and error handling.
290-320
: LGTM!The
get_project_model
method is well-defined with appropriate functionality and error handling.
322-336
: LGTM!The
list_models
method is well-defined with appropriate functionality and error handling.
337-393
: LGTM!The
get_models
andget_model
methods are well-defined with appropriate functionality and error handling.
c7a86a7
to
31b55da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 11
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (11)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/response.py (2 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- deepgram/clients/manage/client.py
- deepgram/clients/manage/v1/async_client.py
Additional context used
Ruff
deepgram/clients/manage/__init__.py
32-32:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/clients/manage/v1/__init__.py
32-32:
.response.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.response.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
examples/manage/models/main.py
7-7:
logging
imported but unusedRemove unused import:
logging
(F401)
examples/manage/async_models/main.py
8-8:
logging
imported but unusedRemove unused import:
logging
(F401)
deepgram/clients/__init__.py
171-171:
.manage.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
172-172:
.manage.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/__init__.py
163-163:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
164-164:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/client.py
167-167:
.clients.ModelResponse
imported but unusedRemove unused import
(F401)
168-168:
.clients.ModelsResponse
imported but unusedRemove unused import
(F401)
Additional comments not posted (18)
deepgram/clients/manage/__init__.py (1)
32-33
: Address unused imports.The imports
ModelResponse
andModelsResponse
are currently unused. Consider adding them to__all__
or using them.+ __all__ = [ + "ManageClient", + "AsyncManageClient", + "ProjectOptions", + "KeyOptions", + "ScopeOptions", + "InviteOptions", + "UsageRequestOptions", + "UsageSummaryOptions", + "UsageFieldsOptions", + "Message", + "Project", + "ProjectsResponse", + "MembersResponse", + "Key", + "KeyResponse", + "KeysResponse", + "ScopesResponse", + "InvitesResponse", + "UsageRequest", + "UsageRequestsResponse", + "UsageSummaryResponse", + "UsageFieldsResponse", + "Balance", + "BalancesResponse", + "ModelResponse", + "ModelsResponse", + ]Tools
Ruff
32-32:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/clients/manage/v1/__init__.py (1)
32-33
: Address unused imports.The imports
ModelResponse
andModelsResponse
are currently unused. Consider adding them to__all__
or using them.+ __all__ = [ + "ManageClient", + "AsyncManageClient", + "ProjectOptions", + "KeyOptions", + "ScopeOptions", + "InviteOptions", + "UsageRequestOptions", + "UsageSummaryOptions", + "UsageFieldsOptions", + "Message", + "Project", + "ProjectsResponse", + "MembersResponse", + "Key", + "KeyResponse", + "KeysResponse", + "ScopesResponse", + "InvitesResponse", + "UsageRequest", + "UsageRequestsResponse", + "UsageSummaryResponse", + "UsageFieldsResponse", + "Balance", + "BalancesResponse", + "ModelResponse", + "ModelsResponse", + ]Tools
Ruff
32-32:
.response.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.response.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
examples/manage/models/main.py (4)
7-7
: Remove unused import.The import
logging
is unused and can be removed.- import logging
Tools
Ruff
7-7:
logging
imported but unusedRemove unused import:
logging
(F401)
24-24
: Remove extraneousf
prefix.The f-string on this line does not contain any placeholders.
- print(f"ListProjects failed.") + print("ListProjects failed.")
81-83
: Improve exception handling.Consider logging the exception for better debugging.
- print(f"Exception: {e}") + logging.error(f"Exception: {e}")
67-71
: Fix incorrect variable usage.The loop should iterate over
listProjModels
instead oflistModels
.- for stt in listModels.stt: + for stt in listProjModels.stt: - for tts in listModels.tts: + for tts in listProjModels.tts:examples/manage/async_models/main.py (2)
8-8
: Acknowledge the necessity of thelogging
import.The
logging
module is required for cases whereverboselogs
log levels are not used. Thank you for the clarification!Tools
Ruff
8-8:
logging
imported but unusedRemove unused import:
logging
(F401)
82-84
: Improve exception handling.Log the exception details using the
logging
module for better debugging.- print(f"Exception: {e}") + logging.error(f"Exception occurred: {e}", exc_info=True)Likely invalid or redundant comment.
deepgram/client.py (3)
266-268
: LGTM!The updated docstring provides better clarity by using "dot-notation router" instead of "instance".
273-275
: LGTM!The updated docstring provides better clarity by using "dot-notation router" instead of "instance".
280-282
: LGTM!The updated docstring provides better clarity by using "dot-notation router" instead of "instance".
deepgram/clients/manage/v1/response.py (1)
140-151
: LGTM!The
Metadata
class is well-structured and provides useful methods for response handling.deepgram/clients/manage/v1/client.py (6)
245-259
: LGTM!The
list_project_models
method is well-structured and provides useful functionality for model management.
260-299
: LGTM!The
get_project_models
method is well-structured and provides useful functionality for model management.
301-343
: LGTM!The
get_project_model
method is well-structured and provides useful functionality for model management.
345-359
: LGTM!The
list_models
method is well-structured and provides useful functionality for model management.
360-395
: LGTM!The
get_models
method is well-structured and provides useful functionality for model management.
397-435
: LGTM!The
get_model
method is well-structured and provides useful functionality for model management.
31b55da
to
a6aafe7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (11)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/response.py (2 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
Files skipped from review due to trivial changes (1)
- examples/manage/async_models/main.py
Files skipped from review as they are similar to previous changes (4)
- deepgram/clients/manage/client.py
- deepgram/clients/manage/v1/client.py
- deepgram/clients/manage/v1/response.py
- examples/manage/models/main.py
Additional context used
Ruff
deepgram/clients/manage/__init__.py
32-32:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/clients/manage/v1/__init__.py
32-32:
.response.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
33-33:
.response.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/clients/__init__.py
171-171:
.manage.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
172-172:
.manage.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/__init__.py
163-163:
.client.ModelsResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
164-164:
.client.ModelResponse
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
deepgram/client.py
167-167:
.clients.ModelResponse
imported but unusedRemove unused import
(F401)
168-168:
.clients.ModelsResponse
imported but unusedRemove unused import
(F401)
Additional comments not posted (4)
deepgram/clients/manage/v1/async_client.py (4)
259-299
: LGTM!The method implementation and docstring are correct.
300-342
: LGTM!The method implementation and docstring are correct.
359-394
: LGTM!The method implementation and docstring are correct.
396-434
: LGTM!The method implementation and docstring are correct.
a6aafe7
to
8c0d65a
Compare
There was a problem hiding this 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
Files selected for processing (12)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/response.py (2 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
- examples/speech-to-text/websocket/microphone/main.py (1 hunks)
Files skipped from review due to trivial changes (1)
- examples/speech-to-text/websocket/microphone/main.py
Files skipped from review as they are similar to previous changes (9)
- deepgram/init.py
- deepgram/client.py
- deepgram/clients/init.py
- deepgram/clients/manage/init.py
- deepgram/clients/manage/client.py
- deepgram/clients/manage/v1/init.py
- deepgram/clients/manage/v1/async_client.py
- examples/manage/async_models/main.py
- examples/manage/models/main.py
Additional comments not posted (12)
deepgram/clients/manage/v1/response.py (6)
20-43
: Add missing type hints.The
BaseResponse
class methods should have type hints for better clarity and type checking.def __getitem__(self, key: str) -> Any: def __setitem__(self, key: str, val: Any) -> None: def eval(self, key: str) -> str:
133-137
: Remove unnecessary conversion in__getitem__
.The conversion of
languages
to strings in the__getitem__
method is redundant since they are already strings.def __getitem__(self, key): _dict = self.to_dict() if "languages" in _dict: - _dict["languages"] = [str(languages) for languages in _dict["languages"]] return _dict[key]
141-150
: LGTM!The
Metadata
class is correctly defined with appropriate attributes.
169-175
: Remove unnecessary conversion in__getitem__
.The conversion of
metadata
to a list ofMetadata
objects in the__getitem__
method is redundant since it is already a singleMetadata
object.def __getitem__(self, key): _dict = self.to_dict() if "metadata" in _dict: - _dict["metadata"] = [Metadata.from_dict(metadata) for metadata in _dict["metadata"]] return _dict[key]
197-203
: Remove unnecessary conversion in__getitem__
.The conversion of
metadata
to a list ofMetadata
objects in the__getitem__
method is redundant since it is already a singleMetadata
object.def __getitem__(self, key): _dict = self.to_dict() if "metadata" in _dict: - _dict["metadata"] = [Metadata.from_dict(metadata) for metadata in _dict["metadata"]] return _dict[key]
215-221
: Remove unnecessary conversion in__getitem__
.The conversion of
stt
andtts
to lists ofStt
andTts
objects in the__getitem__
method is redundant since they are already lists of these objects.def __getitem__(self, key): _dict = self.to_dict() if "stt" in _dict: - _dict["stt"] = [Stt.from_dict(stt) for stt in _dict["stt"]] if "tts" in _dict: - _dict["tts"] = [Tts.from_dict(tts) for tts in _dict["tts"]] return _dict[key]deepgram/clients/manage/v1/client.py (6)
245-258
: LGTM!The
list_project_models
method correctly wraps aroundget_project_models
.
260-299
: LGTM!The
get_project_models
method is correctly implemented with appropriate logging and URL construction.
301-343
: LGTM!The
get_project_model
method is correctly implemented with appropriate logging and response processing.
346-358
: LGTM!The
list_models
method correctly wraps aroundget_models
.
360-395
: LGTM!The
get_models
method is correctly implemented with appropriate logging and URL construction.
397-435
: LGTM!The
get_model
method is correctly implemented with appropriate logging and response processing.
8c0d65a
to
84c6bed
Compare
There was a problem hiding this 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
Outside diff range, codebase verification and nitpick comments (1)
deepgram/clients/manage/v1/response.py (1)
Line range hint
12-34
:
Add missing type hints.The
BaseResponse
class methods should have type hints for better clarity and type checking.def __getitem__(self, key: str) -> Any: def __setitem__(self, key: str, val: Any) -> None: def __str__(self) -> str: def eval(self, key: str) -> str:
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (12)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/response.py (1 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
- examples/speech-to-text/websocket/microphone/main.py (1 hunks)
Files skipped from review due to trivial changes (1)
- examples/speech-to-text/websocket/microphone/main.py
Files skipped from review as they are similar to previous changes (10)
- deepgram/init.py
- deepgram/client.py
- deepgram/clients/init.py
- deepgram/clients/manage/init.py
- deepgram/clients/manage/client.py
- deepgram/clients/manage/v1/init.py
- deepgram/clients/manage/v1/async_client.py
- deepgram/clients/manage/v1/client.py
- examples/manage/async_models/main.py
- examples/manage/models/main.py
Additional comments not posted (2)
deepgram/clients/manage/v1/response.py (2)
111-122
: LGTM!The
Metadata
class is well-defined and straightforward.
88-108
: Remove unnecessary conversion in__getitem__
.The conversion of
languages
to strings in the__getitem__
method is redundant since they are already strings.def __getitem__(self, key): _dict = self.to_dict() if "languages" in _dict: - _dict["languages"] = [str(languages) for languages in _dict["languages"]] return _dict[key]
Likely invalid or redundant comment.
84c6bed
to
479b476
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range, codebase verification and nitpick comments (5)
examples/text-to-speech/websocket/simple/main.py (2)
16-20
: Consider using a more descriptive variable name for_story
.The variable
_story
could be renamed to something more descriptive, such astext_input
, to improve readability.- _story = "Hello world." + text_input = "Hello world." msg = json.dumps({"type": "TextInput", "text": text_input})
8-8
: DEEPGRAM_API_KEY Environment Variable Not SetThe
DEEPGRAM_API_KEY
environment variable is not set, which could lead to authentication issues when running the script. Please ensure this variable is properly configured in your environment before executing the script.Analysis chain
Verify the presence of
DEEPGRAM_API_KEY
.Ensure that the
DEEPGRAM_API_KEY
environment variable is set before running this script to avoid authentication issues.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if the DEEPGRAM_API_KEY environment variable is set. # Test: Print the DEEPGRAM_API_KEY environment variable. Expect: It should not be empty. echo "DEEPGRAM_API_KEY: ${DEEPGRAM_API_KEY:-'Not Set'}"Length of output: 70
examples/manage/models/main.py (1)
84-86
: Improve exception handling.Consider logging the exception for better debugging and consistency with best practices.
- print(f"Exception: {e}") + import logging + logging.error(f"Exception: {e}")deepgram/clients/manage/v1/async_client.py (2)
245-256
: Enhance the docstring forlist_project_models
.The docstring should provide more details about the parameters and the return value.
""" Lists models for a specific project. Args: project_id (str): The ID of the project. options (Optional[Union[Dict, ModelOptions]]): Additional options for the request. timeout (Optional[httpx.Timeout]): The timeout setting for the request. addons (Optional[Dict]): Additional options for the request. headers (Optional[Dict]): Headers to include in the request. **kwargs: Additional keyword arguments. Returns: ModelsResponse: A response object containing the model details. """
360-371
: Enhance the docstring forlist_models
.The docstring should provide more details about the parameters and the return value.
""" Lists all available models. Args: options (Optional[Union[Dict, ModelOptions]]): Additional options for the request. timeout (Optional[httpx.Timeout]): The timeout setting for the request. addons (Optional[Dict]): Additional options for the request. headers (Optional[Dict]): Headers to include in the request. **kwargs: Additional keyword arguments. Returns: ModelsResponse: A response object containing the model details. """
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (14)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/options.py (1 hunks)
- deepgram/clients/manage/v1/response.py (1 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
- examples/speech-to-text/websocket/microphone/main.py (1 hunks)
- examples/text-to-speech/websocket/simple/main.py (1 hunks)
Files skipped from review due to trivial changes (1)
- examples/speech-to-text/websocket/microphone/main.py
Additional context used
Learnings (6)
deepgram/clients/manage/__init__.py (2)
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/manage/v1/__init__.py:32-32 Timestamp: 2024-07-31T20:47:50.008Z Learning: To make `ModelResponse` available for external use in `deepgram/clients/manage/v1/__init__.py`, it should be added to the `__all__` list.
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/__init__.py:172-172 Timestamp: 2024-07-31T20:47:51.397Z Learning: To make `ModelResponse` and `ModelsResponse` available for external use, add them to the `__all__` list in the `deepgram/clients/__init__.py` file.
deepgram/clients/manage/v1/__init__.py (2)
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/manage/v1/__init__.py:32-32 Timestamp: 2024-07-31T20:47:50.008Z Learning: To make `ModelResponse` available for external use in `deepgram/clients/manage/v1/__init__.py`, it should be added to the `__all__` list.
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/__init__.py:172-172 Timestamp: 2024-07-31T20:47:51.397Z Learning: To make `ModelResponse` and `ModelsResponse` available for external use, add them to the `__all__` list in the `deepgram/clients/__init__.py` file.
deepgram/clients/manage/client.py (2)
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/manage/v1/__init__.py:32-32 Timestamp: 2024-07-31T20:47:50.008Z Learning: To make `ModelResponse` available for external use in `deepgram/clients/manage/v1/__init__.py`, it should be added to the `__all__` list.
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/__init__.py:172-172 Timestamp: 2024-07-31T20:47:51.397Z Learning: To make `ModelResponse` and `ModelsResponse` available for external use, add them to the `__all__` list in the `deepgram/clients/__init__.py` file.
deepgram/clients/__init__.py (2)
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/manage/v1/__init__.py:32-32 Timestamp: 2024-07-31T20:47:50.008Z Learning: To make `ModelResponse` available for external use in `deepgram/clients/manage/v1/__init__.py`, it should be added to the `__all__` list.
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/__init__.py:172-172 Timestamp: 2024-07-31T20:47:51.397Z Learning: To make `ModelResponse` and `ModelsResponse` available for external use, add them to the `__all__` list in the `deepgram/clients/__init__.py` file.
deepgram/__init__.py (3)
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/manage/v1/__init__.py:32-32 Timestamp: 2024-07-31T20:47:50.008Z Learning: To make `ModelResponse` available for external use in `deepgram/clients/manage/v1/__init__.py`, it should be added to the `__all__` list.
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/__init__.py:172-172 Timestamp: 2024-07-31T20:47:51.397Z Learning: To make `ModelResponse` and `ModelsResponse` available for external use, add them to the `__all__` list in the `deepgram/clients/__init__.py` file.
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/__init__.py:163-164 Timestamp: 2024-07-31T20:47:09.717Z Learning: To make new entities available for external use in the `deepgram/__init__.py` file, add them to the `__all__` list.
deepgram/client.py (1)
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/clients/__init__.py:172-172 Timestamp: 2024-07-31T20:47:51.397Z Learning: To make `ModelResponse` and `ModelsResponse` available for external use, add them to the `__all__` list in the `deepgram/clients/__init__.py` file.
Additional comments not posted (28)
deepgram/clients/manage/__init__.py (1)
32-33
: Verify the usage ofModelResponse
andModelsResponse
.Ensure that
ModelResponse
andModelsResponse
are used in the codebase or added to the__all__
list if they are meant to be part of the public API.Verification successful
ModelResponse
andModelsResponse
are actively used in the codebase. These classes are imported and utilized in various files, confirming their relevance and integration into the project's functionality. No further action is required regarding their usage.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `ModelResponse` and `ModelsResponse` in the codebase. # Test: Search for occurrences of `ModelResponse` and `ModelsResponse`. Expect: They are used or exported. rg --type python 'ModelResponse|ModelsResponse'Length of output: 80
Script:
#!/bin/bash # Description: Verify the usage of `ModelResponse` and `ModelsResponse` in the codebase. # Test: Search for occurrences of `ModelResponse` and `ModelsResponse` in Python files. rg 'ModelResponse|ModelsResponse' --glob '*.py'Length of output: 3816
deepgram/clients/manage/v1/__init__.py (1)
32-33
: Verify the usage ofModelResponse
andModelsResponse
.Ensure that
ModelResponse
andModelsResponse
are used in the codebase or added to the__all__
list if they are meant to be part of the public API.Verification successful
ModelResponse
andModelsResponse
are used throughout the codebase. They are defined indeepgram/clients/manage/v1/response.py
and utilized in several other files. If these classes are intended to be part of the public API, ensure they are included in the__all__
list in the relevant__init__.py
files.
- Check
deepgram/clients/manage/v1/__init__.py
to include them in__all__
if necessary.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `ModelResponse` and `ModelsResponse` in the codebase. # Test: Search for occurrences of `ModelResponse` and `ModelsResponse`. Expect: They are used or exported. rg --type python 'ModelResponse|ModelsResponse'Length of output: 80
Script:
#!/bin/bash # Description: Verify the usage of `ModelResponse` and `ModelsResponse` in the codebase. # Corrected: Search for occurrences of `ModelResponse` and `ModelsResponse` without specifying file type. rg 'ModelResponse|ModelsResponse'Length of output: 3802
deepgram/clients/manage/client.py (2)
36-36
: AliasModelResponse
looks good.The alias
ModelResponse
is correctly defined asModelResponseLatest
.Ensure that this alias is used consistently throughout the codebase.
Verification successful
Alias
ModelResponse
is used consistently across the codebase.The alias
ModelResponse
appears in multiple files, indicating consistent usage. This includes import statements and function signatures, confirming its integration.
deepgram/__init__.py
deepgram/client.py
deepgram/clients/manage/v1/async_client.py
deepgram/clients/manage/v1/client.py
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of `ModelResponse` alias in the codebase. # Test: Search for the alias usage. Expect: Consistent usage of `ModelResponse`. rg --type python -A 5 $'ModelResponse'Length of output: 68
Script:
#!/bin/bash # Description: Verify usage of `ModelResponse` alias in the codebase. # Test: Search for the alias usage without specifying file type. rg 'ModelResponse'Length of output: 1767
37-37
: AliasModelsResponse
looks good.The alias
ModelsResponse
is correctly defined asModelsResponseLatest
.Ensure that this alias is used consistently throughout the codebase.
Verification successful
Let's rerun the script with the correct file type for Python files to verify the usage of the
ModelsResponse
alias.
Alias
ModelsResponse
is used consistently across the codebase.The alias
ModelsResponse
is correctly utilized in multiple files, indicating consistent usage throughout the codebase. No issues were found.
- Files include
deepgram/client.py
,deepgram/__init__.py
,deepgram/clients/__init__.py
,deepgram/clients/manage/__init__.py
, and several files in thedeepgram/clients/manage/v1/
directory.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of `ModelsResponse` alias in the codebase. # Test: Search for the alias usage. Expect: Consistent usage of `ModelsResponse`. rg --type python -A 5 $'ModelsResponse'Length of output: 69
Script:
#!/bin/bash # Description: Verify usage of `ModelsResponse` alias in the codebase. # Test: Search for the alias usage. Expect: Consistent usage of `ModelsResponse`. rg --type py -A 5 $'ModelsResponse'Length of output: 10085
examples/manage/models/main.py (2)
35-35
: Verify the correctness ofget_models
operation.Ensure that the
get_models
method returns the expected structure and data.Verification successful
The
get_models
operation is correctly implemented.The
get_models
method in bothclient.py
andasync_client.py
constructs a request to retrieve models and processes the response into aModelsResponse
object. The implementation appears to be correct and aligned with the expected behavior.
- Files:
deepgram/clients/manage/v1/client.py
deepgram/clients/manage/v1/async_client.py
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the structure and data returned by `get_models`. # Test: Check if `get_models` method is correctly implemented and returns expected data. rg --type python -A 5 $'def get_models'Length of output: 71
Script:
#!/bin/bash # Corrected: Verify the structure and data returned by `get_models`. # Test: Locate the `get_models` method definition and examine its implementation. rg --type py -A 5 $'def get_models'Length of output: 971
Script:
#!/bin/bash # Extract the full implementation of the `get_models` method from both files for analysis. # Extract from client.py rg --type py -A 20 'def get_models' deepgram/clients/manage/v1/client.py # Extract from async_client.py rg --type py -A 20 'def get_models' deepgram/clients/manage/v1/async_client.pyLength of output: 1577
Script:
#!/bin/bash # Extract more lines to capture the full implementation of the `get_models` method. # Extract from client.py rg --type py -A 50 'def get_models' deepgram/clients/manage/v1/client.py # Extract from async_client.py rg --type py -A 50 'def get_models' deepgram/clients/manage/v1/async_client.pyLength of output: 3891
62-62
: Verify the correctness ofget_project_models
operation.Ensure that the
get_project_models
method returns the expected structure and data.deepgram/clients/__init__.py (2)
171-171
: Addition ofModelsResponse
looks good.
ModelsResponse
is correctly added to the module's public interface.Ensure it is included in the
__all__
list for proper export.
172-172
: Addition ofModelResponse
looks good.
ModelResponse
is correctly added to the module's public interface.Ensure it is included in the
__all__
list for proper export.Verification successful
ModelResponse
is correctly exported.The
ModelResponse
class is included in multiple__init__.py
files, indicating it is part of the module's public API. The absence of an__all__
list suggests that the module relies on implicit exports, which is acceptable in this context. No further action is needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify inclusion of `ModelResponse` in `__all__` list. # Test: Check if `ModelResponse` is part of the `__all__` list. rg --type python -A 5 $'__all__'Length of output: 62
Script:
#!/bin/bash # Description: Verify inclusion of `ModelResponse` in `__all__` list. # Test: Check if `ModelResponse` is part of the `__all__` list. rg --type py -A 5 $'__all__'Length of output: 27
Script:
#!/bin/bash # Description: Search for the definition and usage of `ModelResponse`. # Test: Find where `ModelResponse` is defined and used in the codebase. rg 'ModelResponse'Length of output: 1767
examples/manage/async_models/main.py (4)
21-23
: Check for empty project response.The code assumes that
projectResp.projects
is not empty. Add a check to handle the case where no projects are returned.
36-39
: Handle case where no models are found.The code should handle the case where
listModels
is notNone
butlistModels.stt
andlistModels.tts
are empty.
89-91
: Improve exception handling.Log the exception details using the
logging
module for better debugging.
8-8
: Retain thelogging
import.The
logging
module is necessary when not using log levels found inverboselogs
.deepgram/__init__.py (1)
163-164
: AddModelsResponse
andModelResponse
to__all__
.To make these entities available for external use, add them to the
__all__
list.deepgram/clients/manage/v1/options.py (1)
32-49
: ReviewModelOptions
class implementation.The
ModelOptions
class is well-implemented with JSON serialization and dictionary-like access. Ensure that theinclude_outdated
attribute is correctly utilized in the codebase.deepgram/client.py (1)
266-280
: Docstring updates improve clarity.The change from "instance" to "dot-notation router" in the docstrings enhances clarity regarding the returned objects.
deepgram/clients/manage/v1/response.py (3)
111-123
: Metadata class is well-defined.The
Metadata
class is correctly defined with appropriate use of dataclass configuration for optional fields.
88-108
: Remove unnecessary conversion in__getitem__
.The conversion of
languages
to strings in the__getitem__
method is redundant since they are already strings.def __getitem__(self, key): _dict = self.to_dict() if "languages" in _dict: - _dict["languages"] = [str(languages) for languages in _dict["languages"]] return _dict[key]
Likely invalid or redundant comment.
179-194
: Remove unnecessary conversion in__getitem__
.The conversion of
stt
andtts
to lists ofStt
andTts
objects in the__getitem__
method is redundant since they are already lists of these objects.def __getitem__(self, key): _dict = self.to_dict() if "stt" in _dict: - _dict["stt"] = [Stt.from_dict(stt) for stt in _dict["stt"]] if "tts" in _dict: - _dict["tts"] = [Tts.from_dict(tts) for tts in _dict["tts"]] return _dict[key]Likely invalid or redundant comment.
deepgram/clients/manage/v1/client.py (6)
246-265
: Delegation inlist_project_models
is appropriate.The method correctly delegates functionality to
get_project_models
, maintaining consistency and reducing code duplication.
267-315
:get_project_models
is well-implemented.The method retrieves models for a specific project with appropriate logging and error handling.
317-359
:get_project_model
is well-implemented.The method retrieves a single model for a specific project with appropriate logging and error handling.
362-375
: Delegation inlist_models
is appropriate.The asynchronous method correctly delegates functionality to
get_models
, maintaining consistency and reducing code duplication.
377-421
:get_models
is well-implemented.The method retrieves all available models with appropriate logging and error handling.
423-461
:get_model
is well-implemented.The method retrieves information for a specific model with appropriate logging and error handling.
deepgram/clients/manage/v1/async_client.py (4)
266-314
: LGTM!The
get_project_models
function is well-implemented with appropriate logging and parameter handling.
316-358
: LGTM!The
get_project_model
function is well-structured with comprehensive logging and parameter handling.
376-420
: LGTM!The
get_models
function is well-implemented with appropriate logging and parameter handling.
422-460
: LGTM!The
get_model
function is well-structured with comprehensive logging and parameter handling.
479b476
to
29e835f
Compare
29e835f
to
b882f27
Compare
There was a problem hiding this 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
Files selected for processing (14)
- deepgram/init.py (1 hunks)
- deepgram/client.py (2 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/manage/init.py (1 hunks)
- deepgram/clients/manage/client.py (2 hunks)
- deepgram/clients/manage/v1/init.py (1 hunks)
- deepgram/clients/manage/v1/async_client.py (3 hunks)
- deepgram/clients/manage/v1/client.py (3 hunks)
- deepgram/clients/manage/v1/options.py (1 hunks)
- deepgram/clients/manage/v1/response.py (1 hunks)
- examples/manage/async_models/main.py (1 hunks)
- examples/manage/models/main.py (1 hunks)
- examples/speech-to-text/websocket/microphone/main.py (1 hunks)
- examples/text-to-speech/websocket/simple/main.py (1 hunks)
Files skipped from review due to trivial changes (2)
- deepgram/clients/init.py
- examples/speech-to-text/websocket/microphone/main.py
Files skipped from review as they are similar to previous changes (12)
- deepgram/init.py
- deepgram/client.py
- deepgram/clients/manage/init.py
- deepgram/clients/manage/client.py
- deepgram/clients/manage/v1/init.py
- deepgram/clients/manage/v1/async_client.py
- deepgram/clients/manage/v1/client.py
- deepgram/clients/manage/v1/options.py
- deepgram/clients/manage/v1/response.py
- examples/manage/async_models/main.py
- examples/manage/models/main.py
- examples/text-to-speech/websocket/simple/main.py
Additional context used
Learnings (1)
Common learnings
Learnt from: dvonthenen PR: deepgram/deepgram-python-sdk#445 File: deepgram/client.py:167-168 Timestamp: 2024-08-14T19:03:11.476Z Learning: In the `deepgram/client.py` file, `ModelResponse` and `ModelsResponse` imports are kept intentionally to expose return objects at various levels of packaging, even if they are not used directly in the file.
Proposed changes
This PR implements the Models API.
Types of changes
What types of changes does your code introduce to the community Python 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
ModelResponse
andModelsResponse
for enhanced model management functionality.ModelOptions
to streamline model querying options.Bug Fixes