assemblyai 4.6.1 → 4.7.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.
@@ -40,30 +40,42 @@ const { WritableStream } = typeof window !== "undefined"
40
40
 
41
41
  const factory = (url, params) => new ws(url, params);
42
42
 
43
- var RealtimeErrorType;
44
- (function (RealtimeErrorType) {
45
- RealtimeErrorType[RealtimeErrorType["BadSampleRate"] = 4000] = "BadSampleRate";
46
- RealtimeErrorType[RealtimeErrorType["AuthFailed"] = 4001] = "AuthFailed";
47
- // Both InsufficientFunds and FreeAccount error use 4002
48
- RealtimeErrorType[RealtimeErrorType["InsufficientFundsOrFreeAccount"] = 4002] = "InsufficientFundsOrFreeAccount";
49
- RealtimeErrorType[RealtimeErrorType["NonexistentSessionId"] = 4004] = "NonexistentSessionId";
50
- RealtimeErrorType[RealtimeErrorType["SessionExpired"] = 4008] = "SessionExpired";
51
- RealtimeErrorType[RealtimeErrorType["ClosedSession"] = 4010] = "ClosedSession";
52
- RealtimeErrorType[RealtimeErrorType["RateLimited"] = 4029] = "RateLimited";
53
- RealtimeErrorType[RealtimeErrorType["UniqueSessionViolation"] = 4030] = "UniqueSessionViolation";
54
- RealtimeErrorType[RealtimeErrorType["SessionTimeout"] = 4031] = "SessionTimeout";
55
- RealtimeErrorType[RealtimeErrorType["AudioTooShort"] = 4032] = "AudioTooShort";
56
- RealtimeErrorType[RealtimeErrorType["AudioTooLong"] = 4033] = "AudioTooLong";
57
- RealtimeErrorType[RealtimeErrorType["BadJson"] = 4100] = "BadJson";
58
- RealtimeErrorType[RealtimeErrorType["BadSchema"] = 4101] = "BadSchema";
59
- RealtimeErrorType[RealtimeErrorType["TooManyStreams"] = 4102] = "TooManyStreams";
60
- RealtimeErrorType[RealtimeErrorType["Reconnected"] = 4103] = "Reconnected";
61
- RealtimeErrorType[RealtimeErrorType["ReconnectAttemptsExhausted"] = 1013] = "ReconnectAttemptsExhausted";
62
- })(RealtimeErrorType || (RealtimeErrorType = {}));
43
+ const RealtimeErrorType = {
44
+ BadSampleRate: 4000,
45
+ AuthFailed: 4001,
46
+ /**
47
+ * @deprecated Use InsufficientFunds or FreeTierUser instead
48
+ */
49
+ InsufficientFundsOrFreeAccount: 4002,
50
+ InsufficientFunds: 4002,
51
+ FreeTierUser: 4003,
52
+ NonexistentSessionId: 4004,
53
+ SessionExpired: 4008,
54
+ ClosedSession: 4010,
55
+ RateLimited: 4029,
56
+ UniqueSessionViolation: 4030,
57
+ SessionTimeout: 4031,
58
+ AudioTooShort: 4032,
59
+ AudioTooLong: 4033,
60
+ AudioTooSmallToTranscode: 4034,
61
+ /**
62
+ * @deprecated Don't use
63
+ */
64
+ BadJson: 4100,
65
+ BadSchema: 4101,
66
+ TooManyStreams: 4102,
67
+ Reconnected: 4103,
68
+ /**
69
+ * @deprecated Don't use
70
+ */
71
+ ReconnectAttemptsExhausted: 1013,
72
+ WordBoostParameterParsingFailed: 4104,
73
+ };
63
74
  const RealtimeErrorMessages = {
64
75
  [RealtimeErrorType.BadSampleRate]: "Sample rate must be a positive integer",
65
76
  [RealtimeErrorType.AuthFailed]: "Not Authorized",
66
- [RealtimeErrorType.InsufficientFundsOrFreeAccount]: "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.",
77
+ [RealtimeErrorType.InsufficientFunds]: "Insufficient funds",
78
+ [RealtimeErrorType.FreeTierUser]: "This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",
67
79
  [RealtimeErrorType.NonexistentSessionId]: "Session ID does not exist",
68
80
  [RealtimeErrorType.SessionExpired]: "Session has expired",
69
81
  [RealtimeErrorType.ClosedSession]: "Session is closed",
@@ -72,11 +84,13 @@ const RealtimeErrorMessages = {
72
84
  [RealtimeErrorType.SessionTimeout]: "Session Timeout",
73
85
  [RealtimeErrorType.AudioTooShort]: "Audio too short",
74
86
  [RealtimeErrorType.AudioTooLong]: "Audio too long",
87
+ [RealtimeErrorType.AudioTooSmallToTranscode]: "Audio too small to transcode",
75
88
  [RealtimeErrorType.BadJson]: "Bad JSON",
76
89
  [RealtimeErrorType.BadSchema]: "Bad schema",
77
90
  [RealtimeErrorType.TooManyStreams]: "Too many streams",
78
- [RealtimeErrorType.Reconnected]: "Reconnected",
91
+ [RealtimeErrorType.Reconnected]: "This session has been reconnected. This WebSocket is no longer valid.",
79
92
  [RealtimeErrorType.ReconnectAttemptsExhausted]: "Reconnect attempts exhausted",
93
+ [RealtimeErrorType.WordBoostParameterParsingFailed]: "Could not parse word boost parameter",
80
94
  };
81
95
  class RealtimeError extends Error {
82
96
  }
@@ -170,7 +184,7 @@ class RealtimeTranscriber {
170
184
  this.socket.onclose = ({ code, reason }) => {
171
185
  var _a, _b;
172
186
  if (!reason) {
173
- if (code in RealtimeErrorType) {
187
+ if (code in RealtimeErrorMessages) {
174
188
  reason = RealtimeErrorMessages[code];
175
189
  }
176
190
  }
@@ -2239,6 +2239,16 @@ export type Transcript = {
2239
2239
  * The default value is 'en_us'.
2240
2240
  */
2241
2241
  language_code?: LiteralUnion<TranscriptLanguageCode, string>;
2242
+ /**
2243
+ * The confidence score for the detected language, between 0.0 (low confidence) and 1.0 (high confidence)
2244
+ */
2245
+ language_confidence: number | null;
2246
+ /**
2247
+ * The confidence threshold for the automatically detected language.
2248
+ * An error will be returned if the langauge confidence is below this threshold.
2249
+ * Defaults to 0.
2250
+ */
2251
+ language_confidence_threshold: number | null;
2242
2252
  /**
2243
2253
  * Whether {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection } is enabled, either true or false
2244
2254
  */
@@ -2374,7 +2384,7 @@ export type Transcript = {
2374
2384
  words?: TranscriptWord[] | null;
2375
2385
  };
2376
2386
  /**
2377
- * The word boost parameter value
2387
+ * How much to boost specified words
2378
2388
  */
2379
2389
  export type TranscriptBoostParam = "low" | "default" | "high";
2380
2390
  /**
@@ -2548,7 +2558,7 @@ export type TranscriptOptionalParams = {
2548
2558
  */
2549
2559
  auto_highlights?: boolean;
2550
2560
  /**
2551
- * The word boost parameter value
2561
+ * How much to boost specified words
2552
2562
  */
2553
2563
  boost_param?: TranscriptBoostParam;
2554
2564
  /**
@@ -2596,6 +2606,12 @@ export type TranscriptOptionalParams = {
2596
2606
  * The default value is 'en_us'.
2597
2607
  */
2598
2608
  language_code?: LiteralUnion<TranscriptLanguageCode, string> | null;
2609
+ /**
2610
+ * The confidence threshold for the automatically detected language.
2611
+ * An error will be returned if the langauge confidence is below this threshold.
2612
+ * Defaults to 0.
2613
+ */
2614
+ language_confidence_threshold?: number;
2599
2615
  /**
2600
2616
  * Enable {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection }, either true or false.
2601
2617
  */
@@ -2639,7 +2655,7 @@ export type TranscriptOptionalParams = {
2639
2655
  */
2640
2656
  speakers_expected?: number | null;
2641
2657
  /**
2642
- * The speech model to use for the transcription. When `null`, the default model is used.
2658
+ * The speech model to use for the transcription. When `null`, the "best" model is used.
2643
2659
  * @defaultValue null
2644
2660
  */
2645
2661
  speech_model?: SpeechModel | null;
@@ -1,22 +1,36 @@
1
- declare enum RealtimeErrorType {
2
- BadSampleRate = 4000,
3
- AuthFailed = 4001,
4
- InsufficientFundsOrFreeAccount = 4002,
5
- NonexistentSessionId = 4004,
6
- SessionExpired = 4008,
7
- ClosedSession = 4010,
8
- RateLimited = 4029,
9
- UniqueSessionViolation = 4030,
10
- SessionTimeout = 4031,
11
- AudioTooShort = 4032,
12
- AudioTooLong = 4033,
13
- BadJson = 4100,
14
- BadSchema = 4101,
15
- TooManyStreams = 4102,
16
- Reconnected = 4103,
17
- ReconnectAttemptsExhausted = 1013
18
- }
19
- declare const RealtimeErrorMessages: Record<RealtimeErrorType, string>;
1
+ declare const RealtimeErrorType: {
2
+ readonly BadSampleRate: 4000;
3
+ readonly AuthFailed: 4001;
4
+ /**
5
+ * @deprecated Use InsufficientFunds or FreeTierUser instead
6
+ */
7
+ readonly InsufficientFundsOrFreeAccount: 4002;
8
+ readonly InsufficientFunds: 4002;
9
+ readonly FreeTierUser: 4003;
10
+ readonly NonexistentSessionId: 4004;
11
+ readonly SessionExpired: 4008;
12
+ readonly ClosedSession: 4010;
13
+ readonly RateLimited: 4029;
14
+ readonly UniqueSessionViolation: 4030;
15
+ readonly SessionTimeout: 4031;
16
+ readonly AudioTooShort: 4032;
17
+ readonly AudioTooLong: 4033;
18
+ readonly AudioTooSmallToTranscode: 4034;
19
+ /**
20
+ * @deprecated Don't use
21
+ */
22
+ readonly BadJson: 4100;
23
+ readonly BadSchema: 4101;
24
+ readonly TooManyStreams: 4102;
25
+ readonly Reconnected: 4103;
26
+ /**
27
+ * @deprecated Don't use
28
+ */
29
+ readonly ReconnectAttemptsExhausted: 1013;
30
+ readonly WordBoostParameterParsingFailed: 4104;
31
+ };
32
+ type RealtimeErrorTypeCodes = (typeof RealtimeErrorType)[keyof typeof RealtimeErrorType];
33
+ declare const RealtimeErrorMessages: Record<RealtimeErrorTypeCodes, string>;
20
34
  declare class RealtimeError extends Error {
21
35
  }
22
- export { RealtimeError, RealtimeErrorType, RealtimeErrorMessages };
36
+ export { RealtimeError, RealtimeErrorType, RealtimeErrorTypeCodes, RealtimeErrorMessages, };
package/dist/workerd.mjs CHANGED
@@ -15,7 +15,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
15
15
  defaultUserAgentString += navigator.userAgent;
16
16
  }
17
17
  const defaultUserAgent = {
18
- sdk: { name: "JavaScript", version: "4.6.1" },
18
+ sdk: { name: "JavaScript", version: "4.7.0" },
19
19
  };
20
20
  if (typeof process !== "undefined") {
21
21
  if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
@@ -147,30 +147,42 @@ const { WritableStream } = typeof window !== "undefined"
147
147
 
148
148
  const factory = (url, params) => new ws(url, params);
149
149
 
150
- var RealtimeErrorType;
151
- (function (RealtimeErrorType) {
152
- RealtimeErrorType[RealtimeErrorType["BadSampleRate"] = 4000] = "BadSampleRate";
153
- RealtimeErrorType[RealtimeErrorType["AuthFailed"] = 4001] = "AuthFailed";
154
- // Both InsufficientFunds and FreeAccount error use 4002
155
- RealtimeErrorType[RealtimeErrorType["InsufficientFundsOrFreeAccount"] = 4002] = "InsufficientFundsOrFreeAccount";
156
- RealtimeErrorType[RealtimeErrorType["NonexistentSessionId"] = 4004] = "NonexistentSessionId";
157
- RealtimeErrorType[RealtimeErrorType["SessionExpired"] = 4008] = "SessionExpired";
158
- RealtimeErrorType[RealtimeErrorType["ClosedSession"] = 4010] = "ClosedSession";
159
- RealtimeErrorType[RealtimeErrorType["RateLimited"] = 4029] = "RateLimited";
160
- RealtimeErrorType[RealtimeErrorType["UniqueSessionViolation"] = 4030] = "UniqueSessionViolation";
161
- RealtimeErrorType[RealtimeErrorType["SessionTimeout"] = 4031] = "SessionTimeout";
162
- RealtimeErrorType[RealtimeErrorType["AudioTooShort"] = 4032] = "AudioTooShort";
163
- RealtimeErrorType[RealtimeErrorType["AudioTooLong"] = 4033] = "AudioTooLong";
164
- RealtimeErrorType[RealtimeErrorType["BadJson"] = 4100] = "BadJson";
165
- RealtimeErrorType[RealtimeErrorType["BadSchema"] = 4101] = "BadSchema";
166
- RealtimeErrorType[RealtimeErrorType["TooManyStreams"] = 4102] = "TooManyStreams";
167
- RealtimeErrorType[RealtimeErrorType["Reconnected"] = 4103] = "Reconnected";
168
- RealtimeErrorType[RealtimeErrorType["ReconnectAttemptsExhausted"] = 1013] = "ReconnectAttemptsExhausted";
169
- })(RealtimeErrorType || (RealtimeErrorType = {}));
150
+ const RealtimeErrorType = {
151
+ BadSampleRate: 4000,
152
+ AuthFailed: 4001,
153
+ /**
154
+ * @deprecated Use InsufficientFunds or FreeTierUser instead
155
+ */
156
+ InsufficientFundsOrFreeAccount: 4002,
157
+ InsufficientFunds: 4002,
158
+ FreeTierUser: 4003,
159
+ NonexistentSessionId: 4004,
160
+ SessionExpired: 4008,
161
+ ClosedSession: 4010,
162
+ RateLimited: 4029,
163
+ UniqueSessionViolation: 4030,
164
+ SessionTimeout: 4031,
165
+ AudioTooShort: 4032,
166
+ AudioTooLong: 4033,
167
+ AudioTooSmallToTranscode: 4034,
168
+ /**
169
+ * @deprecated Don't use
170
+ */
171
+ BadJson: 4100,
172
+ BadSchema: 4101,
173
+ TooManyStreams: 4102,
174
+ Reconnected: 4103,
175
+ /**
176
+ * @deprecated Don't use
177
+ */
178
+ ReconnectAttemptsExhausted: 1013,
179
+ WordBoostParameterParsingFailed: 4104,
180
+ };
170
181
  const RealtimeErrorMessages = {
171
182
  [RealtimeErrorType.BadSampleRate]: "Sample rate must be a positive integer",
172
183
  [RealtimeErrorType.AuthFailed]: "Not Authorized",
173
- [RealtimeErrorType.InsufficientFundsOrFreeAccount]: "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.",
184
+ [RealtimeErrorType.InsufficientFunds]: "Insufficient funds",
185
+ [RealtimeErrorType.FreeTierUser]: "This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",
174
186
  [RealtimeErrorType.NonexistentSessionId]: "Session ID does not exist",
175
187
  [RealtimeErrorType.SessionExpired]: "Session has expired",
176
188
  [RealtimeErrorType.ClosedSession]: "Session is closed",
@@ -179,11 +191,13 @@ const RealtimeErrorMessages = {
179
191
  [RealtimeErrorType.SessionTimeout]: "Session Timeout",
180
192
  [RealtimeErrorType.AudioTooShort]: "Audio too short",
181
193
  [RealtimeErrorType.AudioTooLong]: "Audio too long",
194
+ [RealtimeErrorType.AudioTooSmallToTranscode]: "Audio too small to transcode",
182
195
  [RealtimeErrorType.BadJson]: "Bad JSON",
183
196
  [RealtimeErrorType.BadSchema]: "Bad schema",
184
197
  [RealtimeErrorType.TooManyStreams]: "Too many streams",
185
- [RealtimeErrorType.Reconnected]: "Reconnected",
198
+ [RealtimeErrorType.Reconnected]: "This session has been reconnected. This WebSocket is no longer valid.",
186
199
  [RealtimeErrorType.ReconnectAttemptsExhausted]: "Reconnect attempts exhausted",
200
+ [RealtimeErrorType.WordBoostParameterParsingFailed]: "Could not parse word boost parameter",
187
201
  };
188
202
  class RealtimeError extends Error {
189
203
  }
@@ -275,7 +289,7 @@ class RealtimeTranscriber {
275
289
  };
276
290
  this.socket.onclose = ({ code, reason }) => {
277
291
  if (!reason) {
278
- if (code in RealtimeErrorType) {
292
+ if (code in RealtimeErrorMessages) {
279
293
  reason = RealtimeErrorMessages[code];
280
294
  }
281
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assemblyai",
3
- "version": "4.6.1",
3
+ "version": "4.7.0",
4
4
  "description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -17,11 +17,8 @@ import {
17
17
  AudioData,
18
18
  SessionInformation,
19
19
  } from "../..";
20
- import {
21
- RealtimeError,
22
- RealtimeErrorMessages,
23
- RealtimeErrorType,
24
- } from "../../utils/errors";
20
+ import { RealtimeError, RealtimeErrorMessages } from "../../utils/errors";
21
+ import { RealtimeErrorTypeCodes } from "../../utils/errors/realtime";
25
22
 
26
23
  const defaultRealtimeUrl = "wss://api.assemblyai.com/v2/realtime/ws";
27
24
  const forceEndOfUtteranceMessage = `{"force_end_utterance":true}`;
@@ -213,8 +210,8 @@ export class RealtimeTranscriber {
213
210
 
214
211
  this.socket!.onclose = ({ code, reason }: CloseEvent) => {
215
212
  if (!reason) {
216
- if (code in RealtimeErrorType) {
217
- reason = RealtimeErrorMessages[code as RealtimeErrorType];
213
+ if (code in RealtimeErrorMessages) {
214
+ reason = RealtimeErrorMessages[code as RealtimeErrorTypeCodes];
218
215
  }
219
216
  }
220
217
  this.listeners.close?.(code, reason);
@@ -2406,6 +2406,16 @@ export type Transcript = {
2406
2406
  * The default value is 'en_us'.
2407
2407
  */
2408
2408
  language_code?: LiteralUnion<TranscriptLanguageCode, string>;
2409
+ /**
2410
+ * The confidence score for the detected language, between 0.0 (low confidence) and 1.0 (high confidence)
2411
+ */
2412
+ language_confidence: number | null;
2413
+ /**
2414
+ * The confidence threshold for the automatically detected language.
2415
+ * An error will be returned if the langauge confidence is below this threshold.
2416
+ * Defaults to 0.
2417
+ */
2418
+ language_confidence_threshold: number | null;
2409
2419
  /**
2410
2420
  * Whether {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection } is enabled, either true or false
2411
2421
  */
@@ -2542,7 +2552,7 @@ export type Transcript = {
2542
2552
  };
2543
2553
 
2544
2554
  /**
2545
- * The word boost parameter value
2555
+ * How much to boost specified words
2546
2556
  */
2547
2557
  export type TranscriptBoostParam = "low" | "default" | "high";
2548
2558
 
@@ -2823,7 +2833,7 @@ export type TranscriptOptionalParams = {
2823
2833
  */
2824
2834
  auto_highlights?: boolean;
2825
2835
  /**
2826
- * The word boost parameter value
2836
+ * How much to boost specified words
2827
2837
  */
2828
2838
  boost_param?: TranscriptBoostParam;
2829
2839
  /**
@@ -2871,6 +2881,12 @@ export type TranscriptOptionalParams = {
2871
2881
  * The default value is 'en_us'.
2872
2882
  */
2873
2883
  language_code?: LiteralUnion<TranscriptLanguageCode, string> | null;
2884
+ /**
2885
+ * The confidence threshold for the automatically detected language.
2886
+ * An error will be returned if the langauge confidence is below this threshold.
2887
+ * Defaults to 0.
2888
+ */
2889
+ language_confidence_threshold?: number;
2874
2890
  /**
2875
2891
  * Enable {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection }, either true or false.
2876
2892
  */
@@ -2914,7 +2930,7 @@ export type TranscriptOptionalParams = {
2914
2930
  */
2915
2931
  speakers_expected?: number | null;
2916
2932
  /**
2917
- * The speech model to use for the transcription. When `null`, the default model is used.
2933
+ * The speech model to use for the transcription. When `null`, the "best" model is used.
2918
2934
  * @defaultValue null
2919
2935
  */
2920
2936
  speech_model?: SpeechModel | null;
@@ -1,28 +1,44 @@
1
- enum RealtimeErrorType {
2
- BadSampleRate = 4000,
3
- AuthFailed = 4001,
4
- // Both InsufficientFunds and FreeAccount error use 4002
5
- InsufficientFundsOrFreeAccount = 4002,
6
- NonexistentSessionId = 4004,
7
- SessionExpired = 4008,
8
- ClosedSession = 4010,
9
- RateLimited = 4029,
10
- UniqueSessionViolation = 4030,
11
- SessionTimeout = 4031,
12
- AudioTooShort = 4032,
13
- AudioTooLong = 4033,
14
- BadJson = 4100,
15
- BadSchema = 4101,
16
- TooManyStreams = 4102,
17
- Reconnected = 4103,
18
- ReconnectAttemptsExhausted = 1013,
19
- }
1
+ const RealtimeErrorType = {
2
+ BadSampleRate: 4000,
3
+ AuthFailed: 4001,
4
+ /**
5
+ * @deprecated Use InsufficientFunds or FreeTierUser instead
6
+ */
7
+ InsufficientFundsOrFreeAccount: 4002,
8
+ InsufficientFunds: 4002,
9
+ FreeTierUser: 4003,
10
+ NonexistentSessionId: 4004,
11
+ SessionExpired: 4008,
12
+ ClosedSession: 4010,
13
+ RateLimited: 4029,
14
+ UniqueSessionViolation: 4030,
15
+ SessionTimeout: 4031,
16
+ AudioTooShort: 4032,
17
+ AudioTooLong: 4033,
18
+ AudioTooSmallToTranscode: 4034,
19
+ /**
20
+ * @deprecated Don't use
21
+ */
22
+ BadJson: 4100,
23
+ BadSchema: 4101,
24
+ TooManyStreams: 4102,
25
+ Reconnected: 4103,
26
+ /**
27
+ * @deprecated Don't use
28
+ */
29
+ ReconnectAttemptsExhausted: 1013,
30
+ WordBoostParameterParsingFailed: 4104,
31
+ } as const;
20
32
 
21
- const RealtimeErrorMessages: Record<RealtimeErrorType, string> = {
33
+ type RealtimeErrorTypeCodes =
34
+ (typeof RealtimeErrorType)[keyof typeof RealtimeErrorType];
35
+
36
+ const RealtimeErrorMessages: Record<RealtimeErrorTypeCodes, string> = {
22
37
  [RealtimeErrorType.BadSampleRate]: "Sample rate must be a positive integer",
23
38
  [RealtimeErrorType.AuthFailed]: "Not Authorized",
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.",
39
+ [RealtimeErrorType.InsufficientFunds]: "Insufficient funds",
40
+ [RealtimeErrorType.FreeTierUser]:
41
+ "This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",
26
42
  [RealtimeErrorType.NonexistentSessionId]: "Session ID does not exist",
27
43
  [RealtimeErrorType.SessionExpired]: "Session has expired",
28
44
  [RealtimeErrorType.ClosedSession]: "Session is closed",
@@ -31,14 +47,23 @@ const RealtimeErrorMessages: Record<RealtimeErrorType, string> = {
31
47
  [RealtimeErrorType.SessionTimeout]: "Session Timeout",
32
48
  [RealtimeErrorType.AudioTooShort]: "Audio too short",
33
49
  [RealtimeErrorType.AudioTooLong]: "Audio too long",
50
+ [RealtimeErrorType.AudioTooSmallToTranscode]: "Audio too small to transcode",
34
51
  [RealtimeErrorType.BadJson]: "Bad JSON",
35
52
  [RealtimeErrorType.BadSchema]: "Bad schema",
36
53
  [RealtimeErrorType.TooManyStreams]: "Too many streams",
37
- [RealtimeErrorType.Reconnected]: "Reconnected",
54
+ [RealtimeErrorType.Reconnected]:
55
+ "This session has been reconnected. This WebSocket is no longer valid.",
38
56
  [RealtimeErrorType.ReconnectAttemptsExhausted]:
39
57
  "Reconnect attempts exhausted",
58
+ [RealtimeErrorType.WordBoostParameterParsingFailed]:
59
+ "Could not parse word boost parameter",
40
60
  };
41
61
 
42
62
  class RealtimeError extends Error {}
43
63
 
44
- export { RealtimeError, RealtimeErrorType, RealtimeErrorMessages };
64
+ export {
65
+ RealtimeError,
66
+ RealtimeErrorType,
67
+ RealtimeErrorTypeCodes,
68
+ RealtimeErrorMessages,
69
+ };