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
@@ -5,7 +5,7 @@ type Without<T, U> = {
5
5
  type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
6
6
  type OneOf<T extends any[]> = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? OneOf<[XOR<A, B>, ...Rest]> : never;
7
7
  /**
8
- * @description Will be either success, or unavailable in the rare case that the model failed.
8
+ * @description Either success, or unavailable in the rare case that the model failed
9
9
  * @enum {string}
10
10
  */
11
11
  export type AudioIntelligenceModelStatus = "success" | "unavailable";
@@ -23,13 +23,13 @@ export type AutoHighlightResult = {
23
23
  timestamps: Timestamp[];
24
24
  };
25
25
  /**
26
- * @description An array of results for the Key Phrases model, if it was enabled during the transcription request.
26
+ * @description An array of results for the Key Phrases model, if it is enabled.
27
27
  * See [Key phrases](https://www.assemblyai.com/docs/Models/key_phrases) for more information.
28
28
  */
29
29
  export type AutoHighlightsResult = {
30
30
  /** @description A temporally-sequential array of Key Phrases */
31
31
  results: AutoHighlightResult[];
32
- } | null;
32
+ };
33
33
  /** @description Chapter of the audio file */
34
34
  export type Chapter = {
35
35
  /** @description The starting time, in milliseconds, for the chapter */
@@ -58,56 +58,65 @@ export type ContentSafetyLabel = {
58
58
  severity: number;
59
59
  };
60
60
  export type ContentSafetyLabelResult = {
61
- /** @description An array of objects, one per sensitive topic that was detected in the section */
61
+ /** @description An array of safety labels, one per sensitive topic that was detected in the section */
62
62
  labels: ContentSafetyLabel[];
63
63
  /** @description The sentence index at which the section ends */
64
64
  sentences_idx_end: number;
65
65
  /** @description The sentence index at which the section begins */
66
66
  sentences_idx_start: number;
67
+ /** @description The transcript of the section flagged by the Content Moderation model */
68
+ text: string;
69
+ /** @description Timestamp information for the section */
70
+ timestamp: Timestamp;
71
+ };
72
+ /**
73
+ * @description An array of results for the Content Moderation model, if it is enabled.
74
+ * See [Content moderation](https://www.assemblyai.com/docs/Models/content_moderation) for more information.
75
+ */
76
+ export type ContentSafetyLabelsResult = {
77
+ results: ContentSafetyLabelResult[];
67
78
  /** @description A summary of the Content Moderation severity results for the entire audio file */
68
79
  severity_score_summary: {
69
80
  [key: string]: SeverityScoreSummary;
70
81
  };
82
+ /** @description The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed. */
83
+ status: AudioIntelligenceModelStatus;
71
84
  /** @description A summary of the Content Moderation confidence results for the entire audio file */
72
85
  summary: {
73
86
  [key: string]: number;
74
87
  };
75
- /** @description The transcript of the section flagged by the Content Moderation model */
76
- text: string;
77
- /** @description Timestamp information for the section */
78
- timestamp: Timestamp;
79
88
  };
80
89
  export type CreateRealtimeTemporaryTokenParameters = {
81
- /** @description The amount of time until the token expires in seconds. */
90
+ /** @description The amount of time until the token expires in seconds */
82
91
  expires_in: number;
83
92
  };
84
93
  /** @description The parameters for creating a transcript */
85
94
  export type CreateTranscriptOptionalParameters = {
86
95
  /** @description The point in time, in milliseconds, to stop transcribing in your media file */
87
96
  audio_end_at?: number;
88
- /** @description The point in time, in milliseconds, to begin transcription from in your media file */
97
+ /** @description The point in time, in milliseconds, to begin transcribing in your media file */
89
98
  audio_start_from?: number;
90
99
  /** @description Enable [Auto Chapters](https://www.assemblyai.com/docs/Models/auto_chapters), can be true or false */
91
100
  auto_chapters?: boolean;
92
- /** @description Whether Key Phrases was enabled in the transcription request, either true or false */
101
+ /** @description Whether Key Phrases is enabled, either true or false */
93
102
  auto_highlights?: boolean;
94
- /** @description The word boost parameter value, if provided in the transcription request. */
103
+ /** @description The word boost parameter value */
95
104
  boost_param?: TranscriptBoostParam;
96
105
  /** @description Enable [Content Moderation](https://www.assemblyai.com/docs/Models/content_moderation), can be true or false */
97
106
  content_safety?: boolean;
98
107
  /** @description Customize how words are spelled and formatted using to and from values */
99
108
  custom_spelling?: TranscriptCustomSpelling[];
100
- /** @description Whether custom topics was enabled in the transcription request, either true or false */
109
+ /** @description Whether custom topics is enabled, either true or false */
101
110
  custom_topics?: boolean;
102
- /** @description Transcribe Filler Words, like "umm", in your media file; can be true or false. */
111
+ /** @description Transcribe Filler Words, like "umm", in your media file; can be true or false */
103
112
  disfluencies?: boolean;
104
- /** @description Enable [Dual Channel](https://assemblyai.com/docs/Models/speech_recognition#dual-channel-transcription) transcription, can be true or false. */
113
+ /** @description Enable [Dual Channel](https://assemblyai.com/docs/Models/speech_recognition#dual-channel-transcription) transcription, can be true or false */
105
114
  dual_channel?: boolean;
106
115
  /** @description Enable [Entity Detection](https://www.assemblyai.com/docs/Models/entity_detection), can be true or false */
107
116
  entity_detection?: boolean;
108
- /** @description Filter profanity from the transcribed text, can be true or false. */
117
+ /** @description Filter profanity from the transcribed text, can be true or false */
109
118
  filter_profanity?: boolean;
110
- /** @description Enable Text Formatting, can be true or false. */
119
+ /** @description Enable Text Formatting, can be true or false */
111
120
  format_text?: boolean;
112
121
  /** @description Enable [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification), can be true or false */
113
122
  iab_categories?: boolean;
@@ -115,10 +124,10 @@ export type CreateTranscriptOptionalParameters = {
115
124
  * @description The language of your audio file. Possible values are found in [Supported Languages](https://www.assemblyai.com/docs/Concepts/supported_languages).
116
125
  * The default value is 'en_us'.
117
126
  */
118
- language_code?: TranscriptLanguageCode;
119
- /** @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. */
127
+ language_code?: TranscriptLanguageCode | null;
128
+ /** @description Whether [Automatic language detection](https://www.assemblyai.com/docs/Models/speech_recognition#automatic-language-detection) is enabled, either true or false */
120
129
  language_detection?: boolean;
121
- /** @description Enable Automatic Punctuation, can be true or false. */
130
+ /** @description Enable Automatic Punctuation, can be true or false */
122
131
  punctuate?: boolean;
123
132
  /** @description Redact PII from the transcribed text using the Redact PII model, can be true or false */
124
133
  redact_pii?: boolean;
@@ -132,13 +141,13 @@ export type CreateTranscriptOptionalParameters = {
132
141
  /** @description The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more details. */
133
142
  redact_pii_policies?: PiiPolicy[];
134
143
  /** @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. */
135
- redact_pii_sub?: SubstitutionPolicy;
144
+ redact_pii_sub?: SubstitutionPolicy | null;
136
145
  /** @description Enable [Sentiment Analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis), can be true or false */
137
146
  sentiment_analysis?: boolean;
138
147
  /** @description Enable [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization), can be true or false */
139
148
  speaker_labels?: boolean;
140
149
  /**
141
- * @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.
150
+ * @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.
142
151
  * @default null
143
152
  */
144
153
  speakers_expected?: number | null;
@@ -162,21 +171,21 @@ export type CreateTranscriptOptionalParameters = {
162
171
  * @default bullets
163
172
  */
164
173
  summary_type?: SummaryType;
165
- /** @description The list of custom topics provided if custom topics was enabled in the transcription request */
174
+ /** @description The list of custom topics provided, if custom topics is enabled */
166
175
  topics?: string[];
167
176
  /**
168
- * @description The header name which should be sent back with webhook calls, if provided in the transcription request.
177
+ * @description The header name which should be sent back with webhook calls
169
178
  * @default null
170
179
  */
171
180
  webhook_auth_header_name?: string | null;
172
181
  /**
173
- * @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.
182
+ * @description Specify a header name and value to send back with a webhook call for added security
174
183
  * @default null
175
184
  */
176
185
  webhook_auth_header_value?: string | null;
177
- /** @description The URL to which we send webhooks upon trancription completion, if provided in the transcription request. */
186
+ /** @description The URL to which AssemblyAI send webhooks upon trancription completion */
178
187
  webhook_url?: string;
179
- /** @description The list of custom vocabulary to boost transcription probability for, if provided in the transcription request. */
188
+ /** @description The list of custom vocabulary to boost transcription probability for */
180
189
  word_boost?: string[];
181
190
  };
182
191
  /** @description The parameters for creating a transcript */
@@ -208,7 +217,7 @@ export type Error = {
208
217
  };
209
218
  export type LemurActionItemsParameters = LemurBaseParameters;
210
219
  export type LemurActionItemsResponse = LemurBaseResponse & {
211
- /** @description The response generated by LeMUR. */
220
+ /** @description The response generated by LeMUR */
212
221
  response: string;
213
222
  };
214
223
  export type LemurBaseParameters = {
@@ -220,7 +229,12 @@ export type LemurBaseParameters = {
220
229
  }
221
230
  ]>;
222
231
  final_model?: LemurModel;
223
- /** @description Max output size in tokens. Up to 4000 allowed. */
232
+ /**
233
+ * @description Custom formatted transcript data. Maximum size is the context limit of the selected model, which defaults to 100000.
234
+ * Use either transcript_ids or input_text as input into LeMUR.
235
+ */
236
+ input_text?: string;
237
+ /** @description Max output size in tokens, up to 4000 */
224
238
  max_output_size?: number;
225
239
  /**
226
240
  * Format: float
@@ -229,8 +243,11 @@ export type LemurBaseParameters = {
229
243
  * Can be any value between 0.0 and 1.0 inclusive.
230
244
  */
231
245
  temperature?: number;
232
- /** @description A list of completed transcripts with text. Up to 100 files max, or 100 hours max. Whichever is lower. */
233
- transcript_ids: string[];
246
+ /**
247
+ * @description A list of completed transcripts with text. Up to a maximum of 100 files or 100 hours, whichever is lower.
248
+ * Use either transcript_ids or input_text as input into LeMUR.
249
+ */
250
+ transcript_ids?: string[];
234
251
  };
235
252
  export type LemurBaseResponse = {
236
253
  /** @description The ID of the LeMUR request */
@@ -247,7 +264,7 @@ export type LemurQuestion = {
247
264
  answer_format?: string;
248
265
  /** @description What discrete options to return. Useful for precise responses. Can't be used with answer_format. Example: ["Yes", "No"] */
249
266
  answer_options?: string[];
250
- /** @description Any context about the transcripts you wish to provide. This can be a string, or free-form JSON. */
267
+ /** @description Any context about the transcripts you wish to provide. This can be a string or any object. */
251
268
  context?: OneOf<[
252
269
  string,
253
270
  {
@@ -257,19 +274,19 @@ export type LemurQuestion = {
257
274
  /** @description The question you wish to ask. For more complex questions use default model. */
258
275
  question: string;
259
276
  };
260
- /** @description An answer generated by LeMUR and its question. */
277
+ /** @description An answer generated by LeMUR and its question */
261
278
  export type LemurQuestionAnswer = {
262
- /** @description The answer generated by LeMUR. */
279
+ /** @description The answer generated by LeMUR */
263
280
  answer: string;
264
- /** @description The question for LeMUR to answer. */
281
+ /** @description The question for LeMUR to answer */
265
282
  question: string;
266
283
  };
267
284
  export type LemurQuestionAnswerParameters = LemurBaseParameters & {
268
- /** @description A list of questions to ask. */
285
+ /** @description A list of questions to ask */
269
286
  questions: LemurQuestion[];
270
287
  };
271
288
  export type LemurQuestionAnswerResponse = LemurBaseResponse & {
272
- /** @description The answers generated by LeMUR and their questions. */
289
+ /** @description The answers generated by LeMUR and their questions */
273
290
  response: LemurQuestionAnswer[];
274
291
  };
275
292
  export type LemurSummaryParameters = LemurBaseParameters & {
@@ -277,7 +294,7 @@ export type LemurSummaryParameters = LemurBaseParameters & {
277
294
  answer_format?: string;
278
295
  };
279
296
  export type LemurSummaryResponse = LemurBaseResponse & {
280
- /** @description The response generated by LeMUR. */
297
+ /** @description The response generated by LeMUR */
281
298
  response: string;
282
299
  };
283
300
  export type LemurTaskParameters = LemurBaseParameters & {
@@ -285,7 +302,7 @@ export type LemurTaskParameters = LemurBaseParameters & {
285
302
  prompt: string;
286
303
  };
287
304
  export type LemurTaskResponse = LemurBaseResponse & {
288
- /** @description The response generated by LeMUR. */
305
+ /** @description The response generated by LeMUR */
289
306
  response: string;
290
307
  };
291
308
  export type PageDetails = {
@@ -305,11 +322,11 @@ export type ParagraphsResponse = {
305
322
  /** @enum {string} */
306
323
  export type PiiPolicy = "medical_process" | "medical_condition" | "blood_type" | "drug" | "injury" | "number_sequence" | "email_address" | "date_of_birth" | "phone_number" | "us_social_security_number" | "credit_card_number" | "credit_card_expiration" | "credit_card_cvv" | "date" | "nationality" | "event" | "language" | "location" | "money_amount" | "person_name" | "person_age" | "organization" | "political_affiliation" | "occupation" | "religion" | "drivers_license" | "banking_information";
307
324
  export type PurgeLemurRequestDataResponse = {
308
- /** @description Whether the request data was deleted. */
325
+ /** @description Whether the request data was deleted */
309
326
  deleted: boolean;
310
- /** @description The ID of the LeMUR request */
311
- request_id: string;
312
327
  /** @description The ID of the deletion request of the LeMUR request */
328
+ request_id: string;
329
+ /** @description The ID of the LeMUR request to purge the data for */
313
330
  request_id_to_purge: string;
314
331
  };
315
332
  export type RealtimeTemporaryTokenResponse = {
@@ -336,7 +353,7 @@ export type SentencesResponse = {
336
353
  };
337
354
  /** @enum {unknown} */
338
355
  export type Sentiment = "POSITIVE" | "NEUTRAL" | "NEGATIVE";
339
- /** @description The result of the sentiment analysis model. */
356
+ /** @description The result of the sentiment analysis model */
340
357
  export type SentimentAnalysisResult = {
341
358
  /**
342
359
  * Format: double
@@ -347,7 +364,7 @@ export type SentimentAnalysisResult = {
347
364
  end: number;
348
365
  /** @description The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE */
349
366
  sentiment: Sentiment;
350
- /** @description The speaker of the sentence if Speaker Diarization is enabled, else null */
367
+ /** @description The speaker of the sentence if [Speaker Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, else null */
351
368
  speaker?: string | null;
352
369
  /** @description The starting time, in milliseconds, of the sentence */
353
370
  start: number;
@@ -364,7 +381,7 @@ export type SeverityScoreSummary = {
364
381
  };
365
382
  /**
366
383
  * @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.
367
- * @enum {string|null}
384
+ * @enum {string}
368
385
  */
369
386
  export type SubstitutionPolicy = "entity_type" | "hash";
370
387
  /**
@@ -384,14 +401,28 @@ export type SummaryModel = "informative" | "conversational" | "catchy";
384
401
  * @enum {string}
385
402
  */
386
403
  export type SummaryType = "bullets" | "bullets_verbose" | "gist" | "headline" | "paragraph";
387
- /** @description Timestamp containing a start and end property in milliseconds. */
404
+ /** @description Timestamp containing a start and end property in milliseconds */
388
405
  export type Timestamp = {
389
406
  /** @description The end time in milliseconds */
390
407
  end: number;
391
408
  /** @description The start time in milliseconds */
392
409
  start: number;
393
410
  };
394
- /** @description THe result of the topic detection model. */
411
+ /**
412
+ * @description The result of the Topic Detection model, if it is enabled.
413
+ * See [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification) for more information.
414
+ */
415
+ export type TopicDetectionModelResult = {
416
+ /** @description An array of results for the Topic Detection model */
417
+ results: TopicDetectionResult[];
418
+ /** @description The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed. */
419
+ status: AudioIntelligenceModelStatus;
420
+ /** @description The overall relevance of topic to the entire audio file */
421
+ summary: {
422
+ [key: string]: number;
423
+ };
424
+ };
425
+ /** @description The result of the topic detection model */
395
426
  export type TopicDetectionResult = {
396
427
  labels?: {
397
428
  /** @description The IAB taxonomical label for the label of the detected topic, where > denotes supertopic/subtopic relationship */
@@ -410,7 +441,7 @@ export type TopicDetectionResult = {
410
441
  export type Transcript = {
411
442
  /**
412
443
  * @deprecated
413
- * @description The acoustic model that was used for the transcription
444
+ * @description The acoustic model that was used for the transcript
414
445
  */
415
446
  acoustic_model: string;
416
447
  /**
@@ -418,22 +449,22 @@ export type Transcript = {
418
449
  * @description The duration of this transcript object's media file, in seconds
419
450
  */
420
451
  audio_duration?: number | null;
421
- /** @description The point in time, in milliseconds, in the file at which the transcription was terminated, if provided in the transcription request */
452
+ /** @description The point in time, in milliseconds, in the file at which the transcription was terminated */
422
453
  audio_end_at?: number | null;
423
- /** @description The point in time, in milliseconds, in the file at which the transcription was started, if provided in the transcription request */
454
+ /** @description The point in time, in milliseconds, in the file at which the transcription was started */
424
455
  audio_start_from?: number | null;
425
456
  /** @description The URL of the media that was transcribed */
426
457
  audio_url: string;
427
- /** @description Enable [Auto Chapters](https://www.assemblyai.com/docs/Models/auto_chapters), can be true or false */
458
+ /** @description Whether [Auto Chapters](https://www.assemblyai.com/docs/Models/auto_chapters) is enabled, can be true or false */
428
459
  auto_chapters?: boolean | null;
429
- /** @description Whether Key Phrases was enabled in the transcription request, either true or false */
460
+ /** @description Whether Key Phrases is enabled, either true or false */
430
461
  auto_highlights: boolean;
431
462
  /**
432
- * @description An array of results for the Key Phrases model, if it was enabled during the transcription request.
463
+ * @description An array of results for the Key Phrases model, if it is enabled.
433
464
  * See [Key phrases](https://www.assemblyai.com/docs/Models/key_phrases) for more information.
434
465
  */
435
- auto_highlights_result?: AutoHighlightsResult;
436
- /** @description The word boost parameter value, if provided in the transcription request */
466
+ auto_highlights_result?: AutoHighlightsResult | null;
467
+ /** @description The word boost parameter value */
437
468
  boost_param?: string | null;
438
469
  /** @description An array of temporally sequential chapters for the audio file */
439
470
  chapters?: Chapter[] | null;
@@ -442,55 +473,42 @@ export type Transcript = {
442
473
  * @description The confidence score for the transcript, between 0.0 (low confidence) and 1.0 (high confidence)
443
474
  */
444
475
  confidence?: number | null;
445
- /** @description Enable [Content Moderation](https://www.assemblyai.com/docs/Models/content_moderation), can be true or false */
476
+ /** @description Whether [Content Moderation](https://www.assemblyai.com/docs/Models/content_moderation) is enabled, can be true or false */
446
477
  content_safety?: boolean | null;
447
478
  /**
448
- * @description An array of results for the Content Moderation model, if it was enabled during the transcription request.
479
+ * @description An array of results for the Content Moderation model, if it is enabled.
449
480
  * See [Content moderation](https://www.assemblyai.com/docs/Models/content_moderation) for more information.
450
481
  */
451
- content_safety_labels?: {
452
- results: ContentSafetyLabelResult[];
453
- /** @description Will be either success, or unavailable in the rare case that the Content Safety Labels model failed. */
454
- status: AudioIntelligenceModelStatus;
455
- } | null;
482
+ content_safety_labels?: ContentSafetyLabelsResult | null;
456
483
  /** @description Customize how words are spelled and formatted using to and from values */
457
484
  custom_spelling?: TranscriptCustomSpelling[] | null;
458
- /** @description Whether custom topics was enabled in the transcription request, either true or false */
485
+ /** @description Whether custom topics is enabled, either true or false */
459
486
  custom_topics?: boolean | null;
460
487
  /** @description Transcribe Filler Words, like "umm", in your media file; can be true or false */
461
488
  disfluencies?: boolean | null;
462
- /** @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 */
489
+ /** @description Whether [Dual channel transcription](https://www.assemblyai.com/docs/Models/speech_recognition#dual-channel-transcription) is enabled, either true or false */
463
490
  dual_channel?: boolean | null;
464
491
  /**
465
- * @description An array of results for the Entity Detection model, if it was enabled during the transcription request.
492
+ * @description An array of results for the Entity Detection model, if it is enabled.
466
493
  * See [Entity detection](https://www.assemblyai.com/docs/Models/entity_detection) for more information.
467
494
  */
468
495
  entities?: Entity[] | null;
469
- /** @description Enable [Entity Detection](https://www.assemblyai.com/docs/Models/entity_detection), can be true or false */
496
+ /** @description Whether [Entity Detection](https://www.assemblyai.com/docs/Models/entity_detection) is enabled, can be true or false */
470
497
  entity_detection?: boolean | null;
471
498
  /** @description Error message of why the transcript failed */
472
499
  error?: string;
473
- /** @description Whether [Profanity Filtering](https://www.assemblyai.com/docs/Models/speech_recognition#profanity-filtering) was enabled in the transcription request, either true or false */
500
+ /** @description Whether [Profanity Filtering](https://www.assemblyai.com/docs/Models/speech_recognition#profanity-filtering) is enabled, either true or false */
474
501
  filter_profanity?: boolean | null;
475
- /** @description Whether Text Formatting was enabled in the transcription request, either true or false */
502
+ /** @description Whether Text Formatting is enabled, either true or false */
476
503
  format_text?: boolean | null;
477
- /** @description Enable [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification), can be true or false */
504
+ /** @description Whether [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification) is enabled, can be true or false */
478
505
  iab_categories?: boolean | null;
479
506
  /**
480
- * @description An array of results for the Topic Detection model, if it was enabled during the transcription request.
507
+ * @description The result of the Topic Detection model, if it is enabled.
481
508
  * See [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification) for more information.
482
509
  */
483
- iab_categories_result?: {
484
- /** @description An array of results for the Topic Detection model. */
485
- results: TopicDetectionResult[];
486
- /** @description Will be either success, or unavailable in the rare case that the Content Moderation model failed. */
487
- status: AudioIntelligenceModelStatus;
488
- /** @description The overall relevance of topic to the entire audio file */
489
- summary: {
490
- [key: string]: number;
491
- };
492
- } | null;
493
- /** @description The unique identifier of your transcription */
510
+ iab_categories_result?: TopicDetectionModelResult | null;
511
+ /** @description The unique identifier of your transcript */
494
512
  id: string;
495
513
  /**
496
514
  * @description The language of your audio file.
@@ -498,24 +516,24 @@ export type Transcript = {
498
516
  * The default value is 'en_us'.
499
517
  */
500
518
  language_code?: TranscriptLanguageCode;
501
- /** @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 */
519
+ /** @description Whether [Automatic language detection](https://www.assemblyai.com/docs/Models/speech_recognition#automatic-language-detection) is enabled, either true or false */
502
520
  language_detection?: boolean | null;
503
521
  /**
504
522
  * @deprecated
505
- * @description The language model that was used for the transcription
523
+ * @description The language model that was used for the transcript
506
524
  */
507
525
  language_model: string;
508
- /** @description Whether Automatic Punctuation was enabled in the transcription request, either true or false. */
526
+ /** @description Whether Automatic Punctuation is enabled, either true or false */
509
527
  punctuate?: boolean | null;
510
- /** @description Whether [PII Redaction](https://www.assemblyai.com/docs/Models/pii_redaction) was enabled in the transcription request, either true or false */
528
+ /** @description Whether [PII Redaction](https://www.assemblyai.com/docs/Models/pii_redaction) is enabled, either true or false */
511
529
  redact_pii: boolean;
512
530
  /**
513
- * @description Whether a redacted version of the audio file was generated (enabled or disabled in the transcription request),
531
+ * @description Whether a redacted version of the audio file was generated,
514
532
  * either true or false. See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more information.
515
533
  */
516
534
  redact_pii_audio?: boolean | null;
517
535
  /**
518
- * @description The audio quality of the PII-redacted audio file, if enabled in the transcription request.
536
+ * @description The audio quality of the PII-redacted audio file, if redact_pii_audio is enabled.
519
537
  * See [PII redaction](https://www.assemblyai.com/docs/Models/pii_redaction) for more information.
520
538
  */
521
539
  redact_pii_audio_quality?: string | null;
@@ -526,16 +544,16 @@ export type Transcript = {
526
544
  redact_pii_policies?: PiiPolicy[] | null;
527
545
  /** @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. */
528
546
  redact_pii_sub?: SubstitutionPolicy;
529
- /** @description Enable [Sentiment Analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis), can be true or false */
547
+ /** @description Whether [Sentiment Analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis) is enabled, can be true or false */
530
548
  sentiment_analysis?: boolean | null;
531
549
  /**
532
- * @description An array of results for the Sentiment Analysis model, if it was enabled during the transcription request.
550
+ * @description An array of results for the Sentiment Analysis model, if it is enabled.
533
551
  * See [Sentiment analysis](https://www.assemblyai.com/docs/Models/sentiment_analysis) for more information.
534
552
  */
535
553
  sentiment_analysis_results?: SentimentAnalysisResult[] | null;
536
- /** @description Enable [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization), can be true or false */
554
+ /** @description Whether [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) is enabled, can be true or false */
537
555
  speaker_labels?: boolean | null;
538
- /** @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. */
556
+ /** @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. */
539
557
  speakers_expected?: number | null;
540
558
  /**
541
559
  * Format: float
@@ -545,42 +563,42 @@ export type Transcript = {
545
563
  speech_threshold?: number | null;
546
564
  /**
547
565
  * @deprecated
548
- * @description Whether speed boost was enabled in the transcription request
566
+ * @description Whether speed boost is enabled
549
567
  */
550
568
  speed_boost?: boolean | null;
551
- /** @description The status of your transcription. Possible values are queued, processing, completed, or error. */
569
+ /** @description The status of your transcript. Possible values are queued, processing, completed, or error. */
552
570
  status: TranscriptStatus;
553
- /** @description Whether [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request, either true or false */
571
+ /** @description Whether [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled, either true or false */
554
572
  summarization: boolean;
555
- /** @description The generated summary of the media file, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request */
573
+ /** @description The generated summary of the media file, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled */
556
574
  summary?: string | null;
557
575
  /**
558
576
  * @description The Summarization model used to generate the summary,
559
- * if [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request
577
+ * if [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled
560
578
  */
561
579
  summary_model?: string | null;
562
- /** @description The type of summary generated, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) was enabled in the transcription request */
580
+ /** @description The type of summary generated, if [Summarization](https://www.assemblyai.com/docs/Models/summarization) is enabled */
563
581
  summary_type?: string | null;
564
582
  /** @description The textual transcript of your media file */
565
583
  text?: string | null;
566
584
  /** @description True while a request is throttled and false when a request is no longer throttled */
567
585
  throttled?: boolean | null;
568
- /** @description The list of custom topics provided if custom topics was enabled in the transcription request */
586
+ /** @description The list of custom topics provided if custom topics is enabled */
569
587
  topics?: string[];
570
588
  /**
571
589
  * @description When dual_channel or speaker_labels is enabled, a list of turn-by-turn utterance objects.
572
590
  * See [Speaker diarization](https://www.assemblyai.com/docs/Models/speaker_diarization) for more information.
573
591
  */
574
592
  utterances?: TranscriptUtterance[] | null;
575
- /** @description Whether webhook authentication details were provided in the transcription request */
593
+ /** @description Whether webhook authentication details were provided */
576
594
  webhook_auth: boolean;
577
- /** @description The header name which should be sent back with webhook calls, if provided in the transcription request */
595
+ /** @description The header name which should be sent back with webhook calls */
578
596
  webhook_auth_header_name?: string | null;
579
- /** @description The status code we received from your server when delivering your webhook, if a webhook URL was provided in the transcription request */
597
+ /** @description The status code we received from your server when delivering your webhook, if a webhook URL was provided */
580
598
  webhook_status_code?: number | null;
581
- /** @description The URL to which we send webhooks upon trancription completion, if provided in the transcription request */
599
+ /** @description The URL to which we send webhooks upon trancription completion */
582
600
  webhook_url?: string | null;
583
- /** @description The list of custom vocabulary to boost transcription probability for, if provided in the transcription request */
601
+ /** @description The list of custom vocabulary to boost transcription probability for */
584
602
  word_boost?: string[];
585
603
  /**
586
604
  * @description An array of temporally-sequential word objects, one for each word in the transcript.
@@ -589,7 +607,7 @@ export type Transcript = {
589
607
  words?: TranscriptWord[] | null;
590
608
  };
591
609
  /**
592
- * @description The word boost parameter value, if provided in the transcription request.
610
+ * @description The word boost parameter value
593
611
  * @enum {string}
594
612
  */
595
613
  export type TranscriptBoostParam = "low" | "default" | "high";
@@ -605,7 +623,7 @@ export type TranscriptCustomSpelling = {
605
623
  * The default value is 'en_us'.
606
624
  *
607
625
  * @default en_us
608
- * @enum {string|null}
626
+ * @enum {string}
609
627
  */
610
628
  export type TranscriptLanguageCode = "en" | "en_au" | "en_uk" | "en_us" | "es" | "fr" | "de" | "it" | "pt" | "nl" | "hi" | "ja" | "zh" | "fi" | "ko" | "pl" | "ru" | "tr" | "uk" | "vi";
611
629
  export type TranscriptList = {
@@ -658,17 +676,25 @@ export type TranscriptSentence = {
658
676
  words: TranscriptWord[];
659
677
  };
660
678
  /**
661
- * @description The status of your transcription. Possible values are queued, processing, completed, or error.
679
+ * @description The status of your transcript. Possible values are queued, processing, completed, or error.
662
680
  * @enum {string}
663
681
  */
664
682
  export type TranscriptStatus = "queued" | "processing" | "completed" | "error";
665
683
  export type TranscriptUtterance = {
666
- channel: string;
667
- /** Format: double */
684
+ /**
685
+ * Format: double
686
+ * @description The confidence score for the transcript of this utterance
687
+ */
668
688
  confidence: number;
689
+ /** @description The ending time, in milliseconds, of the utterance in the audio file */
669
690
  end: number;
691
+ /** @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. */
692
+ speaker: string;
693
+ /** @description The starting time, in milliseconds, of the utterance in the audio file */
670
694
  start: number;
695
+ /** @description The text for this utterance */
671
696
  text: string;
697
+ /** @description The words in the utterance. */
672
698
  words: TranscriptWord[];
673
699
  };
674
700
  export type TranscriptWord = {
@@ -2,5 +2,5 @@ type BaseServiceParams = {
2
2
  apiKey: string;
3
3
  baseUrl?: string;
4
4
  };
5
- export type * from "./abstractions";
5
+ export * from "./abstractions";
6
6
  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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assemblyai",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "The AssemblyAI Node.js SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -51,6 +51,7 @@
51
51
  "i": "^0.3.7",
52
52
  "jest": "^29.5.0",
53
53
  "jest-cli": "^29.5.0",
54
+ "jest-fetch-mock": "^3.0.3",
54
55
  "jest-junit": "^16.0.0",
55
56
  "jest-mock-extended": "^3.0.4",
56
57
  "jest-websocket-mock": "^2.4.1",
@@ -67,7 +68,6 @@
67
68
  "typescript": "^5.2.2"
68
69
  },
69
70
  "dependencies": {
70
- "axios": "^1.4.0",
71
71
  "ws": "^8.13.0"
72
72
  }
73
73
  }
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export type * from "./types";
1
+ export * from "./types";
2
2
  export * from "./services";