66import sys
77from datetime import datetime
88from typing import Optional , List , Union , Any , Dict
9+
910if sys .version_info >= (3 , 8 ):
1011 from typing import TypedDict , Literal
1112else :
@@ -40,10 +41,13 @@ class BufferSource(TypedDict):
4041TranscriptionSource = Union [UrlSource , BufferSource ]
4142
4243
43- BoostedKeyword = TypedDict ('BoostedKeyword' , {
44- 'word' : str ,
45- 'boost' : float ,
46- })
44+ BoostedKeyword = TypedDict (
45+ "BoostedKeyword" ,
46+ {
47+ "word" : str ,
48+ "boost" : float ,
49+ },
50+ )
4751Keyword = Union [str , BoostedKeyword ]
4852
4953
@@ -57,7 +61,7 @@ class TranscriptionOptions(TypedDict, total=False):
5761 punctuate : bool
5862 profanity_filter : bool
5963 redact : List [str ]
60- diarize : Literal [' false' , ' true' ]
64+ diarize : Literal [" false" , " true" ]
6165 diarize_version : str
6266 version : str
6367 multichannel : bool
@@ -89,7 +93,7 @@ class PrerecordedOptions(TranscriptionOptions, total=False):
8993 utterances : bool
9094 utt_split : float
9195 detect_entities : bool
92- summarize : Union [bool , str ]
96+ summarize : Union [bool , str ]
9397 paragraphs : bool
9498 detect_language : bool
9599 detect_topics : bool
@@ -110,9 +114,11 @@ class LiveOptions(TranscriptionOptions, total=False):
110114 channels : int
111115 sample_rate : int
112116
117+
113118class ToggleConfigOptions (TypedDict ):
114119 numerals : bool
115120
121+
116122class WordBase (TypedDict ):
117123 word : str
118124 start : float
@@ -208,8 +214,21 @@ class Utterance(TypedDict):
208214 id : str
209215
210216
217+ class Warning (TypedDict ):
218+ parameter : str
219+ type : Literal [
220+ "unsupported_language" ,
221+ "unsupported_model" ,
222+ "unsupported_encoding" ,
223+ "deprecated" ,
224+ ]
225+ message : str
226+
227+
211228class SummaryV2 (TypedDict ):
212229 short : str
230+ result : Literal ["success" , "failure" ]
231+
213232
214233class Metadata (TypedDict ):
215234 request_id : str
@@ -220,13 +239,17 @@ class Metadata(TypedDict):
220239 channels : int
221240 models : List [str ]
222241 model_info : Dict [str , Any ]
242+ warnings : List [Warning ]
223243
224244
225- TranscriptionResults = TypedDict ('TranscriptionResults' , {
226- 'channels' : List [Channel ],
227- 'utterances' : Optional [List [Utterance ]],
228- 'summary' : Optional [SummaryV2 ],
229- })
245+ TranscriptionResults = TypedDict (
246+ "TranscriptionResults" ,
247+ {
248+ "channels" : List [Channel ],
249+ "utterances" : Optional [List [Utterance ]],
250+ "summary" : Optional [SummaryV2 ],
251+ },
252+ )
230253
231254
232255class PrerecordedTranscriptionResponse (TypedDict , total = False ):
@@ -235,10 +258,13 @@ class PrerecordedTranscriptionResponse(TypedDict, total=False):
235258 results : TranscriptionResults
236259
237260
238- StreamingMetadata = TypedDict ('StreamingMetadata' , {
239- 'request_id' : str ,
240- 'model_uuid' : str ,
241- })
261+ StreamingMetadata = TypedDict (
262+ "StreamingMetadata" ,
263+ {
264+ "request_id" : str ,
265+ "model_uuid" : str ,
266+ },
267+ )
242268
243269
244270class LiveTranscriptionResponse (TypedDict ):
@@ -264,6 +290,7 @@ class Key(TypedDict):
264290 created : datetime
265291 scopes : List [str ]
266292
293+
267294# Members
268295
269296
@@ -304,7 +331,7 @@ class UsageRequestListOptions(TypedDict):
304331 end : Optional [str ]
305332 page : Optional [int ]
306333 limit : Optional [int ]
307- status : Literal [' succeeded' , ' failed' ]
334+ status : Literal [" succeeded" , " failed" ]
308335
309336
310337class UsageRequestDetails (TypedDict ):
@@ -314,7 +341,7 @@ class UsageRequestDetails(TypedDict):
314341 channels : int
315342 streams : int
316343 model : str
317- method : Literal [' sync' , ' async' , ' streaming' ]
344+ method : Literal [" sync" , " async" , " streaming" ]
318345 tags : List [str ]
319346 features : List [str ]
320347 config : Dict [str , bool ] # TODO: add all possible request options
@@ -353,7 +380,7 @@ class UsageOptions(TypedDict, total=False):
353380 end : str
354381 accessor : str
355382 tag : List [str ]
356- method : Literal [' sync' , ' async' , ' streaming' ]
383+ method : Literal [" sync" , " async" , " streaming" ]
357384 model : str
358385 multichannel : bool
359386 interim_results : bool
@@ -370,7 +397,7 @@ class UsageOptions(TypedDict, total=False):
370397 alternatives : bool
371398 numerals : bool
372399 detect_entities : bool
373- summarize : Union [bool , str ]
400+ summarize : Union [bool , str ]
374401 paragraphs : bool
375402 detect_language : bool
376403 detect_topics : bool
@@ -386,10 +413,9 @@ class UsageResponseDetail(TypedDict):
386413 requests : int
387414
388415
389- UsageResponseResolution = TypedDict ("UsageResponseResolution" , {
390- 'units' : str ,
391- 'amount' : int
392- })
416+ UsageResponseResolution = TypedDict (
417+ "UsageResponseResolution" , {"units" : str , "amount" : int }
418+ )
393419
394420
395421class UsageResponse (TypedDict ):
@@ -411,6 +437,7 @@ class UsageField(TypedDict):
411437 languages : List [str ]
412438 features : List [str ]
413439
440+
414441# Billing
415442
416443
@@ -427,12 +454,14 @@ class BalanceResponse(TypedDict):
427454
428455# Scope
429456
457+
430458class Scope (TypedDict ):
431459 scopes : List [str ]
432460
433461
434462# Invitation
435463
464+
436465class Invitation (TypedDict ):
437466 email : str
438467 scope : str
0 commit comments