@cartesia/cartesia-js 2.2.4 → 2.2.5

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 (50) hide show
  1. package/README.md +86 -44
  2. package/api/resources/apiStatus/client/Client.js +1 -1
  3. package/api/resources/auth/client/Client.js +1 -1
  4. package/api/resources/infill/client/Client.js +1 -1
  5. package/api/resources/stt/types/SttEncoding.d.ts +6 -6
  6. package/api/resources/stt/types/SttEncoding.js +5 -0
  7. package/api/resources/stt/types/TranscriptMessage.d.ts +3 -0
  8. package/api/resources/stt/types/TranscriptionResponse.d.ts +3 -0
  9. package/api/resources/stt/types/TranscriptionWord.d.ts +11 -0
  10. package/api/resources/stt/types/TranscriptionWord.js +5 -0
  11. package/api/resources/stt/types/index.d.ts +1 -0
  12. package/api/resources/stt/types/index.js +1 -0
  13. package/api/resources/voices/client/Client.js +8 -8
  14. package/dist/api/resources/apiStatus/client/Client.js +1 -1
  15. package/dist/api/resources/auth/client/Client.js +1 -1
  16. package/dist/api/resources/infill/client/Client.js +1 -1
  17. package/dist/api/resources/stt/types/SttEncoding.d.ts +6 -6
  18. package/dist/api/resources/stt/types/SttEncoding.js +5 -0
  19. package/dist/api/resources/stt/types/TranscriptMessage.d.ts +3 -0
  20. package/dist/api/resources/stt/types/TranscriptionResponse.d.ts +3 -0
  21. package/dist/api/resources/stt/types/TranscriptionWord.d.ts +11 -0
  22. package/dist/api/resources/stt/types/TranscriptionWord.js +5 -0
  23. package/dist/api/resources/stt/types/index.d.ts +1 -0
  24. package/dist/api/resources/stt/types/index.js +1 -0
  25. package/dist/api/resources/voices/client/Client.js +8 -8
  26. package/dist/serialization/resources/stt/types/SttEncoding.d.ts +1 -1
  27. package/dist/serialization/resources/stt/types/SttEncoding.js +1 -1
  28. package/dist/serialization/resources/stt/types/TranscriptMessage.d.ts +2 -0
  29. package/dist/serialization/resources/stt/types/TranscriptMessage.js +2 -0
  30. package/dist/serialization/resources/stt/types/TranscriptionResponse.d.ts +2 -0
  31. package/dist/serialization/resources/stt/types/TranscriptionResponse.js +2 -0
  32. package/dist/serialization/resources/stt/types/TranscriptionWord.d.ts +14 -0
  33. package/dist/serialization/resources/stt/types/TranscriptionWord.js +45 -0
  34. package/dist/serialization/resources/stt/types/index.d.ts +1 -0
  35. package/dist/serialization/resources/stt/types/index.js +1 -0
  36. package/dist/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/package.json +1 -1
  39. package/serialization/resources/stt/types/SttEncoding.d.ts +1 -1
  40. package/serialization/resources/stt/types/SttEncoding.js +1 -1
  41. package/serialization/resources/stt/types/TranscriptMessage.d.ts +2 -0
  42. package/serialization/resources/stt/types/TranscriptMessage.js +2 -0
  43. package/serialization/resources/stt/types/TranscriptionResponse.d.ts +2 -0
  44. package/serialization/resources/stt/types/TranscriptionResponse.js +2 -0
  45. package/serialization/resources/stt/types/TranscriptionWord.d.ts +14 -0
  46. package/serialization/resources/stt/types/TranscriptionWord.js +45 -0
  47. package/serialization/resources/stt/types/index.d.ts +1 -0
  48. package/serialization/resources/stt/types/index.js +1 -0
  49. package/version.d.ts +1 -1
  50. package/version.js +1 -1
package/README.md CHANGED
@@ -145,58 +145,100 @@ console.log("Done playing.");
145
145
 
146
146
  ```typescript
147
147
  import { CartesiaClient } from "@cartesia/cartesia-js";
148
- import fs from "fs";
148
+ import fs from "node:fs";
149
+
150
+ async function streamingSTTExample() {
151
+ const client = new CartesiaClient({
152
+ apiKey: process.env.CARTESIA_API_KEY,
153
+ });
154
+
155
+ const sttWs = client.stt.websocket({
156
+ model: "ink-whisper",
157
+ language: "en", // Must match the language of your audio
158
+ encoding: "pcm_s16le", // Must match your audio's encoding format (only pcm_s16le is supported currently)
159
+ sampleRate: 16000, // Must match your audio's sample rate (only 16000 is supported currently)
160
+ });
161
+
162
+ // Concurrent audio sending
163
+ async function sendAudio() {
164
+ try {
165
+ const audioBuffer = fs.readFileSync("audio.wav");
166
+ const chunkSize = 3200; // ~200ms chunks for more realistic streaming
167
+
168
+ console.log("Starting audio stream...");
169
+
170
+ for (let i = 0; i < audioBuffer.length; i += chunkSize) {
171
+ const chunk = audioBuffer.subarray(i, i + chunkSize);
172
+ const arrayBuffer = chunk.buffer.slice(
173
+ chunk.byteOffset,
174
+ chunk.byteOffset + chunk.byteLength,
175
+ );
176
+
177
+ await sttWs.send(arrayBuffer);
178
+ console.log(`Sent chunk ${Math.floor(i / chunkSize) + 1}`);
179
+
180
+ // Simulate real-time audio capture delay
181
+ await new Promise((resolve) => setTimeout(resolve, 100));
182
+ }
183
+
184
+ await sttWs.finalize();
185
+ console.log("Audio streaming completed");
186
+ } catch (error) {
187
+ console.error("Error sending audio:", error);
188
+ }
189
+ }
149
190
 
150
- const client = new CartesiaClient({
151
- apiKey: process.env.CARTESIA_API_KEY,
152
- });
191
+ // Concurrent transcript receiving
192
+ async function receiveTranscripts(): Promise<string> {
193
+ return new Promise((resolve) => {
194
+ let fullTranscript = "";
195
+
196
+ sttWs.onMessage((result) => {
197
+ if (result.type === "transcript") {
198
+ const status = result.isFinal ? "FINAL" : "INTERIM";
199
+ console.log(`[${status}] "${result.text}"`);
200
+
201
+ if (result.isFinal) {
202
+ fullTranscript += `${result.text} `;
203
+ }
204
+ } else if (result.type === "flush_done") {
205
+ console.log("Flush completed - sending done command");
206
+ sttWs.done().catch(console.error);
207
+ } else if (result.type === "done") {
208
+ console.log("Transcription completed");
209
+ resolve(fullTranscript.trim());
210
+ } else if (result.type === "error") {
211
+ console.error(`Error: ${result.message}`);
212
+ resolve("");
213
+ }
214
+ });
215
+ });
216
+ }
153
217
 
154
- // Create STT WebSocket connection
155
- const sttWs = client.stt.websocket({
156
- model: "ink-whisper",
157
- language: "en",
158
- encoding: "pcm_s16le",
159
- sampleRate: 16000,
160
- });
218
+ try {
219
+ console.log("Starting STT processing...");
161
220
 
162
- // Set up message handler
163
- await sttWs.onMessage((result) => {
164
- if (result.type === "transcript") {
165
- const status = result.isFinal ? "FINAL" : "INTERIM";
166
- console.log(`[${status}] ${result.text}`);
167
- if (result.duration) {
168
- console.log(`Duration: ${result.duration.toFixed(2)}s`);
169
- }
170
- } else if (result.type === "flush_done") {
171
- console.log("Flush completed");
172
- await sttWs.done(); // Send done command
173
- } else if (result.type === "done") {
174
- console.log("Session complete");
175
- } else if (result.type === "error") {
176
- console.error(`Error: ${result.message}`);
177
- }
178
- });
221
+ // Run audio sending and transcript receiving concurrently
222
+ const [, finalTranscript] = await Promise.all([
223
+ sendAudio(),
224
+ receiveTranscripts(),
225
+ ]);
179
226
 
180
- // Load and send audio data
181
- const audioBuffer = fs.readFileSync("audio.wav");
182
- const chunkSize = 1600; // ~100ms at 16kHz
183
- const audioChunks = [];
227
+ console.log(`\nFinal transcript: ${finalTranscript}`);
184
228
 
185
- for (let i = 0; i < audioBuffer.length; i += chunkSize) {
186
- const chunk = audioBuffer.slice(i, i + chunkSize);
187
- audioChunks.push(chunk.buffer);
188
- }
229
+ // Clean up
230
+ sttWs.disconnect();
189
231
 
190
- // Send audio chunks
191
- for (const chunk of audioChunks) {
192
- await sttWs.send(chunk);
232
+ return finalTranscript;
233
+ } catch (error) {
234
+ console.error("STT processing error:", error);
235
+ sttWs.disconnect();
236
+ throw error;
237
+ }
193
238
  }
194
239
 
195
- // Finalize transcription
196
- await sttWs.finalize();
197
-
198
- // Disconnect when done
199
- sttWs.disconnect();
240
+ // Run the example
241
+ streamingSTTExample().catch(console.error);
200
242
  ```
201
243
 
202
244
  ## Request And Response Types
@@ -66,7 +66,7 @@ class ApiStatus {
66
66
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
67
67
  url: (_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production,
68
68
  method: "GET",
69
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
69
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
70
70
  contentType: "application/json",
71
71
  requestType: "json",
72
72
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -78,7 +78,7 @@ class Auth {
78
78
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
79
79
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "access-token"),
80
80
  method: "POST",
81
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
81
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
82
82
  contentType: "application/json",
83
83
  requestType: "json",
84
84
  body: serializers.TokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -113,7 +113,7 @@ class Infill {
113
113
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
114
114
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/infill/bytes"),
115
115
  method: "POST",
116
- headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
116
+ headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
117
117
  requestType: "file",
118
118
  duplex: _maybeEncodedRequest.duplex,
119
119
  body: _maybeEncodedRequest.body,
@@ -3,13 +3,13 @@
3
3
  */
4
4
  /**
5
5
  * The encoding format for audio data sent to the STT WebSocket.
6
- *
7
- * Currently supported:
8
- * - `pcm_s16le` - 16-bit signed integer PCM, little-endian
9
- *
10
- * Support for other formats will be added in the future.
11
6
  */
12
- export type SttEncoding = "pcm_s16le";
7
+ export type SttEncoding = "pcm_s16le" | "pcm_s32le" | "pcm_f16le" | "pcm_f32le" | "pcm_mulaw" | "pcm_alaw";
13
8
  export declare const SttEncoding: {
14
9
  readonly PcmS16Le: "pcm_s16le";
10
+ readonly PcmS32Le: "pcm_s32le";
11
+ readonly PcmF16Le: "pcm_f16le";
12
+ readonly PcmF32Le: "pcm_f32le";
13
+ readonly PcmMulaw: "pcm_mulaw";
14
+ readonly PcmAlaw: "pcm_alaw";
15
15
  };
@@ -6,4 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SttEncoding = void 0;
7
7
  exports.SttEncoding = {
8
8
  PcmS16Le: "pcm_s16le",
9
+ PcmS32Le: "pcm_s32le",
10
+ PcmF16Le: "pcm_f16le",
11
+ PcmF32Le: "pcm_f32le",
12
+ PcmMulaw: "pcm_mulaw",
13
+ PcmAlaw: "pcm_alaw",
9
14
  };
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Cartesia from "../../../index";
4
5
  export interface TranscriptMessage {
5
6
  /** Unique identifier for this transcription session. */
6
7
  requestId: string;
@@ -16,4 +17,6 @@ export interface TranscriptMessage {
16
17
  duration?: number;
17
18
  /** The detected or specified language of the input audio. */
18
19
  language?: string;
20
+ /** Word-level timestamps showing the start and end time of each word in seconds. Always included in streaming responses. */
21
+ words?: Cartesia.TranscriptionWord[];
19
22
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Cartesia from "../../../index";
4
5
  export interface TranscriptionResponse {
5
6
  /** The transcribed text. */
6
7
  text: string;
@@ -8,4 +9,6 @@ export interface TranscriptionResponse {
8
9
  language?: string;
9
10
  /** The duration of the input audio in seconds. */
10
11
  duration?: number;
12
+ /** Word-level timestamps for batch transcription responses. */
13
+ words?: Cartesia.TranscriptionWord[];
11
14
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface TranscriptionWord {
5
+ /** The transcribed word. */
6
+ word: string;
7
+ /** Start time of the word in seconds. */
8
+ start: number;
9
+ /** End time of the word in seconds. */
10
+ end: number;
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ export * from "./TranscriptionWord";
1
2
  export * from "./TranscriptionResponse";
2
3
  export * from "./StreamingTranscriptionResponse";
3
4
  export * from "./TranscriptMessage";
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./TranscriptionWord"), exports);
17
18
  __exportStar(require("./TranscriptionResponse"), exports);
18
19
  __exportStar(require("./StreamingTranscriptionResponse"), exports);
19
20
  __exportStar(require("./TranscriptMessage"), exports);
@@ -70,7 +70,7 @@ class Voices {
70
70
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
71
71
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
72
72
  method: "GET",
73
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
73
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
74
74
  contentType: "application/json",
75
75
  requestType: "json",
76
76
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -155,7 +155,7 @@ class Voices {
155
155
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
156
156
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/clone"),
157
157
  method: "POST",
158
- headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
158
+ headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
159
159
  requestType: "file",
160
160
  duplex: _maybeEncodedRequest.duplex,
161
161
  body: _maybeEncodedRequest.body,
@@ -206,7 +206,7 @@ class Voices {
206
206
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
207
207
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
208
208
  method: "DELETE",
209
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
209
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
210
210
  contentType: "application/json",
211
211
  requestType: "json",
212
212
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -254,7 +254,7 @@ class Voices {
254
254
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
255
255
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
256
256
  method: "PATCH",
257
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
257
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
258
258
  contentType: "application/json",
259
259
  requestType: "json",
260
260
  body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -305,7 +305,7 @@ class Voices {
305
305
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
306
306
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
307
307
  method: "GET",
308
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
308
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
309
309
  contentType: "application/json",
310
310
  requestType: "json",
311
311
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -364,7 +364,7 @@ class Voices {
364
364
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
365
365
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/localize"),
366
366
  method: "POST",
367
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
367
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
368
368
  contentType: "application/json",
369
369
  requestType: "json",
370
370
  body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -423,7 +423,7 @@ class Voices {
423
423
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
424
424
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/mix"),
425
425
  method: "POST",
426
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
426
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
427
427
  contentType: "application/json",
428
428
  requestType: "json",
429
429
  body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -482,7 +482,7 @@ class Voices {
482
482
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
483
483
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
484
484
  method: "POST",
485
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
485
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
486
486
  contentType: "application/json",
487
487
  requestType: "json",
488
488
  body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -66,7 +66,7 @@ class ApiStatus {
66
66
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
67
67
  url: (_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production,
68
68
  method: "GET",
69
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
69
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
70
70
  contentType: "application/json",
71
71
  requestType: "json",
72
72
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -78,7 +78,7 @@ class Auth {
78
78
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
79
79
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "access-token"),
80
80
  method: "POST",
81
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
81
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
82
82
  contentType: "application/json",
83
83
  requestType: "json",
84
84
  body: serializers.TokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -113,7 +113,7 @@ class Infill {
113
113
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
114
114
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/infill/bytes"),
115
115
  method: "POST",
116
- headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
116
+ headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
117
117
  requestType: "file",
118
118
  duplex: _maybeEncodedRequest.duplex,
119
119
  body: _maybeEncodedRequest.body,
@@ -3,13 +3,13 @@
3
3
  */
4
4
  /**
5
5
  * The encoding format for audio data sent to the STT WebSocket.
6
- *
7
- * Currently supported:
8
- * - `pcm_s16le` - 16-bit signed integer PCM, little-endian
9
- *
10
- * Support for other formats will be added in the future.
11
6
  */
12
- export type SttEncoding = "pcm_s16le";
7
+ export type SttEncoding = "pcm_s16le" | "pcm_s32le" | "pcm_f16le" | "pcm_f32le" | "pcm_mulaw" | "pcm_alaw";
13
8
  export declare const SttEncoding: {
14
9
  readonly PcmS16Le: "pcm_s16le";
10
+ readonly PcmS32Le: "pcm_s32le";
11
+ readonly PcmF16Le: "pcm_f16le";
12
+ readonly PcmF32Le: "pcm_f32le";
13
+ readonly PcmMulaw: "pcm_mulaw";
14
+ readonly PcmAlaw: "pcm_alaw";
15
15
  };
@@ -6,4 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SttEncoding = void 0;
7
7
  exports.SttEncoding = {
8
8
  PcmS16Le: "pcm_s16le",
9
+ PcmS32Le: "pcm_s32le",
10
+ PcmF16Le: "pcm_f16le",
11
+ PcmF32Le: "pcm_f32le",
12
+ PcmMulaw: "pcm_mulaw",
13
+ PcmAlaw: "pcm_alaw",
9
14
  };
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Cartesia from "../../../index";
4
5
  export interface TranscriptMessage {
5
6
  /** Unique identifier for this transcription session. */
6
7
  requestId: string;
@@ -16,4 +17,6 @@ export interface TranscriptMessage {
16
17
  duration?: number;
17
18
  /** The detected or specified language of the input audio. */
18
19
  language?: string;
20
+ /** Word-level timestamps showing the start and end time of each word in seconds. Always included in streaming responses. */
21
+ words?: Cartesia.TranscriptionWord[];
19
22
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Cartesia from "../../../index";
4
5
  export interface TranscriptionResponse {
5
6
  /** The transcribed text. */
6
7
  text: string;
@@ -8,4 +9,6 @@ export interface TranscriptionResponse {
8
9
  language?: string;
9
10
  /** The duration of the input audio in seconds. */
10
11
  duration?: number;
12
+ /** Word-level timestamps for batch transcription responses. */
13
+ words?: Cartesia.TranscriptionWord[];
11
14
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface TranscriptionWord {
5
+ /** The transcribed word. */
6
+ word: string;
7
+ /** Start time of the word in seconds. */
8
+ start: number;
9
+ /** End time of the word in seconds. */
10
+ end: number;
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ export * from "./TranscriptionWord";
1
2
  export * from "./TranscriptionResponse";
2
3
  export * from "./StreamingTranscriptionResponse";
3
4
  export * from "./TranscriptMessage";
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./TranscriptionWord"), exports);
17
18
  __exportStar(require("./TranscriptionResponse"), exports);
18
19
  __exportStar(require("./StreamingTranscriptionResponse"), exports);
19
20
  __exportStar(require("./TranscriptMessage"), exports);
@@ -70,7 +70,7 @@ class Voices {
70
70
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
71
71
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
72
72
  method: "GET",
73
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
73
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
74
74
  contentType: "application/json",
75
75
  requestType: "json",
76
76
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -155,7 +155,7 @@ class Voices {
155
155
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
156
156
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/clone"),
157
157
  method: "POST",
158
- headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
158
+ headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
159
159
  requestType: "file",
160
160
  duplex: _maybeEncodedRequest.duplex,
161
161
  body: _maybeEncodedRequest.body,
@@ -206,7 +206,7 @@ class Voices {
206
206
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
207
207
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
208
208
  method: "DELETE",
209
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
209
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
210
210
  contentType: "application/json",
211
211
  requestType: "json",
212
212
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -254,7 +254,7 @@ class Voices {
254
254
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
255
255
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
256
256
  method: "PATCH",
257
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
257
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
258
258
  contentType: "application/json",
259
259
  requestType: "json",
260
260
  body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -305,7 +305,7 @@ class Voices {
305
305
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
306
306
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
307
307
  method: "GET",
308
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
308
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
309
309
  contentType: "application/json",
310
310
  requestType: "json",
311
311
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -364,7 +364,7 @@ class Voices {
364
364
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
365
365
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/localize"),
366
366
  method: "POST",
367
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
367
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
368
368
  contentType: "application/json",
369
369
  requestType: "json",
370
370
  body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -423,7 +423,7 @@ class Voices {
423
423
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
424
424
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/mix"),
425
425
  method: "POST",
426
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
426
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
427
427
  contentType: "application/json",
428
428
  requestType: "json",
429
429
  body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -482,7 +482,7 @@ class Voices {
482
482
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
483
483
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
484
484
  method: "POST",
485
- headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.4", "User-Agent": "@cartesia/cartesia-js/2.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
485
+ headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.5", "User-Agent": "@cartesia/cartesia-js/2.2.5", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
486
486
  contentType: "application/json",
487
487
  requestType: "json",
488
488
  body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -6,5 +6,5 @@ import * as Cartesia from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
7
  export declare const SttEncoding: core.serialization.Schema<serializers.SttEncoding.Raw, Cartesia.SttEncoding>;
8
8
  export declare namespace SttEncoding {
9
- type Raw = "pcm_s16le";
9
+ type Raw = "pcm_s16le" | "pcm_s32le" | "pcm_f16le" | "pcm_f32le" | "pcm_mulaw" | "pcm_alaw";
10
10
  }
@@ -38,4 +38,4 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.SttEncoding = void 0;
40
40
  const core = __importStar(require("../../../../core"));
41
- exports.SttEncoding = core.serialization.enum_(["pcm_s16le"]);
41
+ exports.SttEncoding = core.serialization.enum_(["pcm_s16le", "pcm_s32le", "pcm_f16le", "pcm_f32le", "pcm_mulaw", "pcm_alaw"]);
@@ -4,6 +4,7 @@
4
4
  import * as serializers from "../../../index";
5
5
  import * as Cartesia from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
+ import { TranscriptionWord } from "./TranscriptionWord";
7
8
  export declare const TranscriptMessage: core.serialization.ObjectSchema<serializers.TranscriptMessage.Raw, Cartesia.TranscriptMessage>;
8
9
  export declare namespace TranscriptMessage {
9
10
  interface Raw {
@@ -12,5 +13,6 @@ export declare namespace TranscriptMessage {
12
13
  is_final: boolean;
13
14
  duration?: number | null;
14
15
  language?: string | null;
16
+ words?: TranscriptionWord.Raw[] | null;
15
17
  }
16
18
  }
@@ -38,10 +38,12 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.TranscriptMessage = void 0;
40
40
  const core = __importStar(require("../../../../core"));
41
+ const TranscriptionWord_1 = require("./TranscriptionWord");
41
42
  exports.TranscriptMessage = core.serialization.object({
42
43
  requestId: core.serialization.property("request_id", core.serialization.string()),
43
44
  text: core.serialization.string(),
44
45
  isFinal: core.serialization.property("is_final", core.serialization.boolean()),
45
46
  duration: core.serialization.number().optional(),
46
47
  language: core.serialization.string().optional(),
48
+ words: core.serialization.list(TranscriptionWord_1.TranscriptionWord).optional(),
47
49
  });
@@ -4,11 +4,13 @@
4
4
  import * as serializers from "../../../index";
5
5
  import * as Cartesia from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
+ import { TranscriptionWord } from "./TranscriptionWord";
7
8
  export declare const TranscriptionResponse: core.serialization.ObjectSchema<serializers.TranscriptionResponse.Raw, Cartesia.TranscriptionResponse>;
8
9
  export declare namespace TranscriptionResponse {
9
10
  interface Raw {
10
11
  text: string;
11
12
  language?: string | null;
12
13
  duration?: number | null;
14
+ words?: TranscriptionWord.Raw[] | null;
13
15
  }
14
16
  }
@@ -38,8 +38,10 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.TranscriptionResponse = void 0;
40
40
  const core = __importStar(require("../../../../core"));
41
+ const TranscriptionWord_1 = require("./TranscriptionWord");
41
42
  exports.TranscriptionResponse = core.serialization.object({
42
43
  text: core.serialization.string(),
43
44
  language: core.serialization.string().optional(),
44
45
  duration: core.serialization.number().optional(),
46
+ words: core.serialization.list(TranscriptionWord_1.TranscriptionWord).optional(),
45
47
  });
@@ -0,0 +1,14 @@
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
+ export declare const TranscriptionWord: core.serialization.ObjectSchema<serializers.TranscriptionWord.Raw, Cartesia.TranscriptionWord>;
8
+ export declare namespace TranscriptionWord {
9
+ interface Raw {
10
+ word: string;
11
+ start: number;
12
+ end: number;
13
+ }
14
+ }
@@ -0,0 +1,45 @@
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.TranscriptionWord = void 0;
40
+ const core = __importStar(require("../../../../core"));
41
+ exports.TranscriptionWord = core.serialization.object({
42
+ word: core.serialization.string(),
43
+ start: core.serialization.number(),
44
+ end: core.serialization.number(),
45
+ });
@@ -1,3 +1,4 @@
1
+ export * from "./TranscriptionWord";
1
2
  export * from "./TranscriptionResponse";
2
3
  export * from "./StreamingTranscriptionResponse";
3
4
  export * from "./TranscriptMessage";
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./TranscriptionWord"), exports);
17
18
  __exportStar(require("./TranscriptionResponse"), exports);
18
19
  __exportStar(require("./StreamingTranscriptionResponse"), exports);
19
20
  __exportStar(require("./TranscriptMessage"), 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.5";
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.5";
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.5",
4
4
  "private": false,
5
5
  "repository": "https://github.com/cartesia-ai/cartesia-js",
6
6
  "main": "./index.js",
@@ -6,5 +6,5 @@ import * as Cartesia from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
7
  export declare const SttEncoding: core.serialization.Schema<serializers.SttEncoding.Raw, Cartesia.SttEncoding>;
8
8
  export declare namespace SttEncoding {
9
- type Raw = "pcm_s16le";
9
+ type Raw = "pcm_s16le" | "pcm_s32le" | "pcm_f16le" | "pcm_f32le" | "pcm_mulaw" | "pcm_alaw";
10
10
  }
@@ -38,4 +38,4 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.SttEncoding = void 0;
40
40
  const core = __importStar(require("../../../../core"));
41
- exports.SttEncoding = core.serialization.enum_(["pcm_s16le"]);
41
+ exports.SttEncoding = core.serialization.enum_(["pcm_s16le", "pcm_s32le", "pcm_f16le", "pcm_f32le", "pcm_mulaw", "pcm_alaw"]);
@@ -4,6 +4,7 @@
4
4
  import * as serializers from "../../../index";
5
5
  import * as Cartesia from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
+ import { TranscriptionWord } from "./TranscriptionWord";
7
8
  export declare const TranscriptMessage: core.serialization.ObjectSchema<serializers.TranscriptMessage.Raw, Cartesia.TranscriptMessage>;
8
9
  export declare namespace TranscriptMessage {
9
10
  interface Raw {
@@ -12,5 +13,6 @@ export declare namespace TranscriptMessage {
12
13
  is_final: boolean;
13
14
  duration?: number | null;
14
15
  language?: string | null;
16
+ words?: TranscriptionWord.Raw[] | null;
15
17
  }
16
18
  }
@@ -38,10 +38,12 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.TranscriptMessage = void 0;
40
40
  const core = __importStar(require("../../../../core"));
41
+ const TranscriptionWord_1 = require("./TranscriptionWord");
41
42
  exports.TranscriptMessage = core.serialization.object({
42
43
  requestId: core.serialization.property("request_id", core.serialization.string()),
43
44
  text: core.serialization.string(),
44
45
  isFinal: core.serialization.property("is_final", core.serialization.boolean()),
45
46
  duration: core.serialization.number().optional(),
46
47
  language: core.serialization.string().optional(),
48
+ words: core.serialization.list(TranscriptionWord_1.TranscriptionWord).optional(),
47
49
  });
@@ -4,11 +4,13 @@
4
4
  import * as serializers from "../../../index";
5
5
  import * as Cartesia from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
+ import { TranscriptionWord } from "./TranscriptionWord";
7
8
  export declare const TranscriptionResponse: core.serialization.ObjectSchema<serializers.TranscriptionResponse.Raw, Cartesia.TranscriptionResponse>;
8
9
  export declare namespace TranscriptionResponse {
9
10
  interface Raw {
10
11
  text: string;
11
12
  language?: string | null;
12
13
  duration?: number | null;
14
+ words?: TranscriptionWord.Raw[] | null;
13
15
  }
14
16
  }
@@ -38,8 +38,10 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.TranscriptionResponse = void 0;
40
40
  const core = __importStar(require("../../../../core"));
41
+ const TranscriptionWord_1 = require("./TranscriptionWord");
41
42
  exports.TranscriptionResponse = core.serialization.object({
42
43
  text: core.serialization.string(),
43
44
  language: core.serialization.string().optional(),
44
45
  duration: core.serialization.number().optional(),
46
+ words: core.serialization.list(TranscriptionWord_1.TranscriptionWord).optional(),
45
47
  });
@@ -0,0 +1,14 @@
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
+ export declare const TranscriptionWord: core.serialization.ObjectSchema<serializers.TranscriptionWord.Raw, Cartesia.TranscriptionWord>;
8
+ export declare namespace TranscriptionWord {
9
+ interface Raw {
10
+ word: string;
11
+ start: number;
12
+ end: number;
13
+ }
14
+ }
@@ -0,0 +1,45 @@
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.TranscriptionWord = void 0;
40
+ const core = __importStar(require("../../../../core"));
41
+ exports.TranscriptionWord = core.serialization.object({
42
+ word: core.serialization.string(),
43
+ start: core.serialization.number(),
44
+ end: core.serialization.number(),
45
+ });
@@ -1,3 +1,4 @@
1
+ export * from "./TranscriptionWord";
1
2
  export * from "./TranscriptionResponse";
2
3
  export * from "./StreamingTranscriptionResponse";
3
4
  export * from "./TranscriptMessage";
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./TranscriptionWord"), exports);
17
18
  __exportStar(require("./TranscriptionResponse"), exports);
18
19
  __exportStar(require("./StreamingTranscriptionResponse"), exports);
19
20
  __exportStar(require("./TranscriptMessage"), exports);
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.2.4";
1
+ export declare const SDK_VERSION = "2.2.5";
package/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.5";