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
|
@@ -78,19 +78,25 @@ export type ContentSafetyLabelResult = {
|
|
|
78
78
|
sentences_idx_end: number;
|
|
79
79
|
/** @description The sentence index at which the section begins */
|
|
80
80
|
sentences_idx_start: number;
|
|
81
|
+
/** @description The transcript of the section flagged by the Content Moderation model */
|
|
82
|
+
text: string;
|
|
83
|
+
/** @description Timestamp information for the section */
|
|
84
|
+
timestamp: Timestamp;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type ContentSafetyLabelsResult = {
|
|
88
|
+
results: ContentSafetyLabelResult[];
|
|
81
89
|
/** @description A summary of the Content Moderation severity results for the entire audio file */
|
|
82
90
|
severity_score_summary: {
|
|
83
91
|
[key: string]: SeverityScoreSummary;
|
|
84
92
|
};
|
|
93
|
+
/** @description Will be either success, or unavailable in the rare case that the Content Moderation model failed. */
|
|
94
|
+
status: AudioIntelligenceModelStatus;
|
|
85
95
|
/** @description A summary of the Content Moderation confidence results for the entire audio file */
|
|
86
96
|
summary: {
|
|
87
97
|
[key: string]: number;
|
|
88
98
|
};
|
|
89
|
-
|
|
90
|
-
text: string;
|
|
91
|
-
/** @description Timestamp information for the section */
|
|
92
|
-
timestamp: Timestamp;
|
|
93
|
-
};
|
|
99
|
+
} | null;
|
|
94
100
|
|
|
95
101
|
export type CreateRealtimeTemporaryTokenParameters = {
|
|
96
102
|
/** @description The amount of time until the token expires in seconds. */
|
|
@@ -450,7 +456,7 @@ export type SentimentAnalysisResult = {
|
|
|
450
456
|
end: number;
|
|
451
457
|
/** @description The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE */
|
|
452
458
|
sentiment: Sentiment;
|
|
453
|
-
/** @description The speaker of the sentence if Speaker Diarization is enabled, else null */
|
|
459
|
+
/** @description The speaker of the sentence if [Speaker Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, else null */
|
|
454
460
|
speaker?: string | null;
|
|
455
461
|
/** @description The starting time, in milliseconds, of the sentence */
|
|
456
462
|
start: number;
|
|
@@ -506,7 +512,7 @@ export type Timestamp = {
|
|
|
506
512
|
start: number;
|
|
507
513
|
};
|
|
508
514
|
|
|
509
|
-
/** @description
|
|
515
|
+
/** @description The result of the topic detection model. */
|
|
510
516
|
export type TopicDetectionResult = {
|
|
511
517
|
labels?: {
|
|
512
518
|
/** @description The IAB taxonomical label for the label of the detected topic, where > denotes supertopic/subtopic relationship */
|
|
@@ -564,11 +570,7 @@ export type Transcript = {
|
|
|
564
570
|
* @description An array of results for the Content Moderation model, if it was enabled during the transcription request.
|
|
565
571
|
* See [Content moderation](https://www.assemblyai.com/docs/Models/content_moderation) for more information.
|
|
566
572
|
*/
|
|
567
|
-
content_safety_labels?:
|
|
568
|
-
results: ContentSafetyLabelResult[];
|
|
569
|
-
/** @description Will be either success, or unavailable in the rare case that the Content Safety Labels model failed. */
|
|
570
|
-
status: AudioIntelligenceModelStatus;
|
|
571
|
-
} | null;
|
|
573
|
+
content_safety_labels?: ContentSafetyLabelsResult;
|
|
572
574
|
/** @description Customize how words are spelled and formatted using to and from values */
|
|
573
575
|
custom_spelling?: TranscriptCustomSpelling[] | null;
|
|
574
576
|
/** @description Whether custom topics was enabled in the transcription request, either true or false */
|
|
@@ -593,7 +595,7 @@ export type Transcript = {
|
|
|
593
595
|
/** @description Enable [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification), can be true or false */
|
|
594
596
|
iab_categories?: boolean | null;
|
|
595
597
|
/**
|
|
596
|
-
* @description
|
|
598
|
+
* @description The result of the Topic Detection model, if it was enabled during the transcription request.
|
|
597
599
|
* See [Topic Detection](https://www.assemblyai.com/docs/Models/iab_classification) for more information.
|
|
598
600
|
*/
|
|
599
601
|
iab_categories_result?: {
|
|
@@ -762,6 +764,28 @@ export type TranscriptListItem = {
|
|
|
762
764
|
status: TranscriptStatus;
|
|
763
765
|
};
|
|
764
766
|
|
|
767
|
+
export type TranscriptListParameters = {
|
|
768
|
+
/** @description Get transcripts that were created after this transcript ID */
|
|
769
|
+
after_id?: string;
|
|
770
|
+
/** @description Get transcripts that were created before this transcript ID */
|
|
771
|
+
before_id?: string;
|
|
772
|
+
/**
|
|
773
|
+
* Format: date
|
|
774
|
+
* @description Only get transcripts created on this date
|
|
775
|
+
*/
|
|
776
|
+
created_on?: string;
|
|
777
|
+
/**
|
|
778
|
+
* Format: int64
|
|
779
|
+
* @description Maximum amount of transcripts to retrieve
|
|
780
|
+
* @default 10
|
|
781
|
+
*/
|
|
782
|
+
limit?: number;
|
|
783
|
+
/** @description Filter by transcript status */
|
|
784
|
+
status?: TranscriptStatus;
|
|
785
|
+
/** @description Only get throttled transcripts, overrides the status filter */
|
|
786
|
+
throttled_only?: boolean;
|
|
787
|
+
};
|
|
788
|
+
|
|
765
789
|
export type TranscriptParagraph = {
|
|
766
790
|
/** Format: double */
|
|
767
791
|
confidence: number;
|
|
@@ -787,12 +811,20 @@ export type TranscriptSentence = {
|
|
|
787
811
|
export type TranscriptStatus = "queued" | "processing" | "completed" | "error";
|
|
788
812
|
|
|
789
813
|
export type TranscriptUtterance = {
|
|
790
|
-
|
|
791
|
-
|
|
814
|
+
/**
|
|
815
|
+
* Format: double
|
|
816
|
+
* @description The confidence score for the transcript of this utterance
|
|
817
|
+
*/
|
|
792
818
|
confidence: number;
|
|
819
|
+
/** @description The ending time, in milliseconds, of the utterance in the audio file */
|
|
793
820
|
end: number;
|
|
821
|
+
/** @description The speaker of this utterance, where each speaker is assigned a sequential capital letter - e.g. "A" for Speaker A, "B" for Speaker B, etc. */
|
|
822
|
+
speaker: string;
|
|
823
|
+
/** @description The starting time, in milliseconds, of the utterance in the audio file */
|
|
794
824
|
start: number;
|
|
825
|
+
/** @description The text for this utterance */
|
|
795
826
|
text: string;
|
|
827
|
+
/** @description The words in the utterance. */
|
|
796
828
|
words: TranscriptWord[];
|
|
797
829
|
};
|
|
798
830
|
|
package/dist/utils/axios.d.ts
DELETED
package/src/utils/axios.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|