assemblyai 2.0.0-beta → 2.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 +148 -48
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +218 -123
- package/dist/index.js +225 -123
- package/dist/services/base.d.ts +0 -2
- package/dist/services/index.d.ts +7 -9
- package/dist/services/lemur/index.d.ts +6 -6
- package/dist/services/realtime/factory.d.ts +10 -0
- package/dist/services/realtime/index.d.ts +2 -16
- package/dist/services/realtime/service.d.ts +22 -0
- package/dist/services/transcripts/index.d.ts +37 -20
- package/dist/types/asyncapi.generated.d.ts +87 -0
- package/dist/types/index.d.ts +3 -4
- package/dist/types/openapi.generated.d.ts +685 -0
- package/dist/types/realtime/index.d.ts +30 -11
- package/dist/types/services/abstractions.d.ts +8 -36
- package/dist/types/services/index.d.ts +2 -5
- package/dist/types/transcripts/index.d.ts +5 -0
- package/dist/utils/axios.d.ts +3 -0
- package/dist/utils/errors/realtime.d.ts +1 -4
- package/package.json +16 -8
- package/src/index.ts +3 -0
- package/src/services/base.ts +1 -3
- package/src/services/files/index.ts +4 -4
- package/src/services/index.ts +18 -35
- package/src/services/lemur/index.ts +20 -16
- package/src/services/realtime/factory.ts +32 -0
- package/src/services/realtime/index.ts +2 -106
- package/src/services/realtime/service.ts +184 -0
- package/src/services/transcripts/index.ts +85 -63
- package/src/types/asyncapi.generated.ts +124 -0
- package/src/types/index.ts +3 -4
- package/src/types/openapi.generated.ts +834 -0
- package/src/types/realtime/index.ts +53 -13
- package/src/types/services/abstractions.ts +8 -40
- package/src/types/services/index.ts +2 -6
- package/src/types/transcripts/index.ts +5 -0
- package/src/utils/axios.ts +19 -0
- package/src/utils/errors/realtime.ts +5 -18
- package/dist/services/transcripts/redactions.d.ts +0 -14
- package/dist/services/transcripts/subtitles.d.ts +0 -12
- package/dist/types/core/index.d.ts +0 -2
- package/dist/types/core/params.d.ts +0 -2
- package/dist/types/core/segments.d.ts +0 -28
- package/dist/types/core/transcript.d.ts +0 -113
- package/dist/types/lemur/index.d.ts +0 -79
- package/dist/types/models/auto_chapter.d.ts +0 -8
- package/dist/types/models/auto_highlights.d.ts +0 -11
- package/dist/types/models/content_safety.d.ts +0 -25
- package/dist/types/models/entity_detection.d.ts +0 -7
- package/dist/types/models/index.d.ts +0 -8
- package/dist/types/models/pii.d.ts +0 -3
- package/dist/types/models/sentiment_analysis.d.ts +0 -9
- package/dist/types/models/shared.d.ts +0 -3
- package/dist/types/models/summarization.d.ts +0 -3
- package/dist/types/models/topic_detection.d.ts +0 -17
- package/dist/types/shared/index.d.ts +0 -2
- package/dist/types/shared/pagination.d.ts +0 -7
- package/dist/types/shared/timestamp.d.ts +0 -5
- package/src/services/transcripts/redactions.ts +0 -27
- package/src/services/transcripts/subtitles.ts +0 -26
- package/src/types/core/index.ts +0 -2
- package/src/types/core/params.ts +0 -3
- package/src/types/core/segments.ts +0 -29
- package/src/types/core/transcript.ts +0 -159
- package/src/types/lemur/index.ts +0 -97
- package/src/types/models/auto_chapter.ts +0 -9
- package/src/types/models/auto_highlights.ts +0 -14
- package/src/types/models/content_safety.ts +0 -34
- package/src/types/models/entity_detection.ts +0 -8
- package/src/types/models/index.ts +0 -8
- package/src/types/models/pii.ts +0 -32
- package/src/types/models/sentiment_analysis.ts +0 -11
- package/src/types/models/shared.ts +0 -4
- package/src/types/models/summarization.ts +0 -10
- package/src/types/models/topic_detection.ts +0 -21
- package/src/types/shared/index.ts +0 -2
- package/src/types/shared/pagination.ts +0 -8
- package/src/types/shared/timestamp.ts +0 -6
|
@@ -1,42 +1,59 @@
|
|
|
1
1
|
import BaseService from "@/services/base";
|
|
2
|
-
import
|
|
3
|
-
import { ParagraphsBody, SentencesBody, Transcript, TranscriptList, TranscriptParams, TranscriptPollingSettings, Createable, Deletable, Listable, Retrieveable } from "@/types";
|
|
4
|
-
import TranscriptRedactionService from "./redactions";
|
|
2
|
+
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, CreateTranscriptParameters, CreateTranscriptOptions, Createable, Deletable, Listable, Retrieveable, SubtitleFormat, RedactedAudioResponse } from "@/types";
|
|
5
3
|
import { AxiosInstance } from "axios";
|
|
6
4
|
import FileService from "../files";
|
|
7
|
-
export default class TranscriptService extends BaseService implements Createable<Transcript,
|
|
5
|
+
export default class TranscriptService extends BaseService implements Createable<Transcript, CreateTranscriptParameters, CreateTranscriptOptions>, Retrieveable<Transcript>, Deletable<Transcript>, Listable<TranscriptList> {
|
|
8
6
|
private files;
|
|
7
|
+
constructor(client: AxiosInstance, files: FileService);
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* Create a transcript.
|
|
10
|
+
* @param params The parameters to create a transcript.
|
|
11
|
+
* @param options The options used for creating the new transcript.
|
|
12
|
+
* @returns A promise that resolves to the newly created transcript.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
create(params: CreateTranscriptParameters, options?: CreateTranscriptOptions): Promise<Transcript>;
|
|
15
|
+
private poll;
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
17
|
+
* Retrieve a transcript.
|
|
18
|
+
* @param id The identifier of the transcript.
|
|
19
|
+
* @returns A promise that resolves to the transcript.
|
|
15
20
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
get(id: string): Promise<Transcript>;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a paged list of transcript listings.
|
|
24
|
+
* @param nextUrl The URL to retrieve the transcript list from. If not provided, the first page will be retrieved.
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
list(nextUrl?: string | null): Promise<TranscriptList>;
|
|
23
28
|
/**
|
|
24
|
-
*
|
|
29
|
+
* Delete a transcript
|
|
25
30
|
* @param id The identifier of the transcript.
|
|
26
|
-
* @
|
|
27
|
-
* @return A promise that resolves to the retrieved resource.
|
|
31
|
+
* @returns A promise that resolves to the transcript.
|
|
28
32
|
*/
|
|
29
|
-
|
|
33
|
+
delete(id: string): Promise<Transcript>;
|
|
30
34
|
/**
|
|
31
35
|
* Retrieve all sentences of a transcript.
|
|
32
36
|
* @param id The identifier of the transcript.
|
|
33
37
|
* @return A promise that resolves to the sentences.
|
|
34
38
|
*/
|
|
35
|
-
sentences(id: string): Promise<
|
|
39
|
+
sentences(id: string): Promise<SentencesResponse>;
|
|
36
40
|
/**
|
|
37
41
|
* Retrieve all paragraphs of a transcript.
|
|
38
42
|
* @param id The identifier of the transcript.
|
|
39
43
|
* @return A promise that resolves to the paragraphs.
|
|
40
44
|
*/
|
|
41
|
-
paragraphs(id: string): Promise<
|
|
45
|
+
paragraphs(id: string): Promise<ParagraphsResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieve subtitles of a transcript.
|
|
48
|
+
* @param id The identifier of the transcript.
|
|
49
|
+
* @param format The format of the subtitles.
|
|
50
|
+
* @return A promise that resolves to the subtitles text.
|
|
51
|
+
*/
|
|
52
|
+
subtitles(id: string, format?: SubtitleFormat): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Retrieve redactions of a transcript.
|
|
55
|
+
* @param id The identifier of the transcript.
|
|
56
|
+
* @return A promise that resolves to the subtitles text.
|
|
57
|
+
*/
|
|
58
|
+
redactions(id: string): Promise<RedactedAudioResponse>;
|
|
42
59
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export type AudioData = {
|
|
2
|
+
/** @description Raw audio data, base64 encoded. This can be the raw data recorded directly from a microphone or read from an audio file. */
|
|
3
|
+
audio_data: string;
|
|
4
|
+
};
|
|
5
|
+
export type FinalTranscript = RealtimeBaseTranscript & {
|
|
6
|
+
/**
|
|
7
|
+
* @description Describes the type of message.
|
|
8
|
+
* @constant
|
|
9
|
+
*/
|
|
10
|
+
message_type: "FinalTranscript";
|
|
11
|
+
/** @description Whether the text has been punctuated and cased. */
|
|
12
|
+
punctuated: boolean;
|
|
13
|
+
/** @description Whether the text has been formatted (e.g. Dollar -> $) */
|
|
14
|
+
text_formatted: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** @enum {string} */
|
|
17
|
+
export type MessageType = "SessionBegins" | "PartialTranscript" | "FinalTranscript" | "SessionTerminated";
|
|
18
|
+
export type PartialTranscript = RealtimeBaseTranscript & {
|
|
19
|
+
/**
|
|
20
|
+
* @description Describes the type of message.
|
|
21
|
+
* @constant
|
|
22
|
+
*/
|
|
23
|
+
message_type: "PartialTranscript";
|
|
24
|
+
};
|
|
25
|
+
export type RealtimeBaseMessage = {
|
|
26
|
+
/** @description Describes the type of the message. */
|
|
27
|
+
message_type: MessageType;
|
|
28
|
+
};
|
|
29
|
+
export type RealtimeBaseTranscript = {
|
|
30
|
+
/** @description End time of audio sample relative to session start, in milliseconds. */
|
|
31
|
+
audio_end: number;
|
|
32
|
+
/** @description Start time of audio sample relative to session start, in milliseconds. */
|
|
33
|
+
audio_start: number;
|
|
34
|
+
/**
|
|
35
|
+
* Format: double
|
|
36
|
+
* @description The confidence score of the entire transcription, between 0 and 1.
|
|
37
|
+
*/
|
|
38
|
+
confidence: number;
|
|
39
|
+
/** @description The timestamp for the partial transcript. */
|
|
40
|
+
created: Date;
|
|
41
|
+
/** @description The partial transcript for your audio. */
|
|
42
|
+
text: string;
|
|
43
|
+
/** @description An array of objects, with the information for each word in the transcription text. Includes the start/end time (in milliseconds) of the word, the confidence score of the word, and the text (i.e. the word itself). */
|
|
44
|
+
words: Word[];
|
|
45
|
+
};
|
|
46
|
+
export type RealtimeError = {
|
|
47
|
+
error: string;
|
|
48
|
+
};
|
|
49
|
+
export type RealtimeMessage = SessionBegins | PartialTranscript | FinalTranscript | SessionTerminated | RealtimeError;
|
|
50
|
+
export type RealtimeTranscript = PartialTranscript | FinalTranscript;
|
|
51
|
+
/** @enum {string} */
|
|
52
|
+
export type RealtimeTranscriptType = "PartialTranscript" | "FinalTranscript";
|
|
53
|
+
export type SessionBegins = RealtimeBaseMessage & {
|
|
54
|
+
/** @description Timestamp when this session will expire. */
|
|
55
|
+
expires_at: Date;
|
|
56
|
+
/**
|
|
57
|
+
* @description Describes the type of the message.
|
|
58
|
+
* @constant
|
|
59
|
+
*/
|
|
60
|
+
message_type: "SessionBegins";
|
|
61
|
+
/** @description Unique identifier for the established session. */
|
|
62
|
+
session_id: string;
|
|
63
|
+
};
|
|
64
|
+
export type SessionTerminated = RealtimeBaseMessage & {
|
|
65
|
+
/**
|
|
66
|
+
* @description Describes the type of the message.
|
|
67
|
+
* @constant
|
|
68
|
+
*/
|
|
69
|
+
message_type: "SessionTerminated";
|
|
70
|
+
};
|
|
71
|
+
export type TerminateSession = RealtimeBaseMessage & {
|
|
72
|
+
/** @description A boolean value to communicate that you wish to end your real-time session forever. */
|
|
73
|
+
terminate_session: boolean;
|
|
74
|
+
};
|
|
75
|
+
export type Word = {
|
|
76
|
+
/**
|
|
77
|
+
* Format: double
|
|
78
|
+
* @description Confidence score of the word
|
|
79
|
+
*/
|
|
80
|
+
confidence: number;
|
|
81
|
+
/** @description End time of the word in milliseconds */
|
|
82
|
+
end: number;
|
|
83
|
+
/** @description Start time of the word in milliseconds */
|
|
84
|
+
start: number;
|
|
85
|
+
/** @description The word itself */
|
|
86
|
+
text: string;
|
|
87
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export type * from "./
|
|
2
|
-
export type * from "./lemur";
|
|
3
|
-
export type * from "./models";
|
|
1
|
+
export type * from "./transcripts";
|
|
4
2
|
export type * from "./realtime";
|
|
5
3
|
export type * from "./services";
|
|
6
|
-
export type * from "./
|
|
4
|
+
export type * from "./asyncapi.generated";
|
|
5
|
+
export type * from "./openapi.generated";
|