assemblyai 4.30.0 → 4.33.0

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.
@@ -36,7 +36,18 @@ export type StreamingTranscriberParams = {
36
36
  inactivityTimeout?: number;
37
37
  speakerLabels?: boolean;
38
38
  maxSpeakers?: number;
39
+ voiceFocus?: VoiceFocusModel;
40
+ voiceFocusThreshold?: number;
41
+ continuousPartials?: boolean;
42
+ customerSupportAudioCapture?: boolean;
43
+ includePartialTurns?: boolean;
44
+ redactPii?: boolean;
45
+ redactPiiPolicies?: StreamingPiiPolicy[];
46
+ redactPiiSub?: StreamingPiiSubstitution;
39
47
  llmGateway?: LLMGatewayConfig;
48
+ webhookUrl?: string;
49
+ webhookAuthHeaderName?: string;
50
+ webhookAuthHeaderValue?: string;
40
51
  };
41
52
 
42
53
  export type StreamingEvents =
@@ -45,6 +56,7 @@ export type StreamingEvents =
45
56
  | "turn"
46
57
  | "speechStarted"
47
58
  | "llmGatewayResponse"
59
+ | "warning"
48
60
  | "error";
49
61
 
50
62
  export type StreamingListeners = {
@@ -53,6 +65,7 @@ export type StreamingListeners = {
53
65
  turn?: (event: TurnEvent) => void;
54
66
  speechStarted?: (event: SpeechStartedEvent) => void;
55
67
  llmGatewayResponse?: (event: LLMGatewayResponseEvent) => void;
68
+ warning?: (event: WarningEvent) => void;
56
69
  error?: (error: Error) => void;
57
70
  };
58
71
 
@@ -65,6 +78,59 @@ export type StreamingSpeechModel =
65
78
 
66
79
  export type StreamingDomain = "medical-v1";
67
80
 
81
+ export type VoiceFocusModel = "near-field" | "far-field";
82
+
83
+ export type StreamingPiiSubstitution = "hash" | "entity_name";
84
+
85
+ export type StreamingPiiPolicy =
86
+ | "account_number"
87
+ | "banking_information"
88
+ | "blood_type"
89
+ | "credit_card_number"
90
+ | "credit_card_expiration"
91
+ | "credit_card_cvv"
92
+ | "date"
93
+ | "date_interval"
94
+ | "date_of_birth"
95
+ | "drivers_license"
96
+ | "drug"
97
+ | "duration"
98
+ | "email_address"
99
+ | "event"
100
+ | "filename"
101
+ | "gender_sexuality"
102
+ | "gender"
103
+ | "healthcare_number"
104
+ | "injury"
105
+ | "ip_address"
106
+ | "language"
107
+ | "location"
108
+ | "marital_status"
109
+ | "medical_condition"
110
+ | "medical_process"
111
+ | "money_amount"
112
+ | "nationality"
113
+ | "number_sequence"
114
+ | "passport_number"
115
+ | "password"
116
+ | "person_age"
117
+ | "person_name"
118
+ | "phone_number"
119
+ | "physical_attribute"
120
+ | "political_affiliation"
121
+ | "occupation"
122
+ | "organization"
123
+ | "organization_medical_facility"
124
+ | "religion"
125
+ | "sexuality"
126
+ | "statistics"
127
+ | "time"
128
+ | "url"
129
+ | "us_social_security_number"
130
+ | "username"
131
+ | "vehicle_id"
132
+ | "zodiac_sign";
133
+
68
134
  export type StreamingTokenParams = {
69
135
  expires_in_seconds: number;
70
136
  max_session_duration_seconds?: number;
@@ -106,6 +172,7 @@ export type StreamingWord = {
106
172
  confidence: number;
107
173
  text: string;
108
174
  word_is_final: boolean;
175
+ speaker?: string;
109
176
  };
110
177
 
111
178
  export type TerminationEvent = {
@@ -139,9 +206,17 @@ export type StreamingForceEndpoint = {
139
206
  };
140
207
 
141
208
  export type ErrorEvent = {
209
+ type: "Error";
210
+ error_code?: number;
142
211
  error: string;
143
212
  };
144
213
 
214
+ export type WarningEvent = {
215
+ type: "Warning";
216
+ warning_code: number;
217
+ warning: string;
218
+ };
219
+
145
220
  export type LLMGatewayResponseEvent = {
146
221
  type: "LLMGatewayResponse";
147
222
  turn_order: number;
@@ -155,7 +230,8 @@ export type StreamingEventMessage =
155
230
  | SpeechStartedEvent
156
231
  | TerminationEvent
157
232
  | LLMGatewayResponseEvent
158
- | ErrorEvent;
233
+ | ErrorEvent
234
+ | WarningEvent;
159
235
 
160
236
  export type StreamingOperationMessage =
161
237
  | StreamingUpdateConfiguration
@@ -15,12 +15,24 @@ const StreamingErrorType = {
15
15
  BadSchema: 4101,
16
16
  TooManyStreams: 4102,
17
17
  Reconnected: 4103,
18
+ ServerError: 3005,
19
+ InputValidationError: 3006,
20
+ AudioChunkDurationViolation: 3007,
21
+ MaxSessionDurationExceeded: 3008,
22
+ ConcurrencyLimitExceeded: 3009,
18
23
  } as const;
19
24
 
20
25
  type StreamingErrorTypeCodes =
21
26
  (typeof StreamingErrorType)[keyof typeof StreamingErrorType];
22
27
 
23
28
  const StreamingErrorMessages: Record<StreamingErrorTypeCodes, string> = {
29
+ [StreamingErrorType.ServerError]: "Server error",
30
+ [StreamingErrorType.InputValidationError]: "Input validation error",
31
+ [StreamingErrorType.AudioChunkDurationViolation]:
32
+ "Audio chunk duration violation",
33
+ [StreamingErrorType.MaxSessionDurationExceeded]:
34
+ "Session expired: maximum session duration exceeded",
35
+ [StreamingErrorType.ConcurrencyLimitExceeded]: "Too many concurrent sessions",
24
36
  [StreamingErrorType.BadSampleRate]: "Sample rate must be a positive integer",
25
37
  [StreamingErrorType.AuthFailed]: "Not Authorized",
26
38
  [StreamingErrorType.InsufficientFunds]: "Insufficient funds",