assemblyai 2.0.0-beta → 2.0.1-beta

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.
Files changed (79) hide show
  1. package/README.md +148 -48
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.esm.js +218 -123
  4. package/dist/index.js +225 -123
  5. package/dist/services/base.d.ts +0 -2
  6. package/dist/services/index.d.ts +7 -9
  7. package/dist/services/lemur/index.d.ts +6 -6
  8. package/dist/services/realtime/factory.d.ts +10 -0
  9. package/dist/services/realtime/index.d.ts +2 -16
  10. package/dist/services/realtime/service.d.ts +22 -0
  11. package/dist/services/transcripts/index.d.ts +37 -20
  12. package/dist/types/asyncapi.generated.d.ts +87 -0
  13. package/dist/types/index.d.ts +3 -4
  14. package/dist/types/openapi.generated.d.ts +685 -0
  15. package/dist/types/realtime/index.d.ts +30 -11
  16. package/dist/types/services/abstractions.d.ts +8 -36
  17. package/dist/types/services/index.d.ts +2 -5
  18. package/dist/types/transcripts/index.d.ts +5 -0
  19. package/dist/utils/axios.d.ts +3 -0
  20. package/dist/utils/errors/realtime.d.ts +1 -4
  21. package/package.json +8 -5
  22. package/src/index.ts +3 -0
  23. package/src/services/base.ts +1 -3
  24. package/src/services/files/index.ts +4 -4
  25. package/src/services/index.ts +18 -35
  26. package/src/services/lemur/index.ts +20 -16
  27. package/src/services/realtime/factory.ts +32 -0
  28. package/src/services/realtime/index.ts +2 -106
  29. package/src/services/realtime/service.ts +184 -0
  30. package/src/services/transcripts/index.ts +85 -63
  31. package/src/types/asyncapi.generated.ts +124 -0
  32. package/src/types/index.ts +3 -4
  33. package/src/types/openapi.generated.ts +834 -0
  34. package/src/types/realtime/index.ts +53 -13
  35. package/src/types/services/abstractions.ts +8 -40
  36. package/src/types/services/index.ts +2 -6
  37. package/src/types/transcripts/index.ts +5 -0
  38. package/src/utils/axios.ts +19 -0
  39. package/src/utils/errors/realtime.ts +5 -18
  40. package/dist/services/transcripts/redactions.d.ts +0 -14
  41. package/dist/services/transcripts/subtitles.d.ts +0 -12
  42. package/dist/types/core/index.d.ts +0 -2
  43. package/dist/types/core/params.d.ts +0 -2
  44. package/dist/types/core/segments.d.ts +0 -28
  45. package/dist/types/core/transcript.d.ts +0 -113
  46. package/dist/types/lemur/index.d.ts +0 -79
  47. package/dist/types/models/auto_chapter.d.ts +0 -8
  48. package/dist/types/models/auto_highlights.d.ts +0 -11
  49. package/dist/types/models/content_safety.d.ts +0 -25
  50. package/dist/types/models/entity_detection.d.ts +0 -7
  51. package/dist/types/models/index.d.ts +0 -8
  52. package/dist/types/models/pii.d.ts +0 -3
  53. package/dist/types/models/sentiment_analysis.d.ts +0 -9
  54. package/dist/types/models/shared.d.ts +0 -3
  55. package/dist/types/models/summarization.d.ts +0 -3
  56. package/dist/types/models/topic_detection.d.ts +0 -17
  57. package/dist/types/shared/index.d.ts +0 -2
  58. package/dist/types/shared/pagination.d.ts +0 -7
  59. package/dist/types/shared/timestamp.d.ts +0 -5
  60. package/src/services/transcripts/redactions.ts +0 -27
  61. package/src/services/transcripts/subtitles.ts +0 -26
  62. package/src/types/core/index.ts +0 -2
  63. package/src/types/core/params.ts +0 -3
  64. package/src/types/core/segments.ts +0 -29
  65. package/src/types/core/transcript.ts +0 -159
  66. package/src/types/lemur/index.ts +0 -97
  67. package/src/types/models/auto_chapter.ts +0 -9
  68. package/src/types/models/auto_highlights.ts +0 -14
  69. package/src/types/models/content_safety.ts +0 -34
  70. package/src/types/models/entity_detection.ts +0 -8
  71. package/src/types/models/index.ts +0 -8
  72. package/src/types/models/pii.ts +0 -32
  73. package/src/types/models/sentiment_analysis.ts +0 -11
  74. package/src/types/models/shared.ts +0 -4
  75. package/src/types/models/summarization.ts +0 -10
  76. package/src/types/models/topic_detection.ts +0 -21
  77. package/src/types/shared/index.ts +0 -2
  78. package/src/types/shared/pagination.ts +0 -8
  79. package/src/types/shared/timestamp.ts +0 -6
@@ -1,26 +0,0 @@
1
- import BaseService from "@/services/base";
2
- import { Retrieveable } from "@/types";
3
-
4
- type Subtitle = string;
5
- type SubtitleFormat = "vtt" | "srt";
6
-
7
- type TranscriptionSubtitleParams = {
8
- transcript_id: string;
9
- format: SubtitleFormat;
10
- };
11
-
12
- export default class TranscriptSubtitleService
13
- extends BaseService
14
- implements Retrieveable<Subtitle, TranscriptionSubtitleParams>
15
- {
16
- async retrieve({
17
- transcript_id,
18
- format,
19
- }: TranscriptionSubtitleParams): Promise<Subtitle> {
20
- const { data } = await this.client.get<Subtitle>(
21
- `/v2/transcript/${transcript_id}/${format}`
22
- );
23
-
24
- return data;
25
- }
26
- }
@@ -1,2 +0,0 @@
1
- export type * from "./transcript";
2
- export type * from "./segments";
@@ -1,3 +0,0 @@
1
- type WordBoostWeight = "low" | "default" | "high";
2
-
3
- export type { WordBoostWeight };
@@ -1,29 +0,0 @@
1
- type SegmentType = "paragraphs" | "sentences";
2
-
3
- type Segment<T> = T & {
4
- id: string;
5
- confidence: number;
6
- audio_duration: number;
7
- };
8
-
9
- type ParagraphsBody = Segment<{ paragraphs: Utterance[] }>;
10
- type SentencesBody = Segment<{ sentences: Utterance[] }>;
11
-
12
- type Word = {
13
- text: string;
14
- start: number;
15
- end: number;
16
- confidence: number;
17
- speaker?: string | null;
18
- };
19
-
20
- type Utterance = {
21
- start: number;
22
- end: number;
23
- confidence: number;
24
- speaker?: string;
25
- text: string;
26
- words: Word[];
27
- };
28
-
29
- export type { Word, Utterance, ParagraphsBody, SentencesBody, SegmentType };
@@ -1,159 +0,0 @@
1
- import {
2
- AutoChapter,
3
- AutoHighlights,
4
- ContentSafetyLabels,
5
- Entity,
6
- PIIAudioQuality,
7
- PIIRedactionPolicies,
8
- SentimentAnalysis,
9
- SummaryModel,
10
- SummaryType,
11
- TopicDetection,
12
- } from "@/types/models";
13
- import { PageDetails } from "@/types/shared";
14
- import { Utterance, Word } from "./segments";
15
- import { WordBoostWeight } from "./params";
16
-
17
- type TranscriptStatus = "queued" | "processing" | "completed" | "error";
18
-
19
- type TranscriptBase = {
20
- status?: TranscriptStatus | null;
21
-
22
- // Core Transcription
23
- audio_url: string;
24
- audio_start_from?: number | null;
25
- audio_end_at?: number | null;
26
- filter_profanity?: boolean;
27
- custom_spelling?: null;
28
- disfluencies?: boolean;
29
- dual_channel?: boolean | null;
30
- punctuate?: boolean;
31
- speaker_labels?: boolean;
32
- format_text?: boolean;
33
-
34
- // Audio Intelligence
35
- auto_chapters?: boolean;
36
- content_safety?: boolean;
37
- entity_detection?: boolean;
38
- language_code?: string;
39
- language_detection?: boolean;
40
- iab_categories?: boolean;
41
- auto_highlights?: boolean;
42
- summarization?: boolean;
43
- summary_type?: SummaryType;
44
- summary_model?: SummaryModel;
45
- redact_pii?: boolean;
46
- redact_pii_sub?: string;
47
- redact_pii_audio_quality?: PIIAudioQuality;
48
- redact_pii_audio?: boolean;
49
- redact_pii_policies?: PIIRedactionPolicies[];
50
- sentiment_analysis?: boolean;
51
- webhook_auth_header_name?: null;
52
- webhook_auth?: boolean;
53
- webhook_status_code?: null | number;
54
- webhook_url?: null | string;
55
-
56
- word_boost?: string[];
57
- boost_param?: WordBoostWeight;
58
- };
59
-
60
- type TranscriptParams = Omit<TranscriptBase, "status">;
61
-
62
- type TranscriptQueued = TranscriptBase & {
63
- id: string;
64
- status: "queued";
65
- };
66
-
67
- type TranscriptProcessing = TranscriptBase & {
68
- id: string;
69
- status: "processing";
70
- };
71
-
72
- type TranscriptCompleted = TranscriptBase & {
73
- status: "completed";
74
- id: string;
75
- audio_duration?: number;
76
- words?: Word[];
77
- utterances?: Utterance[];
78
- text?: string;
79
- confidence?: number;
80
- chapters?: AutoChapter[] | null;
81
- content_safety_labels?: ContentSafetyLabels;
82
- entities?: Entity[];
83
- iab_categories_result?: TopicDetection;
84
- auto_highlights_result?: AutoHighlights;
85
- summary?: string;
86
- sentiment_analysis_results?: SentimentAnalysis[];
87
-
88
- /**
89
- * @deprecated Acoustic Model is deprecated and will be removed in a future release
90
- */
91
- acoustic_model?: unknown;
92
-
93
- /**
94
- * @deprecated Speed Boost is deprecated and will be removed in a future release
95
- */
96
- speed_boost?: boolean;
97
-
98
- /**
99
- * @deprecated Language Model is deprecated and will be removed in a future release
100
- */
101
- language_model?: unknown;
102
- };
103
-
104
- type TranscriptFailed = TranscriptBase & {
105
- status: "error";
106
- id: string;
107
- error?: string;
108
- };
109
-
110
- type Transcript =
111
- | Readonly<TranscriptQueued>
112
- | Readonly<TranscriptProcessing>
113
- | Readonly<TranscriptCompleted>
114
- | Readonly<TranscriptFailed>;
115
-
116
- type TranscriptPollingSettings = {
117
- pollingInterval: number;
118
- pollingTimeout: number;
119
- resolver?: (transcript: Transcript) => boolean;
120
- };
121
-
122
- type TranscriptListInternal = {
123
- page_details: PageDetails;
124
- transcripts: TranscriptListItemInternal[];
125
- };
126
-
127
- type TranscriptListItemInternal = {
128
- id: string;
129
- resource_url: string;
130
- status: TranscriptStatus;
131
- created: string;
132
- completed: string;
133
- audio_url: string;
134
- };
135
-
136
- type TranscriptList = {
137
- page_details: PageDetails;
138
- transcripts: TranscriptListItem[];
139
- };
140
-
141
- type TranscriptListItem = {
142
- id: string;
143
- resource_url: string;
144
- status: TranscriptStatus;
145
- created: Date;
146
- completed: Date;
147
- audio_url: string;
148
- };
149
-
150
- export type {
151
- Transcript,
152
- TranscriptStatus,
153
- TranscriptParams,
154
- TranscriptList,
155
- TranscriptListItem,
156
- TranscriptListInternal,
157
- TranscriptListItemInternal,
158
- TranscriptPollingSettings,
159
- };
@@ -1,97 +0,0 @@
1
- type LeMURModel = "default" | "basic";
2
- type LeMURContext = string | object | LeMURContext[];
3
-
4
- type LeMURBaseServiceParams = {
5
- /**
6
- * A list of completed transcripts with text. Up to 100 files max, or 100 hours max. Whichever is lower.
7
- */
8
- transcript_ids: string[];
9
- /**
10
- * The model that is used for the final prompt after compression is performed (options: "basic" and "default").
11
- */
12
- final_model?: LeMURModel;
13
- /**
14
- * Max output size in tokens. Up to 4000 allowed.
15
- */
16
- max_output_size?: number;
17
- };
18
-
19
- type SummaryParams = LeMURBaseServiceParams & {
20
- /**
21
- * How you want the summary to be returned. This can be any text. Examples: "TLDR", "bullet points"
22
- */
23
- answer_format?: string;
24
- /**
25
- * Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
26
- */
27
- context?: LeMURContext;
28
- };
29
-
30
- type Question = {
31
- /**
32
- * The question you wish to ask. For more complex questions use default model.
33
- */
34
- question: string;
35
- /**
36
- * Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
37
- */
38
- context?: LeMURContext;
39
- /**
40
- * How you want the answer to be returned. This can be any text. Cannot be used with answer_options. Examples: "short sentence", "bullet points"
41
- */
42
- answer_format?: string;
43
- /**
44
- * What discrete options to return. Useful for precise responses. Cannot be used with answer_format. Example: ["Yes", "No"]
45
- */
46
- answer_options?: string[];
47
- };
48
-
49
- type QuestionAnswerParams = LeMURBaseServiceParams & {
50
- /**
51
- * Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
52
- */
53
- context?: LeMURContext;
54
- /**
55
- * A list of questions to ask. Question format listed below.
56
- */
57
- questions: Question[];
58
- };
59
-
60
- type ActionItemsParams = LeMURBaseServiceParams & {
61
- /**
62
- * Any context about the transcripts you wish to provide. This can be a string, or free-form JSON.
63
- */
64
- context?: LeMURContext;
65
- };
66
-
67
- type TaskParams = LeMURBaseServiceParams & {
68
- /**
69
- * Your text to prompt the model to produce a desired output, including any context you want to pass into the model.
70
- */
71
- prompt: string;
72
- };
73
-
74
- type LeMURResponse = {
75
- response: string;
76
- request_id: string;
77
- };
78
-
79
- type QuestionAnswer = {
80
- question: string;
81
- answer: string;
82
- };
83
-
84
- type LeMURQuestionAnswerResponse = {
85
- response: QuestionAnswer[];
86
- request_id: string;
87
- };
88
-
89
- export type {
90
- SummaryParams,
91
- QuestionAnswerParams,
92
- ActionItemsParams,
93
- TaskParams,
94
- LeMURResponse,
95
- LeMURQuestionAnswerResponse,
96
- LeMURBaseServiceParams,
97
- };
@@ -1,9 +0,0 @@
1
- type AutoChapter = {
2
- summary: string;
3
- headline: string;
4
- gist: string;
5
- start: number;
6
- end: number;
7
- };
8
-
9
- export type { AutoChapter };
@@ -1,14 +0,0 @@
1
- import { ModelResultStatus } from "./shared";
2
-
3
- type AutoHighlightsResult = {
4
- text: string;
5
- count: number;
6
- rank: number;
7
- };
8
-
9
- type AutoHighlights = {
10
- status: ModelResultStatus;
11
- results: AutoHighlightsResult[];
12
- };
13
-
14
- export type { AutoHighlights };
@@ -1,34 +0,0 @@
1
- import { ModelResultStatus, ModelSummary } from "./shared";
2
- import { Timestamp } from "@/types/shared";
3
-
4
- type ContentSafetyLabel = {
5
- label: string;
6
- confidence: number;
7
- severity: number | null;
8
- };
9
-
10
- type ContentSafetyResult = {
11
- text: string;
12
- labels: ContentSafetyLabel[];
13
- timestamp: Timestamp;
14
- };
15
-
16
- type ContentSafetySeverityScore = {
17
- low: number;
18
- medium: number;
19
- high: number;
20
- };
21
-
22
- type ContentSafetySeverityScoreSummary = Record<
23
- string,
24
- ContentSafetySeverityScore
25
- >;
26
-
27
- type ContentSafetyLabels = {
28
- status: ModelResultStatus;
29
- results: ContentSafetyResult[];
30
- summary: ModelSummary;
31
- severity_score_summary: ContentSafetySeverityScoreSummary;
32
- };
33
-
34
- export type { ContentSafetyLabels };
@@ -1,8 +0,0 @@
1
- type Entity = {
2
- entity_type: string;
3
- text: string;
4
- start: number;
5
- end: number;
6
- };
7
-
8
- export type { Entity };
@@ -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,32 +0,0 @@
1
- type PIIRedactionPolicies =
2
- | "medical_process"
3
- | "medical_condition"
4
- | "blood_type"
5
- | "drug"
6
- | "injury"
7
- | "number_sequence"
8
- | "email_address"
9
- | "date_of_birth"
10
- | "phone_number"
11
- | "us_social_security_number"
12
- | "credit_card_number"
13
- | "credit_card_expiration"
14
- | "credit_card_cvv"
15
- | "date"
16
- | "nationality"
17
- | "event"
18
- | "language"
19
- | "location"
20
- | "money_amount"
21
- | "person_name"
22
- | "person_age"
23
- | "organization"
24
- | "political_affiliation"
25
- | "occupation"
26
- | "religion"
27
- | "drivers_license"
28
- | "banking_information";
29
-
30
- type PIIAudioQuality = "mp3" | "wav";
31
-
32
- export type { PIIRedactionPolicies, PIIAudioQuality };
@@ -1,11 +0,0 @@
1
- type Sentiment = "NEUTRAL" | "POSITIVE" | "NEGATIVE";
2
-
3
- type SentimentAnalysis = {
4
- text: string;
5
- start: number;
6
- end: number;
7
- sentiment: Sentiment;
8
- confidence: number;
9
- };
10
-
11
- export type { SentimentAnalysis };
@@ -1,4 +0,0 @@
1
- type ModelResultStatus = "success" | "error";
2
- type ModelSummary = Record<string, number>;
3
-
4
- export type { ModelResultStatus, ModelSummary };
@@ -1,10 +0,0 @@
1
- type SummaryType =
2
- | "bullets"
3
- | "bullets_verbose"
4
- | "gist"
5
- | "headline"
6
- | "paragraph";
7
-
8
- type SummaryModel = "informative" | "conversational" | "catchy";
9
-
10
- export type { SummaryType, SummaryModel };
@@ -1,21 +0,0 @@
1
- import { ModelResultStatus, ModelSummary } from "./shared";
2
- import { Timestamp } from "@/types/shared";
3
-
4
- type TopicDetectionLabel = {
5
- relevance: number;
6
- label: string;
7
- };
8
-
9
- type TopicDetectionResults = {
10
- text: string;
11
- labels: TopicDetectionLabel[];
12
- timestamp: Timestamp;
13
- };
14
-
15
- type TopicDetection = {
16
- status: ModelResultStatus;
17
- results: TopicDetectionResults[];
18
- summary: ModelSummary;
19
- };
20
-
21
- export type { TopicDetection };
@@ -1,2 +0,0 @@
1
- export type * from "./pagination";
2
- export type * from "./timestamp";
@@ -1,8 +0,0 @@
1
- type PageDetails = {
2
- limit: number;
3
- result_count: number;
4
- next_url: string | null;
5
- previous_url: string | null;
6
- };
7
-
8
- export type { PageDetails };
@@ -1,6 +0,0 @@
1
- type Timestamp = {
2
- start: number;
3
- end: number;
4
- };
5
-
6
- export type { Timestamp };