assemblyai 4.3.0 → 4.3.2
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/CHANGELOG.md +12 -0
- package/README.md +161 -86
- package/dist/assemblyai.umd.js +65 -59
- package/dist/assemblyai.umd.min.js +1 -1
- package/dist/bun.mjs +60 -54
- package/dist/deno.mjs +60 -54
- package/dist/index.cjs +65 -59
- package/dist/index.mjs +65 -59
- package/dist/node.cjs +60 -54
- package/dist/node.mjs +60 -54
- package/dist/services/base.d.ts +1 -1
- package/dist/services/files/index.d.ts +2 -2
- package/dist/services/index.d.ts +1 -1
- package/dist/services/lemur/index.d.ts +1 -1
- package/dist/services/realtime/service.d.ts +3 -3
- package/dist/services/transcripts/index.d.ts +26 -26
- package/dist/types/asyncapi.generated.d.ts +60 -39
- package/dist/types/openapi.generated.d.ts +722 -329
- package/dist/types/realtime/index.d.ts +2 -2
- package/dist/types/services/index.d.ts +0 -1
- package/dist/types/transcripts/index.d.ts +14 -5
- package/package.json +2 -1
- package/src/services/base.ts +1 -1
- package/src/services/files/index.ts +2 -2
- package/src/services/index.ts +1 -1
- package/src/services/lemur/index.ts +1 -1
- package/src/services/realtime/service.ts +7 -8
- package/src/services/transcripts/index.ts +47 -54
- package/src/types/asyncapi.generated.ts +62 -40
- package/src/types/openapi.generated.ts +726 -330
- package/src/types/realtime/index.ts +2 -2
- package/src/types/services/index.ts +0 -1
- package/src/types/transcripts/index.ts +17 -7
- package/dist/types/services/abstractions.d.ts +0 -52
- package/src/types/services/abstractions.ts +0 -56
|
@@ -1,86 +1,86 @@
|
|
|
1
1
|
import { BaseService } from "../base";
|
|
2
|
-
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, TranscriptParams, CreateTranscriptOptions,
|
|
2
|
+
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, TranscriptParams, CreateTranscriptOptions, SubtitleFormat, RedactedAudioResponse, ListTranscriptParams, WordSearchResponse, BaseServiceParams, PollingOptions, TranscribeParams, TranscribeOptions, SubmitParams } from "../..";
|
|
3
3
|
import { FileService } from "../files";
|
|
4
|
-
export declare class TranscriptService extends BaseService
|
|
4
|
+
export declare class TranscriptService extends BaseService {
|
|
5
5
|
private files;
|
|
6
6
|
constructor(params: BaseServiceParams, files: FileService);
|
|
7
7
|
/**
|
|
8
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.
|
|
9
|
+
* @param params - The parameters to transcribe an audio file.
|
|
10
|
+
* @param options - The options to transcribe an audio file.
|
|
11
11
|
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
12
12
|
*/
|
|
13
13
|
transcribe(params: TranscribeParams, options?: TranscribeOptions): Promise<Transcript>;
|
|
14
14
|
/**
|
|
15
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.
|
|
16
|
+
* @param params - The parameters to start the transcription of an audio file.
|
|
17
17
|
* @returns A promise that resolves to the queued transcript.
|
|
18
18
|
*/
|
|
19
19
|
submit(params: SubmitParams): Promise<Transcript>;
|
|
20
20
|
/**
|
|
21
21
|
* Create a transcript.
|
|
22
|
-
* @param params The parameters to create a transcript.
|
|
23
|
-
* @param options The options used for creating the new transcript.
|
|
22
|
+
* @param params - The parameters to create a transcript.
|
|
23
|
+
* @param options - The options used for creating the new transcript.
|
|
24
24
|
* @returns A promise that resolves to the transcript.
|
|
25
25
|
* @deprecated Use `transcribe` instead to transcribe a audio file that includes polling, or `submit` to transcribe a audio file without polling.
|
|
26
26
|
*/
|
|
27
27
|
create(params: TranscriptParams, options?: CreateTranscriptOptions): Promise<Transcript>;
|
|
28
28
|
/**
|
|
29
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.
|
|
30
|
+
* @param transcriptId - The ID of the transcript.
|
|
31
|
+
* @param options - The options to wait until the transcript is ready.
|
|
32
32
|
* @returns A promise that resolves to the transcript. The transcript status is "completed" or "error".
|
|
33
33
|
*/
|
|
34
34
|
waitUntilReady(transcriptId: string, options?: PollingOptions): Promise<Transcript>;
|
|
35
35
|
/**
|
|
36
36
|
* Retrieve a transcript.
|
|
37
|
-
* @param id The identifier of the transcript.
|
|
37
|
+
* @param id - The identifier of the transcript.
|
|
38
38
|
* @returns A promise that resolves to the transcript.
|
|
39
39
|
*/
|
|
40
40
|
get(id: string): Promise<Transcript>;
|
|
41
41
|
/**
|
|
42
42
|
* Retrieves a page of transcript listings.
|
|
43
|
-
* @param
|
|
43
|
+
* @param params - The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
|
|
44
44
|
*/
|
|
45
|
-
list(
|
|
45
|
+
list(params?: ListTranscriptParams | string): Promise<TranscriptList>;
|
|
46
46
|
/**
|
|
47
47
|
* Delete a transcript
|
|
48
|
-
* @param id The identifier of the transcript.
|
|
48
|
+
* @param id - The identifier of the transcript.
|
|
49
49
|
* @returns A promise that resolves to the transcript.
|
|
50
50
|
*/
|
|
51
51
|
delete(id: string): Promise<Transcript>;
|
|
52
52
|
/**
|
|
53
53
|
* Search through the transcript for a specific set of keywords.
|
|
54
54
|
* You can search for individual words, numbers, or phrases containing up to five words or numbers.
|
|
55
|
-
* @param id The identifier of the transcript.
|
|
56
|
-
* @param words Keywords to search for.
|
|
57
|
-
* @
|
|
55
|
+
* @param id - The identifier of the transcript.
|
|
56
|
+
* @param words - Keywords to search for.
|
|
57
|
+
* @returns A promise that resolves to the sentences.
|
|
58
58
|
*/
|
|
59
59
|
wordSearch(id: string, words: string[]): Promise<WordSearchResponse>;
|
|
60
60
|
/**
|
|
61
61
|
* Retrieve all sentences of a transcript.
|
|
62
|
-
* @param id The identifier of the transcript.
|
|
63
|
-
* @
|
|
62
|
+
* @param id - The identifier of the transcript.
|
|
63
|
+
* @returns A promise that resolves to the sentences.
|
|
64
64
|
*/
|
|
65
65
|
sentences(id: string): Promise<SentencesResponse>;
|
|
66
66
|
/**
|
|
67
67
|
* Retrieve all paragraphs of a transcript.
|
|
68
|
-
* @param id The identifier of the transcript.
|
|
69
|
-
* @
|
|
68
|
+
* @param id - The identifier of the transcript.
|
|
69
|
+
* @returns A promise that resolves to the paragraphs.
|
|
70
70
|
*/
|
|
71
71
|
paragraphs(id: string): Promise<ParagraphsResponse>;
|
|
72
72
|
/**
|
|
73
73
|
* Retrieve subtitles of a transcript.
|
|
74
|
-
* @param id The identifier of the transcript.
|
|
75
|
-
* @param format The format of the subtitles.
|
|
76
|
-
* @param chars_per_caption The maximum number of characters per caption.
|
|
77
|
-
* @
|
|
74
|
+
* @param id - The identifier of the transcript.
|
|
75
|
+
* @param format - The format of the subtitles.
|
|
76
|
+
* @param chars_per_caption - The maximum number of characters per caption.
|
|
77
|
+
* @returns A promise that resolves to the subtitles text.
|
|
78
78
|
*/
|
|
79
79
|
subtitles(id: string, format?: SubtitleFormat, chars_per_caption?: number): Promise<string>;
|
|
80
80
|
/**
|
|
81
81
|
* Retrieve redactions of a transcript.
|
|
82
|
-
* @param id The identifier of the transcript.
|
|
83
|
-
* @
|
|
82
|
+
* @param id - The identifier of the transcript.
|
|
83
|
+
* @returns A promise that resolves to the subtitles text.
|
|
84
84
|
*/
|
|
85
85
|
redactions(id: string): Promise<RedactedAudioResponse>;
|
|
86
86
|
}
|
|
@@ -1,64 +1,80 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @description Binary audio data
|
|
2
|
+
* Binary audio data
|
|
4
3
|
*/
|
|
5
4
|
export type AudioData = ArrayBufferLike;
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
* @enum {string}
|
|
6
|
+
* The encoding of the audio data
|
|
7
|
+
* @defaultValue "pcm_s16"le
|
|
10
8
|
*/
|
|
11
9
|
export type AudioEncoding = "pcm_s16le" | "pcm_mulaw";
|
|
12
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
|
|
12
|
+
*/
|
|
13
13
|
export type ConfigureEndUtteranceSilenceThreshold = {
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The duration threshold in milliseconds
|
|
16
|
+
*/
|
|
15
17
|
end_utterance_silence_threshold: number;
|
|
16
18
|
};
|
|
17
19
|
export type FinalTranscript = RealtimeBaseTranscript & {
|
|
18
20
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @constant
|
|
21
|
+
* Describes the type of message
|
|
21
22
|
*/
|
|
22
23
|
message_type: "FinalTranscript";
|
|
23
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Whether the text is punctuated and cased
|
|
26
|
+
*/
|
|
24
27
|
punctuated: boolean;
|
|
25
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Whether the text is formatted, for example Dollar -> $
|
|
30
|
+
*/
|
|
26
31
|
text_formatted: boolean;
|
|
27
32
|
};
|
|
28
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Manually end an utterance
|
|
35
|
+
*/
|
|
29
36
|
export type ForceEndUtterance = {
|
|
30
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* A boolean value to communicate that you wish to force the end of the utterance
|
|
39
|
+
*/
|
|
31
40
|
force_end_utterance: boolean;
|
|
32
41
|
};
|
|
33
|
-
/** @enum {string} */
|
|
34
42
|
export type MessageType = "SessionBegins" | "PartialTranscript" | "FinalTranscript" | "SessionTerminated";
|
|
35
43
|
export type PartialTranscript = RealtimeBaseTranscript & {
|
|
36
44
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @constant
|
|
45
|
+
* Describes the type of message
|
|
39
46
|
*/
|
|
40
47
|
message_type: "PartialTranscript";
|
|
41
48
|
};
|
|
42
49
|
export type RealtimeBaseMessage = {
|
|
43
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Describes the type of the message
|
|
52
|
+
*/
|
|
44
53
|
message_type: MessageType;
|
|
45
54
|
};
|
|
46
55
|
export type RealtimeBaseTranscript = {
|
|
47
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* End time of audio sample relative to session start, in milliseconds
|
|
58
|
+
*/
|
|
48
59
|
audio_end: number;
|
|
49
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Start time of audio sample relative to session start, in milliseconds
|
|
62
|
+
*/
|
|
50
63
|
audio_start: number;
|
|
51
64
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @description The confidence score of the entire transcription, between 0 and 1
|
|
65
|
+
* The confidence score of the entire transcription, between 0 and 1
|
|
54
66
|
*/
|
|
55
67
|
confidence: number;
|
|
56
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* The timestamp for the partial transcript
|
|
70
|
+
*/
|
|
57
71
|
created: Date;
|
|
58
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* The partial transcript for your audio
|
|
74
|
+
*/
|
|
59
75
|
text: string;
|
|
60
76
|
/**
|
|
61
|
-
*
|
|
77
|
+
* An array of objects, with the information for each word in the transcription text.
|
|
62
78
|
* Includes the start and end time of the word in milliseconds, the confidence score of the word, and the text, which is the word itself.
|
|
63
79
|
*/
|
|
64
80
|
words: Word[];
|
|
@@ -68,43 +84,48 @@ export type RealtimeError = {
|
|
|
68
84
|
};
|
|
69
85
|
export type RealtimeMessage = SessionBegins | PartialTranscript | FinalTranscript | SessionTerminated | RealtimeError;
|
|
70
86
|
export type RealtimeTranscript = PartialTranscript | FinalTranscript;
|
|
71
|
-
/** @enum {string} */
|
|
72
87
|
export type RealtimeTranscriptType = "PartialTranscript" | "FinalTranscript";
|
|
73
88
|
export type SessionBegins = RealtimeBaseMessage & {
|
|
74
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Timestamp when this session will expire
|
|
91
|
+
*/
|
|
75
92
|
expires_at: Date;
|
|
76
93
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @constant
|
|
94
|
+
* Describes the type of the message
|
|
79
95
|
*/
|
|
80
96
|
message_type: "SessionBegins";
|
|
81
97
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @description Unique identifier for the established session
|
|
98
|
+
* Unique identifier for the established session
|
|
84
99
|
*/
|
|
85
100
|
session_id: string;
|
|
86
101
|
};
|
|
87
102
|
export type SessionTerminated = RealtimeBaseMessage & {
|
|
88
103
|
/**
|
|
89
|
-
*
|
|
90
|
-
* @constant
|
|
104
|
+
* Describes the type of the message
|
|
91
105
|
*/
|
|
92
106
|
message_type: "SessionTerminated";
|
|
93
107
|
};
|
|
94
|
-
export type TerminateSession =
|
|
95
|
-
/**
|
|
108
|
+
export type TerminateSession = {
|
|
109
|
+
/**
|
|
110
|
+
* Set to true to end your real-time session forever
|
|
111
|
+
*/
|
|
96
112
|
terminate_session: boolean;
|
|
97
113
|
};
|
|
98
114
|
export type Word = {
|
|
99
115
|
/**
|
|
100
|
-
*
|
|
101
|
-
* @description Confidence score of the word
|
|
116
|
+
* Confidence score of the word
|
|
102
117
|
*/
|
|
103
118
|
confidence: number;
|
|
104
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* End time of the word in milliseconds
|
|
121
|
+
*/
|
|
105
122
|
end: number;
|
|
106
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Start time of the word in milliseconds
|
|
125
|
+
*/
|
|
107
126
|
start: number;
|
|
108
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* The word itself
|
|
129
|
+
*/
|
|
109
130
|
text: string;
|
|
110
131
|
};
|