assemblyai 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +15 -3
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.esm.js +119 -102
  4. package/dist/index.js +120 -103
  5. package/dist/services/base.d.ts +6 -4
  6. package/dist/services/files/index.d.ts +2 -2
  7. package/dist/services/index.d.ts +1 -1
  8. package/dist/services/lemur/index.d.ts +2 -2
  9. package/dist/services/realtime/factory.d.ts +5 -6
  10. package/dist/services/realtime/index.d.ts +2 -2
  11. package/dist/services/realtime/service.d.ts +2 -3
  12. package/dist/services/transcripts/index.d.ts +7 -7
  13. package/dist/types/asyncapi.generated.d.ts +20 -17
  14. package/dist/types/files/index.d.ts +1 -2
  15. package/dist/types/index.d.ts +6 -6
  16. package/dist/types/openapi.generated.d.ts +134 -108
  17. package/dist/types/services/index.d.ts +1 -1
  18. package/dist/types/transcripts/index.d.ts +16 -2
  19. package/package.json +2 -2
  20. package/src/index.ts +1 -1
  21. package/src/services/base.ts +44 -3
  22. package/src/services/files/index.ts +10 -12
  23. package/src/services/index.ts +10 -8
  24. package/src/services/lemur/index.ts +28 -27
  25. package/src/services/realtime/factory.ts +17 -12
  26. package/src/services/realtime/index.ts +2 -2
  27. package/src/services/realtime/service.ts +5 -6
  28. package/src/services/transcripts/index.ts +57 -55
  29. package/src/types/asyncapi.generated.ts +20 -17
  30. package/src/types/files/index.ts +2 -1
  31. package/src/types/index.ts +6 -6
  32. package/src/types/openapi.generated.ts +136 -108
  33. package/src/types/services/index.ts +1 -1
  34. package/src/types/transcripts/index.ts +16 -2
  35. package/dist/utils/axios.d.ts +0 -3
  36. package/src/utils/axios.ts +0 -19
@@ -14,7 +14,7 @@ type OneOf<T extends any[]> = T extends [infer Only]
14
14
  : never;
15
15
 
16
16
  /**
17
- * @description Will be either success, or unavailable in the rare case that the model failed.
17
+ * @description Either success, or unavailable in the rare case that the model failed
18
18
  * @enum {string}
19
19
  */
20
20
  export type AudioIntelligenceModelStatus = "success" | "unavailable";
@@ -34,13 +34,13 @@ export type AutoHighlightResult = {
34
34
  };
35
35
 
36
36
  /**
37
- * @description An array of results for the Key Phrases model, if it was enabled during the transcription request.
37
+ * @description An array of results for the Key Phrases model, if it is enabled.
38
38
  * See [Key phrases](https://www.assemblyai.com/docs/Models/key_phrases) for more information.
39
39
  */
40
40
  export type AutoHighlightsResult = {
41
41
  /** @description A temporally-sequential array of Key Phrases */
42
42
  results: AutoHighlightResult[];
43
- } | null;
43
+ };
44
44
 
45
45
  /** @description Chapter of the audio file */
46
46
  export type Chapter = {
@@ -72,28 +72,38 @@ export type ContentSafetyLabel = {
72
72
  };
73
73
 
74
74
  export type ContentSafetyLabelResult = {
75
- /** @description An array of objects, one per sensitive topic that was detected in the section */
75
+ /** @description An array of safety labels, one per sensitive topic that was detected in the section */
76
76
  labels: ContentSafetyLabel[];
77
77
  /** @description The sentence index at which the section ends */
78
78
  sentences_idx_end: number;
79
79
  /** @description The sentence index at which the section begins */
80
80
  sentences_idx_start: number;
81
+ /** @description The transcript of the section flagged by the Content Moderation model */
82
+ text: string;
83
+ /** @description Timestamp information for the section */
84
+ timestamp: Timestamp;
85
+ };
86
+
87
+ /**
88
+ * @description An array of results for the Content Moderation model, if it is enabled.
89
+ * See [Content moderation](https://www.assemblyai.com/docs/Models/content_moderation) for more information.
90
+ */
91
+ export type ContentSafetyLabelsResult = {
92
+ results: ContentSafetyLabelResult[];
81
93
  /** @description A summary of the Content Moderation severity results for the entire audio file */
82
94
  severity_score_summary: {
83
95
  [key: string]: SeverityScoreSummary;
84
96
  };
97
+ /** @description The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed. */
98
+ status: AudioIntelligenceModelStatus;
85
99
  /** @description A summary of the Content Moderation confidence results for the entire audio file */
86
100
  summary: {
87
101
  [key: string]: number;
88
102
  };
89
- /** @description The transcript of the section flagged by the Content Moderation model */
90
- text: string;
91
- /** @description Timestamp information for the section */
92
- timestamp: Timestamp;
93
103
  };
94
104
 
95
105
  export type CreateRealtimeTemporaryTokenParameters = {
96
- /** @description The amount of time until the token expires in seconds. */
106
+ /** @description The amount of time until the token expires in seconds */
97
107
  expires_in: number;
98
108
  };
99
109
 
@@ -101,29 +111,29 @@ export type CreateRealtimeTemporaryTokenParameters = {
101
111
  export type CreateTranscriptOptionalParameters = {
102
112
  /** @description The point in time, in milliseconds, to stop transcribing in your media file */
103
113
  audio_end_at?: number;
104
- /** @description The point in time, in milliseconds, to begin transcription from in your media file */
114
+ /** @description The point in time, in milliseconds, to begin transcribing in your media file */
105
115
  audio_start_from?: number;
106
116
  /** @description Enable [Auto Chapters](https://www.assemblyai.com/docs/Models/auto_chapters), can be true or false */
107
117
  auto_chapters?: boolean;
108
- /** @description Whether Key Phrases was enabled in the transcription request, either true or false */
118
+ /** @description Whether Key Phrases is enabled, either true or false */
109
119
  auto_highlights?: boolean;
110
- /** @description The word boost parameter value, if provided in the transcription request. */
120
+ /** @description The word boost parameter value */
111
121
  boost_param?: TranscriptBoostParam;
112
122
  /** @description Enable [Content Moderation](https://www.assemblyai.com/docs/Models/content_moderation), can be true or false */
113
123
  content_safety?: boolean;
114
124
  /** @description Customize how words are spelled and formatted using to and from values */
115
125
  custom_spelling?: TranscriptCustomSpelling[];
116
- /** @description Whether custom topics was enabled in the transcription request, either true or false */
126
+ /** @description Whether custom topics is enabled, either true or false */
117
127
  custom_topics?: boolean;
118
- /** @description Transcribe Filler Words, like "umm", in your media file; can be true or false. */
128
+ /** @description Transcribe Filler Words, like "umm", in your media file; can be true or false */
119
129
  disfluencies?: boolean;
120
- /** @description Enable [Dual Channel](https://assemblyai.com/docs/Models/speech_recognition#dual-channel-transcription) transcription, can be true or false. */
130
+ /** @description Enable [Dual Channel](https://assemblyai.com/docs/Models/speech_recognition#dual-channel-transcription) transcription, can be true or false */
121
131
  dual_channel?: boolean;
122
132
  /** @description Enable [Entity Detection](https://www.assemblyai.com/docs/Models/entity_detection), can be true or false */
123
133
  entity_detection?: boolean;
124
- /** @description Filter profanity from the transcribed text, can be true or false. */
134
+ /** @description Filter profanity from the transcribed text, can be true or false */
125
135
  filter_profanity?: boolean;
126
- /** @description Enable Text Formatting, can be true or false. */
136
+ /** @description Enable Text Formatting, can be true or false */
127
137
  format_text?: boolean;
128
138
  /** @description Enable [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification), can be true or false */
129
139
  iab_categories?: boolean;
@@ -131,10 +141,10 @@ export type CreateTranscriptOptionalParameters = {
131
141
  * @description The language of your audio file. Possible values are found in [Supported Languages](https://www.assemblyai.com/docs/Concepts/supported_languages).
132
142
  * The default value is 'en_us'.
133
143
  */
134
- language_code?: TranscriptLanguageCode;
135
- /** @description Whether [Automatic language detection](https://www.assemblyai.com/docs/Models/speech_recognition#automatic-language-detection) was enabled in the transcription request, either true or false. */
144
+ language_code?: TranscriptLanguageCode | null;
145
+ /** @description Whether [Automatic language detection](https://www.assemblyai.com/docs/Models/speech_recognition#automatic-language-detection) is enabled, either true or false */
136
146
  language_detection?: boolean;
137
- /** @description Enable Automatic Punctuation, can be true or false. */
147
+ /** @description Enable Automatic Punctuation, can be true or false */
138
148
  punctuate?: boolean;
139
149
  /** @description Redact PII from the transcribed text using the Redact PII model, can be true or false */
140
150
  redact_pii?: boolean;
@@ -148,13 +158,13 @@ export type CreateTranscriptOptionalParameters = {
148
158
  /** @description The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more details. */
149
159
  redact_pii_policies?: PiiPolicy[];
150
160
  /** @description The replacement logic for detected PII, can be "entity_type" or "hash". See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more details. */
151
- redact_pii_sub?: SubstitutionPolicy;
161
+ redact_pii_sub?: SubstitutionPolicy | null;
152
162
  /** @description Enable [Sentiment Analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis), can be true or false */
153
163
  sentiment_analysis?: boolean;
154
164
  /** @description Enable [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization), can be true or false */
155
165
  speaker_labels?: boolean;
156
166
  /**
157
- * @description Tells the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) for more details.
167
+ * @description Tell the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) for more details.
158
168
  * @default null
159
169
  */
160
170
  speakers_expected?: number | null;
@@ -178,21 +188,21 @@ export type CreateTranscriptOptionalParameters = {
178
188
  * @default bullets
179
189
  */
180
190
  summary_type?: SummaryType;
181
- /** @description The list of custom topics provided if custom topics was enabled in the transcription request */
191
+ /** @description The list of custom topics provided, if custom topics is enabled */
182
192
  topics?: string[];
183
193
  /**
184
- * @description The header name which should be sent back with webhook calls, if provided in the transcription request.
194
+ * @description The header name which should be sent back with webhook calls
185
195
  * @default null
186
196
  */
187
197
  webhook_auth_header_name?: string | null;
188
198
  /**
189
- * @description Defaults to null. Optionally allows a user to specify a header name and value to send back with a webhook call for added security.
199
+ * @description Specify a header name and value to send back with a webhook call for added security
190
200
  * @default null
191
201
  */
192
202
  webhook_auth_header_value?: string | null;
193
- /** @description The URL to which we send webhooks upon trancription completion, if provided in the transcription request. */
203
+ /** @description The URL to which AssemblyAI send webhooks upon trancription completion */
194
204
  webhook_url?: string;
195
- /** @description The list of custom vocabulary to boost transcription probability for, if provided in the transcription request. */
205
+ /** @description The list of custom vocabulary to boost transcription probability for */
196
206
  word_boost?: string[];
197
207
  };
198
208
 
@@ -259,7 +269,7 @@ export type Error = {
259
269
  export type LemurActionItemsParameters = LemurBaseParameters;
260
270
 
261
271
  export type LemurActionItemsResponse = LemurBaseResponse & {
262
- /** @description The response generated by LeMUR. */
272
+ /** @description The response generated by LeMUR */
263
273
  response: string;
264
274
  };
265
275
 
@@ -274,7 +284,12 @@ export type LemurBaseParameters = {
274
284
  ]
275
285
  >;
276
286
  final_model?: LemurModel;
277
- /** @description Max output size in tokens. Up to 4000 allowed. */
287
+ /**
288
+ * @description Custom formatted transcript data. Maximum size is the context limit of the selected model, which defaults to 100000.
289
+ * Use either transcript_ids or input_text as input into LeMUR.
290
+ */
291
+ input_text?: string;
292
+ /** @description Max output size in tokens, up to 4000 */
278
293
  max_output_size?: number;
279
294
  /**
280
295
  * Format: float
@@ -283,8 +298,11 @@ export type LemurBaseParameters = {
283
298
  * Can be any value between 0.0 and 1.0 inclusive.
284
299
  */
285
300
  temperature?: number;
286
- /** @description A list of completed transcripts with text. Up to 100 files max, or 100 hours max. Whichever is lower. */
287
- transcript_ids: string[];
301
+ /**
302
+ * @description A list of completed transcripts with text. Up to a maximum of 100 files or 100 hours, whichever is lower.
303
+ * Use either transcript_ids or input_text as input into LeMUR.
304
+ */
305
+ transcript_ids?: string[];
288
306
  };
289
307
 
290
308
  export type LemurBaseResponse = {
@@ -304,7 +322,7 @@ export type LemurQuestion = {
304
322
  answer_format?: string;
305
323
  /** @description What discrete options to return. Useful for precise responses. Can't be used with answer_format. Example: ["Yes", "No"] */
306
324
  answer_options?: string[];
307
- /** @description Any context about the transcripts you wish to provide. This can be a string, or free-form JSON. */
325
+ /** @description Any context about the transcripts you wish to provide. This can be a string or any object. */
308
326
  context?: OneOf<
309
327
  [
310
328
  string,
@@ -317,21 +335,21 @@ export type LemurQuestion = {
317
335
  question: string;
318
336
  };
319
337
 
320
- /** @description An answer generated by LeMUR and its question. */
338
+ /** @description An answer generated by LeMUR and its question */
321
339
  export type LemurQuestionAnswer = {
322
- /** @description The answer generated by LeMUR. */
340
+ /** @description The answer generated by LeMUR */
323
341
  answer: string;
324
- /** @description The question for LeMUR to answer. */
342
+ /** @description The question for LeMUR to answer */
325
343
  question: string;
326
344
  };
327
345
 
328
346
  export type LemurQuestionAnswerParameters = LemurBaseParameters & {
329
- /** @description A list of questions to ask. */
347
+ /** @description A list of questions to ask */
330
348
  questions: LemurQuestion[];
331
349
  };
332
350
 
333
351
  export type LemurQuestionAnswerResponse = LemurBaseResponse & {
334
- /** @description The answers generated by LeMUR and their questions. */
352
+ /** @description The answers generated by LeMUR and their questions */
335
353
  response: LemurQuestionAnswer[];
336
354
  };
337
355
 
@@ -341,7 +359,7 @@ export type LemurSummaryParameters = LemurBaseParameters & {
341
359
  };
342
360
 
343
361
  export type LemurSummaryResponse = LemurBaseResponse & {
344
- /** @description The response generated by LeMUR. */
362
+ /** @description The response generated by LeMUR */
345
363
  response: string;
346
364
  };
347
365
 
@@ -351,7 +369,7 @@ export type LemurTaskParameters = LemurBaseParameters & {
351
369
  };
352
370
 
353
371
  export type LemurTaskResponse = LemurBaseResponse & {
354
- /** @description The response generated by LeMUR. */
372
+ /** @description The response generated by LeMUR */
355
373
  response: string;
356
374
  };
357
375
 
@@ -402,11 +420,11 @@ export type PiiPolicy =
402
420
  | "banking_information";
403
421
 
404
422
  export type PurgeLemurRequestDataResponse = {
405
- /** @description Whether the request data was deleted. */
423
+ /** @description Whether the request data was deleted */
406
424
  deleted: boolean;
407
- /** @description The ID of the LeMUR request */
408
- request_id: string;
409
425
  /** @description The ID of the deletion request of the LeMUR request */
426
+ request_id: string;
427
+ /** @description The ID of the LeMUR request to purge the data for */
410
428
  request_id_to_purge: string;
411
429
  };
412
430
 
@@ -439,7 +457,7 @@ export type SentencesResponse = {
439
457
  /** @enum {unknown} */
440
458
  export type Sentiment = "POSITIVE" | "NEUTRAL" | "NEGATIVE";
441
459
 
442
- /** @description The result of the sentiment analysis model. */
460
+ /** @description The result of the sentiment analysis model */
443
461
  export type SentimentAnalysisResult = {
444
462
  /**
445
463
  * Format: double
@@ -450,7 +468,7 @@ export type SentimentAnalysisResult = {
450
468
  end: number;
451
469
  /** @description The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE */
452
470
  sentiment: Sentiment;
453
- /** @description The speaker of the sentence if Speaker Diarization is enabled, else null */
471
+ /** @description The speaker of the sentence if [Speaker Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, else null */
454
472
  speaker?: string | null;
455
473
  /** @description The starting time, in milliseconds, of the sentence */
456
474
  start: number;
@@ -469,7 +487,7 @@ export type SeverityScoreSummary = {
469
487
 
470
488
  /**
471
489
  * @description The replacement logic for detected PII, can be "entity_type" or "hash". See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more details.
472
- * @enum {string|null}
490
+ * @enum {string}
473
491
  */
474
492
  export type SubstitutionPolicy = "entity_type" | "hash";
475
493
 
@@ -498,7 +516,7 @@ export type SummaryType =
498
516
  | "headline"
499
517
  | "paragraph";
500
518
 
501
- /** @description Timestamp containing a start and end property in milliseconds. */
519
+ /** @description Timestamp containing a start and end property in milliseconds */
502
520
  export type Timestamp = {
503
521
  /** @description The end time in milliseconds */
504
522
  end: number;
@@ -506,7 +524,22 @@ export type Timestamp = {
506
524
  start: number;
507
525
  };
508
526
 
509
- /** @description THe result of the topic detection model. */
527
+ /**
528
+ * @description The result of the Topic Detection model, if it is enabled.
529
+ * See [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification) for more information.
530
+ */
531
+ export type TopicDetectionModelResult = {
532
+ /** @description An array of results for the Topic Detection model */
533
+ results: TopicDetectionResult[];
534
+ /** @description The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed. */
535
+ status: AudioIntelligenceModelStatus;
536
+ /** @description The overall relevance of topic to the entire audio file */
537
+ summary: {
538
+ [key: string]: number;
539
+ };
540
+ };
541
+
542
+ /** @description The result of the topic detection model */
510
543
  export type TopicDetectionResult = {
511
544
  labels?: {
512
545
  /** @description The IAB taxonomical label for the label of the detected topic, where > denotes supertopic/subtopic relationship */
@@ -526,7 +559,7 @@ export type TopicDetectionResult = {
526
559
  export type Transcript = {
527
560
  /**
528
561
  * @deprecated
529
- * @description The acoustic model that was used for the transcription
562
+ * @description The acoustic model that was used for the transcript
530
563
  */
531
564
  acoustic_model: string;
532
565
  /**
@@ -534,22 +567,22 @@ export type Transcript = {
534
567
  * @description The duration of this transcript object's media file, in seconds
535
568
  */
536
569
  audio_duration?: number | null;
537
- /** @description The point in time, in milliseconds, in the file at which the transcription was terminated, if provided in the transcription request */
570
+ /** @description The point in time, in milliseconds, in the file at which the transcription was terminated */
538
571
  audio_end_at?: number | null;
539
- /** @description The point in time, in milliseconds, in the file at which the transcription was started, if provided in the transcription request */
572
+ /** @description The point in time, in milliseconds, in the file at which the transcription was started */
540
573
  audio_start_from?: number | null;
541
574
  /** @description The URL of the media that was transcribed */
542
575
  audio_url: string;
543
- /** @description Enable [Auto Chapters](https://www.assemblyai.com/docs/Models/auto_chapters), can be true or false */
576
+ /** @description Whether [Auto Chapters](https://www.assemblyai.com/docs/Models/auto_chapters) is enabled, can be true or false */
544
577
  auto_chapters?: boolean | null;
545
- /** @description Whether Key Phrases was enabled in the transcription request, either true or false */
578
+ /** @description Whether Key Phrases is enabled, either true or false */
546
579
  auto_highlights: boolean;
547
580
  /**
548
- * @description An array of results for the Key Phrases model, if it was enabled during the transcription request.
581
+ * @description An array of results for the Key Phrases model, if it is enabled.
549
582
  * See [Key phrases](https://www.assemblyai.com/docs/Models/key_phrases) for more information.
550
583
  */
551
- auto_highlights_result?: AutoHighlightsResult;
552
- /** @description The word boost parameter value, if provided in the transcription request */
584
+ auto_highlights_result?: AutoHighlightsResult | null;
585
+ /** @description The word boost parameter value */
553
586
  boost_param?: string | null;
554
587
  /** @description An array of temporally sequential chapters for the audio file */
555
588
  chapters?: Chapter[] | null;
@@ -558,55 +591,42 @@ export type Transcript = {
558
591
  * @description The confidence score for the transcript, between 0.0 (low confidence) and 1.0 (high confidence)
559
592
  */
560
593
  confidence?: number | null;
561
- /** @description Enable [Content Moderation](https://www.assemblyai.com/docs/Models/content_moderation), can be true or false */
594
+ /** @description Whether [Content Moderation](https://www.assemblyai.com/docs/Models/content_moderation) is enabled, can be true or false */
562
595
  content_safety?: boolean | null;
563
596
  /**
564
- * @description An array of results for the Content Moderation model, if it was enabled during the transcription request.
597
+ * @description An array of results for the Content Moderation model, if it is enabled.
565
598
  * See [Content moderation](https://www.assemblyai.com/docs/Models/content_moderation) for more information.
566
599
  */
567
- content_safety_labels?: {
568
- results: ContentSafetyLabelResult[];
569
- /** @description Will be either success, or unavailable in the rare case that the Content Safety Labels model failed. */
570
- status: AudioIntelligenceModelStatus;
571
- } | null;
600
+ content_safety_labels?: ContentSafetyLabelsResult | null;
572
601
  /** @description Customize how words are spelled and formatted using to and from values */
573
602
  custom_spelling?: TranscriptCustomSpelling[] | null;
574
- /** @description Whether custom topics was enabled in the transcription request, either true or false */
603
+ /** @description Whether custom topics is enabled, either true or false */
575
604
  custom_topics?: boolean | null;
576
605
  /** @description Transcribe Filler Words, like "umm", in your media file; can be true or false */
577
606
  disfluencies?: boolean | null;
578
- /** @description Whether [Dual channel transcription](https://www.assemblyai.com/docs/Models/speech_recognition#dual-channel-transcription) was enabled in the transcription request, either true or false */
607
+ /** @description Whether [Dual channel transcription](https://www.assemblyai.com/docs/Models/speech_recognition#dual-channel-transcription) is enabled, either true or false */
579
608
  dual_channel?: boolean | null;
580
609
  /**
581
- * @description An array of results for the Entity Detection model, if it was enabled during the transcription request.
610
+ * @description An array of results for the Entity Detection model, if it is enabled.
582
611
  * See [Entity detection](https://www.assemblyai.com/docs/Models/entity_detection) for more information.
583
612
  */
584
613
  entities?: Entity[] | null;
585
- /** @description Enable [Entity Detection](https://www.assemblyai.com/docs/Models/entity_detection), can be true or false */
614
+ /** @description Whether [Entity Detection](https://www.assemblyai.com/docs/Models/entity_detection) is enabled, can be true or false */
586
615
  entity_detection?: boolean | null;
587
616
  /** @description Error message of why the transcript failed */
588
617
  error?: string;
589
- /** @description Whether [Profanity Filtering](https://www.assemblyai.com/docs/Models/speech_recognition#profanity-filtering) was enabled in the transcription request, either true or false */
618
+ /** @description Whether [Profanity Filtering](https://www.assemblyai.com/docs/Models/speech_recognition#profanity-filtering) is enabled, either true or false */
590
619
  filter_profanity?: boolean | null;
591
- /** @description Whether Text Formatting was enabled in the transcription request, either true or false */
620
+ /** @description Whether Text Formatting is enabled, either true or false */
592
621
  format_text?: boolean | null;
593
- /** @description Enable [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification), can be true or false */
622
+ /** @description Whether [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification) is enabled, can be true or false */
594
623
  iab_categories?: boolean | null;
595
624
  /**
596
- * @description An array of results for the Topic Detection model, if it was enabled during the transcription request.
625
+ * @description The result of the Topic Detection model, if it is enabled.
597
626
  * See [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification) for more information.
598
627
  */
599
- iab_categories_result?: {
600
- /** @description An array of results for the Topic Detection model. */
601
- results: TopicDetectionResult[];
602
- /** @description Will be either success, or unavailable in the rare case that the Content Moderation model failed. */
603
- status: AudioIntelligenceModelStatus;
604
- /** @description The overall relevance of topic to the entire audio file */
605
- summary: {
606
- [key: string]: number;
607
- };
608
- } | null;
609
- /** @description The unique identifier of your transcription */
628
+ iab_categories_result?: TopicDetectionModelResult | null;
629
+ /** @description The unique identifier of your transcript */
610
630
  id: string;
611
631
  /**
612
632
  * @description The language of your audio file.
@@ -614,24 +634,24 @@ export type Transcript = {
614
634
  * The default value is 'en_us'.
615
635
  */
616
636
  language_code?: TranscriptLanguageCode;
617
- /** @description Whether [Automatic language detection](https://www.assemblyai.com/docs/Models/speech_recognition#automatic-language-detection) was enabled in the transcription request, either true or false */
637
+ /** @description Whether [Automatic language detection](https://www.assemblyai.com/docs/Models/speech_recognition#automatic-language-detection) is enabled, either true or false */
618
638
  language_detection?: boolean | null;
619
639
  /**
620
640
  * @deprecated
621
- * @description The language model that was used for the transcription
641
+ * @description The language model that was used for the transcript
622
642
  */
623
643
  language_model: string;
624
- /** @description Whether Automatic Punctuation was enabled in the transcription request, either true or false. */
644
+ /** @description Whether Automatic Punctuation is enabled, either true or false */
625
645
  punctuate?: boolean | null;
626
- /** @description Whether [PII Redaction](https://www.assemblyai.com/docs/Models/pii_redaction) was enabled in the transcription request, either true or false */
646
+ /** @description Whether [PII Redaction](https://www.assemblyai.com/docs/Models/pii_redaction) is enabled, either true or false */
627
647
  redact_pii: boolean;
628
648
  /**
629
- * @description Whether a redacted version of the audio file was generated (enabled or disabled in the transcription request),
649
+ * @description Whether a redacted version of the audio file was generated,
630
650
  * either true or false. See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more information.
631
651
  */
632
652
  redact_pii_audio?: boolean | null;
633
653
  /**
634
- * @description The audio quality of the PII-redacted audio file, if enabled in the transcription request.
654
+ * @description The audio quality of the PII-redacted audio file, if redact_pii_audio is enabled.
635
655
  * See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more information.
636
656
  */
637
657
  redact_pii_audio_quality?: string | null;
@@ -642,16 +662,16 @@ export type Transcript = {
642
662
  redact_pii_policies?: PiiPolicy[] | null;
643
663
  /** @description The replacement logic for detected PII, can be "entity_type" or "hash". See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more details. */
644
664
  redact_pii_sub?: SubstitutionPolicy;
645
- /** @description Enable [Sentiment Analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis), can be true or false */
665
+ /** @description Whether [Sentiment Analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis) is enabled, can be true or false */
646
666
  sentiment_analysis?: boolean | null;
647
667
  /**
648
- * @description An array of results for the Sentiment Analysis model, if it was enabled during the transcription request.
668
+ * @description An array of results for the Sentiment Analysis model, if it is enabled.
649
669
  * See [Sentiment analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis) for more information.
650
670
  */
651
671
  sentiment_analysis_results?: SentimentAnalysisResult[] | null;
652
- /** @description Enable [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization), can be true or false */
672
+ /** @description Whether [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) is enabled, can be true or false */
653
673
  speaker_labels?: boolean | null;
654
- /** @description Defaults to null. Tells the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) for more details. */
674
+ /** @description Tell the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) for more details. */
655
675
  speakers_expected?: number | null;
656
676
  /**
657
677
  * Format: float
@@ -661,42 +681,42 @@ export type Transcript = {
661
681
  speech_threshold?: number | null;
662
682
  /**
663
683
  * @deprecated
664
- * @description Whether speed boost was enabled in the transcription request
684
+ * @description Whether speed boost is enabled
665
685
  */
666
686
  speed_boost?: boolean | null;
667
- /** @description The status of your transcription. Possible values are queued, processing, completed, or error. */
687
+ /** @description The status of your transcript. Possible values are queued, processing, completed, or error. */
668
688
  status: TranscriptStatus;
669
- /** @description Whether [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request, either true or false */
689
+ /** @description Whether [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled, either true or false */
670
690
  summarization: boolean;
671
- /** @description The generated summary of the media file, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request */
691
+ /** @description The generated summary of the media file, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled */
672
692
  summary?: string | null;
673
693
  /**
674
694
  * @description The Summarization model used to generate the summary,
675
- * if [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request
695
+ * if [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled
676
696
  */
677
697
  summary_model?: string | null;
678
- /** @description The type of summary generated, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request */
698
+ /** @description The type of summary generated, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled */
679
699
  summary_type?: string | null;
680
700
  /** @description The textual transcript of your media file */
681
701
  text?: string | null;
682
702
  /** @description True while a request is throttled and false when a request is no longer throttled */
683
703
  throttled?: boolean | null;
684
- /** @description The list of custom topics provided if custom topics was enabled in the transcription request */
704
+ /** @description The list of custom topics provided if custom topics is enabled */
685
705
  topics?: string[];
686
706
  /**
687
707
  * @description When dual_channel or speaker_labels is enabled, a list of turn-by-turn utterance objects.
688
708
  * See [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) for more information.
689
709
  */
690
710
  utterances?: TranscriptUtterance[] | null;
691
- /** @description Whether webhook authentication details were provided in the transcription request */
711
+ /** @description Whether webhook authentication details were provided */
692
712
  webhook_auth: boolean;
693
- /** @description The header name which should be sent back with webhook calls, if provided in the transcription request */
713
+ /** @description The header name which should be sent back with webhook calls */
694
714
  webhook_auth_header_name?: string | null;
695
- /** @description The status code we received from your server when delivering your webhook, if a webhook URL was provided in the transcription request */
715
+ /** @description The status code we received from your server when delivering your webhook, if a webhook URL was provided */
696
716
  webhook_status_code?: number | null;
697
- /** @description The URL to which we send webhooks upon trancription completion, if provided in the transcription request */
717
+ /** @description The URL to which we send webhooks upon trancription completion */
698
718
  webhook_url?: string | null;
699
- /** @description The list of custom vocabulary to boost transcription probability for, if provided in the transcription request */
719
+ /** @description The list of custom vocabulary to boost transcription probability for */
700
720
  word_boost?: string[];
701
721
  /**
702
722
  * @description An array of temporally-sequential word objects, one for each word in the transcript.
@@ -706,7 +726,7 @@ export type Transcript = {
706
726
  };
707
727
 
708
728
  /**
709
- * @description The word boost parameter value, if provided in the transcription request.
729
+ * @description The word boost parameter value
710
730
  * @enum {string}
711
731
  */
712
732
  export type TranscriptBoostParam = "low" | "default" | "high";
@@ -724,7 +744,7 @@ export type TranscriptCustomSpelling = {
724
744
  * The default value is 'en_us'.
725
745
  *
726
746
  * @default en_us
727
- * @enum {string|null}
747
+ * @enum {string}
728
748
  */
729
749
  export type TranscriptLanguageCode =
730
750
  | "en"
@@ -803,18 +823,26 @@ export type TranscriptSentence = {
803
823
  };
804
824
 
805
825
  /**
806
- * @description The status of your transcription. Possible values are queued, processing, completed, or error.
826
+ * @description The status of your transcript. Possible values are queued, processing, completed, or error.
807
827
  * @enum {string}
808
828
  */
809
829
  export type TranscriptStatus = "queued" | "processing" | "completed" | "error";
810
830
 
811
831
  export type TranscriptUtterance = {
812
- channel: string;
813
- /** Format: double */
832
+ /**
833
+ * Format: double
834
+ * @description The confidence score for the transcript of this utterance
835
+ */
814
836
  confidence: number;
837
+ /** @description The ending time, in milliseconds, of the utterance in the audio file */
815
838
  end: number;
839
+ /** @description The speaker of this utterance, where each speaker is assigned a sequential capital letter - e.g. "A" for Speaker A, "B" for Speaker B, etc. */
840
+ speaker: string;
841
+ /** @description The starting time, in milliseconds, of the utterance in the audio file */
816
842
  start: number;
843
+ /** @description The text for this utterance */
817
844
  text: string;
845
+ /** @description The words in the utterance. */
818
846
  words: TranscriptWord[];
819
847
  };
820
848
 
@@ -3,5 +3,5 @@ type BaseServiceParams = {
3
3
  baseUrl?: string;
4
4
  };
5
5
 
6
- export type * from "./abstractions";
6
+ export * from "./abstractions";
7
7
  export type { BaseServiceParams };
@@ -1,5 +1,19 @@
1
- export type CreateTranscriptOptions = {
2
- poll?: boolean;
1
+ export type PollingOptions = {
2
+ /**
3
+ * The amount of time to wait between polling requests.
4
+ * @default 3000 or every 3 seconds
5
+ */
3
6
  pollingInterval?: number;
7
+ /**
8
+ * The maximum amount of time to wait for the transcript to be ready.
9
+ * @default -1 which means wait forever
10
+ */
4
11
  pollingTimeout?: number;
5
12
  };
13
+ export type CreateTranscriptOptions = {
14
+ /**
15
+ * Whether to poll the transcript until it is ready.
16
+ * @default true
17
+ */
18
+ poll?: boolean;
19
+ } & PollingOptions;
@@ -1,3 +0,0 @@
1
- import { BaseServiceParams } from "@/types";
2
- export declare function createAxiosClient(params: BaseServiceParams): import("axios").AxiosInstance;
3
- export declare function throwApiError(error: unknown): Promise<never>;
@@ -1,19 +0,0 @@
1
- import axios, { isAxiosError } from "axios";
2
- import { BaseServiceParams } from "@/types";
3
-
4
- export function createAxiosClient(params: BaseServiceParams) {
5
- const client = axios.create({
6
- baseURL: params.baseUrl,
7
- headers: { Authorization: params.apiKey },
8
- });
9
-
10
- client.interceptors.response.use(undefined, throwApiError);
11
- return client;
12
- }
13
-
14
- export function throwApiError(error: unknown) {
15
- if (isAxiosError(error) && error.response?.data?.error) {
16
- return Promise.reject(new Error(error.response.data.error));
17
- }
18
- return Promise.reject(error);
19
- }