assemblyai 2.0.2 → 3.0.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 +2 -2
- package/dist/index.d.ts +1 -3
- package/dist/index.esm.js +120 -115
- package/dist/index.js +120 -118
- package/dist/services/base.d.ts +6 -4
- package/dist/services/files/index.d.ts +4 -3
- package/dist/services/index.d.ts +1 -1
- package/dist/services/lemur/index.d.ts +2 -2
- package/dist/services/realtime/factory.d.ts +5 -6
- package/dist/services/realtime/index.d.ts +2 -2
- package/dist/services/realtime/service.d.ts +2 -3
- package/dist/services/transcripts/index.d.ts +7 -9
- package/dist/types/files/index.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/openapi.generated.d.ts +45 -15
- package/package.json +2 -2
- package/src/index.ts +1 -6
- package/src/services/base.ts +44 -3
- package/src/services/files/index.ts +15 -9
- package/src/services/index.ts +10 -8
- package/src/services/lemur/index.ts +28 -27
- package/src/services/realtime/factory.ts +17 -12
- package/src/services/realtime/index.ts +2 -2
- package/src/services/realtime/service.ts +5 -6
- package/src/services/transcripts/index.ts +46 -49
- package/src/types/files/index.ts +11 -0
- package/src/types/index.ts +1 -0
- package/src/types/openapi.generated.ts +47 -15
- package/dist/utils/axios.d.ts +0 -3
- package/src/utils/axios.ts +0 -19
package/dist/index.js
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var axios = require('axios');
|
|
6
3
|
var WebSocket = require('ws');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
function createAxiosClient(params) {
|
|
11
|
-
const client = axios.create({
|
|
12
|
-
baseURL: params.baseUrl,
|
|
13
|
-
headers: { Authorization: params.apiKey },
|
|
14
|
-
});
|
|
15
|
-
client.interceptors.response.use(undefined, throwApiError);
|
|
16
|
-
return client;
|
|
17
|
-
}
|
|
18
|
-
function throwApiError(error) {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
if (axios.isAxiosError(error) && ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error)) {
|
|
21
|
-
return Promise.reject(new Error(error.response.data.error));
|
|
22
|
-
}
|
|
23
|
-
return Promise.reject(error);
|
|
24
|
-
}
|
|
4
|
+
var Stream = require('stream');
|
|
5
|
+
var fs = require('fs');
|
|
25
6
|
|
|
26
7
|
/******************************************************************************
|
|
27
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -61,36 +42,70 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
61
42
|
class BaseService {
|
|
62
43
|
/**
|
|
63
44
|
* Create a new service.
|
|
64
|
-
* @param params The
|
|
45
|
+
* @param params The parameters to use for the service.
|
|
65
46
|
*/
|
|
66
|
-
constructor(
|
|
67
|
-
this.
|
|
47
|
+
constructor(params) {
|
|
48
|
+
this.params = params;
|
|
49
|
+
}
|
|
50
|
+
fetch(input, init) {
|
|
51
|
+
var _a;
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
init = init !== null && init !== void 0 ? init : {};
|
|
54
|
+
init.headers = (_a = init.headers) !== null && _a !== void 0 ? _a : {};
|
|
55
|
+
init.headers = Object.assign({ Authorization: this.params.apiKey, "Content-Type": "application/json" }, init.headers);
|
|
56
|
+
if (!input.startsWith("http"))
|
|
57
|
+
input = this.params.baseUrl + input;
|
|
58
|
+
const response = yield fetch(input, init);
|
|
59
|
+
if (response.status >= 400) {
|
|
60
|
+
let json;
|
|
61
|
+
const text = yield response.text();
|
|
62
|
+
if (text) {
|
|
63
|
+
try {
|
|
64
|
+
json = JSON.parse(text);
|
|
65
|
+
}
|
|
66
|
+
catch (_b) {
|
|
67
|
+
/* empty */
|
|
68
|
+
}
|
|
69
|
+
if (json === null || json === void 0 ? void 0 : json.error)
|
|
70
|
+
throw new Error(json.error);
|
|
71
|
+
throw new Error(text);
|
|
72
|
+
}
|
|
73
|
+
throw new Error(`HTTP Error: ${response.status} ${response.statusText}`);
|
|
74
|
+
}
|
|
75
|
+
return response;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
fetchJson(input, init) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const response = yield this.fetch(input, init);
|
|
81
|
+
return response.json();
|
|
82
|
+
});
|
|
68
83
|
}
|
|
69
84
|
}
|
|
70
85
|
|
|
71
86
|
class LemurService extends BaseService {
|
|
72
87
|
summary(params) {
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
return this.fetchJson("/lemur/v3/generate/summary", {
|
|
89
|
+
method: "POST",
|
|
90
|
+
body: JSON.stringify(params),
|
|
76
91
|
});
|
|
77
92
|
}
|
|
78
93
|
questionAnswer(params) {
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
return this.fetchJson("/lemur/v3/generate/question-answer", {
|
|
95
|
+
method: "POST",
|
|
96
|
+
body: JSON.stringify(params),
|
|
82
97
|
});
|
|
83
98
|
}
|
|
84
99
|
actionItems(params) {
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
return this.fetchJson("/lemur/v3/generate/action-items", {
|
|
101
|
+
method: "POST",
|
|
102
|
+
body: JSON.stringify(params),
|
|
88
103
|
});
|
|
89
104
|
}
|
|
90
105
|
task(params) {
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
return this.fetchJson("/lemur/v3/generate/task", {
|
|
107
|
+
method: "POST",
|
|
108
|
+
body: JSON.stringify(params),
|
|
94
109
|
});
|
|
95
110
|
}
|
|
96
111
|
/**
|
|
@@ -98,9 +113,8 @@ class LemurService extends BaseService {
|
|
|
98
113
|
* @param id ID of the LeMUR request
|
|
99
114
|
*/
|
|
100
115
|
purgeRequestData(id) {
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
return data;
|
|
116
|
+
return this.fetchJson(`/lemur/v3/${id}`, {
|
|
117
|
+
method: "DELETE",
|
|
104
118
|
});
|
|
105
119
|
}
|
|
106
120
|
}
|
|
@@ -149,12 +163,11 @@ class RealtimeError extends Error {
|
|
|
149
163
|
const defaultRealtimeUrl = "wss://api.assemblyai.com/v2/realtime/ws";
|
|
150
164
|
class RealtimeService {
|
|
151
165
|
constructor(params) {
|
|
152
|
-
var _a, _b
|
|
166
|
+
var _a, _b;
|
|
153
167
|
this.listeners = {};
|
|
154
168
|
this.realtimeUrl = (_a = params.realtimeUrl) !== null && _a !== void 0 ? _a : defaultRealtimeUrl;
|
|
155
169
|
this.sampleRate = (_b = params.sampleRate) !== null && _b !== void 0 ? _b : 16000;
|
|
156
170
|
this.wordBoost = params.wordBoost;
|
|
157
|
-
this.realtimeUrl = (_c = params.realtimeUrl) !== null && _c !== void 0 ? _c : defaultRealtimeUrl;
|
|
158
171
|
if ("apiKey" in params)
|
|
159
172
|
this.apiKey = params.apiKey;
|
|
160
173
|
if ("token" in params)
|
|
@@ -262,13 +275,13 @@ class RealtimeService {
|
|
|
262
275
|
this.socket.send(JSON.stringify(payload));
|
|
263
276
|
}
|
|
264
277
|
stream() {
|
|
265
|
-
const stream
|
|
278
|
+
const stream = new Stream.Writable({
|
|
266
279
|
write: (chunk, encoding, next) => {
|
|
267
280
|
this.sendAudio(chunk);
|
|
268
281
|
next();
|
|
269
282
|
},
|
|
270
283
|
});
|
|
271
|
-
return stream
|
|
284
|
+
return stream;
|
|
272
285
|
}
|
|
273
286
|
close(waitForSessionTermination = true) {
|
|
274
287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -295,30 +308,33 @@ class RealtimeService {
|
|
|
295
308
|
}
|
|
296
309
|
}
|
|
297
310
|
|
|
298
|
-
class RealtimeServiceFactory {
|
|
299
|
-
constructor(
|
|
300
|
-
|
|
301
|
-
this.
|
|
311
|
+
class RealtimeServiceFactory extends BaseService {
|
|
312
|
+
constructor(params) {
|
|
313
|
+
super(params);
|
|
314
|
+
this.rtFactoryParams = params;
|
|
302
315
|
}
|
|
303
316
|
createService(params) {
|
|
304
317
|
if (!params)
|
|
305
|
-
params = { apiKey: this.
|
|
318
|
+
params = { apiKey: this.rtFactoryParams.apiKey };
|
|
306
319
|
else if (!("token" in params) && !params.apiKey) {
|
|
307
|
-
params.apiKey = this.
|
|
320
|
+
params.apiKey = this.rtFactoryParams.apiKey;
|
|
308
321
|
}
|
|
309
322
|
return new RealtimeService(params);
|
|
310
323
|
}
|
|
311
324
|
createTemporaryToken(params) {
|
|
312
325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
313
|
-
const
|
|
314
|
-
|
|
326
|
+
const data = yield this.fetchJson("/v2/realtime/token", {
|
|
327
|
+
method: "POST",
|
|
328
|
+
body: JSON.stringify(params),
|
|
329
|
+
});
|
|
330
|
+
return data.token;
|
|
315
331
|
});
|
|
316
332
|
}
|
|
317
333
|
}
|
|
318
334
|
|
|
319
335
|
class TranscriptService extends BaseService {
|
|
320
|
-
constructor(
|
|
321
|
-
super(
|
|
336
|
+
constructor(params, files) {
|
|
337
|
+
super(params);
|
|
322
338
|
this.files = files;
|
|
323
339
|
}
|
|
324
340
|
/**
|
|
@@ -335,11 +351,14 @@ class TranscriptService extends BaseService {
|
|
|
335
351
|
const uploadUrl = yield this.files.upload(path);
|
|
336
352
|
params.audio_url = uploadUrl;
|
|
337
353
|
}
|
|
338
|
-
const
|
|
354
|
+
const data = yield this.fetchJson("/v2/transcript", {
|
|
355
|
+
method: "POST",
|
|
356
|
+
body: JSON.stringify(params),
|
|
357
|
+
});
|
|
339
358
|
if ((_a = options === null || options === void 0 ? void 0 : options.poll) !== null && _a !== void 0 ? _a : true) {
|
|
340
|
-
return yield this.poll(
|
|
359
|
+
return yield this.poll(data.id, options);
|
|
341
360
|
}
|
|
342
|
-
return
|
|
361
|
+
return data;
|
|
343
362
|
});
|
|
344
363
|
}
|
|
345
364
|
poll(transcriptId, options) {
|
|
@@ -368,20 +387,28 @@ class TranscriptService extends BaseService {
|
|
|
368
387
|
* @returns A promise that resolves to the transcript.
|
|
369
388
|
*/
|
|
370
389
|
get(id) {
|
|
371
|
-
return
|
|
372
|
-
const res = yield this.client.get(`/v2/transcript/${id}`);
|
|
373
|
-
return res.data;
|
|
374
|
-
});
|
|
390
|
+
return this.fetchJson(`/v2/transcript/${id}`);
|
|
375
391
|
}
|
|
376
|
-
// TODO: add options overload to support list querystring parameters
|
|
377
392
|
/**
|
|
378
|
-
* Retrieves a
|
|
379
|
-
* @param
|
|
380
|
-
* @returns
|
|
393
|
+
* Retrieves a page of transcript listings.
|
|
394
|
+
* @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
|
|
381
395
|
*/
|
|
382
|
-
list(
|
|
396
|
+
list(parameters) {
|
|
383
397
|
return __awaiter(this, void 0, void 0, function* () {
|
|
384
|
-
|
|
398
|
+
let url = "/v2/transcript";
|
|
399
|
+
if (typeof parameters === "string") {
|
|
400
|
+
url = parameters;
|
|
401
|
+
}
|
|
402
|
+
else if (parameters) {
|
|
403
|
+
url = `${url}?${new URLSearchParams(Object.keys(parameters).map((key) => {
|
|
404
|
+
var _a;
|
|
405
|
+
return [
|
|
406
|
+
key,
|
|
407
|
+
((_a = parameters[key]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
|
|
408
|
+
];
|
|
409
|
+
}))}`;
|
|
410
|
+
}
|
|
411
|
+
const data = yield this.fetchJson(url);
|
|
385
412
|
for (const transcriptListItem of data.transcripts) {
|
|
386
413
|
transcriptListItem.created = new Date(transcriptListItem.created);
|
|
387
414
|
if (transcriptListItem.completed) {
|
|
@@ -397,27 +424,17 @@ class TranscriptService extends BaseService {
|
|
|
397
424
|
* @returns A promise that resolves to the transcript.
|
|
398
425
|
*/
|
|
399
426
|
delete(id) {
|
|
400
|
-
return
|
|
401
|
-
const res = yield this.client.delete(`/v2/transcript/${id}`);
|
|
402
|
-
return res.data;
|
|
403
|
-
});
|
|
427
|
+
return this.fetchJson(`/v2/transcript/${id}`, { method: "DELETE" });
|
|
404
428
|
}
|
|
405
429
|
/**
|
|
406
430
|
* Search through the transcript for a specific set of keywords.
|
|
407
431
|
* You can search for individual words, numbers, or phrases containing up to five words or numbers.
|
|
408
432
|
* @param id The identifier of the transcript.
|
|
409
|
-
* @param
|
|
433
|
+
* @param words Keywords to search for.
|
|
410
434
|
* @return A promise that resolves to the sentences.
|
|
411
435
|
*/
|
|
412
436
|
wordSearch(id, words) {
|
|
413
|
-
return
|
|
414
|
-
const { data } = yield this.client.get(`/v2/transcript/${id}/word-search`, {
|
|
415
|
-
params: {
|
|
416
|
-
words: JSON.stringify(words),
|
|
417
|
-
},
|
|
418
|
-
});
|
|
419
|
-
return data;
|
|
420
|
-
});
|
|
437
|
+
return this.fetchJson(`/v2/transcript/${id}/word-search?words=${JSON.stringify(words)}`);
|
|
421
438
|
}
|
|
422
439
|
/**
|
|
423
440
|
* Retrieve all sentences of a transcript.
|
|
@@ -425,10 +442,7 @@ class TranscriptService extends BaseService {
|
|
|
425
442
|
* @return A promise that resolves to the sentences.
|
|
426
443
|
*/
|
|
427
444
|
sentences(id) {
|
|
428
|
-
return
|
|
429
|
-
const { data } = yield this.client.get(`/v2/transcript/${id}/sentences`);
|
|
430
|
-
return data;
|
|
431
|
-
});
|
|
445
|
+
return this.fetchJson(`/v2/transcript/${id}/sentences`);
|
|
432
446
|
}
|
|
433
447
|
/**
|
|
434
448
|
* Retrieve all paragraphs of a transcript.
|
|
@@ -436,10 +450,7 @@ class TranscriptService extends BaseService {
|
|
|
436
450
|
* @return A promise that resolves to the paragraphs.
|
|
437
451
|
*/
|
|
438
452
|
paragraphs(id) {
|
|
439
|
-
return
|
|
440
|
-
const { data } = yield this.client.get(`/v2/transcript/${id}/paragraphs`);
|
|
441
|
-
return data;
|
|
442
|
-
});
|
|
453
|
+
return this.fetchJson(`/v2/transcript/${id}/paragraphs`);
|
|
443
454
|
}
|
|
444
455
|
/**
|
|
445
456
|
* Retrieve subtitles of a transcript.
|
|
@@ -449,8 +460,8 @@ class TranscriptService extends BaseService {
|
|
|
449
460
|
*/
|
|
450
461
|
subtitles(id, format = "srt") {
|
|
451
462
|
return __awaiter(this, void 0, void 0, function* () {
|
|
452
|
-
const
|
|
453
|
-
return
|
|
463
|
+
const response = yield this.fetch(`/v2/transcript/${id}/${format}`);
|
|
464
|
+
return yield response.text();
|
|
454
465
|
});
|
|
455
466
|
}
|
|
456
467
|
/**
|
|
@@ -459,10 +470,7 @@ class TranscriptService extends BaseService {
|
|
|
459
470
|
* @return A promise that resolves to the subtitles text.
|
|
460
471
|
*/
|
|
461
472
|
redactions(id) {
|
|
462
|
-
return
|
|
463
|
-
const { data } = yield this.client.get(`/v2/transcript/${id}/redacted-audio`);
|
|
464
|
-
return data;
|
|
465
|
-
});
|
|
473
|
+
return this.fetchJson(`/v2/transcript/${id}/redacted-audio`);
|
|
466
474
|
}
|
|
467
475
|
}
|
|
468
476
|
function getPath(path) {
|
|
@@ -482,55 +490,49 @@ function getPath(path) {
|
|
|
482
490
|
class FileService extends BaseService {
|
|
483
491
|
/**
|
|
484
492
|
* Upload a local file to AssemblyAI.
|
|
485
|
-
* @param
|
|
493
|
+
* @param input The local file path to upload, or a stream or buffer of the file to upload.
|
|
486
494
|
* @return A promise that resolves to the uploaded file URL.
|
|
487
495
|
*/
|
|
488
|
-
upload(
|
|
496
|
+
upload(input) {
|
|
489
497
|
return __awaiter(this, void 0, void 0, function* () {
|
|
490
|
-
|
|
491
|
-
|
|
498
|
+
let fileData;
|
|
499
|
+
if (typeof input === "string")
|
|
500
|
+
fileData = fs.createReadStream(input);
|
|
501
|
+
else
|
|
502
|
+
fileData = input;
|
|
503
|
+
const data = yield this.fetchJson("/v2/upload", {
|
|
504
|
+
method: "POST",
|
|
505
|
+
body: fileData,
|
|
492
506
|
headers: {
|
|
493
507
|
"Content-Type": "application/octet-stream",
|
|
494
508
|
},
|
|
509
|
+
duplex: "half",
|
|
495
510
|
});
|
|
496
511
|
return data.upload_url;
|
|
497
512
|
});
|
|
498
513
|
}
|
|
499
514
|
}
|
|
500
515
|
|
|
516
|
+
const defaultBaseUrl = "https://api.assemblyai.com";
|
|
501
517
|
class AssemblyAI {
|
|
502
518
|
/**
|
|
503
519
|
* Create a new AssemblyAI client.
|
|
504
520
|
* @param params The parameters for the service, including the API key and base URL, if any.
|
|
505
521
|
*/
|
|
506
522
|
constructor(params) {
|
|
507
|
-
params.baseUrl = params.baseUrl ||
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
this.
|
|
511
|
-
this.
|
|
512
|
-
this.
|
|
523
|
+
params.baseUrl = params.baseUrl || defaultBaseUrl;
|
|
524
|
+
if (params.baseUrl && params.baseUrl.endsWith("/"))
|
|
525
|
+
params.baseUrl = params.baseUrl.slice(0, -1);
|
|
526
|
+
this.files = new FileService(params);
|
|
527
|
+
this.transcripts = new TranscriptService(params, this.files);
|
|
528
|
+
this.lemur = new LemurService(params);
|
|
529
|
+
this.realtime = new RealtimeServiceFactory(params);
|
|
513
530
|
}
|
|
514
531
|
}
|
|
515
532
|
|
|
516
|
-
var services = /*#__PURE__*/Object.freeze({
|
|
517
|
-
__proto__: null,
|
|
518
|
-
AssemblyAI: AssemblyAI,
|
|
519
|
-
FileService: FileService,
|
|
520
|
-
LemurService: LemurService,
|
|
521
|
-
RealtimeService: RealtimeService,
|
|
522
|
-
RealtimeServiceFactory: RealtimeServiceFactory,
|
|
523
|
-
TranscriptService: TranscriptService
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
class AssemblyAIExports extends AssemblyAI {
|
|
527
|
-
}
|
|
528
|
-
module.exports = Object.assign(AssemblyAIExports, services);
|
|
529
|
-
|
|
530
533
|
exports.AssemblyAI = AssemblyAI;
|
|
531
534
|
exports.FileService = FileService;
|
|
532
535
|
exports.LemurService = LemurService;
|
|
533
536
|
exports.RealtimeService = RealtimeService;
|
|
534
537
|
exports.RealtimeServiceFactory = RealtimeServiceFactory;
|
|
535
538
|
exports.TranscriptService = TranscriptService;
|
|
536
|
-
exports.default = AssemblyAI;
|
package/dist/services/base.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseServiceParams } from "..";
|
|
2
2
|
/**
|
|
3
3
|
* Base class for services that communicate with the API.
|
|
4
4
|
*/
|
|
5
5
|
export declare abstract class BaseService {
|
|
6
|
-
|
|
6
|
+
private params;
|
|
7
7
|
/**
|
|
8
8
|
* Create a new service.
|
|
9
|
-
* @param params The
|
|
9
|
+
* @param params The parameters to use for the service.
|
|
10
10
|
*/
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(params: BaseServiceParams);
|
|
12
|
+
protected fetch(input: string, init?: RequestInit | undefined): Promise<Response>;
|
|
13
|
+
protected fetchJson<T>(input: string, init?: RequestInit | undefined): Promise<T>;
|
|
12
14
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BaseService } from "
|
|
1
|
+
import { BaseService } from "../base";
|
|
2
|
+
import { FileUploadParameters } from "../..";
|
|
2
3
|
export declare class FileService extends BaseService {
|
|
3
4
|
/**
|
|
4
5
|
* Upload a local file to AssemblyAI.
|
|
5
|
-
* @param
|
|
6
|
+
* @param input The local file path to upload, or a stream or buffer of the file to upload.
|
|
6
7
|
* @return A promise that resolves to the uploaded file URL.
|
|
7
8
|
*/
|
|
8
|
-
upload(
|
|
9
|
+
upload(input: FileUploadParameters): Promise<string>;
|
|
9
10
|
}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LemurSummaryParameters, LemurActionItemsParameters, LemurQuestionAnswerParameters, LemurTaskParameters, LemurSummaryResponse, LemurQuestionAnswerResponse, LemurActionItemsResponse, LemurTaskResponse, PurgeLemurRequestDataResponse } from "
|
|
2
|
-
import { BaseService } from "
|
|
1
|
+
import { LemurSummaryParameters, LemurActionItemsParameters, LemurQuestionAnswerParameters, LemurTaskParameters, LemurSummaryResponse, LemurQuestionAnswerResponse, LemurActionItemsResponse, LemurTaskResponse, PurgeLemurRequestDataResponse } from "../..";
|
|
2
|
+
import { BaseService } from "../base";
|
|
3
3
|
export declare class LemurService extends BaseService {
|
|
4
4
|
summary(params: LemurSummaryParameters): Promise<LemurSummaryResponse>;
|
|
5
5
|
questionAnswer(params: LemurQuestionAnswerParameters): Promise<LemurQuestionAnswerResponse>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { BaseServiceParams, RealtimeTokenParams, CreateRealtimeServiceParams } from "
|
|
2
|
-
import { AxiosInstance } from "axios";
|
|
1
|
+
import { BaseServiceParams, RealtimeTokenParams, CreateRealtimeServiceParams } from "../..";
|
|
3
2
|
import { RealtimeService } from "./service";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
private
|
|
7
|
-
constructor(
|
|
3
|
+
import { BaseService } from "../base";
|
|
4
|
+
export declare class RealtimeServiceFactory extends BaseService {
|
|
5
|
+
private rtFactoryParams;
|
|
6
|
+
constructor(params: BaseServiceParams);
|
|
8
7
|
createService(params?: CreateRealtimeServiceParams): RealtimeService;
|
|
9
8
|
createTemporaryToken(params: RealtimeTokenParams): Promise<string>;
|
|
10
9
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "
|
|
2
|
-
export * from "
|
|
1
|
+
export * from "./factory";
|
|
2
|
+
export * from "./service";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { RealtimeServiceParams, RealtimeTranscript, PartialTranscript, FinalTranscript, SessionBeginsEventData } from "
|
|
3
|
-
import { Writable } from "stream";
|
|
2
|
+
import { RealtimeServiceParams, RealtimeTranscript, PartialTranscript, FinalTranscript, SessionBeginsEventData } from "../..";
|
|
4
3
|
export declare class RealtimeService {
|
|
5
4
|
private realtimeUrl;
|
|
6
5
|
private sampleRate;
|
|
@@ -20,6 +19,6 @@ export declare class RealtimeService {
|
|
|
20
19
|
on(event: "close", listener: (code: number, reason: string) => void): void;
|
|
21
20
|
connect(): Promise<SessionBeginsEventData>;
|
|
22
21
|
sendAudio(audio: ArrayBuffer): void;
|
|
23
|
-
stream():
|
|
22
|
+
stream(): NodeJS.WritableStream;
|
|
24
23
|
close(waitForSessionTermination?: boolean): Promise<void>;
|
|
25
24
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { BaseService } from "
|
|
2
|
-
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, CreateTranscriptParameters, CreateTranscriptOptions, Createable, Deletable, Listable, Retrieveable, SubtitleFormat, RedactedAudioResponse, WordSearchResponse } from "
|
|
3
|
-
import { AxiosInstance } from "axios";
|
|
1
|
+
import { BaseService } from "../base";
|
|
2
|
+
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, CreateTranscriptParameters, CreateTranscriptOptions, Createable, Deletable, Listable, Retrieveable, SubtitleFormat, RedactedAudioResponse, TranscriptListParameters, WordSearchResponse, BaseServiceParams } from "../..";
|
|
4
3
|
import { FileService } from "../files";
|
|
5
4
|
export declare class TranscriptService extends BaseService implements Createable<Transcript, CreateTranscriptParameters, CreateTranscriptOptions>, Retrieveable<Transcript>, Deletable<Transcript>, Listable<TranscriptList> {
|
|
6
5
|
private files;
|
|
7
|
-
constructor(
|
|
6
|
+
constructor(params: BaseServiceParams, files: FileService);
|
|
8
7
|
/**
|
|
9
8
|
* Create a transcript.
|
|
10
9
|
* @param params The parameters to create a transcript.
|
|
@@ -20,11 +19,10 @@ export declare class TranscriptService extends BaseService implements Createable
|
|
|
20
19
|
*/
|
|
21
20
|
get(id: string): Promise<Transcript>;
|
|
22
21
|
/**
|
|
23
|
-
* Retrieves a
|
|
24
|
-
* @param
|
|
25
|
-
* @returns
|
|
22
|
+
* Retrieves a page of transcript listings.
|
|
23
|
+
* @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
|
|
26
24
|
*/
|
|
27
|
-
list(
|
|
25
|
+
list(parameters?: TranscriptListParameters | string): Promise<TranscriptList>;
|
|
28
26
|
/**
|
|
29
27
|
* Delete a transcript
|
|
30
28
|
* @param id The identifier of the transcript.
|
|
@@ -35,7 +33,7 @@ export declare class TranscriptService extends BaseService implements Createable
|
|
|
35
33
|
* Search through the transcript for a specific set of keywords.
|
|
36
34
|
* You can search for individual words, numbers, or phrases containing up to five words or numbers.
|
|
37
35
|
* @param id The identifier of the transcript.
|
|
38
|
-
* @param
|
|
36
|
+
* @param words Keywords to search for.
|
|
39
37
|
* @return A promise that resolves to the sentences.
|
|
40
38
|
*/
|
|
41
39
|
wordSearch(id: string, words: string[]): Promise<WordSearchResponse>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
type FileUploadParameters = string | FileUploadData;
|
|
3
|
+
type FileUploadData = NodeJS.ReadableStream | ReadableStream | Blob | BufferSource | ArrayBufferView | ArrayBufferLike | Uint8Array;
|
|
4
|
+
export type { FileUploadParameters, FileUploadData };
|
package/dist/types/index.d.ts
CHANGED