@cartesia/cartesia-js 2.2.4 → 2.2.7

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 (219) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +11 -6
  3. package/README.md +539 -172
  4. package/api/resources/apiStatus/client/Client.js +1 -1
  5. package/api/resources/auth/client/Client.d.ts +17 -0
  6. package/api/resources/auth/client/Client.js +18 -1
  7. package/api/resources/auth/types/TokenGrant.d.ts +3 -1
  8. package/api/resources/auth/types/TokenRequest.d.ts +2 -2
  9. package/api/resources/index.d.ts +1 -0
  10. package/api/resources/index.js +1 -0
  11. package/api/resources/infill/client/Client.js +1 -1
  12. package/api/resources/infill/client/requests/InfillBytesRequest.d.ts +3 -11
  13. package/api/resources/stt/client/Client.d.ts +43 -0
  14. package/api/resources/stt/client/Client.js +108 -0
  15. package/api/resources/stt/client/index.d.ts +1 -1
  16. package/api/resources/stt/client/index.js +15 -3
  17. package/api/resources/stt/client/requests/TranscriptionRequest.d.ts +147 -0
  18. package/api/resources/stt/client/requests/TranscriptionRequest.js +5 -0
  19. package/api/resources/stt/client/requests/index.d.ts +1 -0
  20. package/api/resources/stt/client/requests/index.js +2 -0
  21. package/api/resources/stt/index.d.ts +1 -0
  22. package/api/resources/stt/index.js +1 -0
  23. package/api/resources/stt/types/SttEncoding.d.ts +6 -6
  24. package/api/resources/stt/types/SttEncoding.js +5 -0
  25. package/api/resources/stt/types/TimestampGranularity.d.ts +12 -0
  26. package/api/resources/stt/types/TimestampGranularity.js +9 -0
  27. package/api/resources/stt/types/TranscriptMessage.d.ts +4 -1
  28. package/api/resources/stt/types/TranscriptionResponse.d.ts +4 -1
  29. package/api/resources/stt/types/TranscriptionWord.d.ts +11 -0
  30. package/api/resources/stt/types/TranscriptionWord.js +5 -0
  31. package/api/resources/stt/types/index.d.ts +2 -0
  32. package/api/resources/stt/types/index.js +2 -0
  33. package/api/resources/tts/client/Client.d.ts +7 -2
  34. package/api/resources/tts/client/Client.js +8 -8
  35. package/api/resources/tts/types/Controls.d.ts +1 -1
  36. package/api/resources/tts/types/Emotion.d.ts +2 -33
  37. package/api/resources/tts/types/Emotion.js +0 -28
  38. package/api/resources/tts/types/EmotionDeprecated.d.ts +38 -0
  39. package/api/resources/tts/types/EmotionDeprecated.js +33 -0
  40. package/api/resources/tts/types/GenerationConfig.d.ts +15 -0
  41. package/api/resources/tts/types/GenerationConfig.js +5 -0
  42. package/api/resources/tts/types/GenerationRequest.d.ts +5 -4
  43. package/api/resources/tts/types/Mp3OutputFormat.d.ts +1 -0
  44. package/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
  45. package/api/resources/tts/types/SseOutputFormat.d.ts +10 -0
  46. package/api/resources/tts/types/SseOutputFormat.js +5 -0
  47. package/api/resources/tts/types/TtsRequest.d.ts +1 -0
  48. package/api/resources/tts/types/TtssseRequest.d.ts +27 -0
  49. package/api/resources/tts/types/TtssseRequest.js +5 -0
  50. package/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +1 -0
  51. package/api/resources/tts/types/WebSocketRequest.d.ts +2 -4
  52. package/api/resources/tts/types/WebSocketTtsRequest.d.ts +4 -1
  53. package/api/resources/tts/types/index.d.ts +5 -1
  54. package/api/resources/tts/types/index.js +5 -1
  55. package/api/resources/voiceChanger/client/Client.d.ts +9 -4
  56. package/api/resources/voiceChanger/client/Client.js +24 -20
  57. package/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +3 -8
  58. package/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +3 -8
  59. package/api/resources/voices/client/Client.js +8 -8
  60. package/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +6 -24
  61. package/api/resources/voices/types/LocalizeDialect.d.ts +4 -8
  62. package/core/fetcher/Fetcher.d.ts +2 -2
  63. package/core/fetcher/Fetcher.js +4 -3
  64. package/core/fetcher/getResponseBody.js +3 -3
  65. package/dist/Client.d.ts +3 -0
  66. package/dist/Client.js +11 -6
  67. package/dist/api/resources/apiStatus/client/Client.js +1 -1
  68. package/dist/api/resources/auth/client/Client.d.ts +17 -0
  69. package/dist/api/resources/auth/client/Client.js +18 -1
  70. package/dist/api/resources/auth/types/TokenGrant.d.ts +3 -1
  71. package/dist/api/resources/auth/types/TokenRequest.d.ts +2 -2
  72. package/dist/api/resources/index.d.ts +1 -0
  73. package/dist/api/resources/index.js +1 -0
  74. package/dist/api/resources/infill/client/Client.js +1 -1
  75. package/dist/api/resources/infill/client/requests/InfillBytesRequest.d.ts +3 -11
  76. package/dist/api/resources/stt/client/Client.d.ts +43 -0
  77. package/dist/api/resources/stt/client/Client.js +108 -0
  78. package/dist/api/resources/stt/client/index.d.ts +1 -1
  79. package/dist/api/resources/stt/client/index.js +15 -3
  80. package/dist/api/resources/stt/client/requests/TranscriptionRequest.d.ts +147 -0
  81. package/dist/api/resources/stt/client/requests/TranscriptionRequest.js +5 -0
  82. package/dist/api/resources/stt/client/requests/index.d.ts +1 -0
  83. package/dist/api/resources/stt/client/requests/index.js +2 -0
  84. package/dist/api/resources/stt/index.d.ts +1 -0
  85. package/dist/api/resources/stt/index.js +1 -0
  86. package/dist/api/resources/stt/types/SttEncoding.d.ts +6 -6
  87. package/dist/api/resources/stt/types/SttEncoding.js +5 -0
  88. package/dist/api/resources/stt/types/TimestampGranularity.d.ts +12 -0
  89. package/dist/api/resources/stt/types/TimestampGranularity.js +9 -0
  90. package/dist/api/resources/stt/types/TranscriptMessage.d.ts +4 -1
  91. package/dist/api/resources/stt/types/TranscriptionResponse.d.ts +4 -1
  92. package/dist/api/resources/stt/types/TranscriptionWord.d.ts +11 -0
  93. package/dist/api/resources/stt/types/TranscriptionWord.js +5 -0
  94. package/dist/api/resources/stt/types/index.d.ts +2 -0
  95. package/dist/api/resources/stt/types/index.js +2 -0
  96. package/dist/api/resources/tts/client/Client.d.ts +7 -2
  97. package/dist/api/resources/tts/client/Client.js +8 -8
  98. package/dist/api/resources/tts/types/Controls.d.ts +1 -1
  99. package/dist/api/resources/tts/types/Emotion.d.ts +2 -33
  100. package/dist/api/resources/tts/types/Emotion.js +0 -28
  101. package/dist/api/resources/tts/types/EmotionDeprecated.d.ts +38 -0
  102. package/dist/api/resources/tts/types/EmotionDeprecated.js +33 -0
  103. package/dist/api/resources/tts/types/GenerationConfig.d.ts +15 -0
  104. package/dist/api/resources/tts/types/GenerationConfig.js +5 -0
  105. package/dist/api/resources/tts/types/GenerationRequest.d.ts +5 -4
  106. package/dist/api/resources/tts/types/Mp3OutputFormat.d.ts +1 -0
  107. package/dist/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
  108. package/dist/api/resources/tts/types/SseOutputFormat.d.ts +10 -0
  109. package/dist/api/resources/tts/types/SseOutputFormat.js +5 -0
  110. package/dist/api/resources/tts/types/TtsRequest.d.ts +1 -0
  111. package/dist/api/resources/tts/types/TtssseRequest.d.ts +27 -0
  112. package/dist/api/resources/tts/types/TtssseRequest.js +5 -0
  113. package/dist/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +1 -0
  114. package/dist/api/resources/tts/types/WebSocketRequest.d.ts +2 -4
  115. package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +4 -1
  116. package/dist/api/resources/tts/types/index.d.ts +5 -1
  117. package/dist/api/resources/tts/types/index.js +5 -1
  118. package/dist/api/resources/voiceChanger/client/Client.d.ts +9 -4
  119. package/dist/api/resources/voiceChanger/client/Client.js +24 -20
  120. package/dist/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +3 -8
  121. package/dist/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +3 -8
  122. package/dist/api/resources/voices/client/Client.js +8 -8
  123. package/dist/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +6 -24
  124. package/dist/api/resources/voices/types/LocalizeDialect.d.ts +4 -8
  125. package/dist/core/fetcher/Fetcher.d.ts +2 -2
  126. package/dist/core/fetcher/Fetcher.js +4 -3
  127. package/dist/core/fetcher/getResponseBody.js +3 -3
  128. package/dist/index.d.ts +2 -0
  129. package/dist/index.js +8 -1
  130. package/dist/serialization/resources/auth/types/TokenGrant.d.ts +2 -1
  131. package/dist/serialization/resources/auth/types/TokenGrant.js +2 -1
  132. package/dist/serialization/resources/auth/types/TokenRequest.d.ts +1 -1
  133. package/dist/serialization/resources/auth/types/TokenRequest.js +1 -1
  134. package/dist/serialization/resources/stt/types/SttEncoding.d.ts +1 -1
  135. package/dist/serialization/resources/stt/types/SttEncoding.js +1 -1
  136. package/dist/serialization/resources/stt/types/TimestampGranularity.d.ts +10 -0
  137. package/dist/serialization/resources/stt/types/TimestampGranularity.js +41 -0
  138. package/dist/serialization/resources/stt/types/TranscriptMessage.d.ts +2 -0
  139. package/dist/serialization/resources/stt/types/TranscriptMessage.js +2 -0
  140. package/dist/serialization/resources/stt/types/TranscriptionResponse.d.ts +2 -0
  141. package/dist/serialization/resources/stt/types/TranscriptionResponse.js +2 -0
  142. package/dist/serialization/resources/stt/types/TranscriptionWord.d.ts +14 -0
  143. package/dist/serialization/resources/stt/types/TranscriptionWord.js +45 -0
  144. package/dist/serialization/resources/stt/types/index.d.ts +2 -0
  145. package/dist/serialization/resources/stt/types/index.js +2 -0
  146. package/dist/serialization/resources/tts/types/Controls.d.ts +2 -2
  147. package/dist/serialization/resources/tts/types/Controls.js +2 -2
  148. package/dist/serialization/resources/tts/types/Emotion.d.ts +1 -1
  149. package/dist/serialization/resources/tts/types/Emotion.js +1 -27
  150. package/dist/serialization/resources/tts/types/EmotionDeprecated.d.ts +10 -0
  151. package/dist/serialization/resources/tts/types/EmotionDeprecated.js +67 -0
  152. package/dist/serialization/resources/tts/types/GenerationConfig.d.ts +15 -0
  153. package/dist/serialization/resources/tts/types/GenerationConfig.js +46 -0
  154. package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +3 -1
  155. package/dist/serialization/resources/tts/types/GenerationRequest.js +3 -1
  156. package/dist/serialization/resources/tts/types/SseOutputFormat.d.ts +15 -0
  157. package/dist/serialization/resources/tts/types/SseOutputFormat.js +46 -0
  158. package/dist/serialization/resources/tts/types/TtsRequest.d.ts +2 -0
  159. package/dist/serialization/resources/tts/types/TtsRequest.js +2 -0
  160. package/dist/serialization/resources/tts/types/TtssseRequest.d.ts +29 -0
  161. package/dist/serialization/resources/tts/types/TtssseRequest.js +60 -0
  162. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
  163. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +3 -1
  164. package/dist/serialization/resources/tts/types/index.d.ts +5 -1
  165. package/dist/serialization/resources/tts/types/index.js +5 -1
  166. package/dist/version.d.ts +1 -1
  167. package/dist/version.js +1 -1
  168. package/dist/wrapper/StreamingSTTClient.d.ts +22 -2
  169. package/dist/wrapper/StreamingSTTClient.js +124 -1
  170. package/dist/wrapper/SttWebsocket.d.ts +8 -3
  171. package/dist/wrapper/SttWebsocket.js +24 -3
  172. package/dist/wrapper/Websocket.js +1 -1
  173. package/index.d.ts +2 -0
  174. package/index.js +8 -1
  175. package/package.json +1 -1
  176. package/reference.md +89 -1
  177. package/serialization/resources/auth/types/TokenGrant.d.ts +2 -1
  178. package/serialization/resources/auth/types/TokenGrant.js +2 -1
  179. package/serialization/resources/auth/types/TokenRequest.d.ts +1 -1
  180. package/serialization/resources/auth/types/TokenRequest.js +1 -1
  181. package/serialization/resources/stt/types/SttEncoding.d.ts +1 -1
  182. package/serialization/resources/stt/types/SttEncoding.js +1 -1
  183. package/serialization/resources/stt/types/TimestampGranularity.d.ts +10 -0
  184. package/serialization/resources/stt/types/TimestampGranularity.js +41 -0
  185. package/serialization/resources/stt/types/TranscriptMessage.d.ts +2 -0
  186. package/serialization/resources/stt/types/TranscriptMessage.js +2 -0
  187. package/serialization/resources/stt/types/TranscriptionResponse.d.ts +2 -0
  188. package/serialization/resources/stt/types/TranscriptionResponse.js +2 -0
  189. package/serialization/resources/stt/types/TranscriptionWord.d.ts +14 -0
  190. package/serialization/resources/stt/types/TranscriptionWord.js +45 -0
  191. package/serialization/resources/stt/types/index.d.ts +2 -0
  192. package/serialization/resources/stt/types/index.js +2 -0
  193. package/serialization/resources/tts/types/Controls.d.ts +2 -2
  194. package/serialization/resources/tts/types/Controls.js +2 -2
  195. package/serialization/resources/tts/types/Emotion.d.ts +1 -1
  196. package/serialization/resources/tts/types/Emotion.js +1 -27
  197. package/serialization/resources/tts/types/EmotionDeprecated.d.ts +10 -0
  198. package/serialization/resources/tts/types/EmotionDeprecated.js +67 -0
  199. package/serialization/resources/tts/types/GenerationConfig.d.ts +15 -0
  200. package/serialization/resources/tts/types/GenerationConfig.js +46 -0
  201. package/serialization/resources/tts/types/GenerationRequest.d.ts +3 -1
  202. package/serialization/resources/tts/types/GenerationRequest.js +3 -1
  203. package/serialization/resources/tts/types/SseOutputFormat.d.ts +15 -0
  204. package/serialization/resources/tts/types/SseOutputFormat.js +46 -0
  205. package/serialization/resources/tts/types/TtsRequest.d.ts +2 -0
  206. package/serialization/resources/tts/types/TtsRequest.js +2 -0
  207. package/serialization/resources/tts/types/TtssseRequest.d.ts +29 -0
  208. package/serialization/resources/tts/types/TtssseRequest.js +60 -0
  209. package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
  210. package/serialization/resources/tts/types/WebSocketTtsRequest.js +3 -1
  211. package/serialization/resources/tts/types/index.d.ts +5 -1
  212. package/serialization/resources/tts/types/index.js +5 -1
  213. package/version.d.ts +1 -1
  214. package/version.js +1 -1
  215. package/wrapper/StreamingSTTClient.d.ts +22 -2
  216. package/wrapper/StreamingSTTClient.js +124 -1
  217. package/wrapper/SttWebsocket.d.ts +8 -3
  218. package/wrapper/SttWebsocket.js +24 -3
  219. package/wrapper/Websocket.js +1 -1
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.SseOutputFormat = void 0;
40
+ const core = __importStar(require("../../../../core"));
41
+ const RawEncoding_1 = require("./RawEncoding");
42
+ exports.SseOutputFormat = core.serialization.object({
43
+ container: core.serialization.stringLiteral("raw"),
44
+ encoding: RawEncoding_1.RawEncoding,
45
+ sampleRate: core.serialization.property("sample_rate", core.serialization.number()),
46
+ });
@@ -7,6 +7,7 @@ import * as core from "../../../../core";
7
7
  import { TtsRequestVoiceSpecifier } from "./TtsRequestVoiceSpecifier";
8
8
  import { SupportedLanguage } from "./SupportedLanguage";
9
9
  import { OutputFormat } from "./OutputFormat";
10
+ import { GenerationConfig } from "./GenerationConfig";
10
11
  import { ModelSpeed } from "./ModelSpeed";
11
12
  export declare const TtsRequest: core.serialization.ObjectSchema<serializers.TtsRequest.Raw, Cartesia.TtsRequest>;
12
13
  export declare namespace TtsRequest {
@@ -16,6 +17,7 @@ export declare namespace TtsRequest {
16
17
  voice: TtsRequestVoiceSpecifier.Raw;
17
18
  language?: SupportedLanguage.Raw | null;
18
19
  output_format: OutputFormat.Raw;
20
+ generation_config?: GenerationConfig.Raw | null;
19
21
  duration?: number | null;
20
22
  speed?: ModelSpeed.Raw | null;
21
23
  }
@@ -41,6 +41,7 @@ const core = __importStar(require("../../../../core"));
41
41
  const TtsRequestVoiceSpecifier_1 = require("./TtsRequestVoiceSpecifier");
42
42
  const SupportedLanguage_1 = require("./SupportedLanguage");
43
43
  const OutputFormat_1 = require("./OutputFormat");
44
+ const GenerationConfig_1 = require("./GenerationConfig");
44
45
  const ModelSpeed_1 = require("./ModelSpeed");
45
46
  exports.TtsRequest = core.serialization.object({
46
47
  modelId: core.serialization.property("model_id", core.serialization.string()),
@@ -48,6 +49,7 @@ exports.TtsRequest = core.serialization.object({
48
49
  voice: TtsRequestVoiceSpecifier_1.TtsRequestVoiceSpecifier,
49
50
  language: SupportedLanguage_1.SupportedLanguage.optional(),
50
51
  outputFormat: core.serialization.property("output_format", OutputFormat_1.OutputFormat),
52
+ generationConfig: core.serialization.property("generation_config", GenerationConfig_1.GenerationConfig.optional()),
51
53
  duration: core.serialization.number().optional(),
52
54
  speed: ModelSpeed_1.ModelSpeed.optional(),
53
55
  });
@@ -0,0 +1,29 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../../../index";
5
+ import * as Cartesia from "../../../../api/index";
6
+ import * as core from "../../../../core";
7
+ import { TtsRequestVoiceSpecifier } from "./TtsRequestVoiceSpecifier";
8
+ import { SupportedLanguage } from "./SupportedLanguage";
9
+ import { SseOutputFormat } from "./SseOutputFormat";
10
+ import { GenerationConfig } from "./GenerationConfig";
11
+ import { ModelSpeed } from "./ModelSpeed";
12
+ import { ContextId } from "./ContextId";
13
+ export declare const TtssseRequest: core.serialization.ObjectSchema<serializers.TtssseRequest.Raw, Cartesia.TtssseRequest>;
14
+ export declare namespace TtssseRequest {
15
+ interface Raw {
16
+ model_id: string;
17
+ transcript: string;
18
+ voice: TtsRequestVoiceSpecifier.Raw;
19
+ language?: SupportedLanguage.Raw | null;
20
+ output_format: SseOutputFormat.Raw;
21
+ generation_config?: GenerationConfig.Raw | null;
22
+ duration?: number | null;
23
+ speed?: ModelSpeed.Raw | null;
24
+ add_timestamps?: boolean | null;
25
+ add_phoneme_timestamps?: boolean | null;
26
+ use_normalized_timestamps?: boolean | null;
27
+ context_id?: ContextId.Raw | null;
28
+ }
29
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.TtssseRequest = void 0;
40
+ const core = __importStar(require("../../../../core"));
41
+ const TtsRequestVoiceSpecifier_1 = require("./TtsRequestVoiceSpecifier");
42
+ const SupportedLanguage_1 = require("./SupportedLanguage");
43
+ const SseOutputFormat_1 = require("./SseOutputFormat");
44
+ const GenerationConfig_1 = require("./GenerationConfig");
45
+ const ModelSpeed_1 = require("./ModelSpeed");
46
+ const ContextId_1 = require("./ContextId");
47
+ exports.TtssseRequest = core.serialization.object({
48
+ modelId: core.serialization.property("model_id", core.serialization.string()),
49
+ transcript: core.serialization.string(),
50
+ voice: TtsRequestVoiceSpecifier_1.TtsRequestVoiceSpecifier,
51
+ language: SupportedLanguage_1.SupportedLanguage.optional(),
52
+ outputFormat: core.serialization.property("output_format", SseOutputFormat_1.SseOutputFormat),
53
+ generationConfig: core.serialization.property("generation_config", GenerationConfig_1.GenerationConfig.optional()),
54
+ duration: core.serialization.number().optional(),
55
+ speed: ModelSpeed_1.ModelSpeed.optional(),
56
+ addTimestamps: core.serialization.property("add_timestamps", core.serialization.boolean().optional()),
57
+ addPhonemeTimestamps: core.serialization.property("add_phoneme_timestamps", core.serialization.boolean().optional()),
58
+ useNormalizedTimestamps: core.serialization.property("use_normalized_timestamps", core.serialization.boolean().optional()),
59
+ contextId: core.serialization.property("context_id", ContextId_1.ContextId.optional()),
60
+ });
@@ -5,6 +5,7 @@ import * as serializers from "../../../index";
5
5
  import * as Cartesia from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
7
  import { OutputFormat } from "./OutputFormat";
8
+ import { GenerationConfig } from "./GenerationConfig";
8
9
  import { TtsRequestVoiceSpecifier } from "./TtsRequestVoiceSpecifier";
9
10
  import { ModelSpeed } from "./ModelSpeed";
10
11
  export declare const WebSocketTtsRequest: core.serialization.ObjectSchema<serializers.WebSocketTtsRequest.Raw, Cartesia.WebSocketTtsRequest>;
@@ -12,13 +13,14 @@ export declare namespace WebSocketTtsRequest {
12
13
  interface Raw {
13
14
  model_id: string;
14
15
  output_format?: OutputFormat.Raw | null;
16
+ generation_config?: GenerationConfig.Raw | null;
15
17
  transcript?: string | null;
16
18
  voice: TtsRequestVoiceSpecifier.Raw;
17
19
  duration?: number | null;
18
20
  language?: string | null;
19
21
  add_timestamps?: boolean | null;
20
22
  add_phoneme_timestamps?: boolean | null;
21
- use_original_timestamps?: boolean | null;
23
+ use_normalized_timestamps?: boolean | null;
22
24
  continue?: boolean | null;
23
25
  context_id?: string | null;
24
26
  max_buffer_delay_ms?: number | null;
@@ -39,18 +39,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.WebSocketTtsRequest = void 0;
40
40
  const core = __importStar(require("../../../../core"));
41
41
  const OutputFormat_1 = require("./OutputFormat");
42
+ const GenerationConfig_1 = require("./GenerationConfig");
42
43
  const TtsRequestVoiceSpecifier_1 = require("./TtsRequestVoiceSpecifier");
43
44
  const ModelSpeed_1 = require("./ModelSpeed");
44
45
  exports.WebSocketTtsRequest = core.serialization.object({
45
46
  modelId: core.serialization.property("model_id", core.serialization.string()),
46
47
  outputFormat: core.serialization.property("output_format", OutputFormat_1.OutputFormat.optional()),
48
+ generationConfig: core.serialization.property("generation_config", GenerationConfig_1.GenerationConfig.optional()),
47
49
  transcript: core.serialization.string().optional(),
48
50
  voice: TtsRequestVoiceSpecifier_1.TtsRequestVoiceSpecifier,
49
51
  duration: core.serialization.number().optional(),
50
52
  language: core.serialization.string().optional(),
51
53
  addTimestamps: core.serialization.property("add_timestamps", core.serialization.boolean().optional()),
52
54
  addPhonemeTimestamps: core.serialization.property("add_phoneme_timestamps", core.serialization.boolean().optional()),
53
- useOriginalTimestamps: core.serialization.property("use_original_timestamps", core.serialization.boolean().optional()),
55
+ useNormalizedTimestamps: core.serialization.property("use_normalized_timestamps", core.serialization.boolean().optional()),
54
56
  continue: core.serialization.boolean().optional(),
55
57
  contextId: core.serialization.property("context_id", core.serialization.string().optional()),
56
58
  maxBufferDelayMs: core.serialization.property("max_buffer_delay_ms", core.serialization.number().optional()),
@@ -19,9 +19,13 @@ export * from "./WebSocketRawOutputFormat";
19
19
  export * from "./WebSocketRequest";
20
20
  export * from "./WebSocketTtsRequest";
21
21
  export * from "./TtsRequest";
22
+ export * from "./TtssseRequest";
22
23
  export * from "./SupportedLanguage";
24
+ export * from "./GenerationConfig";
25
+ export * from "./Emotion";
23
26
  export * from "./OutputFormat";
24
27
  export * from "./RawOutputFormat";
28
+ export * from "./SseOutputFormat";
25
29
  export * from "./RawEncoding";
26
30
  export * from "./WavOutputFormat";
27
31
  export * from "./Mp3OutputFormat";
@@ -32,4 +36,4 @@ export * from "./Controls";
32
36
  export * from "./Speed";
33
37
  export * from "./NumericalSpecifier";
34
38
  export * from "./NaturalSpecifier";
35
- export * from "./Emotion";
39
+ export * from "./EmotionDeprecated";
@@ -35,9 +35,13 @@ __exportStar(require("./WebSocketRawOutputFormat"), exports);
35
35
  __exportStar(require("./WebSocketRequest"), exports);
36
36
  __exportStar(require("./WebSocketTtsRequest"), exports);
37
37
  __exportStar(require("./TtsRequest"), exports);
38
+ __exportStar(require("./TtssseRequest"), exports);
38
39
  __exportStar(require("./SupportedLanguage"), exports);
40
+ __exportStar(require("./GenerationConfig"), exports);
41
+ __exportStar(require("./Emotion"), exports);
39
42
  __exportStar(require("./OutputFormat"), exports);
40
43
  __exportStar(require("./RawOutputFormat"), exports);
44
+ __exportStar(require("./SseOutputFormat"), exports);
41
45
  __exportStar(require("./RawEncoding"), exports);
42
46
  __exportStar(require("./WavOutputFormat"), exports);
43
47
  __exportStar(require("./Mp3OutputFormat"), exports);
@@ -48,4 +52,4 @@ __exportStar(require("./Controls"), exports);
48
52
  __exportStar(require("./Speed"), exports);
49
53
  __exportStar(require("./NumericalSpecifier"), exports);
50
54
  __exportStar(require("./NaturalSpecifier"), exports);
51
- __exportStar(require("./Emotion"), exports);
55
+ __exportStar(require("./EmotionDeprecated"), exports);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.2.4";
1
+ export declare const SDK_VERSION = "2.2.7";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "2.2.4";
4
+ exports.SDK_VERSION = "2.2.7";
@@ -1,6 +1,26 @@
1
1
  import { Stt } from "../api/resources/stt/client/Client";
2
- import SttWebsocket, { SttWebSocketOptions } from "./SttWebsocket";
2
+ import SttWebsocket, { SttWebSocketOptions, TranscriptionResult } from "./SttWebsocket";
3
3
  export declare class StreamingSTTClient extends Stt {
4
4
  constructor(options?: Stt.Options);
5
- websocket(options?: SttWebSocketOptions): SttWebsocket;
5
+ /**
6
+ * Create a WebSocket connection for real-time speech transcription.
7
+ *
8
+ * @param options - Configuration options for the STT WebSocket
9
+ * @param options.model - ID of the model to use for transcription (required)
10
+ * @param options.language - The language of the input audio in ISO-639-1 format (defaults to "en")
11
+ * @param options.encoding - The encoding format of the audio data (required). Must be one of: "pcm_s16le", "pcm_s32le", "pcm_f16le", "pcm_f32le", "pcm_mulaw", "pcm_alaw"
12
+ * @param options.sampleRate - The sample rate of the audio in Hz (required)
13
+ * @param options.minVolume - Volume threshold for voice activity detection (0.0-1.0)
14
+ * @param options.maxSilenceDurationSecs - Maximum duration of silence before endpointing
15
+ * @returns SttWebsocket instance for STT operations
16
+ */
17
+ websocket(options: SttWebSocketOptions): SttWebsocket;
18
+ /**
19
+ * Transcribe audio chunks using WebSocket with automatic connection management.
20
+ *
21
+ * @param audioChunks - Iterator of audio chunks as ArrayBuffer
22
+ * @param options - Configuration options for the STT WebSocket
23
+ * @returns AsyncGenerator yielding transcription results
24
+ */
25
+ transcribeChunks(audioChunks: AsyncIterable<ArrayBuffer>, options: SttWebSocketOptions): AsyncGenerator<TranscriptionResult, void, unknown>;
6
26
  }
@@ -1,4 +1,33 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
12
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
13
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
14
+ var m = o[Symbol.asyncIterator], i;
15
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
16
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
17
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
18
+ };
19
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
22
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
23
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
24
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
25
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
26
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
27
+ function fulfill(value) { resume("next", value); }
28
+ function reject(value) { resume("throw", value); }
29
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
30
+ };
2
31
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
32
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
33
  };
@@ -10,8 +39,102 @@ class StreamingSTTClient extends Client_1.Stt {
10
39
  constructor(options = {}) {
11
40
  super(options);
12
41
  }
13
- websocket(options = {}) {
42
+ /**
43
+ * Create a WebSocket connection for real-time speech transcription.
44
+ *
45
+ * @param options - Configuration options for the STT WebSocket
46
+ * @param options.model - ID of the model to use for transcription (required)
47
+ * @param options.language - The language of the input audio in ISO-639-1 format (defaults to "en")
48
+ * @param options.encoding - The encoding format of the audio data (required). Must be one of: "pcm_s16le", "pcm_s32le", "pcm_f16le", "pcm_f32le", "pcm_mulaw", "pcm_alaw"
49
+ * @param options.sampleRate - The sample rate of the audio in Hz (required)
50
+ * @param options.minVolume - Volume threshold for voice activity detection (0.0-1.0)
51
+ * @param options.maxSilenceDurationSecs - Maximum duration of silence before endpointing
52
+ * @returns SttWebsocket instance for STT operations
53
+ */
54
+ websocket(options) {
14
55
  return new SttWebsocket_1.default(options, Object.assign({ cartesiaVersion: "2024-06-10" }, this._options));
15
56
  }
57
+ /**
58
+ * Transcribe audio chunks using WebSocket with automatic connection management.
59
+ *
60
+ * @param audioChunks - Iterator of audio chunks as ArrayBuffer
61
+ * @param options - Configuration options for the STT WebSocket
62
+ * @returns AsyncGenerator yielding transcription results
63
+ */
64
+ transcribeChunks(audioChunks, options) {
65
+ return __asyncGenerator(this, arguments, function* transcribeChunks_1() {
66
+ const ws = this.websocket(options);
67
+ try {
68
+ // Set up message handling
69
+ const resultQueue = [];
70
+ let isComplete = false;
71
+ let error = null;
72
+ yield __await(ws.onMessage((result) => {
73
+ if (result.type === "error") {
74
+ error = new Error(result.message || "STT error occurred");
75
+ }
76
+ else if (result.type === "done") {
77
+ isComplete = true;
78
+ }
79
+ resultQueue.push(result);
80
+ }));
81
+ // Send audio chunks
82
+ const sendAudio = () => __awaiter(this, void 0, void 0, function* () {
83
+ var _a, e_1, _b, _c;
84
+ try {
85
+ try {
86
+ for (var _d = true, audioChunks_1 = __asyncValues(audioChunks), audioChunks_1_1; audioChunks_1_1 = yield audioChunks_1.next(), _a = audioChunks_1_1.done, !_a; _d = true) {
87
+ _c = audioChunks_1_1.value;
88
+ _d = false;
89
+ const chunk = _c;
90
+ yield ws.send(chunk);
91
+ }
92
+ }
93
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
94
+ finally {
95
+ try {
96
+ if (!_d && !_a && (_b = audioChunks_1.return)) yield _b.call(audioChunks_1);
97
+ }
98
+ finally { if (e_1) throw e_1.error; }
99
+ }
100
+ // Finalize and close session
101
+ yield ws.finalize();
102
+ yield ws.done();
103
+ }
104
+ catch (e) {
105
+ error = e instanceof Error ? e : new Error(String(e));
106
+ }
107
+ });
108
+ // Start sending audio in background
109
+ const sendPromise = sendAudio();
110
+ // Yield results as they come in
111
+ while (!isComplete && !error) {
112
+ if (resultQueue.length > 0) {
113
+ const result = resultQueue.shift();
114
+ yield yield __await(result);
115
+ if (result.type === "done") {
116
+ break;
117
+ }
118
+ }
119
+ else {
120
+ // Small delay to avoid busy waiting
121
+ yield __await(new Promise(resolve => setTimeout(resolve, 10)));
122
+ }
123
+ }
124
+ // Wait for sending to complete and handle any errors
125
+ yield __await(sendPromise);
126
+ if (error) {
127
+ throw error;
128
+ }
129
+ // Yield any remaining results
130
+ while (resultQueue.length > 0) {
131
+ yield yield __await(resultQueue.shift());
132
+ }
133
+ }
134
+ finally {
135
+ ws.disconnect();
136
+ }
137
+ });
138
+ }
16
139
  }
17
140
  exports.StreamingSTTClient = StreamingSTTClient;
@@ -1,10 +1,14 @@
1
1
  import { ReconnectingWebSocket, Options } from "../core/websocket";
2
2
  import { Stt } from "../api/resources/stt/client/Client";
3
+ import * as Cartesia from "../api/index";
4
+ import { SttEncoding } from "../api/resources/stt/types/SttEncoding";
3
5
  export interface SttWebSocketOptions {
4
6
  model?: string;
5
7
  language?: string;
6
- encoding?: string;
7
- sampleRate?: number;
8
+ encoding: SttEncoding;
9
+ sampleRate: number;
10
+ minVolume?: number;
11
+ maxSilenceDurationSecs?: number;
8
12
  }
9
13
  export interface TranscriptionResult {
10
14
  type: "transcript" | "flush_done" | "done" | "error";
@@ -13,13 +17,14 @@ export interface TranscriptionResult {
13
17
  isFinal?: boolean;
14
18
  duration?: number;
15
19
  language?: string;
20
+ words?: Cartesia.TranscriptionWord[];
16
21
  message?: string;
17
22
  }
18
23
  export default class SttWebsocket {
19
24
  #private;
20
25
  private readonly options;
21
26
  socket?: ReconnectingWebSocket;
22
- constructor({ model, language, encoding, sampleRate, }: SttWebSocketOptions, options: Stt.Options);
27
+ constructor({ model, language, encoding, sampleRate, minVolume, maxSilenceDurationSecs, }: SttWebSocketOptions, options: Stt.Options);
23
28
  send(audioData: ArrayBuffer): Promise<void>;
24
29
  finalize(): Promise<void>;
25
30
  done(): Promise<void>;
@@ -52,13 +52,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
52
52
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
53
53
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
54
54
  };
55
- var _SttWebsocket_instances, _SttWebsocket_isConnected, _SttWebsocket_model, _SttWebsocket_language, _SttWebsocket_encoding, _SttWebsocket_sampleRate, _SttWebsocket_connectionPromise, _SttWebsocket_ensureConnected;
55
+ var _SttWebsocket_instances, _SttWebsocket_isConnected, _SttWebsocket_model, _SttWebsocket_language, _SttWebsocket_encoding, _SttWebsocket_sampleRate, _SttWebsocket_minVolume, _SttWebsocket_maxSilenceDurationSecs, _SttWebsocket_connectionPromise, _SttWebsocket_ensureConnected;
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
57
  const core = __importStar(require("../core"));
58
58
  const environments = __importStar(require("../environments"));
59
59
  const websocket_1 = require("../core/websocket");
60
60
  class SttWebsocket {
61
- constructor({ model = "ink-whisper", language = "en", encoding = "pcm_s16le", sampleRate = 16000, }, options) {
61
+ constructor({ model = "ink-whisper", language = "en", encoding, sampleRate, minVolume, maxSilenceDurationSecs, }, options) {
62
62
  _SttWebsocket_instances.add(this);
63
63
  this.options = options;
64
64
  _SttWebsocket_isConnected.set(this, false);
@@ -66,11 +66,24 @@ class SttWebsocket {
66
66
  _SttWebsocket_language.set(this, void 0);
67
67
  _SttWebsocket_encoding.set(this, void 0);
68
68
  _SttWebsocket_sampleRate.set(this, void 0);
69
+ _SttWebsocket_minVolume.set(this, void 0);
70
+ _SttWebsocket_maxSilenceDurationSecs.set(this, void 0);
69
71
  _SttWebsocket_connectionPromise.set(this, void 0);
72
+ if (!model) {
73
+ throw new Error("model parameter is required");
74
+ }
75
+ if (!encoding) {
76
+ throw new Error("encoding parameter is required");
77
+ }
78
+ if (!sampleRate) {
79
+ throw new Error("sampleRate parameter is required");
80
+ }
70
81
  __classPrivateFieldSet(this, _SttWebsocket_model, model, "f");
71
82
  __classPrivateFieldSet(this, _SttWebsocket_language, language, "f");
72
83
  __classPrivateFieldSet(this, _SttWebsocket_encoding, encoding, "f");
73
84
  __classPrivateFieldSet(this, _SttWebsocket_sampleRate, sampleRate, "f");
85
+ __classPrivateFieldSet(this, _SttWebsocket_minVolume, minVolume, "f");
86
+ __classPrivateFieldSet(this, _SttWebsocket_maxSilenceDurationSecs, maxSilenceDurationSecs, "f");
74
87
  }
75
88
  send(audioData) {
76
89
  return __awaiter(this, void 0, void 0, function* () {
@@ -112,6 +125,10 @@ class SttWebsocket {
112
125
  result.isFinal = data.is_final || false;
113
126
  result.duration = data.duration;
114
127
  result.language = data.language;
128
+ // Include word-level timestamps if available
129
+ if (data.words) {
130
+ result.words = data.words;
131
+ }
115
132
  }
116
133
  else if (data.type === "flush_done") {
117
134
  // Acknowledgment for finalize command
@@ -152,6 +169,10 @@ class SttWebsocket {
152
169
  };
153
170
  if (__classPrivateFieldGet(this, _SttWebsocket_language, "f"))
154
171
  params.language = __classPrivateFieldGet(this, _SttWebsocket_language, "f");
172
+ if (__classPrivateFieldGet(this, _SttWebsocket_minVolume, "f") !== undefined)
173
+ params.min_volume = __classPrivateFieldGet(this, _SttWebsocket_minVolume, "f").toString();
174
+ if (__classPrivateFieldGet(this, _SttWebsocket_maxSilenceDurationSecs, "f") !== undefined)
175
+ params.max_silence_duration_secs = __classPrivateFieldGet(this, _SttWebsocket_maxSilenceDurationSecs, "f").toString();
155
176
  const apiKey = yield core.Supplier.get(this.options.apiKey);
156
177
  if (apiKey) {
157
178
  params.api_key = apiKey;
@@ -185,7 +206,7 @@ class SttWebsocket {
185
206
  __classPrivateFieldSet(this, _SttWebsocket_isConnected, false, "f");
186
207
  }
187
208
  }
188
- _SttWebsocket_isConnected = new WeakMap(), _SttWebsocket_model = new WeakMap(), _SttWebsocket_language = new WeakMap(), _SttWebsocket_encoding = new WeakMap(), _SttWebsocket_sampleRate = new WeakMap(), _SttWebsocket_connectionPromise = new WeakMap(), _SttWebsocket_instances = new WeakSet(), _SttWebsocket_ensureConnected = function _SttWebsocket_ensureConnected() {
209
+ _SttWebsocket_isConnected = new WeakMap(), _SttWebsocket_model = new WeakMap(), _SttWebsocket_language = new WeakMap(), _SttWebsocket_encoding = new WeakMap(), _SttWebsocket_sampleRate = new WeakMap(), _SttWebsocket_minVolume = new WeakMap(), _SttWebsocket_maxSilenceDurationSecs = new WeakMap(), _SttWebsocket_connectionPromise = new WeakMap(), _SttWebsocket_instances = new WeakSet(), _SttWebsocket_ensureConnected = function _SttWebsocket_ensureConnected() {
189
210
  return __awaiter(this, void 0, void 0, function* () {
190
211
  if (__classPrivateFieldGet(this, _SttWebsocket_isConnected, "f"))
191
212
  return;
@@ -180,7 +180,7 @@ class Websocket {
180
180
  var _a;
181
181
  const baseUrl = ((_a = (yield core.Supplier.get(this.options.environment))) !== null && _a !== void 0 ? _a : environments.CartesiaEnvironment.Production).replace(/^https?:\/\//, "");
182
182
  const params = {
183
- cartesia_version: this.options.cartesiaVersion || "2024-06-10",
183
+ cartesia_version: this.options.cartesiaVersion || "2025-04-16",
184
184
  };
185
185
  const apiKey = yield core.Supplier.get(this.options.apiKey);
186
186
  if (apiKey) {
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * as Cartesia from "./api";
2
2
  export { CartesiaClient } from "./wrapper/Client";
3
3
  export { WebPlayer } from "./wrapper/WebPlayer";
4
+ export { default as SttWebsocket } from "./wrapper/SttWebsocket";
5
+ export { StreamingSTTClient } from "./wrapper/StreamingSTTClient";
4
6
  export { CartesiaEnvironment } from "./environments";
5
7
  export { CartesiaError, CartesiaTimeoutError } from "./errors";
package/index.js CHANGED
@@ -32,13 +32,20 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.CartesiaTimeoutError = exports.CartesiaError = exports.CartesiaEnvironment = exports.WebPlayer = exports.CartesiaClient = exports.Cartesia = void 0;
39
+ exports.CartesiaTimeoutError = exports.CartesiaError = exports.CartesiaEnvironment = exports.StreamingSTTClient = exports.SttWebsocket = exports.WebPlayer = exports.CartesiaClient = exports.Cartesia = void 0;
37
40
  exports.Cartesia = __importStar(require("./api"));
38
41
  var Client_1 = require("./wrapper/Client");
39
42
  Object.defineProperty(exports, "CartesiaClient", { enumerable: true, get: function () { return Client_1.CartesiaClient; } });
40
43
  var WebPlayer_1 = require("./wrapper/WebPlayer");
41
44
  Object.defineProperty(exports, "WebPlayer", { enumerable: true, get: function () { return WebPlayer_1.WebPlayer; } });
45
+ var SttWebsocket_1 = require("./wrapper/SttWebsocket");
46
+ Object.defineProperty(exports, "SttWebsocket", { enumerable: true, get: function () { return __importDefault(SttWebsocket_1).default; } });
47
+ var StreamingSTTClient_1 = require("./wrapper/StreamingSTTClient");
48
+ Object.defineProperty(exports, "StreamingSTTClient", { enumerable: true, get: function () { return StreamingSTTClient_1.StreamingSTTClient; } });
42
49
  var environments_1 = require("./environments");
43
50
  Object.defineProperty(exports, "CartesiaEnvironment", { enumerable: true, get: function () { return environments_1.CartesiaEnvironment; } });
44
51
  var errors_1 = require("./errors");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartesia/cartesia-js",
3
- "version": "2.2.4",
3
+ "version": "2.2.7",
4
4
  "private": false,
5
5
  "repository": "https://github.com/cartesia-ai/cartesia-js",
6
6
  "main": "./index.js",