assemblyai 4.3.1 → 4.3.3

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 (37) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +165 -89
  3. package/dist/assemblyai.umd.js +62 -56
  4. package/dist/assemblyai.umd.min.js +1 -1
  5. package/dist/bun.mjs +57 -51
  6. package/dist/deno.mjs +57 -51
  7. package/dist/index.cjs +62 -56
  8. package/dist/index.mjs +62 -56
  9. package/dist/node.cjs +57 -51
  10. package/dist/node.mjs +57 -51
  11. package/dist/services/base.d.ts +1 -1
  12. package/dist/services/files/index.d.ts +2 -2
  13. package/dist/services/index.d.ts +1 -1
  14. package/dist/services/lemur/index.d.ts +1 -1
  15. package/dist/services/realtime/service.d.ts +2 -2
  16. package/dist/services/transcripts/index.d.ts +26 -26
  17. package/dist/types/asyncapi.generated.d.ts +60 -39
  18. package/dist/types/openapi.generated.d.ts +740 -347
  19. package/dist/types/services/index.d.ts +0 -1
  20. package/dist/types/transcripts/index.d.ts +14 -5
  21. package/package.json +26 -25
  22. package/src/polyfills/fs/index.ts +2 -2
  23. package/src/polyfills/fs/node.ts +1 -1
  24. package/src/polyfills/streams/index.ts +2 -2
  25. package/src/services/base.ts +3 -3
  26. package/src/services/files/index.ts +2 -2
  27. package/src/services/index.ts +1 -1
  28. package/src/services/lemur/index.ts +5 -5
  29. package/src/services/realtime/factory.ts +1 -1
  30. package/src/services/realtime/service.ts +7 -8
  31. package/src/services/transcripts/index.ts +59 -63
  32. package/src/types/asyncapi.generated.ts +64 -42
  33. package/src/types/openapi.generated.ts +748 -352
  34. package/src/types/services/index.ts +0 -1
  35. package/src/types/transcripts/index.ts +17 -7
  36. package/dist/types/services/abstractions.d.ts +0 -52
  37. package/src/types/services/abstractions.ts +0 -56
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.3.3] - 2024-03-18
4
+
5
+ ### Added
6
+
7
+ - GitHub action to generate API reference
8
+ - Generate API reference with Typedoc and host on GitHub Pages
9
+
10
+ ### Changed
11
+
12
+ - Add `conformer-2` to `SpeechModel` type
13
+ - Change `language_code` field to accept any string
14
+ - Move from JSDoc to TSDoc
15
+ - Update `ws` to 8.13.0
16
+ - Update dev dependencies (no public facing changes)
17
+
18
+ ## [4.3.2] - 2024-03-08
19
+
20
+ ### Added
21
+
22
+ - Add `audio_url` property to `TranscribeParams` in addition to the `audio` property. You can use one or the other. `audio_url` only accepts a URL string.
23
+ - Add `TranscriptReadyNotification` type for the transcript webhook body.
24
+
25
+ ### Changed
26
+
27
+ - Update codebase to use TSDoc
28
+ - Update README.md with more samples
29
+
3
30
  ## [4.3.0] - 2024-02-15
4
31
 
5
32
  ### Added
package/README.md CHANGED
@@ -16,9 +16,14 @@ The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting
16
16
  which supports async and real-time transcription, as well as the latest LeMUR models.
17
17
  It is written primarily for Node.js in TypeScript with all types exported, but also [compatible with other runtimes](./docs/compat.md).
18
18
 
19
- ## Installation
19
+ ## Documentation
20
20
 
21
- You can install the AssemblyAI SDK by running:
21
+ Visit the [AssemblyAI documentation](https://www.assemblyai.com/docs) for step-by-step instructions and a lot more details about our AI models and API.
22
+ Explore the [SDK API reference](https://assemblyai.github.io/assemblyai-node-sdk/) for more details on the SDK types, functions, and classes.
23
+
24
+ ## Quickstart
25
+
26
+ Install the AssemblyAI SDK using your preferred package manager:
22
27
 
23
28
  ```bash
24
29
  npm install assemblyai
@@ -36,11 +41,9 @@ pnpm add assemblyai
36
41
  bun add assemblyai
37
42
  ```
38
43
 
39
- # Usage
44
+ Then, import the `assemblyai` module and create an AssemblyAI object with your API key:
40
45
 
41
- Import the AssemblyAI package and create an AssemblyAI object with your API key:
42
-
43
- ```javascript
46
+ ```js
44
47
  import { AssemblyAI } from "assemblyai";
45
48
 
46
49
  const client = new AssemblyAI({
@@ -50,61 +53,94 @@ const client = new AssemblyAI({
50
53
 
51
54
  You can now use the `client` object to interact with the AssemblyAI API.
52
55
 
53
- ## Create a transcript
56
+ ## Speech-To-Text
57
+
58
+ ### Transcribe audio and video files
59
+
60
+ <details open>
61
+ <summary>Transcribe an audio file with a public URL</summary>
54
62
 
55
63
  When you create a transcript, you can either pass in a URL to an audio file or upload a file directly.
56
64
 
57
- ```javascript
65
+ ```js
58
66
  // Transcribe file at remote URL
59
67
  let transcript = await client.transcripts.transcribe({
60
68
  audio: "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a",
61
69
  });
70
+ ```
71
+
72
+ > **Note**
73
+ > You can also pass a local file path, a stream, or a buffer as the `audio` property.
74
+
75
+ `transcribe` queues a transcription job and polls it until the `status` is `completed` or `error`.
76
+
77
+ If you don't want to wait until the transcript is ready, you can use `submit`:
78
+
79
+ ```js
80
+ let transcript = await client.transcripts.submit({
81
+ audio: "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a",
82
+ });
83
+ ```
84
+
85
+ </details>
86
+
87
+ <details>
88
+ <summary>Transcribe a local audio file</summary>
62
89
 
90
+ When you create a transcript, you can either pass in a URL to an audio file or upload a file directly.
91
+
92
+ ```js
63
93
  // Upload a file via local path and transcribe
64
94
  let transcript = await client.transcripts.transcribe({
65
95
  audio: "./news.mp4",
66
96
  });
67
97
  ```
68
98
 
69
- > **Note**
70
- > You can also pass streams and buffers to the `audio` property.
99
+ > **Note:**
100
+ > You can also pass a file URL, a stream, or a buffer as the `audio` property.
71
101
 
72
102
  `transcribe` queues a transcription job and polls it until the `status` is `completed` or `error`.
73
- You can configure the polling interval and polling timeout using these options:
74
-
75
- ```javascript
76
- let transcript = await client.transcripts.transcribe(
77
- {
78
- audio: "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a",
79
- },
80
- {
81
- // How frequently the transcript is polled in ms. Defaults to 3000.
82
- pollingInterval: 1000,
83
- // How long to wait in ms until the "Polling timeout" error is thrown. Defaults to infinite (-1).
84
- pollingTimeout: 5000,
85
- }
86
- );
87
- ```
88
103
 
89
104
  If you don't want to wait until the transcript is ready, you can use `submit`:
90
105
 
91
- ```javascript
106
+ ```js
92
107
  let transcript = await client.transcripts.submit({
108
+ audio: "./news.mp4",
109
+ });
110
+ ```
111
+
112
+ </details>
113
+
114
+ <details>
115
+ <summary>Enable additional AI models</summary>
116
+
117
+ You can extract even more insights from the audio by enabling any of our [AI models](https://www.assemblyai.com/docs/audio-intelligence) using _transcription options_.
118
+ For example, here's how to enable [Speaker diarization](https://www.assemblyai.com/docs/speech-to-text/speaker-diarization) model to detect who said what.
119
+
120
+ ```js
121
+ let transcript = await client.transcripts.transcribe({
93
122
  audio: "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a",
123
+ speaker_labels: true,
94
124
  });
125
+ for (let utterance of transcript.utterances) {
126
+ console.log(`Speaker ${utterance.speaker}: ${utterance.text}`);
127
+ }
95
128
  ```
96
129
 
97
- ## Get a transcript
130
+ </details>
131
+
132
+ <details>
133
+ <summary>Get a transcript</summary>
98
134
 
99
135
  This will return the transcript object in its current state. If the transcript is still processing, the `status` field will be `queued` or `processing`. Once the transcript is complete, the `status` field will be `completed`.
100
136
 
101
- ```javascript
137
+ ```js
102
138
  const transcript = await client.transcripts.get(transcript.id);
103
139
  ```
104
140
 
105
- If you created a transcript using `submit`, you can still poll until the transcript `status` is `completed` or `error` using `waitUntilReady`:
141
+ If you created a transcript using `.submit()`, you can still poll until the transcript `status` is `completed` or `error` using `.waitUntilReady()`:
106
142
 
107
- ```javascript
143
+ ```js
108
144
  const transcript = await client.transcripts.waitUntilReady(transcript.id, {
109
145
  // How frequently the transcript is polled in ms. Defaults to 3000.
110
146
  pollingInterval: 1000,
@@ -113,11 +149,36 @@ const transcript = await client.transcripts.waitUntilReady(transcript.id, {
113
149
  });
114
150
  ```
115
151
 
116
- ## List transcripts
152
+ </details>
153
+ <details>
154
+ <summary>Get sentences and paragraphs</summary>
155
+
156
+ ```js
157
+ const sentences = await client.transcripts.sentences(transcript.id);
158
+ const paragraphs = await client.transcripts.paragraphs(transcript.id);
159
+ ```
160
+
161
+ </details>
162
+
163
+ <details>
164
+ <summary>Get subtitles</summary>
165
+
166
+ ```js
167
+ const charsPerCaption = 32;
168
+ let srt = await client.transcripts.subtitles(transcript.id, "srt");
169
+ srt = await client.transcripts.subtitles(transcript.id, "srt", charsPerCaption);
170
+
171
+ let vtt = await client.transcripts.subtitles(transcript.id, "vtt");
172
+ vtt = await client.transcripts.subtitles(transcript.id, "vtt", charsPerCaption);
173
+ ```
174
+
175
+ </details>
176
+ <details>
177
+ <summary>List transcripts</summary>
117
178
 
118
179
  This will return a page of transcripts you created.
119
180
 
120
- ```javascript
181
+ ```js
121
182
  const page = await client.transcripts.list();
122
183
  ```
123
184
 
@@ -131,60 +192,18 @@ do {
131
192
  } while (nextPageUrl !== null);
132
193
  ```
133
194
 
134
- ## Delete a transcript
135
-
136
- ```javascript
137
- const res = await client.transcripts.delete(transcript.id);
138
- ```
139
-
140
- ## Use LeMUR
141
-
142
- Call [LeMUR endpoints](https://www.assemblyai.com/docs/API%20reference/lemur) to summarize, ask questions, generate action items, or run a custom task.
195
+ </details>
143
196
 
144
- Custom Summary:
197
+ <details>
198
+ <summary>Delete a transcript</summary>
145
199
 
146
- ```javascript
147
- const { response } = await client.lemur.summary({
148
- transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
149
- answer_format: "one sentence",
150
- context: {
151
- speakers: ["Alex", "Bob"],
152
- },
153
- });
154
- ```
155
-
156
- Question & Answer:
157
-
158
- ```javascript
159
- const { response } = await client.lemur.questionAnswer({
160
- transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
161
- questions: [
162
- {
163
- question: "What are they discussing?",
164
- answer_format: "text",
165
- },
166
- ],
167
- });
168
- ```
169
-
170
- Action Items:
171
-
172
- ```javascript
173
- const { response } = await client.lemur.actionItems({
174
- transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
175
- });
200
+ ```js
201
+ const res = await client.transcripts.delete(transcript.id);
176
202
  ```
177
203
 
178
- Custom Task:
179
-
180
- ```javascript
181
- const { response } = await client.lemur.task({
182
- transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
183
- prompt: "Write a haiku about this conversation.",
184
- });
185
- ```
204
+ </details>
186
205
 
187
- ## Transcribe in real-time
206
+ ### Transcribe in real-time
188
207
 
189
208
  Create the real-time transcriber.
190
209
 
@@ -222,9 +241,9 @@ You can configure the following events.
222
241
  ```typescript
223
242
  rt.on("open", ({ sessionId, expiresAt }) => console.log('Session ID:', sessionId, 'Expires at:', expiresAt));
224
243
  rt.on("close", (code: number, reason: string) => console.log('Closed', code, reason));
225
- rt.on("transcript", (transcript: TranscriptMessage) => console.log('Transcript:', transcript));
226
- rt.on("transcript.partial", (transcript: PartialTranscriptMessage) => console.log('Partial transcript:', transcript));
227
- rt.on("transcript.final", (transcript: FinalTranscriptMessage) => console.log('Final transcript:', transcript));
244
+ rt.on("transcript", (transcript: RealtimeTranscript) => console.log('Transcript:', transcript));
245
+ rt.on("transcript.partial", (transcript: PartialTranscript) => console.log('Partial transcript:', transcript));
246
+ rt.on("transcript.final", (transcript: FinalTranscript) => console.log('Final transcript:', transcript));
228
247
  rt.on("error", (error: Error) => console.error('Error', error));
229
248
  ```
230
249
 
@@ -255,11 +274,68 @@ Close the connection when you're finished.
255
274
  await rt.close();
256
275
  ```
257
276
 
258
- # Tests
277
+ ## Apply LLMs to your audio with LeMUR
259
278
 
260
- To run the test suite, first install the dependencies, then run `pnpm test`:
279
+ Call [LeMUR endpoints](https://www.assemblyai.com/docs/api-reference/lemur) to apply LLMs to your transcript.
261
280
 
262
- ```bash
263
- pnpm install
264
- pnpm test
281
+ <details open>
282
+ <summary>Prompt your audio with LeMUR</summary>
283
+
284
+ ```js
285
+ const { response } = await client.lemur.task({
286
+ transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
287
+ prompt: "Write a haiku about this conversation.",
288
+ });
265
289
  ```
290
+
291
+ </details>
292
+
293
+ <details>
294
+ <summary>Summarize with LeMUR</summary>
295
+
296
+ ```js
297
+ const { response } = await client.lemur.summary({
298
+ transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
299
+ answer_format: "one sentence",
300
+ context: {
301
+ speakers: ["Alex", "Bob"],
302
+ },
303
+ });
304
+ ```
305
+
306
+ </details>
307
+
308
+ <details>
309
+ <summary>Ask questions</summary>
310
+
311
+ ```js
312
+ const { response } = await client.lemur.questionAnswer({
313
+ transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
314
+ questions: [
315
+ {
316
+ question: "What are they discussing?",
317
+ answer_format: "text",
318
+ },
319
+ ],
320
+ });
321
+ ```
322
+
323
+ </details>
324
+ <details>
325
+ <summary>Generate action items</summary>
326
+
327
+ ```js
328
+ const { response } = await client.lemur.actionItems({
329
+ transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
330
+ });
331
+ ```
332
+
333
+ </details>
334
+ <details>
335
+ <summary>Delete LeMUR request</summary>
336
+
337
+ ```js
338
+ const response = await client.lemur.purgeRequestData(lemurResponse.request_id);
339
+ ```
340
+
341
+ </details>
@@ -54,14 +54,14 @@
54
54
  class BaseService {
55
55
  /**
56
56
  * Create a new service.
57
- * @param params The parameters to use for the service.
57
+ * @param params - The parameters to use for the service.
58
58
  */
59
59
  constructor(params) {
60
60
  this.params = params;
61
61
  }
62
62
  fetch(input, init) {
63
- var _a;
64
63
  return __awaiter(this, void 0, void 0, function* () {
64
+ var _a;
65
65
  init = init !== null && init !== void 0 ? init : {};
66
66
  init.headers = (_a = init.headers) !== null && _a !== void 0 ? _a : {};
67
67
  init.headers = Object.assign({ Authorization: this.params.apiKey, "Content-Type": "application/json" }, init.headers);
@@ -122,7 +122,7 @@
122
122
  }
123
123
  /**
124
124
  * Delete the data for a previously submitted LeMUR request.
125
- * @param id ID of the LeMUR request
125
+ * @param id - ID of the LeMUR request
126
126
  */
127
127
  purgeRequestData(id) {
128
128
  return this.fetchJson(`/lemur/v3/${id}`, {
@@ -205,8 +205,7 @@
205
205
  this.sampleRate = (_b = params.sampleRate) !== null && _b !== void 0 ? _b : 16000;
206
206
  this.wordBoost = params.wordBoost;
207
207
  this.encoding = params.encoding;
208
- this.endUtteranceSilenceThreshold =
209
- params.endUtteranceSilenceThreshold;
208
+ this.endUtteranceSilenceThreshold = params.endUtteranceSilenceThreshold;
210
209
  if ("token" in params && params.token)
211
210
  this.token = params.token;
212
211
  if ("apiKey" in params && params.apiKey)
@@ -333,8 +332,8 @@
333
332
  }
334
333
  /**
335
334
  * Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
336
- * @param threshold The duration of the end utterance silence threshold in milliseconds
337
- * @format integer
335
+ * @param threshold - The duration of the end utterance silence threshold in milliseconds.
336
+ * This value must be an integer between 0 and 20_000.
338
337
  */
339
338
  configureEndUtteranceSilenceThreshold(threshold) {
340
339
  this.send(`{"end_utterance_silence_threshold":${threshold}}`);
@@ -345,8 +344,8 @@
345
344
  }
346
345
  this.socket.send(data);
347
346
  }
348
- close(waitForSessionTermination = true) {
349
- return __awaiter(this, void 0, void 0, function* () {
347
+ close() {
348
+ return __awaiter(this, arguments, void 0, function* (waitForSessionTermination = true) {
350
349
  if (this.socket) {
351
350
  if (this.socket.readyState === WebSocket$1.OPEN) {
352
351
  if (waitForSessionTermination) {
@@ -428,8 +427,8 @@
428
427
  }
429
428
  /**
430
429
  * Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
431
- * @param params The parameters to transcribe an audio file.
432
- * @param options The options to transcribe an audio file.
430
+ * @param params - The parameters to transcribe an audio file.
431
+ * @param options - The options to transcribe an audio file.
433
432
  * @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
434
433
  */
435
434
  transcribe(params, options) {
@@ -440,45 +439,52 @@
440
439
  }
441
440
  /**
442
441
  * Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
443
- * @param params The parameters to start the transcription of an audio file.
442
+ * @param params - The parameters to start the transcription of an audio file.
444
443
  * @returns A promise that resolves to the queued transcript.
445
444
  */
446
445
  submit(params) {
447
446
  return __awaiter(this, void 0, void 0, function* () {
448
- const { audio } = params, createParams = __rest(params, ["audio"]);
449
447
  let audioUrl;
450
- if (typeof audio === "string") {
451
- const path = getPath(audio);
452
- if (path !== null) {
453
- // audio is local path, upload local file
454
- audioUrl = yield this.files.upload(path);
448
+ let transcriptParams = undefined;
449
+ if ("audio" in params) {
450
+ const { audio } = params, audioTranscriptParams = __rest(params, ["audio"]);
451
+ if (typeof audio === "string") {
452
+ const path = getPath(audio);
453
+ if (path !== null) {
454
+ // audio is local path, upload local file
455
+ audioUrl = yield this.files.upload(path);
456
+ }
457
+ else {
458
+ // audio is not a local path, assume it's a URL
459
+ audioUrl = audio;
460
+ }
455
461
  }
456
462
  else {
457
- // audio is not a local path, assume it's a URL
458
- audioUrl = audio;
463
+ // audio is of uploadable type
464
+ audioUrl = yield this.files.upload(audio);
459
465
  }
466
+ transcriptParams = Object.assign(Object.assign({}, audioTranscriptParams), { audio_url: audioUrl });
460
467
  }
461
468
  else {
462
- // audio is of uploadable type
463
- audioUrl = yield this.files.upload(audio);
469
+ transcriptParams = params;
464
470
  }
465
471
  const data = yield this.fetchJson("/v2/transcript", {
466
472
  method: "POST",
467
- body: JSON.stringify(Object.assign(Object.assign({}, createParams), { audio_url: audioUrl })),
473
+ body: JSON.stringify(transcriptParams),
468
474
  });
469
475
  return data;
470
476
  });
471
477
  }
472
478
  /**
473
479
  * Create a transcript.
474
- * @param params The parameters to create a transcript.
475
- * @param options The options used for creating the new transcript.
480
+ * @param params - The parameters to create a transcript.
481
+ * @param options - The options used for creating the new transcript.
476
482
  * @returns A promise that resolves to the transcript.
477
483
  * @deprecated Use `transcribe` instead to transcribe a audio file that includes polling, or `submit` to transcribe a audio file without polling.
478
484
  */
479
485
  create(params, options) {
480
- var _a;
481
486
  return __awaiter(this, void 0, void 0, function* () {
487
+ var _a;
482
488
  const path = getPath(params.audio_url);
483
489
  if (path !== null) {
484
490
  const uploadUrl = yield this.files.upload(path);
@@ -496,13 +502,13 @@
496
502
  }
497
503
  /**
498
504
  * Wait until the transcript ready, either the status is "completed" or "error".
499
- * @param transcriptId The ID of the transcript.
500
- * @param options The options to wait until the transcript is ready.
505
+ * @param transcriptId - The ID of the transcript.
506
+ * @param options - The options to wait until the transcript is ready.
501
507
  * @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
502
508
  */
503
509
  waitUntilReady(transcriptId, options) {
504
- var _a, _b;
505
510
  return __awaiter(this, void 0, void 0, function* () {
511
+ var _a, _b;
506
512
  const pollingInterval = (_a = options === null || options === void 0 ? void 0 : options.pollingInterval) !== null && _a !== void 0 ? _a : 3000;
507
513
  const pollingTimeout = (_b = options === null || options === void 0 ? void 0 : options.pollingTimeout) !== null && _b !== void 0 ? _b : -1;
508
514
  const startTime = Date.now();
@@ -524,7 +530,7 @@
524
530
  }
525
531
  /**
526
532
  * Retrieve a transcript.
527
- * @param id The identifier of the transcript.
533
+ * @param id - The identifier of the transcript.
528
534
  * @returns A promise that resolves to the transcript.
529
535
  */
530
536
  get(id) {
@@ -532,20 +538,20 @@
532
538
  }
533
539
  /**
534
540
  * Retrieves a page of transcript listings.
535
- * @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
541
+ * @param params - The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
536
542
  */
537
- list(parameters) {
543
+ list(params) {
538
544
  return __awaiter(this, void 0, void 0, function* () {
539
545
  let url = "/v2/transcript";
540
- if (typeof parameters === "string") {
541
- url = parameters;
546
+ if (typeof params === "string") {
547
+ url = params;
542
548
  }
543
- else if (parameters) {
544
- url = `${url}?${new URLSearchParams(Object.keys(parameters).map((key) => {
549
+ else if (params) {
550
+ url = `${url}?${new URLSearchParams(Object.keys(params).map((key) => {
545
551
  var _a;
546
552
  return [
547
553
  key,
548
- ((_a = parameters[key]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
554
+ ((_a = params[key]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
549
555
  ];
550
556
  }))}`;
551
557
  }
@@ -561,7 +567,7 @@
561
567
  }
562
568
  /**
563
569
  * Delete a transcript
564
- * @param id The identifier of the transcript.
570
+ * @param id - The identifier of the transcript.
565
571
  * @returns A promise that resolves to the transcript.
566
572
  */
567
573
  delete(id) {
@@ -570,9 +576,9 @@
570
576
  /**
571
577
  * Search through the transcript for a specific set of keywords.
572
578
  * You can search for individual words, numbers, or phrases containing up to five words or numbers.
573
- * @param id The identifier of the transcript.
574
- * @param words Keywords to search for.
575
- * @return A promise that resolves to the sentences.
579
+ * @param id - The identifier of the transcript.
580
+ * @param words - Keywords to search for.
581
+ * @returns A promise that resolves to the sentences.
576
582
  */
577
583
  wordSearch(id, words) {
578
584
  const params = new URLSearchParams({ words: words.join(",") });
@@ -580,29 +586,29 @@
580
586
  }
581
587
  /**
582
588
  * Retrieve all sentences of a transcript.
583
- * @param id The identifier of the transcript.
584
- * @return A promise that resolves to the sentences.
589
+ * @param id - The identifier of the transcript.
590
+ * @returns A promise that resolves to the sentences.
585
591
  */
586
592
  sentences(id) {
587
593
  return this.fetchJson(`/v2/transcript/${id}/sentences`);
588
594
  }
589
595
  /**
590
596
  * Retrieve all paragraphs of a transcript.
591
- * @param id The identifier of the transcript.
592
- * @return A promise that resolves to the paragraphs.
597
+ * @param id - The identifier of the transcript.
598
+ * @returns A promise that resolves to the paragraphs.
593
599
  */
594
600
  paragraphs(id) {
595
601
  return this.fetchJson(`/v2/transcript/${id}/paragraphs`);
596
602
  }
597
603
  /**
598
604
  * Retrieve subtitles of a transcript.
599
- * @param id The identifier of the transcript.
600
- * @param format The format of the subtitles.
601
- * @param chars_per_caption The maximum number of characters per caption.
602
- * @return A promise that resolves to the subtitles text.
605
+ * @param id - The identifier of the transcript.
606
+ * @param format - The format of the subtitles.
607
+ * @param chars_per_caption - The maximum number of characters per caption.
608
+ * @returns A promise that resolves to the subtitles text.
603
609
  */
604
- subtitles(id, format = "srt", chars_per_caption) {
605
- return __awaiter(this, void 0, void 0, function* () {
610
+ subtitles(id_1) {
611
+ return __awaiter(this, arguments, void 0, function* (id, format = "srt", chars_per_caption) {
606
612
  let url = `/v2/transcript/${id}/${format}`;
607
613
  if (chars_per_caption) {
608
614
  const params = new URLSearchParams();
@@ -615,8 +621,8 @@
615
621
  }
616
622
  /**
617
623
  * Retrieve redactions of a transcript.
618
- * @param id The identifier of the transcript.
619
- * @return A promise that resolves to the subtitles text.
624
+ * @param id - The identifier of the transcript.
625
+ * @returns A promise that resolves to the subtitles text.
620
626
  */
621
627
  redactions(id) {
622
628
  return this.fetchJson(`/v2/transcript/${id}/redacted-audio`);
@@ -634,8 +640,8 @@
634
640
  class FileService extends BaseService {
635
641
  /**
636
642
  * Upload a local file to AssemblyAI.
637
- * @param input The local file path to upload, or a stream or buffer of the file to upload.
638
- * @return A promise that resolves to the uploaded file URL.
643
+ * @param input - The local file path to upload, or a stream or buffer of the file to upload.
644
+ * @returns A promise that resolves to the uploaded file URL.
639
645
  */
640
646
  upload(input) {
641
647
  return __awaiter(this, void 0, void 0, function* () {
@@ -661,7 +667,7 @@
661
667
  class AssemblyAI {
662
668
  /**
663
669
  * Create a new AssemblyAI client.
664
- * @param params The parameters for the service, including the API key and base URL, if any.
670
+ * @param params - The parameters for the service, including the API key and base URL, if any.
665
671
  */
666
672
  constructor(params) {
667
673
  params.baseUrl = params.baseUrl || defaultBaseUrl;