1# Copyright 2023-2024 Deepgram SDK contributors. All Rights Reserved.
2# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
3# SPDX-License-Identifier: MIT
4
5# common
6from .common import (
7 TextSource,
8 BufferSource,
9 StreamSource,
10 FileSource,
11 UrlSource,
12)
13from .common import BaseResponse
14
15# common (shared between analze and prerecorded)
16from .common import (
17 Average,
18 Intent,
19 Intents,
20 IntentsInfo,
21 Segment,
22 SentimentInfo,
23 Sentiment,
24 Sentiments,
25 SummaryInfo,
26 Topic,
27 Topics,
28 TopicsInfo,
29)
30
31# common (shared between listen rest and websocket)
32from .common import (
33 ModelInfo,
34 Hit,
35 Search,
36)
37from .common import (
38 OpenResponse,
39 CloseResponse,
40 UnhandledResponse,
41 ErrorResponse,
42)
43from .common import (
44 DeepgramError,
45 DeepgramTypeError,
46 DeepgramApiError,
47 DeepgramUnknownApiError,
48)
49from .errors import DeepgramModuleError
50
51from .listen_router import ListenRouter
52from .read_router import ReadRouter
53from .speak_router import SpeakRouter
54from .agent_router import AgentRouter
55
56# listen
57from .listen import LiveTranscriptionEvents
58
59## backward compat
60from .prerecorded import (
61 PreRecordedClient,
62 AsyncPreRecordedClient,
63)
64from .live import (
65 LiveClient,
66 AsyncLiveClient,
67)
68
69# speech-to-text rest
70from .listen import ListenRESTClient, AsyncListenRESTClient
71
72## input
73from .listen import (
74 # common
75 # UrlSource,
76 # BufferSource,
77 # StreamSource,
78 # TextSource,
79 # FileSource,
80 # unique
81 PreRecordedStreamSource,
82 PrerecordedSource,
83 ListenRestSource,
84)
85
86from .listen import (
87 ListenRESTOptions,
88 PrerecordedOptions,
89)
90
91## output
92from .listen import (
93 #### top level
94 AsyncPrerecordedResponse,
95 PrerecordedResponse,
96 SyncPrerecordedResponse,
97 #### shared
98 # Average,
99 # Intent,
100 # Intents,
101 # IntentsInfo,
102 # Segment,
103 # SentimentInfo,
104 # Sentiment,
105 # Sentiments,
106 # SummaryInfo,
107 # Topic,
108 # Topics,
109 # TopicsInfo,
110 #### between rest and websocket
111 # ModelInfo,
112 # Alternative,
113 # Hit,
114 # Search,
115 # Channel,
116 # Word,
117 # unique
118 Entity,
119 ListenRESTMetadata,
120 Paragraph,
121 Paragraphs,
122 ListenRESTResults,
123 Sentence,
124 Summaries,
125 SummaryV1,
126 SummaryV2,
127 Translation,
128 Utterance,
129 Warning,
130 ListenRESTAlternative,
131 ListenRESTChannel,
132 ListenRESTWord,
133)
134
135
136# speech-to-text websocket
137from .listen import ListenWebSocketClient, AsyncListenWebSocketClient
138
139## input
140from .listen import (
141 ListenWebSocketOptions,
142 LiveOptions,
143)
144
145## output
146from .listen import (
147 #### top level
148 LiveResultResponse,
149 ListenWSMetadataResponse,
150 SpeechStartedResponse,
151 UtteranceEndResponse,
152 #### common websocket response
153 # OpenResponse,
154 # CloseResponse,
155 # ErrorResponse,
156 # UnhandledResponse,
157 #### uniqye
158 ListenWSMetadata,
159 ListenWSWord,
160 ListenWSAlternative,
161 ListenWSChannel,
162)
163
164## clients
165from .listen import (
166 ListenWebSocketClient,
167 AsyncListenWebSocketClient,
168)
169
170
171# read/analyze
172from .analyze import ReadClient, AsyncReadClient
173from .analyze import AnalyzeClient, AsyncAnalyzeClient
174from .analyze import AnalyzeOptions
175from .analyze import (
176 # common
177 # UrlSource,
178 # TextSource,
179 # BufferSource,
180 # StreamSource,
181 # FileSource
182 # unique
183 AnalyzeStreamSource,
184 AnalyzeSource,
185)
186from .analyze import (
187 #### top level
188 AsyncAnalyzeResponse,
189 SyncAnalyzeResponse,
190 AnalyzeResponse,
191 #### shared between analyze and pre-recorded
192 # Average,
193 # Intent,
194 # Intents,
195 # IntentsInfo,
196 # Segment,
197 # SentimentInfo,
198 # Sentiment,
199 # Sentiments,
200 # SummaryInfo,
201 # Topic,
202 # Topics,
203 # TopicsInfo,
204 #### unique
205 AnalyzeMetadata,
206 AnalyzeResults,
207 AnalyzeSummary,
208)
209
210# text-to-speech
211## text-to-speech REST
212from .speak import (
213 #### top level
214 SpeakRESTOptions,
215 SpeakOptions,
216 # common
217 # TextSource,
218 # BufferSource,
219 # StreamSource,
220 # FileSource,
221 # unique
222 SpeakSource,
223 SpeakRestSource,
224 SpeakRESTSource,
225)
226
227from .speak import (
228 SpeakClient, # backward compat
229 SpeakRESTClient,
230 AsyncSpeakRESTClient,
231)
232
233from .speak import (
234 SpeakResponse, # backward compat
235 SpeakRESTResponse,
236)
237
238## text-to-speech WebSocket
239from .speak import SpeakWebSocketEvents, SpeakWebSocketMessage
240
241from .speak import (
242 SpeakWSOptions,
243)
244
245from .speak import (
246 SpeakWebSocketClient,
247 AsyncSpeakWebSocketClient,
248 SpeakWSClient,
249 AsyncSpeakWSClient,
250)
251
252from .speak import (
253 #### top level
254 SpeakWSMetadataResponse,
255 FlushedResponse,
256 ClearedResponse,
257 WarningResponse,
258 #### common websocket response
259 # OpenResponse,
260 # CloseResponse,
261 # UnhandledResponse,
262 # ErrorResponse,
263)
264
265# manage
266from .manage import ManageClient, AsyncManageClient
267from .manage import (
268 ProjectOptions,
269 KeyOptions,
270 ScopeOptions,
271 InviteOptions,
272 UsageRequestOptions,
273 UsageSummaryOptions,
274 UsageFieldsOptions,
275)
276from .manage import (
277 #### top level
278 Message,
279 ProjectsResponse,
280 ModelResponse,
281 ModelsResponse,
282 MembersResponse,
283 KeyResponse,
284 KeysResponse,
285 ScopesResponse,
286 InvitesResponse,
287 UsageRequest,
288 UsageResponse,
289 UsageRequestsResponse,
290 UsageSummaryResponse,
291 UsageFieldsResponse,
292 BalancesResponse,
293 #### shared
294 Project,
295 STTDetails,
296 TTSMetadata,
297 TTSDetails,
298 Member,
299 Key,
300 Invite,
301 Config,
302 STTUsageDetails,
303 Callback,
304 TokenDetail,
305 SpeechSegment,
306 TTSUsageDetails,
307 STTTokens,
308 TTSTokens,
309 UsageSummaryResults,
310 Resolution,
311 UsageModel,
312 Balance,
313)
314
315# auth
316from .auth import AuthRESTClient, AsyncAuthRESTClient
317from .auth import (
318 GrantTokenResponse,
319)
320
321# selfhosted
322from .selfhosted import (
323 OnPremClient,
324 AsyncOnPremClient,
325 SelfHostedClient,
326 AsyncSelfHostedClient,
327)
328
329# agent
330from .agent import AgentWebSocketEvents
331
332# websocket
333from .agent import (
334 AgentWebSocketClient,
335 AsyncAgentWebSocketClient,
336)
337
338from .agent import (
339 #### common websocket response
340 # OpenResponse,
341 # CloseResponse,
342 # ErrorResponse,
343 # UnhandledResponse,
344 #### unique
345 WelcomeResponse,
346 SettingsAppliedResponse,
347 ConversationTextResponse,
348 UserStartedSpeakingResponse,
349 AgentThinkingResponse,
350 FunctionCalling,
351 FunctionCallRequest,
352 AgentStartedSpeakingResponse,
353 AgentAudioDoneResponse,
354 InjectionRefusedResponse,
355)
356
357from .agent import (
358 # top level
359 SettingsConfigurationOptions,
360 UpdateInstructionsOptions,
361 UpdateSpeakOptions,
362 InjectAgentMessageOptions,
363 FunctionCallResponse,
364 AgentKeepAlive,
365 # sub level
366 Listen,
367 Speak,
368 Header,
369 Item,
370 Properties,
371 Parameters,
372 Function,
373 Provider,
374 Think,
375 Agent,
376 Input,
377 Output,
378 Audio,
379 Context,
380)