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,28 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
FinalTranscript,
|
|
3
|
+
PartialTranscript,
|
|
4
|
+
RealtimeTranscript,
|
|
5
|
+
RealtimeTranscriptType,
|
|
6
|
+
} from "../asyncapi.generated";
|
|
7
|
+
|
|
8
|
+
type CreateRealtimeServiceParams = {
|
|
9
|
+
realtimeUrl?: string;
|
|
2
10
|
sampleRate?: number;
|
|
3
11
|
wordBoost?: string[];
|
|
4
|
-
}
|
|
12
|
+
} & (
|
|
13
|
+
| {
|
|
14
|
+
apiKey?: string;
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
token: string;
|
|
18
|
+
}
|
|
19
|
+
);
|
|
5
20
|
|
|
6
|
-
type
|
|
21
|
+
type RealtimeServiceParams = {
|
|
22
|
+
realtimeUrl?: string;
|
|
23
|
+
sampleRate?: number;
|
|
24
|
+
wordBoost?: string[];
|
|
25
|
+
} & (
|
|
26
|
+
| {
|
|
27
|
+
apiKey: string;
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
token: string;
|
|
31
|
+
}
|
|
32
|
+
);
|
|
7
33
|
|
|
8
|
-
type
|
|
34
|
+
type RealtimeEvents =
|
|
35
|
+
| "open"
|
|
36
|
+
| "close"
|
|
37
|
+
| "transcript"
|
|
38
|
+
| "transcript.partial"
|
|
39
|
+
| "transcript.final"
|
|
40
|
+
| "error";
|
|
9
41
|
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
42
|
+
type SessionBeginsEventData = {
|
|
43
|
+
sessionId: string;
|
|
44
|
+
expiresAt: Date;
|
|
13
45
|
};
|
|
14
46
|
|
|
15
47
|
type RealtimeListeners = {
|
|
16
|
-
|
|
17
|
-
error?: (error: Error) => void;
|
|
18
|
-
open?: () => void;
|
|
48
|
+
open?: (event: SessionBeginsEventData) => void;
|
|
19
49
|
close?: (code: number, reason: string) => void;
|
|
50
|
+
transcript?: (transcript: RealtimeTranscript) => void;
|
|
51
|
+
"transcript.partial"?: (transcript: PartialTranscript) => void;
|
|
52
|
+
"transcript.final"?: (transcript: FinalTranscript) => void;
|
|
53
|
+
error?: (error: Error) => void;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type RealtimeTokenParams = {
|
|
57
|
+
expires_in: number;
|
|
20
58
|
};
|
|
21
59
|
|
|
22
60
|
export type {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
61
|
+
CreateRealtimeServiceParams,
|
|
62
|
+
RealtimeServiceParams,
|
|
63
|
+
RealtimeEvents,
|
|
26
64
|
RealtimeTranscriptType,
|
|
65
|
+
SessionBeginsEventData,
|
|
27
66
|
RealtimeListeners,
|
|
67
|
+
RealtimeTokenParams,
|
|
28
68
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Interface for classes that can create resources.
|
|
3
3
|
* @template T The type of the resource.
|
|
4
|
-
* @template
|
|
4
|
+
* @template Parameters The type of the parameters required to create the resource.
|
|
5
5
|
*/
|
|
6
|
-
interface Createable<T,
|
|
6
|
+
interface Createable<T, Parameters, Options = Record<string, any>> {
|
|
7
7
|
/**
|
|
8
8
|
* Create a new resource.
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
9
|
+
* @param params The parameters of the new resource.
|
|
10
|
+
* @param options The options used for creating the new resource.
|
|
11
11
|
* @return A promise that resolves to the newly created resource.
|
|
12
12
|
*/
|
|
13
|
-
create(params:
|
|
13
|
+
create(params: Parameters, options?: Options): Promise<T>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -20,11 +20,11 @@ interface Createable<T, Props, Settings = Record<string, any>> {
|
|
|
20
20
|
*/
|
|
21
21
|
interface Retrieveable<T, Id = string> {
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Get a resource.
|
|
24
24
|
* @param id The identifier of the resource to retrieve.
|
|
25
25
|
* @return A promise that resolves to the retrieved resource.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
get(id: Id): Promise<T>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -53,36 +53,4 @@ interface Listable<T, Page = string> {
|
|
|
53
53
|
list(page?: Page): Promise<T>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
* Interface for classes that can connect to resources.
|
|
58
|
-
* @template T The type of the resource's data.
|
|
59
|
-
*/
|
|
60
|
-
interface Connectable<T, Params> {
|
|
61
|
-
/**
|
|
62
|
-
* Connect to a resource.
|
|
63
|
-
* @param event The event to listen for.
|
|
64
|
-
* @param listener The listener for the event.
|
|
65
|
-
*/
|
|
66
|
-
on(event: "data", listener: (data: T) => void): void;
|
|
67
|
-
on(event: "error", listener: (error: Error) => void): void;
|
|
68
|
-
on(event: "open", listener: () => void): void;
|
|
69
|
-
on(event: "close", listener: (code: number, reason: string) => void): void;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Send data to the resource.
|
|
73
|
-
* @param data The data to send.
|
|
74
|
-
*/
|
|
75
|
-
send(data: ArrayBuffer): void;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Connect to the resource.
|
|
79
|
-
*/
|
|
80
|
-
connect(params: Params): void;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Disconnect from the resource.
|
|
84
|
-
*/
|
|
85
|
-
disconnect(): void;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type { Createable, Retrieveable, Deletable, Listable, Connectable };
|
|
56
|
+
export type { Createable, Retrieveable, Deletable, Listable };
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
type BaseServiceParams = {
|
|
2
|
-
|
|
2
|
+
apiKey: string;
|
|
3
3
|
baseUrl?: string;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
type Upload = {
|
|
7
|
-
upload_url: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
6
|
export type * from "./abstractions";
|
|
11
|
-
export type { BaseServiceParams
|
|
7
|
+
export type { BaseServiceParams };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import axios, { isAxiosError } from "axios";
|
|
2
|
+
import { BaseServiceParams } from "../.";
|
|
3
|
+
|
|
4
|
+
export function createAxiosClient(params: BaseServiceParams) {
|
|
5
|
+
const client = axios.create({
|
|
6
|
+
baseURL: params.baseUrl,
|
|
7
|
+
headers: { Authorization: params.apiKey },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
client.interceptors.response.use(undefined, throwApiError);
|
|
11
|
+
return client;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function throwApiError(error: unknown) {
|
|
15
|
+
if (isAxiosError(error) && error.response?.data?.error) {
|
|
16
|
+
return Promise.reject(new Error(error.response.data.error));
|
|
17
|
+
}
|
|
18
|
+
return Promise.reject(error);
|
|
19
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
enum RealtimeErrorType {
|
|
2
2
|
BadSampleRate = 4000,
|
|
3
3
|
AuthFailed = 4001,
|
|
4
|
-
InsufficientFunds
|
|
5
|
-
|
|
4
|
+
// Both InsufficientFunds and FreeAccount error use 4002
|
|
5
|
+
InsufficientFundsOrFreeAccount = 4002,
|
|
6
6
|
NonexistentSessionId = 4004,
|
|
7
7
|
SessionExpired = 4008,
|
|
8
8
|
ClosedSession = 4010,
|
|
@@ -21,9 +21,8 @@ enum RealtimeErrorType {
|
|
|
21
21
|
const RealtimeErrorMessages: Record<RealtimeErrorType, string> = {
|
|
22
22
|
[RealtimeErrorType.BadSampleRate]: "Sample rate must be a positive integer",
|
|
23
23
|
[RealtimeErrorType.AuthFailed]: "Not Authorized",
|
|
24
|
-
[RealtimeErrorType.
|
|
25
|
-
|
|
26
|
-
"This feature is paid-only and requires you to add a credit card. Please visit https://assemblyai.com/dashboard/ to add a credit card to your account",
|
|
24
|
+
[RealtimeErrorType.InsufficientFundsOrFreeAccount]:
|
|
25
|
+
"Insufficient funds or you are using a free account. This feature is paid-only and requires you to add a credit card. Please visit https://assemblyai.com/dashboard/ to add a credit card to your account.",
|
|
27
26
|
[RealtimeErrorType.NonexistentSessionId]: "Session ID does not exist",
|
|
28
27
|
[RealtimeErrorType.SessionExpired]: "Session has expired",
|
|
29
28
|
[RealtimeErrorType.ClosedSession]: "Session is closed",
|
|
@@ -40,19 +39,7 @@ const RealtimeErrorMessages: Record<RealtimeErrorType, string> = {
|
|
|
40
39
|
"Reconnect attempts exhausted",
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
class RealtimeError extends Error {
|
|
44
|
-
public code: RealtimeErrorType;
|
|
45
|
-
|
|
46
|
-
constructor(code: RealtimeErrorType) {
|
|
47
|
-
const message = RealtimeErrorMessages[code];
|
|
48
|
-
super(message);
|
|
49
|
-
|
|
50
|
-
this.name = this.constructor.name;
|
|
51
|
-
this.code = code;
|
|
52
|
-
|
|
53
|
-
Error.captureStackTrace(this, this.constructor);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
42
|
+
class RealtimeError extends Error {}
|
|
56
43
|
|
|
57
44
|
export { RealtimeErrorType, RealtimeErrorMessages };
|
|
58
45
|
export default RealtimeError;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import BaseService from "@/services/base";
|
|
2
|
-
import { Retrieveable } from "@/types";
|
|
3
|
-
type TranscriptRedactionParams = {
|
|
4
|
-
transcript_id: string;
|
|
5
|
-
path: string;
|
|
6
|
-
};
|
|
7
|
-
type TranscriptRedactionResponse = {
|
|
8
|
-
status: "redacted_audio_ready";
|
|
9
|
-
redacted_audio_url: string;
|
|
10
|
-
};
|
|
11
|
-
export default class TranscriptRedactionService extends BaseService implements Retrieveable<TranscriptRedactionResponse, TranscriptRedactionParams> {
|
|
12
|
-
retrieve(params: TranscriptRedactionParams): Promise<TranscriptRedactionResponse>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import BaseService from "@/services/base";
|
|
2
|
-
import { Retrieveable } from "@/types";
|
|
3
|
-
type Subtitle = string;
|
|
4
|
-
type SubtitleFormat = "vtt" | "srt";
|
|
5
|
-
type TranscriptionSubtitleParams = {
|
|
6
|
-
transcript_id: string;
|
|
7
|
-
format: SubtitleFormat;
|
|
8
|
-
};
|
|
9
|
-
export default class TranscriptSubtitleService extends BaseService implements Retrieveable<Subtitle, TranscriptionSubtitleParams> {
|
|
10
|
-
retrieve({ transcript_id, format, }: TranscriptionSubtitleParams): Promise<Subtitle>;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
type SegmentType = "paragraphs" | "sentences";
|
|
2
|
-
type Segment<T> = T & {
|
|
3
|
-
id: string;
|
|
4
|
-
confidence: number;
|
|
5
|
-
audio_duration: number;
|
|
6
|
-
};
|
|
7
|
-
type ParagraphsBody = Segment<{
|
|
8
|
-
paragraphs: Utterance[];
|
|
9
|
-
}>;
|
|
10
|
-
type SentencesBody = Segment<{
|
|
11
|
-
sentences: Utterance[];
|
|
12
|
-
}>;
|
|
13
|
-
type Word = {
|
|
14
|
-
text: string;
|
|
15
|
-
start: number;
|
|
16
|
-
end: number;
|
|
17
|
-
confidence: number;
|
|
18
|
-
speaker?: string | null;
|
|
19
|
-
};
|
|
20
|
-
type Utterance = {
|
|
21
|
-
start: number;
|
|
22
|
-
end: number;
|
|
23
|
-
confidence: number;
|
|
24
|
-
speaker?: string;
|
|
25
|
-
text: string;
|
|
26
|
-
words: Word[];
|
|
27
|
-
};
|
|
28
|
-
export type { Word, Utterance, ParagraphsBody, SentencesBody, SegmentType };
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { AutoChapter, AutoHighlights, ContentSafetyLabels, Entity, PIIAudioQuality, PIIRedactionPolicies, SentimentAnalysis, SummaryModel, SummaryType, TopicDetection } from "@/types/models";
|
|
2
|
-
import { PageDetails } from "@/types/shared";
|
|
3
|
-
import { Utterance, Word } from "./segments";
|
|
4
|
-
import { WordBoostWeight } from "./params";
|
|
5
|
-
type TranscriptStatus = "queued" | "processing" | "completed" | "error";
|
|
6
|
-
type TranscriptBase = {
|
|
7
|
-
status?: TranscriptStatus | null;
|
|
8
|
-
audio_url: string;
|
|
9
|
-
audio_start_from?: number | null;
|
|
10
|
-
audio_end_at?: number | null;
|
|
11
|
-
filter_profanity?: boolean;
|
|
12
|
-
custom_spelling?: null;
|
|
13
|
-
disfluencies?: boolean;
|
|
14
|
-
dual_channel?: boolean | null;
|
|
15
|
-
punctuate?: boolean;
|
|
16
|
-
speaker_labels?: boolean;
|
|
17
|
-
format_text?: boolean;
|
|
18
|
-
auto_chapters?: boolean;
|
|
19
|
-
content_safety?: boolean;
|
|
20
|
-
entity_detection?: boolean;
|
|
21
|
-
language_code?: string;
|
|
22
|
-
language_detection?: boolean;
|
|
23
|
-
iab_categories?: boolean;
|
|
24
|
-
auto_highlights?: boolean;
|
|
25
|
-
summarization?: boolean;
|
|
26
|
-
summary_type?: SummaryType;
|
|
27
|
-
summary_model?: SummaryModel;
|
|
28
|
-
redact_pii?: boolean;
|
|
29
|
-
redact_pii_sub?: string;
|
|
30
|
-
redact_pii_audio_quality?: PIIAudioQuality;
|
|
31
|
-
redact_pii_audio?: boolean;
|
|
32
|
-
redact_pii_policies?: PIIRedactionPolicies[];
|
|
33
|
-
sentiment_analysis?: boolean;
|
|
34
|
-
webhook_auth_header_name?: null;
|
|
35
|
-
webhook_auth?: boolean;
|
|
36
|
-
webhook_status_code?: null | number;
|
|
37
|
-
webhook_url?: null | string;
|
|
38
|
-
word_boost?: string[];
|
|
39
|
-
boost_param?: WordBoostWeight;
|
|
40
|
-
};
|
|
41
|
-
type TranscriptParams = Omit<TranscriptBase, "status">;
|
|
42
|
-
type TranscriptQueued = TranscriptBase & {
|
|
43
|
-
id: string;
|
|
44
|
-
status: "queued";
|
|
45
|
-
};
|
|
46
|
-
type TranscriptProcessing = TranscriptBase & {
|
|
47
|
-
id: string;
|
|
48
|
-
status: "processing";
|
|
49
|
-
};
|
|
50
|
-
type TranscriptCompleted = TranscriptBase & {
|
|
51
|
-
status: "completed";
|
|
52
|
-
id: string;
|
|
53
|
-
audio_duration?: number;
|
|
54
|
-
words?: Word[];
|
|
55
|
-
utterances?: Utterance[];
|
|
56
|
-
text?: string;
|
|
57
|
-
confidence?: number;
|
|
58
|
-
chapters?: AutoChapter[] | null;
|
|
59
|
-
content_safety_labels?: ContentSafetyLabels;
|
|
60
|
-
entities?: Entity[];
|
|
61
|
-
iab_categories_result?: TopicDetection;
|
|
62
|
-
auto_highlights_result?: AutoHighlights;
|
|
63
|
-
summary?: string;
|
|
64
|
-
sentiment_analysis_results?: SentimentAnalysis[];
|
|
65
|
-
/**
|
|
66
|
-
* @deprecated Acoustic Model is deprecated and will be removed in a future release
|
|
67
|
-
*/
|
|
68
|
-
acoustic_model?: unknown;
|
|
69
|
-
/**
|
|
70
|
-
* @deprecated Speed Boost is deprecated and will be removed in a future release
|
|
71
|
-
*/
|
|
72
|
-
speed_boost?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated Language Model is deprecated and will be removed in a future release
|
|
75
|
-
*/
|
|
76
|
-
language_model?: unknown;
|
|
77
|
-
};
|
|
78
|
-
type TranscriptFailed = TranscriptBase & {
|
|
79
|
-
status: "error";
|
|
80
|
-
id: string;
|
|
81
|
-
error?: string;
|
|
82
|
-
};
|
|
83
|
-
type Transcript = Readonly<TranscriptQueued> | Readonly<TranscriptProcessing> | Readonly<TranscriptCompleted> | Readonly<TranscriptFailed>;
|
|
84
|
-
type TranscriptPollingSettings = {
|
|
85
|
-
pollingInterval: number;
|
|
86
|
-
pollingTimeout: number;
|
|
87
|
-
resolver?: (transcript: Transcript) => boolean;
|
|
88
|
-
};
|
|
89
|
-
type TranscriptListInternal = {
|
|
90
|
-
page_details: PageDetails;
|
|
91
|
-
transcripts: TranscriptListItemInternal[];
|
|
92
|
-
};
|
|
93
|
-
type TranscriptListItemInternal = {
|
|
94
|
-
id: string;
|
|
95
|
-
resource_url: string;
|
|
96
|
-
status: TranscriptStatus;
|
|
97
|
-
created: string;
|
|
98
|
-
completed: string;
|
|
99
|
-
audio_url: string;
|
|
100
|
-
};
|
|
101
|
-
type TranscriptList = {
|
|
102
|
-
page_details: PageDetails;
|
|
103
|
-
transcripts: TranscriptListItem[];
|
|
104
|
-
};
|
|
105
|
-
type TranscriptListItem = {
|
|
106
|
-
id: string;
|
|
107
|
-
resource_url: string;
|
|
108
|
-
status: TranscriptStatus;
|
|
109
|
-
created: Date;
|
|
110
|
-
completed: Date;
|
|
111
|
-
audio_url: string;
|
|
112
|
-
};
|
|
113
|
-
export type { Transcript, TranscriptStatus, TranscriptParams, TranscriptList, TranscriptListItem, TranscriptListInternal, TranscriptListItemInternal, TranscriptPollingSettings, };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
type LeMURModel = "default" | "basic";
|
|
2
|
-
type LeMURContext = string | object | LeMURContext[];
|
|
3
|
-
type LeMURBaseServiceParams = {
|
|
4
|
-
/**
|
|
5
|
-
* A list of completed transcripts with text. Up to 100 files max, or 100 hours max. Whichever is lower.
|
|
6
|
-
*/
|
|
7
|
-
transcript_ids: string[];
|
|
8
|
-
/**
|
|
9
|
-
* The model that is used for the final prompt after compression is performed (options: "basic" and "default").
|
|
10
|
-
*/
|
|
11
|
-
final_model?: LeMURModel;
|
|
12
|
-
/**
|
|
13
|
-
* Max output size in tokens. Up to 4000 allowed.
|
|
14
|
-
*/
|
|
15
|
-
max_output_size?: number;
|
|
16
|
-
};
|
|
17
|
-
type SummaryParams = LeMURBaseServiceParams & {
|
|
18
|
-
/**
|
|
19
|
-
* How you want the summary to be returned. This can be any text. Examples: "TLDR", "bullet points"
|
|
20
|
-
*/
|
|
21
|
-
answer_format?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
|
|
24
|
-
*/
|
|
25
|
-
context?: LeMURContext;
|
|
26
|
-
};
|
|
27
|
-
type Question = {
|
|
28
|
-
/**
|
|
29
|
-
* The question you wish to ask. For more complex questions use default model.
|
|
30
|
-
*/
|
|
31
|
-
question: string;
|
|
32
|
-
/**
|
|
33
|
-
* Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
|
|
34
|
-
*/
|
|
35
|
-
context?: LeMURContext;
|
|
36
|
-
/**
|
|
37
|
-
* How you want the answer to be returned. This can be any text. Cannot be used with answer_options. Examples: "short sentence", "bullet points"
|
|
38
|
-
*/
|
|
39
|
-
answer_format?: string;
|
|
40
|
-
/**
|
|
41
|
-
* What discrete options to return. Useful for precise responses. Cannot be used with answer_format. Example: ["Yes", "No"]
|
|
42
|
-
*/
|
|
43
|
-
answer_options?: string[];
|
|
44
|
-
};
|
|
45
|
-
type QuestionAnswerParams = LeMURBaseServiceParams & {
|
|
46
|
-
/**
|
|
47
|
-
* Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
|
|
48
|
-
*/
|
|
49
|
-
context?: LeMURContext;
|
|
50
|
-
/**
|
|
51
|
-
* A list of questions to ask. Question format listed below.
|
|
52
|
-
*/
|
|
53
|
-
questions: Question[];
|
|
54
|
-
};
|
|
55
|
-
type ActionItemsParams = LeMURBaseServiceParams & {
|
|
56
|
-
/**
|
|
57
|
-
* Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
|
|
58
|
-
*/
|
|
59
|
-
context?: LeMURContext;
|
|
60
|
-
};
|
|
61
|
-
type TaskParams = LeMURBaseServiceParams & {
|
|
62
|
-
/**
|
|
63
|
-
* Your text to prompt the model to produce a desired output, including any context you want to pass into the model.
|
|
64
|
-
*/
|
|
65
|
-
prompt: string;
|
|
66
|
-
};
|
|
67
|
-
type LeMURResponse = {
|
|
68
|
-
response: string;
|
|
69
|
-
request_id: string;
|
|
70
|
-
};
|
|
71
|
-
type QuestionAnswer = {
|
|
72
|
-
question: string;
|
|
73
|
-
answer: string;
|
|
74
|
-
};
|
|
75
|
-
type LeMURQuestionAnswerResponse = {
|
|
76
|
-
response: QuestionAnswer[];
|
|
77
|
-
request_id: string;
|
|
78
|
-
};
|
|
79
|
-
export type { SummaryParams, QuestionAnswerParams, ActionItemsParams, TaskParams, LeMURResponse, LeMURQuestionAnswerResponse, LeMURBaseServiceParams, };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ModelResultStatus } from "./shared";
|
|
2
|
-
type AutoHighlightsResult = {
|
|
3
|
-
text: string;
|
|
4
|
-
count: number;
|
|
5
|
-
rank: number;
|
|
6
|
-
};
|
|
7
|
-
type AutoHighlights = {
|
|
8
|
-
status: ModelResultStatus;
|
|
9
|
-
results: AutoHighlightsResult[];
|
|
10
|
-
};
|
|
11
|
-
export type { AutoHighlights };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ModelResultStatus, ModelSummary } from "./shared";
|
|
2
|
-
import { Timestamp } from "@/types/shared";
|
|
3
|
-
type ContentSafetyLabel = {
|
|
4
|
-
label: string;
|
|
5
|
-
confidence: number;
|
|
6
|
-
severity: number | null;
|
|
7
|
-
};
|
|
8
|
-
type ContentSafetyResult = {
|
|
9
|
-
text: string;
|
|
10
|
-
labels: ContentSafetyLabel[];
|
|
11
|
-
timestamp: Timestamp;
|
|
12
|
-
};
|
|
13
|
-
type ContentSafetySeverityScore = {
|
|
14
|
-
low: number;
|
|
15
|
-
medium: number;
|
|
16
|
-
high: number;
|
|
17
|
-
};
|
|
18
|
-
type ContentSafetySeverityScoreSummary = Record<string, ContentSafetySeverityScore>;
|
|
19
|
-
type ContentSafetyLabels = {
|
|
20
|
-
status: ModelResultStatus;
|
|
21
|
-
results: ContentSafetyResult[];
|
|
22
|
-
summary: ModelSummary;
|
|
23
|
-
severity_score_summary: ContentSafetySeverityScoreSummary;
|
|
24
|
-
};
|
|
25
|
-
export type { ContentSafetyLabels };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type * from "./auto_chapter";
|
|
2
|
-
export type * from "./auto_highlights";
|
|
3
|
-
export type * from "./content_safety";
|
|
4
|
-
export type * from "./entity_detection";
|
|
5
|
-
export type * from "./pii";
|
|
6
|
-
export type * from "./sentiment_analysis";
|
|
7
|
-
export type * from "./summarization";
|
|
8
|
-
export type * from "./topic_detection";
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
type PIIRedactionPolicies = "medical_process" | "medical_condition" | "blood_type" | "drug" | "injury" | "number_sequence" | "email_address" | "date_of_birth" | "phone_number" | "us_social_security_number" | "credit_card_number" | "credit_card_expiration" | "credit_card_cvv" | "date" | "nationality" | "event" | "language" | "location" | "money_amount" | "person_name" | "person_age" | "organization" | "political_affiliation" | "occupation" | "religion" | "drivers_license" | "banking_information";
|
|
2
|
-
type PIIAudioQuality = "mp3" | "wav";
|
|
3
|
-
export type { PIIRedactionPolicies, PIIAudioQuality };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ModelResultStatus, ModelSummary } from "./shared";
|
|
2
|
-
import { Timestamp } from "@/types/shared";
|
|
3
|
-
type TopicDetectionLabel = {
|
|
4
|
-
relevance: number;
|
|
5
|
-
label: string;
|
|
6
|
-
};
|
|
7
|
-
type TopicDetectionResults = {
|
|
8
|
-
text: string;
|
|
9
|
-
labels: TopicDetectionLabel[];
|
|
10
|
-
timestamp: Timestamp;
|
|
11
|
-
};
|
|
12
|
-
type TopicDetection = {
|
|
13
|
-
status: ModelResultStatus;
|
|
14
|
-
results: TopicDetectionResults[];
|
|
15
|
-
summary: ModelSummary;
|
|
16
|
-
};
|
|
17
|
-
export type { TopicDetection };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import BaseService from "@/services/base";
|
|
2
|
-
import { Retrieveable } from "@/types";
|
|
3
|
-
|
|
4
|
-
type TranscriptRedactionParams = {
|
|
5
|
-
transcript_id: string;
|
|
6
|
-
path: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type TranscriptRedactionResponse = {
|
|
10
|
-
status: "redacted_audio_ready";
|
|
11
|
-
redacted_audio_url: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default class TranscriptRedactionService
|
|
15
|
-
extends BaseService
|
|
16
|
-
implements
|
|
17
|
-
Retrieveable<TranscriptRedactionResponse, TranscriptRedactionParams>
|
|
18
|
-
{
|
|
19
|
-
async retrieve(
|
|
20
|
-
params: TranscriptRedactionParams
|
|
21
|
-
): Promise<TranscriptRedactionResponse> {
|
|
22
|
-
const { data } = await this.client.get<TranscriptRedactionResponse>(
|
|
23
|
-
`/v2/transcript/${params.transcript_id}/redacted-audio`
|
|
24
|
-
);
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
}
|