assemblyai 3.1.0 → 3.1.1
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.
- package/README.md +64 -50
- package/dist/index.esm.js +63 -1
- package/dist/index.js +63 -1
- package/dist/services/files/index.d.ts +2 -2
- package/dist/services/lemur/index.d.ts +5 -5
- package/dist/services/transcripts/index.d.ts +25 -5
- package/dist/types/deprecated.d.ts +63 -0
- package/dist/types/files/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/openapi.generated.d.ts +125 -125
- package/dist/types/services/abstractions.d.ts +3 -3
- package/dist/types/transcripts/index.d.ts +20 -0
- package/package.json +10 -5
- package/src/services/files/index.ts +2 -2
- package/src/services/lemur/index.ts +8 -8
- package/src/services/transcripts/index.ts +60 -7
- package/src/types/deprecated.ts +78 -0
- package/src/types/files/index.ts +2 -2
- package/src/types/index.ts +1 -0
- package/src/types/openapi.generated.ts +127 -127
- package/src/types/services/abstractions.ts +3 -3
- package/src/types/transcripts/index.ts +27 -0
- package/src/utils/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/assemblyai)
|
|
6
6
|
[](https://github.com/AssemblyAI/assemblyai-node-sdk/actions/workflows/test.yml)
|
|
7
|
-
[](https://github.com/AssemblyAI/assemblyai-node-sdk/blob/
|
|
7
|
+
[](https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/LICENSE)
|
|
8
8
|
[](https://twitter.com/AssemblyAI)
|
|
9
9
|
[](https://www.youtube.com/@AssemblyAI)
|
|
10
10
|
[
|
|
@@ -44,7 +44,7 @@ import { AssemblyAI } from "assemblyai";
|
|
|
44
44
|
|
|
45
45
|
const client = new AssemblyAI({
|
|
46
46
|
apiKey: process.env.ASSEMBLYAI_API_KEY,
|
|
47
|
-
})
|
|
47
|
+
});
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
You can now use the `client` object to interact with the AssemblyAI API.
|
|
@@ -54,34 +54,43 @@ You can now use the `client` object to interact with the AssemblyAI API.
|
|
|
54
54
|
When you create a transcript, you can either pass in a URL to an audio file, or upload a file directly.
|
|
55
55
|
|
|
56
56
|
```javascript
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
57
|
+
// Transcribe file at remote URL
|
|
58
|
+
let transcript = await client.transcripts.transcribe({
|
|
59
|
+
audio: "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a",
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Upload a file via local path and transcribe
|
|
63
|
+
let transcript = await client.transcripts.transcribe({
|
|
64
|
+
audio: "./news.mp4",
|
|
65
|
+
});
|
|
61
66
|
```
|
|
62
67
|
|
|
68
|
+
> **Note**
|
|
69
|
+
> You can also pass streams and buffers to the `audio` property.
|
|
70
|
+
|
|
71
|
+
`transcribe` queues a transcription job and polls it until the `status` is `completed` or `error`.
|
|
72
|
+
You can configure the polling interval and polling timeout using these options:
|
|
73
|
+
|
|
63
74
|
```javascript
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
75
|
+
let transcript = await client.transcripts.transcribe(
|
|
76
|
+
{
|
|
77
|
+
audio: "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
// How frequently the transcript is polled in ms. Defaults to 3000.
|
|
81
|
+
pollingInterval: 1000,
|
|
82
|
+
// How long to wait in ms until the "Polling timeout" error is thrown. Defaults to infinite (-1).
|
|
83
|
+
pollingTimeout: 5000,
|
|
84
|
+
}
|
|
85
|
+
);
|
|
68
86
|
```
|
|
69
87
|
|
|
70
|
-
|
|
71
|
-
You can configure whether to poll, the polling interval, and polling timeout using these options:
|
|
88
|
+
If you don't want to wait until the transcript is ready, you can use `submit`:
|
|
72
89
|
|
|
73
90
|
```javascript
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
{
|
|
78
|
-
// Enable or disable polling. Defaults to true.
|
|
79
|
-
poll: true,
|
|
80
|
-
// How frequently the transcript is polled in ms. Defaults to 3000.
|
|
81
|
-
pollingInterval: 1000,
|
|
82
|
-
// How long to wait in ms until the "Polling timeout" error is thrown. Defaults to infinite (-1).
|
|
83
|
-
pollingTimeout: 5000,
|
|
84
|
-
})
|
|
91
|
+
let transcript = await client.transcripts.submit({
|
|
92
|
+
audio: "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a",
|
|
93
|
+
});
|
|
85
94
|
```
|
|
86
95
|
|
|
87
96
|
## Get a transcript
|
|
@@ -89,19 +98,18 @@ const transcript = await client.transcripts.create({
|
|
|
89
98
|
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`.
|
|
90
99
|
|
|
91
100
|
```javascript
|
|
92
|
-
const transcript = await client.transcripts.get(transcript.id)
|
|
101
|
+
const transcript = await client.transcripts.get(transcript.id);
|
|
93
102
|
```
|
|
94
103
|
|
|
95
|
-
If you
|
|
104
|
+
If you created a transcript using `submit`, you can still poll until the transcript `status` is `completed` or `error` using `waitUntilReady`:
|
|
96
105
|
|
|
97
106
|
```javascript
|
|
98
|
-
const transcript = await client.transcripts.waitUntilReady(transcript.id,
|
|
99
|
-
{
|
|
107
|
+
const transcript = await client.transcripts.waitUntilReady(transcript.id, {
|
|
100
108
|
// How frequently the transcript is polled in ms. Defaults to 3000.
|
|
101
109
|
pollingInterval: 1000,
|
|
102
110
|
// How long to wait in ms until the "Polling timeout" error is thrown. Defaults to infinite (-1).
|
|
103
111
|
pollingTimeout: 5000,
|
|
104
|
-
})
|
|
112
|
+
});
|
|
105
113
|
```
|
|
106
114
|
|
|
107
115
|
## List transcripts
|
|
@@ -109,7 +117,7 @@ const transcript = await client.transcripts.waitUntilReady(transcript.id,
|
|
|
109
117
|
This will return a page of transcripts you created.
|
|
110
118
|
|
|
111
119
|
```javascript
|
|
112
|
-
const page = await client.transcripts.list()
|
|
120
|
+
const page = await client.transcripts.list();
|
|
113
121
|
```
|
|
114
122
|
|
|
115
123
|
You can also paginate over all pages.
|
|
@@ -117,15 +125,15 @@ You can also paginate over all pages.
|
|
|
117
125
|
```typescript
|
|
118
126
|
let nextPageUrl: string | null = null;
|
|
119
127
|
do {
|
|
120
|
-
const page = await client.transcripts.list(nextPageUrl)
|
|
121
|
-
nextPageUrl = page.page_details.next_url
|
|
122
|
-
} while(nextPageUrl !== null)
|
|
128
|
+
const page = await client.transcripts.list(nextPageUrl);
|
|
129
|
+
nextPageUrl = page.page_details.next_url;
|
|
130
|
+
} while (nextPageUrl !== null);
|
|
123
131
|
```
|
|
124
132
|
|
|
125
133
|
## Delete a transcript
|
|
126
134
|
|
|
127
135
|
```javascript
|
|
128
|
-
const res = await client.transcripts.delete(transcript.id)
|
|
136
|
+
const res = await client.transcripts.delete(transcript.id);
|
|
129
137
|
```
|
|
130
138
|
|
|
131
139
|
## Use LeMUR
|
|
@@ -133,42 +141,46 @@ const res = await client.transcripts.delete(transcript.id)
|
|
|
133
141
|
Call [LeMUR endpoints](https://www.assemblyai.com/docs/API%20reference/lemur) to summarize, ask questions, generate action items, or run a custom task.
|
|
134
142
|
|
|
135
143
|
Custom Summary:
|
|
144
|
+
|
|
136
145
|
```javascript
|
|
137
146
|
const { response } = await client.lemur.summary({
|
|
138
|
-
transcript_ids: [
|
|
139
|
-
answer_format:
|
|
147
|
+
transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
|
|
148
|
+
answer_format: "one sentence",
|
|
140
149
|
context: {
|
|
141
|
-
speakers: [
|
|
142
|
-
}
|
|
143
|
-
})
|
|
150
|
+
speakers: ["Alex", "Bob"],
|
|
151
|
+
},
|
|
152
|
+
});
|
|
144
153
|
```
|
|
145
154
|
|
|
146
155
|
Question & Answer:
|
|
156
|
+
|
|
147
157
|
```javascript
|
|
148
158
|
const { response } = await client.lemur.questionAnswer({
|
|
149
|
-
transcript_ids: [
|
|
159
|
+
transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
|
|
150
160
|
questions: [
|
|
151
161
|
{
|
|
152
|
-
question:
|
|
153
|
-
answer_format:
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
})
|
|
162
|
+
question: "What are they discussing?",
|
|
163
|
+
answer_format: "text",
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
});
|
|
157
167
|
```
|
|
158
168
|
|
|
159
169
|
Action Items:
|
|
170
|
+
|
|
160
171
|
```javascript
|
|
161
172
|
const { response } = await client.lemur.actionItems({
|
|
162
|
-
transcript_ids: [
|
|
163
|
-
})
|
|
173
|
+
transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
|
|
174
|
+
});
|
|
164
175
|
```
|
|
165
176
|
|
|
166
177
|
Custom Task:
|
|
178
|
+
|
|
167
179
|
```javascript
|
|
168
180
|
const { response } = await client.lemur.task({
|
|
169
|
-
transcript_ids: [
|
|
170
|
-
prompt:
|
|
171
|
-
})
|
|
181
|
+
transcript_ids: ["0d295578-8c75-421a-885a-2c487f188927"],
|
|
182
|
+
prompt: "Write a haiku about this conversation.",
|
|
183
|
+
});
|
|
172
184
|
```
|
|
173
185
|
|
|
174
186
|
## Transcribe in real time
|
|
@@ -195,7 +207,7 @@ You can also generate a temporary auth token for real-time.
|
|
|
195
207
|
```typescript
|
|
196
208
|
const token = await client.realtime.createTemporaryToken({ expires_in = 60 });
|
|
197
209
|
const rt = client.realtime.createService({
|
|
198
|
-
token: token
|
|
210
|
+
token: token,
|
|
199
211
|
});
|
|
200
212
|
```
|
|
201
213
|
|
|
@@ -205,6 +217,7 @@ const rt = client.realtime.createService({
|
|
|
205
217
|
|
|
206
218
|
You can configure the following events.
|
|
207
219
|
|
|
220
|
+
<!-- prettier-ignore -->
|
|
208
221
|
```typescript
|
|
209
222
|
rt.on("open", ({ sessionId, expiresAt }) => console.log('Session ID:', sessionId, 'Expires at:', expiresAt));
|
|
210
223
|
rt.on("close", (code: number, reason: string) => console.log('Closed', code, reason));
|
|
@@ -228,6 +241,7 @@ getAudio((chunk) => {
|
|
|
228
241
|
rt.sendAudio(chunk);
|
|
229
242
|
});
|
|
230
243
|
```
|
|
244
|
+
|
|
231
245
|
Or send audio data via a stream by piping to the realtime stream.
|
|
232
246
|
|
|
233
247
|
```typescript
|
package/dist/index.esm.js
CHANGED
|
@@ -19,6 +19,18 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
19
19
|
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
function __rest(s, e) {
|
|
23
|
+
var t = {};
|
|
24
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
25
|
+
t[p] = s[p];
|
|
26
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
27
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
29
|
+
t[p[i]] = s[p[i]];
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
23
35
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
24
36
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -335,11 +347,55 @@ class TranscriptService extends BaseService {
|
|
|
335
347
|
super(params);
|
|
336
348
|
this.files = files;
|
|
337
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
|
|
352
|
+
* @param params The parameters to transcribe an audio file.
|
|
353
|
+
* @param options The options to transcribe an audio file.
|
|
354
|
+
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
355
|
+
*/
|
|
356
|
+
transcribe(params, options) {
|
|
357
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
358
|
+
const transcript = yield this.submit(params);
|
|
359
|
+
return yield this.waitUntilReady(transcript.id, options);
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
|
|
364
|
+
* @param params The parameters to start the transcription of an audio file.
|
|
365
|
+
* @returns A promise that resolves to the queued transcript.
|
|
366
|
+
*/
|
|
367
|
+
submit(params) {
|
|
368
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
369
|
+
const { audio } = params, createParams = __rest(params, ["audio"]);
|
|
370
|
+
let audioUrl;
|
|
371
|
+
if (typeof audio === "string") {
|
|
372
|
+
const path = getPath(audio);
|
|
373
|
+
if (path !== null) {
|
|
374
|
+
// audio is local path, upload local file
|
|
375
|
+
audioUrl = yield this.files.upload(path);
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
// audio is not a local path, assume it's a URL
|
|
379
|
+
audioUrl = audio;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
// audio is of uploadable type
|
|
384
|
+
audioUrl = yield this.files.upload(audio);
|
|
385
|
+
}
|
|
386
|
+
const data = yield this.fetchJson("/v2/transcript", {
|
|
387
|
+
method: "POST",
|
|
388
|
+
body: JSON.stringify(Object.assign(Object.assign({}, createParams), { audio_url: audioUrl })),
|
|
389
|
+
});
|
|
390
|
+
return data;
|
|
391
|
+
});
|
|
392
|
+
}
|
|
338
393
|
/**
|
|
339
394
|
* Create a transcript.
|
|
340
395
|
* @param params The parameters to create a transcript.
|
|
341
396
|
* @param options The options used for creating the new transcript.
|
|
342
|
-
* @returns A promise that resolves to the
|
|
397
|
+
* @returns A promise that resolves to the transcript.
|
|
398
|
+
* @deprecated Use `transcribe` instead to transcribe a audio file that includes polling, or `submit` to transcribe a audio file without polling.
|
|
343
399
|
*/
|
|
344
400
|
create(params, options) {
|
|
345
401
|
var _a;
|
|
@@ -359,6 +415,12 @@ class TranscriptService extends BaseService {
|
|
|
359
415
|
return data;
|
|
360
416
|
});
|
|
361
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Wait until the transcript ready, either the status is "completed" or "error".
|
|
420
|
+
* @param transcriptId The ID of the transcript.
|
|
421
|
+
* @param options The options to wait until the transcript is ready.
|
|
422
|
+
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
423
|
+
*/
|
|
362
424
|
waitUntilReady(transcriptId, options) {
|
|
363
425
|
var _a, _b;
|
|
364
426
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,18 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
21
21
|
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
function __rest(s, e) {
|
|
25
|
+
var t = {};
|
|
26
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
27
|
+
t[p] = s[p];
|
|
28
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
29
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
30
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
31
|
+
t[p[i]] = s[p[i]];
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
25
37
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
26
38
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -337,11 +349,55 @@ class TranscriptService extends BaseService {
|
|
|
337
349
|
super(params);
|
|
338
350
|
this.files = files;
|
|
339
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
|
|
354
|
+
* @param params The parameters to transcribe an audio file.
|
|
355
|
+
* @param options The options to transcribe an audio file.
|
|
356
|
+
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
357
|
+
*/
|
|
358
|
+
transcribe(params, options) {
|
|
359
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
360
|
+
const transcript = yield this.submit(params);
|
|
361
|
+
return yield this.waitUntilReady(transcript.id, options);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
|
|
366
|
+
* @param params The parameters to start the transcription of an audio file.
|
|
367
|
+
* @returns A promise that resolves to the queued transcript.
|
|
368
|
+
*/
|
|
369
|
+
submit(params) {
|
|
370
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
371
|
+
const { audio } = params, createParams = __rest(params, ["audio"]);
|
|
372
|
+
let audioUrl;
|
|
373
|
+
if (typeof audio === "string") {
|
|
374
|
+
const path = getPath(audio);
|
|
375
|
+
if (path !== null) {
|
|
376
|
+
// audio is local path, upload local file
|
|
377
|
+
audioUrl = yield this.files.upload(path);
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
// audio is not a local path, assume it's a URL
|
|
381
|
+
audioUrl = audio;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
// audio is of uploadable type
|
|
386
|
+
audioUrl = yield this.files.upload(audio);
|
|
387
|
+
}
|
|
388
|
+
const data = yield this.fetchJson("/v2/transcript", {
|
|
389
|
+
method: "POST",
|
|
390
|
+
body: JSON.stringify(Object.assign(Object.assign({}, createParams), { audio_url: audioUrl })),
|
|
391
|
+
});
|
|
392
|
+
return data;
|
|
393
|
+
});
|
|
394
|
+
}
|
|
340
395
|
/**
|
|
341
396
|
* Create a transcript.
|
|
342
397
|
* @param params The parameters to create a transcript.
|
|
343
398
|
* @param options The options used for creating the new transcript.
|
|
344
|
-
* @returns A promise that resolves to the
|
|
399
|
+
* @returns A promise that resolves to the transcript.
|
|
400
|
+
* @deprecated Use `transcribe` instead to transcribe a audio file that includes polling, or `submit` to transcribe a audio file without polling.
|
|
345
401
|
*/
|
|
346
402
|
create(params, options) {
|
|
347
403
|
var _a;
|
|
@@ -361,6 +417,12 @@ class TranscriptService extends BaseService {
|
|
|
361
417
|
return data;
|
|
362
418
|
});
|
|
363
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Wait until the transcript ready, either the status is "completed" or "error".
|
|
422
|
+
* @param transcriptId The ID of the transcript.
|
|
423
|
+
* @param options The options to wait until the transcript is ready.
|
|
424
|
+
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
425
|
+
*/
|
|
364
426
|
waitUntilReady(transcriptId, options) {
|
|
365
427
|
var _a, _b;
|
|
366
428
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseService } from "../base";
|
|
2
|
-
import {
|
|
2
|
+
import { FileUploadParams } from "../..";
|
|
3
3
|
export declare class FileService extends BaseService {
|
|
4
4
|
/**
|
|
5
5
|
* Upload a local file to AssemblyAI.
|
|
6
6
|
* @param input The local file path to upload, or a stream or buffer of the file to upload.
|
|
7
7
|
* @return A promise that resolves to the uploaded file URL.
|
|
8
8
|
*/
|
|
9
|
-
upload(input:
|
|
9
|
+
upload(input: FileUploadParams): Promise<string>;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LemurSummaryParams, LemurActionItemsParams, LemurQuestionAnswerParams, LemurTaskParams, LemurSummaryResponse, LemurQuestionAnswerResponse, LemurActionItemsResponse, LemurTaskResponse, PurgeLemurRequestDataResponse } from "../..";
|
|
2
2
|
import { BaseService } from "../base";
|
|
3
3
|
export declare class LemurService extends BaseService {
|
|
4
|
-
summary(params:
|
|
5
|
-
questionAnswer(params:
|
|
6
|
-
actionItems(params:
|
|
7
|
-
task(params:
|
|
4
|
+
summary(params: LemurSummaryParams): Promise<LemurSummaryResponse>;
|
|
5
|
+
questionAnswer(params: LemurQuestionAnswerParams): Promise<LemurQuestionAnswerResponse>;
|
|
6
|
+
actionItems(params: LemurActionItemsParams): Promise<LemurActionItemsResponse>;
|
|
7
|
+
task(params: LemurTaskParams): Promise<LemurTaskResponse>;
|
|
8
8
|
/**
|
|
9
9
|
* Delete the data for a previously submitted LeMUR request.
|
|
10
10
|
* @param id ID of the LeMUR request
|
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
import { BaseService } from "../base";
|
|
2
|
-
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList,
|
|
2
|
+
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, TranscriptParams, CreateTranscriptOptions, Createable, Deletable, Listable, Retrieveable, SubtitleFormat, RedactedAudioResponse, ListTranscriptParams, WordSearchResponse, BaseServiceParams, PollingOptions, TranscribeParams, TranscribeOptions, SubmitParams } from "../..";
|
|
3
3
|
import { FileService } from "../files";
|
|
4
|
-
export declare class TranscriptService extends BaseService implements Createable<Transcript,
|
|
4
|
+
export declare class TranscriptService extends BaseService implements Createable<Transcript, TranscriptParams, CreateTranscriptOptions>, Retrieveable<Transcript>, Deletable<Transcript>, Listable<TranscriptList> {
|
|
5
5
|
private files;
|
|
6
6
|
constructor(params: BaseServiceParams, files: FileService);
|
|
7
|
+
/**
|
|
8
|
+
* Transcribe an audio file. This will create a transcript and wait until the transcript status is "completed" or "error".
|
|
9
|
+
* @param params The parameters to transcribe an audio file.
|
|
10
|
+
* @param options The options to transcribe an audio file.
|
|
11
|
+
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
12
|
+
*/
|
|
13
|
+
transcribe(params: TranscribeParams, options?: TranscribeOptions): Promise<Transcript>;
|
|
14
|
+
/**
|
|
15
|
+
* Submits a transcription job for an audio file. This will not wait until the transcript status is "completed" or "error".
|
|
16
|
+
* @param params The parameters to start the transcription of an audio file.
|
|
17
|
+
* @returns A promise that resolves to the queued transcript.
|
|
18
|
+
*/
|
|
19
|
+
submit(params: SubmitParams): Promise<Transcript>;
|
|
7
20
|
/**
|
|
8
21
|
* Create a transcript.
|
|
9
22
|
* @param params The parameters to create a transcript.
|
|
10
23
|
* @param options The options used for creating the new transcript.
|
|
11
|
-
* @returns A promise that resolves to the
|
|
24
|
+
* @returns A promise that resolves to the transcript.
|
|
25
|
+
* @deprecated Use `transcribe` instead to transcribe a audio file that includes polling, or `submit` to transcribe a audio file without polling.
|
|
26
|
+
*/
|
|
27
|
+
create(params: TranscriptParams, options?: CreateTranscriptOptions): Promise<Transcript>;
|
|
28
|
+
/**
|
|
29
|
+
* Wait until the transcript ready, either the status is "completed" or "error".
|
|
30
|
+
* @param transcriptId The ID of the transcript.
|
|
31
|
+
* @param options The options to wait until the transcript is ready.
|
|
32
|
+
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
12
33
|
*/
|
|
13
|
-
create(params: CreateTranscriptParameters, options?: CreateTranscriptOptions): Promise<Transcript>;
|
|
14
34
|
waitUntilReady(transcriptId: string, options?: PollingOptions): Promise<Transcript>;
|
|
15
35
|
/**
|
|
16
36
|
* Retrieve a transcript.
|
|
@@ -22,7 +42,7 @@ export declare class TranscriptService extends BaseService implements Createable
|
|
|
22
42
|
* Retrieves a page of transcript listings.
|
|
23
43
|
* @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
|
|
24
44
|
*/
|
|
25
|
-
list(parameters?:
|
|
45
|
+
list(parameters?: ListTranscriptParams | string): Promise<TranscriptList>;
|
|
26
46
|
/**
|
|
27
47
|
* Delete a transcript
|
|
28
48
|
* @param id The identifier of the transcript.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FileUploadParams } from "./files";
|
|
2
|
+
import { CreateRealtimeTemporaryTokenParams, LemurActionItemsParams, LemurBaseParams, LemurQuestionAnswerParams, LemurSummaryParams, LemurTaskParams, ListTranscriptParams, TranscriptOptionalParams, TranscriptParams } from "./openapi.generated";
|
|
3
|
+
import { SubmitParams, TranscribeParams } from "./transcripts";
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
* Use`FileUploadParams` instead.
|
|
7
|
+
*/
|
|
8
|
+
export type FileUploadParameters = FileUploadParams;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated
|
|
11
|
+
* Use`TranscribeParams` instead.
|
|
12
|
+
*/
|
|
13
|
+
export type TranscribeParameters = TranscribeParams;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* Use`SubmitParams` instead.
|
|
17
|
+
*/
|
|
18
|
+
export type SubmitParameters = SubmitParams;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated
|
|
21
|
+
* Use`CreateRealtimeTemporaryTokenParams` instead.
|
|
22
|
+
*/
|
|
23
|
+
export type CreateRealtimeTemporaryTokenParameters = CreateRealtimeTemporaryTokenParams;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated
|
|
26
|
+
* Use`LemurActionItemsParams` instead.
|
|
27
|
+
*/
|
|
28
|
+
export type LemurActionItemsParameters = LemurActionItemsParams;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated
|
|
31
|
+
* Use`LemurBaseParams` instead.
|
|
32
|
+
*/
|
|
33
|
+
export type LemurBaseParameters = LemurBaseParams;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated
|
|
36
|
+
* Use`LemurQuestionAnswerParams` instead.
|
|
37
|
+
*/
|
|
38
|
+
export type LemurQuestionAnswerParameters = LemurQuestionAnswerParams;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated
|
|
41
|
+
* Use`LemurSummaryParams` instead.
|
|
42
|
+
*/
|
|
43
|
+
export type LemurSummaryParameters = LemurSummaryParams;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated
|
|
46
|
+
* Use`LemurTaskParams` instead.
|
|
47
|
+
*/
|
|
48
|
+
export type LemurTaskParameters = LemurTaskParams;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated
|
|
51
|
+
* Use`ListTranscriptParams` instead.
|
|
52
|
+
*/
|
|
53
|
+
export type TranscriptListParameters = ListTranscriptParams;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated
|
|
56
|
+
* Use`TranscriptOptionalParams` instead.
|
|
57
|
+
*/
|
|
58
|
+
export type CreateTranscriptOptionalParameters = TranscriptOptionalParams;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated
|
|
61
|
+
* Use`TranscriptParams` instead.
|
|
62
|
+
*/
|
|
63
|
+
export type CreateTranscriptParameters = TranscriptParams;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
type
|
|
2
|
+
type FileUploadParams = string | FileUploadData;
|
|
3
3
|
type FileUploadData = NodeJS.ReadableStream | ReadableStream | Blob | BufferSource | ArrayBufferView | ArrayBufferLike | Uint8Array;
|
|
4
|
-
export type {
|
|
4
|
+
export type { FileUploadParams, FileUploadData };
|
package/dist/types/index.d.ts
CHANGED