-
Notifications
You must be signed in to change notification settings - Fork 115
adds TTS streaming clients #424
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
Conversation
WalkthroughThe recent enhancements to the Deepgram codebase involve the introduction of new classes for handling real-time speech synthesis via WebSockets. This includes the addition of Changes
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 Configration File (
|
|
@coderabbitai review |
Actions performedReview triggered.
|
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: 15
Outside diff range and nitpick comments (1)
deepgram/clients/speak/__init__.py (1)
Line range hint
6-16: Consider declaring imported modules in__all__to avoid unused import warnings.Similar to the previous file, these imports are flagged as unused. If these modules are intended for external use, adding them to the
__all__list can clarify their purpose and prevent linting errors.+ __all__ = ['SpeakStreamClient', 'AsyncSpeakStreamClient', 'SpeakStreamEvents']Tools
Ruff
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (13)
- deepgram/init.py (1 hunks)
- deepgram/client.py (5 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/speak/init.py (2 hunks)
- deepgram/clients/speak/client.py (2 hunks)
- deepgram/clients/speak/enums.py (1 hunks)
- deepgram/clients/speak/errors.py (1 hunks)
- deepgram/clients/speak/v1/init.py (1 hunks)
- deepgram/clients/speak/v1/async_client_stream.py (1 hunks)
- deepgram/clients/speak/v1/client_stream.py (1 hunks)
- deepgram/clients/speak/v1/response.py (1 hunks)
- examples/speak-stream/async-interactive/main.py (1 hunks)
- examples/speak-stream/interactive/main.py (1 hunks)
Files skipped from review due to trivial changes (2)
- deepgram/clients/speak/enums.py
- deepgram/clients/speak/errors.py
Additional context used
Ruff
deepgram/clients/speak/v1/__init__.py
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client_stream.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.async_client_stream.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.async_client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.response.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
....options.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
....options.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/speak/__init__.py
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
11-11:
.client.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.client.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
13-13:
.client.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.enums.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
...options.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
...options.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/__init__.py
7-7:
.common.TextSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.common.BufferSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.common.StreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.common.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
11-11:
.common.UrlSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.common.Sentimentimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.listen.Listenimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
.read.Readimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.live.LiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.live.AsyncLiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
21-21:
.live.LiveOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
22-22:
.live.LiveTranscriptionEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
24-24:
.live.OpenResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.live.LiveResultResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.live.MetadataResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.live.SpeechStartedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
28-28:
.live.UtteranceEndResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
29-29:
.live.CloseResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.live.ErrorResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
31-31:
.live.UnhandledResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.prerecorded.PreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.prerecorded.AsyncPreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
36-36:
.prerecorded.PrerecordedOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
38-38:
.prerecorded.PreRecordedStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
39-39:
.prerecorded.PrerecordedSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
42-42:
.prerecorded.AsyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
43-43:
.prerecorded.PrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.prerecorded.SyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.analyze.ReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.analyze.AsyncReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.analyze.AnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.analyze.AsyncAnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
50-50:
.analyze.AnalyzeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
52-52:
.analyze.AnalyzeStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
53-53:
.analyze.AnalyzeSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
56-56:
.analyze.AsyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
57-57:
.analyze.AnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.analyze.SyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.speak.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.speak.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
63-63:
.speak.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
65-65:
.speak.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
66-66:
.speak.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
68-68:
.speak.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
69-69:
.speak.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.manage.ManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.manage.AsyncManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
77-77:
.manage.ProjectOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
78-78:
.manage.KeyOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
79-79:
.manage.ScopeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
80-80:
.manage.InviteOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
81-81:
.manage.UsageRequestOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
82-82:
.manage.UsageSummaryOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
83-83:
.manage.UsageFieldsOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.manage.Messageimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.manage.Projectimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
88-88:
.manage.ProjectsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
89-89:
.manage.MembersResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
90-90:
.manage.Keyimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
91-91:
.manage.KeyResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.manage.KeysResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
93-93:
.manage.ScopesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
94-94:
.manage.InvitesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
95-95:
.manage.UsageRequestimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
96-96:
.manage.UsageRequestsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
97-97:
.manage.UsageSummaryResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
98-98:
.manage.UsageFieldsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
99-99:
.manage.Balanceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
100-100:
.manage.BalancesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
105-105:
.selfhosted.OnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
106-106:
.selfhosted.AsyncOnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
107-107:
.selfhosted.SelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
108-108:
.selfhosted.AsyncSelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/__init__.py
9-9:
loggingimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.utils.VerboseLoggerimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.utils.NOTICEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
13-13:
.utils.SPAMimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
14-14:
.utils.SUCCESSimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
15-15:
.utils.VERBOSEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.utils.WARNINGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
.utils.ERRORimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
18-18:
.utils.FATALimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
19-19:
.utils.CRITICALimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.utils.INFOimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
21-21:
.utils.DEBUGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
22-22:
.utils.NOTSETimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.client.Deepgramimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.client.DeepgramClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.client.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.client.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.client.DeepgramApiKeyErrorimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.client.DeepgramModuleErrorimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.client.Listenimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.client.Readimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
34-34:
.client.TextSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.client.BufferSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
36-36:
.client.StreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
37-37:
.client.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
38-38:
.client.UrlSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
39-39:
.client.Sentimentimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
43-43:
.client.LiveTranscriptionEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.client.LiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.client.AsyncLiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
45-45:
.client.LiveOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
47-47:
.client.OpenResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.client.LiveResultResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.client.MetadataResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
50-50:
.client.SpeechStartedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
51-51:
.client.UtteranceEndResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
52-52:
.client.CloseResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
53-53:
.client.UnhandledResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
54-54:
.client.ErrorResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.client.PreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.client.AsyncPreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
60-60:
.client.PrerecordedOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
61-61:
.client.PreRecordedStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.client.PrerecordedSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
65-65:
.client.AsyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
66-66:
.client.PrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
67-67:
.client.SyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
71-71:
.client.ReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
71-71:
.client.AsyncReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.client.AnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.client.AsyncAnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
74-74:
.client.AnalyzeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.client.AnalyzeStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
76-76:
.client.AnalyzeSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
79-79:
.client.AsyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
80-80:
.client.AnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
81-81:
.client.SyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
85-85:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
85-85:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
88-88:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
89-89:
.client.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.client.ManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.client.AsyncManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
94-94:
.client.ProjectOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
95-95:
.client.KeyOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
96-96:
.client.ScopeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
97-97:
.client.InviteOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
98-98:
.client.UsageRequestOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
99-99:
.client.UsageSummaryOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
100-100:
.client.UsageFieldsOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
105-105:
.client.Messageimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
106-106:
.client.Projectimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
107-107:
.client.ProjectsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
108-108:
.client.MembersResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
109-109:
.client.Keyimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
110-110:
.client.KeyResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
111-111:
.client.KeysResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
112-112:
.client.ScopesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
113-113:
.client.InvitesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
114-114:
.client.UsageRequestimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
115-115:
.client.UsageRequestsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
116-116:
.client.UsageSummaryResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
117-117:
.client.UsageFieldsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
118-118:
.client.Balanceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
119-119:
.client.BalancesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
124-124:
.client.OnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
125-125:
.client.AsyncOnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
126-126:
.client.SelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
127-127:
.client.AsyncSelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
131-131:
.audio.Microphoneimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
133-133:
.audio.LOGGINGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
134-134:
.audio.CHANNELSimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
135-135:
.audio.RATEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
136-136:
.audio.CHUNKimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)examples/speak-stream/async-interactive/main.py
3-3:
jsonimported but unused (F401)Remove unused import:
jsonexamples/speak-stream/interactive/main.py
8-8:
jsonimported but unused (F401)Remove unused import:
jsondeepgram/client.py
15-15:
.clients.TextSourceimported but unused (F401)Remove unused import
16-16:
.clients.BufferSourceimported but unused (F401)Remove unused import
17-17:
.clients.StreamSourceimported but unused (F401)Remove unused import
18-18:
.clients.FileSourceimported but unused (F401)Remove unused import
19-19:
.clients.UrlSourceimported but unused (F401)Remove unused import
20-20:
.clients.Sentimentimported but unused (F401)Remove unused import
27-27:
.clients.LiveClientimported but unused (F401)Remove unused import
27-27:
.clients.AsyncLiveClientimported but unused (F401)Remove unused import
29-29:
.clients.LiveOptionsimported but unused (F401)Remove unused import
30-30:
.clients.LiveTranscriptionEventsimported but unused (F401)Remove unused import
35-35:
.clients.OpenResponseimported but unused (F401)Remove unused import
36-36:
.clients.LiveResultResponseimported but unused (F401)Remove unused import
37-37:
.clients.MetadataResponseimported but unused (F401)Remove unused import
38-38:
.clients.SpeechStartedResponseimported but unused (F401)Remove unused import
39-39:
.clients.UtteranceEndResponseimported but unused (F401)Remove unused import
40-40:
.clients.CloseResponseimported but unused (F401)Remove unused import
41-41:
.clients.ErrorResponseimported but unused (F401)Remove unused import
42-42:
.clients.UnhandledResponseimported but unused (F401)Remove unused import
47-47:
.clients.PreRecordedClientimported but unused (F401)Remove unused import
48-48:
.clients.AsyncPreRecordedClientimported but unused (F401)Remove unused import
51-51:
.clients.PrerecordedOptionsimported but unused (F401)Remove unused import
52-52:
.clients.PreRecordedStreamSourceimported but unused (F401)Remove unused import
53-53:
.clients.PrerecordedSourceimported but unused (F401)Remove unused import
58-58:
.clients.AsyncPrerecordedResponseimported but unused (F401)Remove unused import
59-59:
.clients.PrerecordedResponseimported but unused (F401)Remove unused import
60-60:
.clients.SyncPrerecordedResponseimported but unused (F401)Remove unused import
64-64:
.clients.ReadClientimported but unused (F401)Remove unused import
64-64:
.clients.AsyncReadClientimported but unused (F401)Remove unused import
65-65:
.clients.AnalyzeClientimported but unused (F401)Remove unused import
65-65:
.clients.AsyncAnalyzeClientimported but unused (F401)Remove unused import
67-67:
.clients.AnalyzeOptionsimported but unused (F401)Remove unused import
68-68:
.clients.AnalyzeStreamSourceimported but unused (F401)Remove unused import
69-69:
.clients.AnalyzeSourceimported but unused (F401)Remove unused import
74-74:
.clients.AsyncAnalyzeResponseimported but unused (F401)Remove unused import
75-75:
.clients.AnalyzeResponseimported but unused (F401)Remove unused import
76-76:
.clients.SyncAnalyzeResponseimported but unused (F401)Remove unused import
80-80:
.clients.SpeakClientimported but unused (F401)Remove unused import
80-80:
.clients.AsyncSpeakClientimported but unused (F401)Remove unused import
81-81:
.clients.SpeakStreamClientimported but unused (F401)Remove unused import
81-81:
.clients.AsyncSpeakStreamClientimported but unused (F401)Remove unused import
82-82:
.clients.SpeakOptionsimported but unused (F401)Remove unused import:
.clients.SpeakOptions
83-83:
.clients.SpeakStreamSourceimported but unused (F401)Remove unused import
83-83:
.clients.SpeakSourceimported but unused (F401)Remove unused import
84-84:
.clients.SpeakStreamEventsimported but unused (F401)Remove unused import:
.clients.SpeakStreamEvents
87-87:
.clients.SpeakResponseimported but unused (F401)Remove unused import:
.clients.SpeakResponse
90-90:
.clients.ManageClientimported but unused (F401)Remove unused import
90-90:
.clients.AsyncManageClientimported but unused (F401)Remove unused import
92-92:
.clients.ProjectOptionsimported but unused (F401)Remove unused import
93-93:
.clients.KeyOptionsimported but unused (F401)Remove unused import
94-94:
.clients.ScopeOptionsimported but unused (F401)Remove unused import
95-95:
.clients.InviteOptionsimported but unused (F401)Remove unused import
96-96:
.clients.UsageRequestOptionsimported but unused (F401)Remove unused import
97-97:
.clients.UsageSummaryOptionsimported but unused (F401)Remove unused import
98-98:
.clients.UsageFieldsOptionsimported but unused (F401)Remove unused import
103-103:
.clients.Messageimported but unused (F401)Remove unused import
104-104:
.clients.Projectimported but unused (F401)Remove unused import
105-105:
.clients.ProjectsResponseimported but unused (F401)Remove unused import
106-106:
.clients.MembersResponseimported but unused (F401)Remove unused import
107-107:
.clients.Keyimported but unused (F401)Remove unused import
108-108:
.clients.KeyResponseimported but unused (F401)Remove unused import
109-109:
.clients.KeysResponseimported but unused (F401)Remove unused import
110-110:
.clients.ScopesResponseimported but unused (F401)Remove unused import
111-111:
.clients.InvitesResponseimported but unused (F401)Remove unused import
112-112:
.clients.UsageRequestimported but unused (F401)Remove unused import
113-113:
.clients.UsageRequestsResponseimported but unused (F401)Remove unused import
114-114:
.clients.UsageSummaryResponseimported but unused (F401)Remove unused import
115-115:
.clients.UsageFieldsResponseimported but unused (F401)Remove unused import
116-116:
.clients.Balanceimported but unused (F401)Remove unused import
117-117:
.clients.BalancesResponseimported but unused (F401)Remove unused import
122-122:
.clients.OnPremClientimported but unused (F401)Remove unused import
123-123:
.clients.AsyncOnPremClientimported but unused (F401)Remove unused import
124-124:
.clients.SelfHostedClientimported but unused (F401)Remove unused import
125-125:
.clients.AsyncSelfHostedClientimported but unused (F401)Remove unused import
129-129:
.options.ClientOptionsFromEnvimported but unused (F401)Remove unused import:
.options.ClientOptionsFromEnv
130-130:
.errors.DeepgramApiKeyErrorimported but unused (F401)Remove unused import:
.errors.DeepgramApiKeyError
Additional comments not posted (8)
deepgram/clients/speak/client.py (1)
Line range hint
7-35: Updated class references to latest versions are correctly implemented.The imports and aliases are correctly updated to reference the latest versions of the classes, which aligns with the SDK's versioning strategy to support backward compatibility.
deepgram/client.py (1)
81-84: Introduction of SpeakStreamClient and AsyncSpeakStreamClientThe introduction of
SpeakStreamClientandAsyncSpeakStreamClientproperties in theDeepgramClientclass is a significant enhancement, aligning with the new feature set of TTS streaming. Here are a few points to consider:
- Documentation: The documentation for these new properties is clear and concise, explaining their purpose and usage well.
- Error Handling: Consider adding error handling within the
Versionclass methods to manage cases where the module or class cannot be found, as this could lead to runtime errors.- Testing: Ensure that these new properties are covered by unit tests, particularly testing edge cases and error scenarios.
These additions are crucial for supporting the new TTS streaming functionality and are implemented correctly in the context of the existing SDK architecture.
Also applies to: 241-253
Tools
Ruff
81-81:
.clients.SpeakStreamClientimported but unused (F401)Remove unused import
81-81:
.clients.AsyncSpeakStreamClientimported but unused (F401)Remove unused import
82-82:
.clients.SpeakOptionsimported but unused (F401)Remove unused import:
.clients.SpeakOptions
83-83:
.clients.SpeakStreamSourceimported but unused (F401)Remove unused import
83-83:
.clients.SpeakSourceimported but unused (F401)Remove unused import
84-84:
.clients.SpeakStreamEventsimported but unused (F401)Remove unused import:
.clients.SpeakStreamEventsdeepgram/clients/speak/v1/client_stream.py (5)
190-198: Validate event handler registration in theonmethod.The
onmethod correctly checks if the event is valid and if the handler is callable before appending it to the event handlers list. This prevents potential runtime errors and ensures that only valid handlers are registered.
216-386: Optimize the_listeningmethod's exception handling and control flow.The
_listeningmethod is designed to continuously listen for messages from the WebSocket connection. However, the method's exception handling and control flow can be optimized to reduce redundancy and improve clarity.
[REFACTOR_Suggestion]- except websockets.exceptions.ConnectionClosed as e: - if e.code == 1000: - self._logger.notice(f"_listening({e.code}) exiting gracefully") - self._logger.debug("SpeakStreamClient._listening LEAVE") - return - self._logger.error( - "ConnectionClosed in SpeakStreamClient._listening with code %s: %s", - e.code, - e.reason, - ) - cc_error: ErrorResponse = ErrorResponse( - "ConnectionClosed in SpeakStreamClient._listening", - f"{e}", - "ConnectionClosed", - ) - self._emit( - SpeakStreamEvents(SpeakStreamEvents.Error), cc_error - ) - # signal exit and close - self._signal_exit() - self._logger.debug("SpeakStreamClient._listening LEAVE") - if self._config.options.get("termination_exception") == "true": - raise - return + except websockets.exceptions.ConnectionClosed as e: + self._handle_connection_closed(e)Create a new method
_handle_connection_closedto handleConnectionClosedexceptions, which will centralize the error handling and make the code cleaner.
390-445: Review thesendmethod's error handling and socket check.The
sendmethod includes comprehensive error handling for various WebSocket exceptions. However, the method first checks if the socket is notNonebefore proceeding, which is a good practice to avoidNoneTypeerrors.
450-477: Ensure robustness in theflushmethod.The
flushmethod attempts to send a "Flush" command via the WebSocket connection. It correctly checks the return value to determine if the flush was successful. This method is crucial for ensuring that all pending data is sent before closing the connection.
480-508: Validate thefinishmethod's thread management and cleanup.The
finishmethod handles the graceful closure of the WebSocket connection and ensures that all associated threads are properly joined. This is crucial for avoiding resource leaks and ensuring that the application exits cleanly.deepgram/clients/speak/v1/async_client_stream.py (1)
77-183: Review thestartmethod for error handling and logic flow.
- The method logs extensively, which is good for debugging, but ensure that logging does not expose sensitive information.
- The method handles different types of exceptions and re-raises them based on a configuration option. This is a flexible error handling strategy but verify that it is consistent with the overall error handling strategy of the SDK.
- The use of
isinstancechecks forSpeakOptionscould be streamlined by ensuringoptionsis always a valid instance orNone.
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.
Other than that plus the existing coderabbit stuff (already dismissed a bunch of stuff we don't want to tackle right now), this looks great!
It's just the coderabbit stuff now. I think we are good to go after those updates.
1ff0e05 to
a53a297
Compare
a53a297 to
3b6c941
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: 8
Outside diff range and nitpick comments (2)
deepgram/client.py (1)
Line range hint
15-15: Suggestion to remove unused imports.The static analysis has identified multiple imports that are currently unused. Removing these can help clean up the codebase and potentially improve the module's load time and memory usage.
- from .clients import TextSource, BufferSource, StreamSource, FileSource, UrlSource, Sentiment, LiveClient, AsyncLiveClient, LiveOptions, LiveTranscriptionEvents, OpenResponse, LiveResultResponse, MetadataResponse, SpeechStartedResponse, UtteranceEndResponse, CloseResponse, ErrorResponse, UnhandledResponse, PreRecordedClient, AsyncPreRecordedClient, PrerecordedOptions, PreRecordedStreamSource, PrerecordedSource, AsyncPrerecordedResponse, PrerecordedResponse, SyncPrerecordedResponse, ReadClient, AsyncReadClient, AnalyzeClient, AsyncAnalyzeClient, AnalyzeOptions, AnalyzeStreamSource, AnalyzeSource, AsyncAnalyzeResponse, AnalyzeResponse, SyncAnalyzeResponse, SpeakClient, AsyncSpeakClient, SpeakStreamClient, AsyncSpeakStreamClient, SpeakOptions, SpeakStreamSource, SpeakSource, SpeakStreamEvents, SpeakResponse, ManageClient, AsyncManageClient, ProjectOptions, KeyOptions, ScopeOptions, InviteOptions, UsageRequestOptions, UsageSummaryOptions, UsageFieldsOptions, Message, Project, ProjectsResponse, MembersResponse, Key, KeyResponse, KeysResponse, ScopesResponse, InvitesResponse, UsageRequest, UsageRequestsResponse, UsageSummaryResponse, UsageFieldsResponse, Balance, BalancesResponse, OnPremClient, AsyncOnPremClient, SelfHostedClient, AsyncSelfHostedClient, ClientOptionsFromEnv, DeepgramApiKeyErrorAlso applies to: 16-16, 17-17, 18-18, 19-19, 20-20, 27-27, 27-27, 29-29, 30-30, 35-35, 36-36, 37-37, 38-38, 39-39, 40-40, 41-41, 42-42, 47-47, 48-48, 51-51, 52-52, 53-53, 58-58, 59-59, 60-60, 64-64, 64-64, 65-65, 65-65, 67-67, 68-68, 69-69, 74-74, 75-75, 76-76, 80-80, 80-80, 81-81, 81-81, 82-82, 83-83, 83-83, 84-84, 87-87, 87-87, 92-92, 93-93, 94-94, 95-95, 96-96, 97-97, 98-98, 103-103, 104-104, 105-105, 106-106, 107-107, 108-108, 109-109, 110-110, 111-111, 112-112, 113-113, 114-114, 115-115, 116-116, 117-117, 122-122, 123-123, 124-124, 125-125, 129-129, 130-130
Tools
Ruff
80-80:
.clients.SpeakClientimported but unused (F401)Remove unused import
80-80:
.clients.AsyncSpeakClientimported but unused (F401)Remove unused import
81-81:
.clients.SpeakStreamClientimported but unused (F401)Remove unused import
81-81:
.clients.AsyncSpeakStreamClientimported but unused (F401)Remove unused import
82-82:
.clients.SpeakOptionsimported but unused (F401)Remove unused import:
.clients.SpeakOptions
83-83:
.clients.SpeakStreamSourceimported but unused (F401)Remove unused import
83-83:
.clients.SpeakSourceimported but unused (F401)Remove unused import
84-84:
.clients.SpeakStreamEventsimported but unused (F401)Remove unused import:
.clients.SpeakStreamEvents
87-87:
.clients.SpeakResponseimported but unused (F401)Remove unused import:
.clients.SpeakResponsedeepgram/clients/speak/v1/async_client_stream.py (1)
228-417: Enhance error handling in the_listeningmethod.Ensure robust error handling for different WebSocket exceptions. Consider adding specific error handling for different WebSocket error codes to improve the method's resilience.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (14)
- deepgram/init.py (1 hunks)
- deepgram/client.py (5 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/live/v1/async_client.py (3 hunks)
- deepgram/clients/speak/init.py (2 hunks)
- deepgram/clients/speak/client.py (2 hunks)
- deepgram/clients/speak/enums.py (1 hunks)
- deepgram/clients/speak/errors.py (1 hunks)
- deepgram/clients/speak/v1/init.py (1 hunks)
- deepgram/clients/speak/v1/async_client_stream.py (1 hunks)
- deepgram/clients/speak/v1/client_stream.py (1 hunks)
- deepgram/clients/speak/v1/response.py (1 hunks)
- examples/speak-stream/async-interactive/main.py (1 hunks)
- examples/speak-stream/interactive/main.py (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- deepgram/clients/speak/client.py
- deepgram/clients/speak/enums.py
- deepgram/clients/speak/errors.py
- deepgram/clients/speak/v1/response.py
- examples/speak-stream/async-interactive/main.py
Additional context used
Learnings (2)
deepgram/clients/speak/v1/client_stream.py (2)
User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/client_stream.py:59-79 Timestamp: 2024-06-25T15:26:40.699Z Learning: The `config` object is always created before being passed to the `SpeakStreamClient` constructor, and should not be `null`.User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/async_client_stream.py:55-74 Timestamp: 2024-06-25T15:18:16.852Z Learning: The `config` parameter in the `AsyncSpeakStreamClient` constructor should not be optional and must be enforced at the type level.deepgram/clients/speak/v1/async_client_stream.py (2)
User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/async_client_stream.py:55-74 Timestamp: 2024-06-25T15:18:16.852Z Learning: The `config` parameter in the `AsyncSpeakStreamClient` constructor should not be optional and must be enforced at the type level.User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/client_stream.py:59-79 Timestamp: 2024-06-25T15:26:40.699Z Learning: The `config` object is always created before being passed to the `SpeakStreamClient` constructor, and should not be `null`.
Ruff
deepgram/clients/speak/v1/__init__.py
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client_stream.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.async_client_stream.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.async_client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.response.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
....options.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
....options.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/speak/__init__.py
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
11-11:
.client.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.client.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
13-13:
.client.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.enums.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
...options.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
...options.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/__init__.py
7-7:
.common.TextSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.common.BufferSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.common.StreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.common.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
11-11:
.common.UrlSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.common.Sentimentimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.listen.Listenimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
.read.Readimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.live.LiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.live.AsyncLiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
21-21:
.live.LiveOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
22-22:
.live.LiveTranscriptionEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
24-24:
.live.OpenResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.live.LiveResultResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.live.MetadataResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.live.SpeechStartedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
28-28:
.live.UtteranceEndResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
29-29:
.live.CloseResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.live.ErrorResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
31-31:
.live.UnhandledResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.prerecorded.PreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.prerecorded.AsyncPreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
36-36:
.prerecorded.PrerecordedOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
38-38:
.prerecorded.PreRecordedStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
39-39:
.prerecorded.PrerecordedSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
42-42:
.prerecorded.AsyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
43-43:
.prerecorded.PrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.prerecorded.SyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.analyze.ReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.analyze.AsyncReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.analyze.AnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.analyze.AsyncAnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
50-50:
.analyze.AnalyzeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
52-52:
.analyze.AnalyzeStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
53-53:
.analyze.AnalyzeSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
56-56:
.analyze.AsyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
57-57:
.analyze.AnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.analyze.SyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.speak.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.speak.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
63-63:
.speak.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
65-65:
.speak.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
66-66:
.speak.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
68-68:
.speak.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
69-69:
.speak.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.manage.ManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.manage.AsyncManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
77-77:
.manage.ProjectOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
78-78:
.manage.KeyOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
79-79:
.manage.ScopeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
80-80:
.manage.InviteOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
81-81:
.manage.UsageRequestOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
82-82:
.manage.UsageSummaryOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
83-83:
.manage.UsageFieldsOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.manage.Messageimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.manage.Projectimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
88-88:
.manage.ProjectsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
89-89:
.manage.MembersResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
90-90:
.manage.Keyimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
91-91:
.manage.KeyResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.manage.KeysResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
93-93:
.manage.ScopesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
94-94:
.manage.InvitesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
95-95:
.manage.UsageRequestimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
96-96:
.manage.UsageRequestsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
97-97:
.manage.UsageSummaryResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
98-98:
.manage.UsageFieldsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
99-99:
.manage.Balanceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
100-100:
.manage.BalancesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
105-105:
.selfhosted.OnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
106-106:
.selfhosted.AsyncOnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
107-107:
.selfhosted.SelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
108-108:
.selfhosted.AsyncSelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/__init__.py
9-9:
loggingimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.utils.VerboseLoggerimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.utils.NOTICEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
13-13:
.utils.SPAMimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
14-14:
.utils.SUCCESSimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
15-15:
.utils.VERBOSEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.utils.WARNINGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
.utils.ERRORimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
18-18:
.utils.FATALimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
19-19:
.utils.CRITICALimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.utils.INFOimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
21-21:
.utils.DEBUGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
22-22:
.utils.NOTSETimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.client.Deepgramimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.client.DeepgramClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.client.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.client.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.client.DeepgramApiKeyErrorimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.client.DeepgramModuleErrorimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.client.Listenimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.client.Readimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
34-34:
.client.TextSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.client.BufferSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
36-36:
.client.StreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
37-37:
.client.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
38-38:
.client.UrlSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
39-39:
.client.Sentimentimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
43-43:
.client.LiveTranscriptionEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.client.LiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.client.AsyncLiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
45-45:
.client.LiveOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
47-47:
.client.OpenResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.client.LiveResultResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.client.MetadataResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
50-50:
.client.SpeechStartedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
51-51:
.client.UtteranceEndResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
52-52:
.client.CloseResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
53-53:
.client.UnhandledResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
54-54:
.client.ErrorResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.client.PreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.client.AsyncPreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
60-60:
.client.PrerecordedOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
61-61:
.client.PreRecordedStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.client.PrerecordedSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
65-65:
.client.AsyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
66-66:
.client.PrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
67-67:
.client.SyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
71-71:
.client.ReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
71-71:
.client.AsyncReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.client.AnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.client.AsyncAnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
74-74:
.client.AnalyzeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.client.AnalyzeStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
76-76:
.client.AnalyzeSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
79-79:
.client.AsyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
80-80:
.client.AnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
81-81:
.client.SyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
85-85:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
85-85:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
88-88:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
89-89:
.client.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.client.ManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.client.AsyncManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
94-94:
.client.ProjectOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
95-95:
.client.KeyOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
96-96:
.client.ScopeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
97-97:
.client.InviteOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
98-98:
.client.UsageRequestOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
99-99:
.client.UsageSummaryOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
100-100:
.client.UsageFieldsOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
105-105:
.client.Messageimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
106-106:
.client.Projectimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
107-107:
.client.ProjectsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
108-108:
.client.MembersResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
109-109:
.client.Keyimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
110-110:
.client.KeyResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
111-111:
.client.KeysResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
112-112:
.client.ScopesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
113-113:
.client.InvitesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
114-114:
.client.UsageRequestimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
115-115:
.client.UsageRequestsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
116-116:
.client.UsageSummaryResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
117-117:
.client.UsageFieldsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
118-118:
.client.Balanceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
119-119:
.client.BalancesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
124-124:
.client.OnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
125-125:
.client.AsyncOnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
126-126:
.client.SelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
127-127:
.client.AsyncSelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
131-131:
.audio.Microphoneimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
133-133:
.audio.LOGGINGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
134-134:
.audio.CHANNELSimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
135-135:
.audio.RATEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
136-136:
.audio.CHUNKimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/client.py
15-15:
.clients.TextSourceimported but unused (F401)Remove unused import
16-16:
.clients.BufferSourceimported but unused (F401)Remove unused import
17-17:
.clients.StreamSourceimported but unused (F401)Remove unused import
18-18:
.clients.FileSourceimported but unused (F401)Remove unused import
19-19:
.clients.UrlSourceimported but unused (F401)Remove unused import
20-20:
.clients.Sentimentimported but unused (F401)Remove unused import
27-27:
.clients.LiveClientimported but unused (F401)Remove unused import
27-27:
.clients.AsyncLiveClientimported but unused (F401)Remove unused import
29-29:
.clients.LiveOptionsimported but unused (F401)Remove unused import
30-30:
.clients.LiveTranscriptionEventsimported but unused (F401)Remove unused import
35-35:
.clients.OpenResponseimported but unused (F401)Remove unused import
36-36:
.clients.LiveResultResponseimported but unused (F401)Remove unused import
37-37:
.clients.MetadataResponseimported but unused (F401)Remove unused import
38-38:
.clients.SpeechStartedResponseimported but unused (F401)Remove unused import
39-39:
.clients.UtteranceEndResponseimported but unused (F401)Remove unused import
40-40:
.clients.CloseResponseimported but unused (F401)Remove unused import
41-41:
.clients.ErrorResponseimported but unused (F401)Remove unused import
42-42:
.clients.UnhandledResponseimported but unused (F401)Remove unused import
47-47:
.clients.PreRecordedClientimported but unused (F401)Remove unused import
48-48:
.clients.AsyncPreRecordedClientimported but unused (F401)Remove unused import
51-51:
.clients.PrerecordedOptionsimported but unused (F401)Remove unused import
52-52:
.clients.PreRecordedStreamSourceimported but unused (F401)Remove unused import
53-53:
.clients.PrerecordedSourceimported but unused (F401)Remove unused import
58-58:
.clients.AsyncPrerecordedResponseimported but unused (F401)Remove unused import
59-59:
.clients.PrerecordedResponseimported but unused (F401)Remove unused import
60-60:
.clients.SyncPrerecordedResponseimported but unused (F401)Remove unused import
64-64:
.clients.ReadClientimported but unused (F401)Remove unused import
64-64:
.clients.AsyncReadClientimported but unused (F401)Remove unused import
65-65:
.clients.AnalyzeClientimported but unused (F401)Remove unused import
65-65:
.clients.AsyncAnalyzeClientimported but unused (F401)Remove unused import
67-67:
.clients.AnalyzeOptionsimported but unused (F401)Remove unused import
68-68:
.clients.AnalyzeStreamSourceimported but unused (F401)Remove unused import
69-69:
.clients.AnalyzeSourceimported but unused (F401)Remove unused import
74-74:
.clients.AsyncAnalyzeResponseimported but unused (F401)Remove unused import
75-75:
.clients.AnalyzeResponseimported but unused (F401)Remove unused import
76-76:
.clients.SyncAnalyzeResponseimported but unused (F401)Remove unused import
80-80:
.clients.SpeakClientimported but unused (F401)Remove unused import
80-80:
.clients.AsyncSpeakClientimported but unused (F401)Remove unused import
81-81:
.clients.SpeakStreamClientimported but unused (F401)Remove unused import
81-81:
.clients.AsyncSpeakStreamClientimported but unused (F401)Remove unused import
82-82:
.clients.SpeakOptionsimported but unused (F401)Remove unused import:
.clients.SpeakOptions
83-83:
.clients.SpeakStreamSourceimported but unused (F401)Remove unused import
83-83:
.clients.SpeakSourceimported but unused (F401)Remove unused import
84-84:
.clients.SpeakStreamEventsimported but unused (F401)Remove unused import:
.clients.SpeakStreamEvents
87-87:
.clients.SpeakResponseimported but unused (F401)Remove unused import:
.clients.SpeakResponse
90-90:
.clients.ManageClientimported but unused (F401)Remove unused import
90-90:
.clients.AsyncManageClientimported but unused (F401)Remove unused import
92-92:
.clients.ProjectOptionsimported but unused (F401)Remove unused import
93-93:
.clients.KeyOptionsimported but unused (F401)Remove unused import
94-94:
.clients.ScopeOptionsimported but unused (F401)Remove unused import
95-95:
.clients.InviteOptionsimported but unused (F401)Remove unused import
96-96:
.clients.UsageRequestOptionsimported but unused (F401)Remove unused import
97-97:
.clients.UsageSummaryOptionsimported but unused (F401)Remove unused import
98-98:
.clients.UsageFieldsOptionsimported but unused (F401)Remove unused import
103-103:
.clients.Messageimported but unused (F401)Remove unused import
104-104:
.clients.Projectimported but unused (F401)Remove unused import
105-105:
.clients.ProjectsResponseimported but unused (F401)Remove unused import
106-106:
.clients.MembersResponseimported but unused (F401)Remove unused import
107-107:
.clients.Keyimported but unused (F401)Remove unused import
108-108:
.clients.KeyResponseimported but unused (F401)Remove unused import
109-109:
.clients.KeysResponseimported but unused (F401)Remove unused import
110-110:
.clients.ScopesResponseimported but unused (F401)Remove unused import
111-111:
.clients.InvitesResponseimported but unused (F401)Remove unused import
112-112:
.clients.UsageRequestimported but unused (F401)Remove unused import
113-113:
.clients.UsageRequestsResponseimported but unused (F401)Remove unused import
114-114:
.clients.UsageSummaryResponseimported but unused (F401)Remove unused import
115-115:
.clients.UsageFieldsResponseimported but unused (F401)Remove unused import
116-116:
.clients.Balanceimported but unused (F401)Remove unused import
117-117:
.clients.BalancesResponseimported but unused (F401)Remove unused import
122-122:
.clients.OnPremClientimported but unused (F401)Remove unused import
123-123:
.clients.AsyncOnPremClientimported but unused (F401)Remove unused import
124-124:
.clients.SelfHostedClientimported but unused (F401)Remove unused import
125-125:
.clients.AsyncSelfHostedClientimported but unused (F401)Remove unused import
129-129:
.options.ClientOptionsFromEnvimported but unused (F401)Remove unused import:
.options.ClientOptionsFromEnv
130-130:
.errors.DeepgramApiKeyErrorimported but unused (F401)Remove unused import:
.errors.DeepgramApiKeyErrordeepgram/clients/speak/v1/async_client_stream.py
193-194: Use a single
ifstatement instead of nestedifstatements (SIM102)deepgram/clients/live/v1/async_client.py
223-224: Use a single
ifstatement instead of nestedifstatements (SIM102)
Additional comments not posted (14)
deepgram/clients/speak/v1/__init__.py (1)
6-7: Consider adding new imports to__all__to clarify their purpose.The imports of
SpeakStreamClientandAsyncSpeakStreamClientare flagged as unused. If these are intended for export, they should be included in the__all__list. This will clarify their purpose and avoid linting issues.Tools
Ruff
6-6:
.client_stream.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.async_client_stream.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/speak/__init__.py (1)
Line range hint
6-16: Consider adding new imports to__all__to clarify their purpose.The imports of
SpeakStreamClient,AsyncSpeakStreamClient, andSpeakStreamEventsare flagged as unused. If these are intended for export, they should be included in the__all__list. This will clarify their purpose and avoid linting issues.Tools
Ruff
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/__init__.py (1)
68-73: Consider adding new imports to__all__to clarify their purpose.The imports of
SpeakStreamClient,AsyncSpeakStreamClient, andSpeakStreamEventsare flagged as unused. If these are intended for export, they should be included in the__all__list. This will clarify their purpose and avoid linting issues.Tools
Ruff
68-68:
.speak.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
69-69:
.speak.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/__init__.py (1)
86-89: Consider adding new imports to__all__to clarify their purpose.The imports of
SpeakStreamClient,AsyncSpeakStreamClient, andSpeakStreamEventsare flagged as unused. If these are intended for export, they should be included in the__all__list. This will clarify their purpose and avoid linting issues.Tools
Ruff
86-86:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
88-88:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
89-89:
.client.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)examples/speak-stream/interactive/main.py (1)
24-93: Refactor to use structured logging and improve error handling.Replace print statements with structured logging for better consistency and maintainability. Improve error handling by catching specific exceptions and using more descriptive error messages.
import logging + logger = logging.getLogger(__name__) - print(f"\n\n{open}\n\n") + logger.info(f"Open: {open}") - print("Failed to start connection") + logger.error("Failed to start connection")deepgram/client.py (2)
241-245: Approval forspeakstreamproperty addition.
The implementation for accessingSpeakStreamClientthroughspeakstreamproperty is consistent with the existing architecture of the client.
247-252: Approval forasyncspeakstreamproperty addition.
The addition of theasyncspeakstreamproperty to accessAsyncSpeakStreamClientaligns well with the SDK's architecture and provides a clear asynchronous alternative.deepgram/clients/speak/v1/client_stream.py (3)
60-81: Constructor review forSpeakStreamClient.The constructor properly initializes all necessary instance attributes and sets up logging. The check for
configbeingNoneis consistent with the previous discussions and learnings indicating that theconfigobject is always created before being passed to the constructor.
398-450: Review ofsendmethod inSpeakStreamClient.The method correctly handles thread safety with a lock and provides comprehensive error handling. The logging level might be adjusted to provide more appropriate feedback in production environments.
- self._logger.spam("SpeakStreamClient.send ENTER") + self._logger.debug("SpeakStreamClient.send ENTER")
459-486: Review offlushmethod inSpeakStreamClient.The method effectively uses the
sendmethod to flush the WebSocket buffer and handles potential errors well.deepgram/clients/speak/v1/async_client_stream.py (2)
197-226: Good management of tasks in the_emitmethod.The method correctly creates tasks for each event handler, waits for them to complete, and clears the list to prevent memory leaks.
554-596: Ensure proper cleanup in the_signal_exitmethod.The method should ensure that all tasks are completed and the WebSocket is closed properly to avoid resource leaks.
deepgram/clients/live/v1/async_client.py (2)
242-248: Efficient handling of asynchronous tasks.Creating and awaiting tasks for each event handler ensures that all handlers are executed in parallel, and using
asyncio.gatherwithreturn_exceptions=Trueis a good practice to handle exceptions gracefully.
386-386: Proper handling of specific WebSocket error codes.Handling specific WebSocket error codes (
1000,1001) gracefully is a good practice. Consider adding a comment or documentation to explain why these specific codes are treated differently, enhancing maintainability.
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: 18
Outside diff range and nitpick comments (2)
deepgram/clients/speak/__init__.py (1)
Line range hint
6-16: Consolidate imports from the same module for clarity.Multiple imports from
.clientcan be consolidated to improve clarity and maintainability.- from .client import SpeakClient - from .client import SpeakStreamClient, AsyncSpeakStreamClient - from .client import AsyncSpeakClient - from .client import SpeakOptions - from .client import SpeakResponse - from .client import ( - FileSource, - SpeakStreamSource, - SpeakSource, - ) + from .client import ( + SpeakClient, + SpeakStreamClient, + AsyncSpeakClient, + SpeakOptions, + SpeakResponse, + FileSource, + SpeakStreamSource, + SpeakSource + )Tools
Ruff
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)examples/speak-stream/interactive/main.py (1)
74-79: Good use of locking to prevent race conditions.The use of
threading.Lockin thesend_tts_textfunction is appropriate to ensure that multiple threads do not cause race conditions when sending text to speech data. However, consider if the threading model can be simplified or improved to avoid excessive thread management complexity.Review the overall threading model to ensure it aligns with best practices and consider alternatives like asynchronous programming if applicable.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (14)
- deepgram/init.py (1 hunks)
- deepgram/client.py (5 hunks)
- deepgram/clients/init.py (1 hunks)
- deepgram/clients/live/v1/async_client.py (3 hunks)
- deepgram/clients/speak/init.py (2 hunks)
- deepgram/clients/speak/client.py (2 hunks)
- deepgram/clients/speak/enums.py (1 hunks)
- deepgram/clients/speak/errors.py (1 hunks)
- deepgram/clients/speak/v1/init.py (1 hunks)
- deepgram/clients/speak/v1/async_client_stream.py (1 hunks)
- deepgram/clients/speak/v1/client_stream.py (1 hunks)
- deepgram/clients/speak/v1/response.py (1 hunks)
- examples/speak-stream/async-interactive/main.py (1 hunks)
- examples/speak-stream/interactive/main.py (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- deepgram/clients/speak/client.py
- deepgram/clients/speak/enums.py
- deepgram/clients/speak/errors.py
Additional context used
Learnings (2)
deepgram/clients/speak/v1/client_stream.py (2)
User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/client_stream.py:59-79 Timestamp: 2024-06-25T15:26:40.699Z Learning: The `config` object is always created before being passed to the `SpeakStreamClient` constructor, and should not be `null`.User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/async_client_stream.py:55-74 Timestamp: 2024-06-25T15:18:16.852Z Learning: The `config` parameter in the `AsyncSpeakStreamClient` constructor should not be optional and must be enforced at the type level.deepgram/clients/speak/v1/async_client_stream.py (2)
User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/async_client_stream.py:55-74 Timestamp: 2024-06-25T15:18:16.852Z Learning: The `config` parameter in the `AsyncSpeakStreamClient` constructor should not be optional and must be enforced at the type level.User: dvonthenen PR: deepgram/deepgram-python-sdk#424 File: deepgram/clients/speak/v1/client_stream.py:59-79 Timestamp: 2024-06-25T15:26:40.699Z Learning: The `config` object is always created before being passed to the `SpeakStreamClient` constructor, and should not be `null`.
Ruff
deepgram/clients/speak/v1/__init__.py
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client_stream.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.async_client_stream.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.async_client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.options.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.response.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
....options.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
....options.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/speak/__init__.py
5-5:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
6-6:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
11-11:
.client.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.client.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
13-13:
.client.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.enums.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
...options.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
...options.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/__init__.py
7-7:
.common.TextSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
8-8:
.common.BufferSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
9-9:
.common.StreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.common.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
11-11:
.common.UrlSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.common.Sentimentimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.listen.Listenimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
.read.Readimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.live.LiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.live.AsyncLiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
21-21:
.live.LiveOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
22-22:
.live.LiveTranscriptionEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
24-24:
.live.OpenResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.live.LiveResultResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.live.MetadataResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.live.SpeechStartedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
28-28:
.live.UtteranceEndResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
29-29:
.live.CloseResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.live.ErrorResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
31-31:
.live.UnhandledResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.prerecorded.PreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.prerecorded.AsyncPreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
36-36:
.prerecorded.PrerecordedOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
38-38:
.prerecorded.PreRecordedStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
39-39:
.prerecorded.PrerecordedSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
42-42:
.prerecorded.AsyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
43-43:
.prerecorded.PrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.prerecorded.SyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.analyze.ReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.analyze.AsyncReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.analyze.AnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.analyze.AsyncAnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
50-50:
.analyze.AnalyzeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
52-52:
.analyze.AnalyzeStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
53-53:
.analyze.AnalyzeSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
56-56:
.analyze.AsyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
57-57:
.analyze.AnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.analyze.SyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.speak.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.speak.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
63-63:
.speak.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
65-65:
.speak.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
66-66:
.speak.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
68-68:
.speak.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
69-69:
.speak.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.manage.ManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.manage.AsyncManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
77-77:
.manage.ProjectOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
78-78:
.manage.KeyOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
79-79:
.manage.ScopeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
80-80:
.manage.InviteOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
81-81:
.manage.UsageRequestOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
82-82:
.manage.UsageSummaryOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
83-83:
.manage.UsageFieldsOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.manage.Messageimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.manage.Projectimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
88-88:
.manage.ProjectsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
89-89:
.manage.MembersResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
90-90:
.manage.Keyimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
91-91:
.manage.KeyResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.manage.KeysResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
93-93:
.manage.ScopesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
94-94:
.manage.InvitesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
95-95:
.manage.UsageRequestimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
96-96:
.manage.UsageRequestsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
97-97:
.manage.UsageSummaryResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
98-98:
.manage.UsageFieldsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
99-99:
.manage.Balanceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
100-100:
.manage.BalancesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
105-105:
.selfhosted.OnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
106-106:
.selfhosted.AsyncOnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
107-107:
.selfhosted.SelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
108-108:
.selfhosted.AsyncSelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/__init__.py
9-9:
loggingimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
10-10:
.utils.VerboseLoggerimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
12-12:
.utils.NOTICEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
13-13:
.utils.SPAMimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
14-14:
.utils.SUCCESSimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
15-15:
.utils.VERBOSEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
16-16:
.utils.WARNINGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
17-17:
.utils.ERRORimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
18-18:
.utils.FATALimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
19-19:
.utils.CRITICALimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
20-20:
.utils.INFOimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
21-21:
.utils.DEBUGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
22-22:
.utils.NOTSETimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.client.Deepgramimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
25-25:
.client.DeepgramClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.client.DeepgramClientOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
26-26:
.client.ClientOptionsFromEnvimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.client.DeepgramApiKeyErrorimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
27-27:
.client.DeepgramModuleErrorimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.client.Listenimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
30-30:
.client.Readimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
34-34:
.client.TextSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
35-35:
.client.BufferSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
36-36:
.client.StreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
37-37:
.client.FileSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
38-38:
.client.UrlSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
39-39:
.client.Sentimentimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
43-43:
.client.LiveTranscriptionEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.client.LiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
44-44:
.client.AsyncLiveClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
45-45:
.client.LiveOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
47-47:
.client.OpenResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
48-48:
.client.LiveResultResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
49-49:
.client.MetadataResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
50-50:
.client.SpeechStartedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
51-51:
.client.UtteranceEndResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
52-52:
.client.CloseResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
53-53:
.client.UnhandledResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
54-54:
.client.ErrorResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.client.PreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
58-58:
.client.AsyncPreRecordedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
60-60:
.client.PrerecordedOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
61-61:
.client.PreRecordedStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
62-62:
.client.PrerecordedSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
65-65:
.client.AsyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
66-66:
.client.PrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
67-67:
.client.SyncPrerecordedResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
71-71:
.client.ReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
71-71:
.client.AsyncReadClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.client.AnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.client.AsyncAnalyzeClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
74-74:
.client.AnalyzeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
75-75:
.client.AnalyzeStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
76-76:
.client.AnalyzeSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
79-79:
.client.AsyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
80-80:
.client.AnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
81-81:
.client.SyncAnalyzeResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
85-85:
.client.SpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
85-85:
.client.AsyncSpeakClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.client.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
86-86:
.client.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakStreamSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
87-87:
.client.SpeakSourceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
88-88:
.client.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
89-89:
.client.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.client.ManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
92-92:
.client.AsyncManageClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
94-94:
.client.ProjectOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
95-95:
.client.KeyOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
96-96:
.client.ScopeOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
97-97:
.client.InviteOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
98-98:
.client.UsageRequestOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
99-99:
.client.UsageSummaryOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
100-100:
.client.UsageFieldsOptionsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
105-105:
.client.Messageimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
106-106:
.client.Projectimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
107-107:
.client.ProjectsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
108-108:
.client.MembersResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
109-109:
.client.Keyimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
110-110:
.client.KeyResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
111-111:
.client.KeysResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
112-112:
.client.ScopesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
113-113:
.client.InvitesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
114-114:
.client.UsageRequestimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
115-115:
.client.UsageRequestsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
116-116:
.client.UsageSummaryResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
117-117:
.client.UsageFieldsResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
118-118:
.client.Balanceimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
119-119:
.client.BalancesResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
124-124:
.client.OnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
125-125:
.client.AsyncOnPremClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
126-126:
.client.SelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
127-127:
.client.AsyncSelfHostedClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
131-131:
.audio.Microphoneimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
133-133:
.audio.LOGGINGimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
134-134:
.audio.CHANNELSimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
135-135:
.audio.RATEimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
136-136:
.audio.CHUNKimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)examples/speak-stream/interactive/main.py
8-8:
deepgram.utils.verboselogsimported but unused (F401)Remove unused import:
deepgram.utils.verboselogs
12-12:
deepgram.DeepgramClientOptionsimported but unused (F401)Remove unused import:
deepgram.DeepgramClientOptionsexamples/speak-stream/async-interactive/main.py
4-4:
deepgram.utils.verboselogsimported but unused (F401)Remove unused import:
deepgram.utils.verboselogs
7-7:
deepgram.DeepgramClientOptionsimported but unused (F401)Remove unused import:
deepgram.DeepgramClientOptionsdeepgram/client.py
15-15:
.clients.TextSourceimported but unused (F401)Remove unused import
16-16:
.clients.BufferSourceimported but unused (F401)Remove unused import
17-17:
.clients.StreamSourceimported but unused (F401)Remove unused import
18-18:
.clients.FileSourceimported but unused (F401)Remove unused import
19-19:
.clients.UrlSourceimported but unused (F401)Remove unused import
20-20:
.clients.Sentimentimported but unused (F401)Remove unused import
27-27:
.clients.LiveClientimported but unused (F401)Remove unused import
27-27:
.clients.AsyncLiveClientimported but unused (F401)Remove unused import
29-29:
.clients.LiveOptionsimported but unused (F401)Remove unused import
30-30:
.clients.LiveTranscriptionEventsimported but unused (F401)Remove unused import
35-35:
.clients.OpenResponseimported but unused (F401)Remove unused import
36-36:
.clients.LiveResultResponseimported but unused (F401)Remove unused import
37-37:
.clients.MetadataResponseimported but unused (F401)Remove unused import
38-38:
.clients.SpeechStartedResponseimported but unused (F401)Remove unused import
39-39:
.clients.UtteranceEndResponseimported but unused (F401)Remove unused import
40-40:
.clients.CloseResponseimported but unused (F401)Remove unused import
41-41:
.clients.ErrorResponseimported but unused (F401)Remove unused import
42-42:
.clients.UnhandledResponseimported but unused (F401)Remove unused import
47-47:
.clients.PreRecordedClientimported but unused (F401)Remove unused import
48-48:
.clients.AsyncPreRecordedClientimported but unused (F401)Remove unused import
51-51:
.clients.PrerecordedOptionsimported but unused (F401)Remove unused import
52-52:
.clients.PreRecordedStreamSourceimported but unused (F401)Remove unused import
53-53:
.clients.PrerecordedSourceimported but unused (F401)Remove unused import
58-58:
.clients.AsyncPrerecordedResponseimported but unused (F401)Remove unused import
59-59:
.clients.PrerecordedResponseimported but unused (F401)Remove unused import
60-60:
.clients.SyncPrerecordedResponseimported but unused (F401)Remove unused import
64-64:
.clients.ReadClientimported but unused (F401)Remove unused import
64-64:
.clients.AsyncReadClientimported but unused (F401)Remove unused import
65-65:
.clients.AnalyzeClientimported but unused (F401)Remove unused import
65-65:
.clients.AsyncAnalyzeClientimported but unused (F401)Remove unused import
67-67:
.clients.AnalyzeOptionsimported but unused (F401)Remove unused import
68-68:
.clients.AnalyzeStreamSourceimported but unused (F401)Remove unused import
69-69:
.clients.AnalyzeSourceimported but unused (F401)Remove unused import
74-74:
.clients.AsyncAnalyzeResponseimported but unused (F401)Remove unused import
75-75:
.clients.AnalyzeResponseimported but unused (F401)Remove unused import
76-76:
.clients.SyncAnalyzeResponseimported but unused (F401)Remove unused import
80-80:
.clients.SpeakClientimported but unused (F401)Remove unused import
80-80:
.clients.AsyncSpeakClientimported but unused (F401)Remove unused import
81-81:
.clients.SpeakStreamClientimported but unused (F401)Remove unused import
81-81:
.clients.AsyncSpeakStreamClientimported but unused (F401)Remove unused import
82-82:
.clients.SpeakOptionsimported but unused (F401)Remove unused import:
.clients.SpeakOptions
83-83:
.clients.SpeakStreamSourceimported but unused (F401)Remove unused import
83-83:
.clients.SpeakSourceimported but unused (F401)Remove unused import
84-84:
.clients.SpeakStreamEventsimported but unused (F401)Remove unused import:
.clients.SpeakStreamEvents
87-87:
.clients.SpeakResponseimported but unused (F401)Remove unused import:
.clients.SpeakResponse
90-90:
.clients.ManageClientimported but unused (F401)Remove unused import
90-90:
.clients.AsyncManageClientimported but unused (F401)Remove unused import
92-92:
.clients.ProjectOptionsimported but unused (F401)Remove unused import
93-93:
.clients.KeyOptionsimported but unused (F401)Remove unused import
94-94:
.clients.ScopeOptionsimported but unused (F401)Remove unused import
95-95:
.clients.InviteOptionsimported but unused (F401)Remove unused import
96-96:
.clients.UsageRequestOptionsimported but unused (F401)Remove unused import
97-97:
.clients.UsageSummaryOptionsimported but unused (F401)Remove unused import
98-98:
.clients.UsageFieldsOptionsimported but unused (F401)Remove unused import
103-103:
.clients.Messageimported but unused (F401)Remove unused import
104-104:
.clients.Projectimported but unused (F401)Remove unused import
105-105:
.clients.ProjectsResponseimported but unused (F401)Remove unused import
106-106:
.clients.MembersResponseimported but unused (F401)Remove unused import
107-107:
.clients.Keyimported but unused (F401)Remove unused import
108-108:
.clients.KeyResponseimported but unused (F401)Remove unused import
109-109:
.clients.KeysResponseimported but unused (F401)Remove unused import
110-110:
.clients.ScopesResponseimported but unused (F401)Remove unused import
111-111:
.clients.InvitesResponseimported but unused (F401)Remove unused import
112-112:
.clients.UsageRequestimported but unused (F401)Remove unused import
113-113:
.clients.UsageRequestsResponseimported but unused (F401)Remove unused import
114-114:
.clients.UsageSummaryResponseimported but unused (F401)Remove unused import
115-115:
.clients.UsageFieldsResponseimported but unused (F401)Remove unused import
116-116:
.clients.Balanceimported but unused (F401)Remove unused import
117-117:
.clients.BalancesResponseimported but unused (F401)Remove unused import
122-122:
.clients.OnPremClientimported but unused (F401)Remove unused import
123-123:
.clients.AsyncOnPremClientimported but unused (F401)Remove unused import
124-124:
.clients.SelfHostedClientimported but unused (F401)Remove unused import
125-125:
.clients.AsyncSelfHostedClientimported but unused (F401)Remove unused import
129-129:
.options.ClientOptionsFromEnvimported but unused (F401)Remove unused import:
.options.ClientOptionsFromEnv
130-130:
.errors.DeepgramApiKeyErrorimported but unused (F401)Remove unused import:
.errors.DeepgramApiKeyErrordeepgram/clients/speak/v1/async_client_stream.py
193-194: Use a single
ifstatement instead of nestedifstatements (SIM102)deepgram/clients/live/v1/async_client.py
223-224: Use a single
ifstatement instead of nestedifstatements (SIM102)
Additional comments not posted (12)
deepgram/clients/speak/v1/__init__.py (1)
6-7: Imports are well-organized but consider usage documentation.The imports are correctly structured, but it would be beneficial to include comments or documentation on how these imports are intended to be used, especially since they are designed for external exposure.
Tools
Ruff
6-6:
.client_stream.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
7-7:
.async_client_stream.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/speak/__init__.py (1)
16-16: Consider documenting the use ofSpeakStreamEvents.
SpeakStreamEventsis imported but not documented within this file. Adding usage examples or a brief description can help developers understand its purpose better.Tools
Ruff
16-16:
.enums.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/clients/__init__.py (1)
68-73: Imports are well-organized but consider usage documentation.The imports are correctly structured, but it would be beneficial to include comments or documentation on how these imports are intended to be used, especially since they are designed for external exposure.
Tools
Ruff
68-68:
.speak.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
69-69:
.speak.SpeakResponseimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.SpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)
72-72:
.speak.AsyncSpeakStreamClientimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/__init__.py (1)
89-89: Consider documenting the use ofSpeakStreamEvents.
SpeakStreamEventsis imported but not documented within this file. Adding usage examples or a brief description can help developers understand its purpose better.Tools
Ruff
89-89:
.client.SpeakStreamEventsimported but unused; consider removing, adding to__all__, or using a redundant alias (F401)deepgram/client.py (1)
241-253: Implement properties for SpeakStream functionality correctly.The properties
speakstreamandasyncspeakstreamare implemented to return instances ofSpeakStreamClientandAsyncSpeakStreamClient. Ensure these are correctly integrated and tested.deepgram/clients/speak/v1/async_client_stream.py (5)
197-225: Good implementation of the_emitmethod.The method effectively manages asynchronous tasks and ensures they are awaited and cleared, which is crucial for preventing memory leaks and ensuring all tasks complete before proceeding.
421-473: Consider reducing logging verbosity in thesendmethod.Excessive logging, especially at spam levels, can impact performance. Consider reducing the verbosity to debug or info level.
- self._logger.spam("AsyncSpeakStreamClient.send ENTER") + self._logger.debug("AsyncSpeakStreamClient.send ENTER") - self._logger.spam("AsyncSpeakStreamClient.send LEAVE") + self._logger.debug("AsyncSpeakStreamClient.send LEAVE")
477-503: Good implementation of theflushmethod.The method correctly handles the state of the WebSocket and ensures that operations are only attempted when the socket is initialized.
506-553: Well-implementedfinishmethod.The method effectively manages task cancellation and handles exceptions appropriately, ensuring a graceful shutdown of the WebSocket connection.
554-596: Effective management of WebSocket closure in_signal_exit.The method correctly signals the exit event and manages the WebSocket closure, including handling various exceptions that might occur during the process.
deepgram/clients/live/v1/async_client.py (2)
242-248: Enhance event emission with concurrent task handling.Creating tasks for each event handler and using
asyncio.gatherto wait for all tasks to complete allows for efficient concurrent processing. Ensure that exceptions in tasks are logged or handled appropriately to avoid silent failures.
386-386: Improve graceful exit handling for WebSocket closures.Handling specific WebSocket close codes (1000, 1001) gracefully is a good practice. Consider reviewing if other close codes should also be handled similarly based on the application's requirements.
|
It looks like the blackformatter doesnt error the unit tests out. Will fix in this in a subsequent PR. |
davidvonthenen
left a comment
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.
This looks great to me!
Proposed changes
Summary by CodeRabbit
New Features
SpeakStreamClientandAsyncSpeakStreamClientclasses.Bug Fixes
AsyncLiveClient.Documentation
Refactor