@cartesia/cartesia-js 2.2.3 → 2.2.4
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.
- package/README.md +58 -7
- package/api/resources/apiStatus/client/Client.js +1 -1
- package/api/resources/auth/client/Client.js +1 -1
- package/api/resources/index.d.ts +2 -0
- package/api/resources/index.js +3 -1
- package/api/resources/infill/client/Client.js +1 -1
- package/api/resources/stt/client/Client.d.ts +28 -0
- package/api/resources/stt/client/Client.js +58 -0
- package/api/resources/stt/client/index.d.ts +1 -0
- package/api/resources/stt/client/index.js +5 -0
- package/api/resources/stt/index.d.ts +1 -0
- package/api/resources/stt/index.js +17 -0
- package/api/resources/stt/types/DoneMessage.d.ts +10 -0
- package/api/resources/stt/types/DoneMessage.js +5 -0
- package/api/resources/stt/types/ErrorMessage.d.ts +9 -0
- package/api/resources/stt/types/ErrorMessage.js +5 -0
- package/api/resources/stt/types/FlushDoneMessage.d.ts +10 -0
- package/api/resources/stt/types/FlushDoneMessage.js +5 -0
- package/api/resources/stt/types/StreamingTranscriptionResponse.d.ts +22 -0
- package/api/resources/stt/types/StreamingTranscriptionResponse.js +5 -0
- package/api/resources/stt/types/SttEncoding.d.ts +15 -0
- package/api/resources/stt/types/SttEncoding.js +9 -0
- package/api/resources/stt/types/TranscriptMessage.d.ts +19 -0
- package/api/resources/stt/types/TranscriptMessage.js +5 -0
- package/api/resources/stt/types/TranscriptionResponse.d.ts +11 -0
- package/api/resources/stt/types/TranscriptionResponse.js +5 -0
- package/api/resources/stt/types/index.d.ts +7 -0
- package/api/resources/stt/types/index.js +23 -0
- package/api/resources/voices/client/Client.js +8 -8
- package/dist/api/resources/apiStatus/client/Client.js +1 -1
- package/dist/api/resources/auth/client/Client.js +1 -1
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +3 -1
- package/dist/api/resources/infill/client/Client.js +1 -1
- package/dist/api/resources/stt/client/Client.d.ts +28 -0
- package/dist/api/resources/stt/client/Client.js +58 -0
- package/dist/api/resources/stt/client/index.d.ts +1 -0
- package/dist/api/resources/stt/client/index.js +5 -0
- package/dist/api/resources/stt/index.d.ts +1 -0
- package/dist/api/resources/stt/index.js +17 -0
- package/dist/api/resources/stt/types/DoneMessage.d.ts +10 -0
- package/dist/api/resources/stt/types/DoneMessage.js +5 -0
- package/dist/api/resources/stt/types/ErrorMessage.d.ts +9 -0
- package/dist/api/resources/stt/types/ErrorMessage.js +5 -0
- package/dist/api/resources/stt/types/FlushDoneMessage.d.ts +10 -0
- package/dist/api/resources/stt/types/FlushDoneMessage.js +5 -0
- package/dist/api/resources/stt/types/StreamingTranscriptionResponse.d.ts +22 -0
- package/dist/api/resources/stt/types/StreamingTranscriptionResponse.js +5 -0
- package/dist/api/resources/stt/types/SttEncoding.d.ts +15 -0
- package/dist/api/resources/stt/types/SttEncoding.js +9 -0
- package/dist/api/resources/stt/types/TranscriptMessage.d.ts +19 -0
- package/dist/api/resources/stt/types/TranscriptMessage.js +5 -0
- package/dist/api/resources/stt/types/TranscriptionResponse.d.ts +11 -0
- package/dist/api/resources/stt/types/TranscriptionResponse.js +5 -0
- package/dist/api/resources/stt/types/index.d.ts +7 -0
- package/dist/api/resources/stt/types/index.js +23 -0
- package/dist/api/resources/voices/client/Client.js +8 -8
- package/dist/serialization/resources/index.d.ts +2 -0
- package/dist/serialization/resources/index.js +3 -1
- package/dist/serialization/resources/stt/index.d.ts +1 -0
- package/dist/serialization/resources/stt/index.js +17 -0
- package/dist/serialization/resources/stt/types/DoneMessage.d.ts +12 -0
- package/dist/serialization/resources/stt/types/DoneMessage.js +43 -0
- package/dist/serialization/resources/stt/types/ErrorMessage.d.ts +13 -0
- package/dist/serialization/resources/stt/types/ErrorMessage.js +44 -0
- package/dist/serialization/resources/stt/types/FlushDoneMessage.d.ts +12 -0
- package/dist/serialization/resources/stt/types/FlushDoneMessage.js +43 -0
- package/dist/serialization/resources/stt/types/StreamingTranscriptionResponse.d.ts +26 -0
- package/dist/serialization/resources/stt/types/StreamingTranscriptionResponse.js +55 -0
- package/dist/serialization/resources/stt/types/SttEncoding.d.ts +10 -0
- package/dist/serialization/resources/stt/types/SttEncoding.js +41 -0
- package/dist/serialization/resources/stt/types/TranscriptMessage.d.ts +16 -0
- package/dist/serialization/resources/stt/types/TranscriptMessage.js +47 -0
- package/dist/serialization/resources/stt/types/TranscriptionResponse.d.ts +14 -0
- package/dist/serialization/resources/stt/types/TranscriptionResponse.js +45 -0
- package/dist/serialization/resources/stt/types/index.d.ts +7 -0
- package/dist/serialization/resources/stt/types/index.js +23 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/Client.d.ts +3 -0
- package/dist/wrapper/Client.js +5 -0
- package/dist/wrapper/StreamingSTTClient.d.ts +6 -0
- package/dist/wrapper/StreamingSTTClient.js +17 -0
- package/dist/wrapper/SttWebsocket.d.ts +29 -0
- package/dist/wrapper/SttWebsocket.js +198 -0
- package/dist/wrapper/Websocket.d.ts +1 -1
- package/dist/wrapper/Websocket.js +24 -16
- package/package.json +1 -1
- package/serialization/resources/index.d.ts +2 -0
- package/serialization/resources/index.js +3 -1
- package/serialization/resources/stt/index.d.ts +1 -0
- package/serialization/resources/stt/index.js +17 -0
- package/serialization/resources/stt/types/DoneMessage.d.ts +12 -0
- package/serialization/resources/stt/types/DoneMessage.js +43 -0
- package/serialization/resources/stt/types/ErrorMessage.d.ts +13 -0
- package/serialization/resources/stt/types/ErrorMessage.js +44 -0
- package/serialization/resources/stt/types/FlushDoneMessage.d.ts +12 -0
- package/serialization/resources/stt/types/FlushDoneMessage.js +43 -0
- package/serialization/resources/stt/types/StreamingTranscriptionResponse.d.ts +26 -0
- package/serialization/resources/stt/types/StreamingTranscriptionResponse.js +55 -0
- package/serialization/resources/stt/types/SttEncoding.d.ts +10 -0
- package/serialization/resources/stt/types/SttEncoding.js +41 -0
- package/serialization/resources/stt/types/TranscriptMessage.d.ts +16 -0
- package/serialization/resources/stt/types/TranscriptMessage.js +47 -0
- package/serialization/resources/stt/types/TranscriptionResponse.d.ts +14 -0
- package/serialization/resources/stt/types/TranscriptionResponse.js +45 -0
- package/serialization/resources/stt/types/index.d.ts +7 -0
- package/serialization/resources/stt/types/index.js +23 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/Client.d.ts +3 -0
- package/wrapper/Client.js +5 -0
- package/wrapper/StreamingSTTClient.d.ts +6 -0
- package/wrapper/StreamingSTTClient.js +17 -0
- package/wrapper/SttWebsocket.d.ts +29 -0
- package/wrapper/SttWebsocket.js +198 -0
- package/wrapper/Websocket.d.ts +1 -1
- package/wrapper/Websocket.js +24 -16
package/README.md
CHANGED
|
@@ -69,13 +69,6 @@ const websocket = cartesia.tts.websocket({
|
|
|
69
69
|
sampleRate: 44100,
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
try {
|
|
73
|
-
await websocket.connect();
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error(`Failed to connect to Cartesia: ${error}`);
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
72
|
// Create a stream.
|
|
80
73
|
const response = await websocket.send({
|
|
81
74
|
modelId: "sonic-2",
|
|
@@ -148,6 +141,64 @@ await player.play(response.source);
|
|
|
148
141
|
console.log("Done playing.");
|
|
149
142
|
```
|
|
150
143
|
|
|
144
|
+
## Speech-to-Text (STT)
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { CartesiaClient } from "@cartesia/cartesia-js";
|
|
148
|
+
import fs from "fs";
|
|
149
|
+
|
|
150
|
+
const client = new CartesiaClient({
|
|
151
|
+
apiKey: process.env.CARTESIA_API_KEY,
|
|
152
|
+
});
|
|
153
|
+
|
|
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
|
+
});
|
|
161
|
+
|
|
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
|
+
});
|
|
179
|
+
|
|
180
|
+
// Load and send audio data
|
|
181
|
+
const audioBuffer = fs.readFileSync("audio.wav");
|
|
182
|
+
const chunkSize = 1600; // ~100ms at 16kHz
|
|
183
|
+
const audioChunks = [];
|
|
184
|
+
|
|
185
|
+
for (let i = 0; i < audioBuffer.length; i += chunkSize) {
|
|
186
|
+
const chunk = audioBuffer.slice(i, i + chunkSize);
|
|
187
|
+
audioChunks.push(chunk.buffer);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Send audio chunks
|
|
191
|
+
for (const chunk of audioChunks) {
|
|
192
|
+
await sttWs.send(chunk);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Finalize transcription
|
|
196
|
+
await sttWs.finalize();
|
|
197
|
+
|
|
198
|
+
// Disconnect when done
|
|
199
|
+
sttWs.disconnect();
|
|
200
|
+
```
|
|
201
|
+
|
|
151
202
|
## Request And Response Types
|
|
152
203
|
|
|
153
204
|
The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
|
|
@@ -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.
|
|
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),
|
|
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.
|
|
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),
|
|
82
82
|
contentType: "application/json",
|
|
83
83
|
requestType: "json",
|
|
84
84
|
body: serializers.TokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
package/api/resources/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * as auth from "./auth";
|
|
|
4
4
|
export * from "./auth/types";
|
|
5
5
|
export * as embedding from "./embedding";
|
|
6
6
|
export * from "./embedding/types";
|
|
7
|
+
export * as stt from "./stt";
|
|
8
|
+
export * from "./stt/types";
|
|
7
9
|
export * as tts from "./tts";
|
|
8
10
|
export * from "./tts/types";
|
|
9
11
|
export * as voiceChanger from "./voiceChanger";
|
package/api/resources/index.js
CHANGED
|
@@ -36,13 +36,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.auth = exports.apiStatus = void 0;
|
|
39
|
+
exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.stt = exports.embedding = exports.auth = exports.apiStatus = void 0;
|
|
40
40
|
exports.apiStatus = __importStar(require("./apiStatus"));
|
|
41
41
|
__exportStar(require("./apiStatus/types"), exports);
|
|
42
42
|
exports.auth = __importStar(require("./auth"));
|
|
43
43
|
__exportStar(require("./auth/types"), exports);
|
|
44
44
|
exports.embedding = __importStar(require("./embedding"));
|
|
45
45
|
__exportStar(require("./embedding/types"), exports);
|
|
46
|
+
exports.stt = __importStar(require("./stt"));
|
|
47
|
+
__exportStar(require("./stt/types"), exports);
|
|
46
48
|
exports.tts = __importStar(require("./tts"));
|
|
47
49
|
__exportStar(require("./tts/types"), exports);
|
|
48
50
|
exports.voiceChanger = __importStar(require("./voiceChanger"));
|
|
@@ -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.
|
|
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),
|
|
117
117
|
requestType: "file",
|
|
118
118
|
duplex: _maybeEncodedRequest.duplex,
|
|
119
119
|
body: _maybeEncodedRequest.body,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as environments from "../../../../environments";
|
|
2
|
+
import * as core from "../../../../core";
|
|
3
|
+
export declare namespace Stt {
|
|
4
|
+
interface Options {
|
|
5
|
+
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
6
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
7
|
+
/** Override the Cartesia-Version header */
|
|
8
|
+
cartesiaVersion?: "2024-06-10";
|
|
9
|
+
fetcher?: core.FetchFunction;
|
|
10
|
+
}
|
|
11
|
+
interface RequestOptions {
|
|
12
|
+
/** The maximum time to wait for a response in seconds. */
|
|
13
|
+
timeoutInSeconds?: number;
|
|
14
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
/** A hook to abort the request. */
|
|
17
|
+
abortSignal?: AbortSignal;
|
|
18
|
+
/** Override the Cartesia-Version header */
|
|
19
|
+
cartesiaVersion?: "2024-06-10";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare class Stt {
|
|
23
|
+
protected readonly _options: Stt.Options;
|
|
24
|
+
constructor(_options?: Stt.Options);
|
|
25
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
26
|
+
"X-API-Key": string | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.Stt = void 0;
|
|
46
|
+
const core = __importStar(require("../../../../core"));
|
|
47
|
+
class Stt {
|
|
48
|
+
constructor(_options = {}) {
|
|
49
|
+
this._options = _options;
|
|
50
|
+
}
|
|
51
|
+
_getCustomAuthorizationHeaders() {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
54
|
+
return { "X-API-Key": apiKeyValue };
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Stt = Stt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stt } from "./Client";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Acknowledgment message sent in response to a `done` command, indicating that the session is complete and the WebSocket will close.
|
|
6
|
+
*/
|
|
7
|
+
export interface DoneMessage {
|
|
8
|
+
/** Unique identifier for this transcription session. */
|
|
9
|
+
requestId: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface ErrorMessage {
|
|
5
|
+
/** The request ID associated with the error, if applicable. */
|
|
6
|
+
requestId?: string;
|
|
7
|
+
/** Human-readable error message describing what went wrong. */
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Acknowledgment message sent in response to a `finalize` command, indicating that all buffered audio has been flushed and processed.
|
|
6
|
+
*/
|
|
7
|
+
export interface FlushDoneMessage {
|
|
8
|
+
/** Unique identifier for this transcription session. */
|
|
9
|
+
requestId: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Cartesia from "../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* The server sends transcription results, control messages, or error messages. Each message has a `type` field to distinguish between different message types.
|
|
7
|
+
*/
|
|
8
|
+
export type StreamingTranscriptionResponse = Cartesia.StreamingTranscriptionResponse.Transcript | Cartesia.StreamingTranscriptionResponse.FlushDone | Cartesia.StreamingTranscriptionResponse.Done | Cartesia.StreamingTranscriptionResponse.Error_;
|
|
9
|
+
export declare namespace StreamingTranscriptionResponse {
|
|
10
|
+
interface Transcript extends Cartesia.TranscriptMessage {
|
|
11
|
+
type: "transcript";
|
|
12
|
+
}
|
|
13
|
+
interface FlushDone extends Cartesia.FlushDoneMessage {
|
|
14
|
+
type: "flush_done";
|
|
15
|
+
}
|
|
16
|
+
interface Done extends Cartesia.DoneMessage {
|
|
17
|
+
type: "done";
|
|
18
|
+
}
|
|
19
|
+
interface Error_ extends Cartesia.ErrorMessage {
|
|
20
|
+
type: "error";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
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
|
+
*/
|
|
12
|
+
export type SttEncoding = "pcm_s16le";
|
|
13
|
+
export declare const SttEncoding: {
|
|
14
|
+
readonly PcmS16Le: "pcm_s16le";
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface TranscriptMessage {
|
|
5
|
+
/** Unique identifier for this transcription session. */
|
|
6
|
+
requestId: string;
|
|
7
|
+
/**
|
|
8
|
+
* The transcribed text. May be partial or final depending on is_final.
|
|
9
|
+
*
|
|
10
|
+
* **Note**: Text may be empty in initial responses while the system accumulates sufficient audio for transcription. This is normal behavior - wait for responses with non-empty text or monitor is_final for completion status.
|
|
11
|
+
*/
|
|
12
|
+
text: string;
|
|
13
|
+
/** Whether this is a final transcription result or an interim result. */
|
|
14
|
+
isFinal: boolean;
|
|
15
|
+
/** The duration of the audio transcribed so far, in seconds. */
|
|
16
|
+
duration?: number;
|
|
17
|
+
/** The detected or specified language of the input audio. */
|
|
18
|
+
language?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface TranscriptionResponse {
|
|
5
|
+
/** The transcribed text. */
|
|
6
|
+
text: string;
|
|
7
|
+
/** The detected or specified language of the input audio. */
|
|
8
|
+
language?: string;
|
|
9
|
+
/** The duration of the input audio in seconds. */
|
|
10
|
+
duration?: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./TranscriptionResponse";
|
|
2
|
+
export * from "./StreamingTranscriptionResponse";
|
|
3
|
+
export * from "./TranscriptMessage";
|
|
4
|
+
export * from "./FlushDoneMessage";
|
|
5
|
+
export * from "./DoneMessage";
|
|
6
|
+
export * from "./ErrorMessage";
|
|
7
|
+
export * from "./SttEncoding";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TranscriptionResponse"), exports);
|
|
18
|
+
__exportStar(require("./StreamingTranscriptionResponse"), exports);
|
|
19
|
+
__exportStar(require("./TranscriptMessage"), exports);
|
|
20
|
+
__exportStar(require("./FlushDoneMessage"), exports);
|
|
21
|
+
__exportStar(require("./DoneMessage"), exports);
|
|
22
|
+
__exportStar(require("./ErrorMessage"), exports);
|
|
23
|
+
__exportStar(require("./SttEncoding"), 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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
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.
|
|
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),
|
|
82
82
|
contentType: "application/json",
|
|
83
83
|
requestType: "json",
|
|
84
84
|
body: serializers.TokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -4,6 +4,8 @@ export * as auth from "./auth";
|
|
|
4
4
|
export * from "./auth/types";
|
|
5
5
|
export * as embedding from "./embedding";
|
|
6
6
|
export * from "./embedding/types";
|
|
7
|
+
export * as stt from "./stt";
|
|
8
|
+
export * from "./stt/types";
|
|
7
9
|
export * as tts from "./tts";
|
|
8
10
|
export * from "./tts/types";
|
|
9
11
|
export * as voiceChanger from "./voiceChanger";
|
|
@@ -36,13 +36,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.auth = exports.apiStatus = void 0;
|
|
39
|
+
exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.stt = exports.embedding = exports.auth = exports.apiStatus = void 0;
|
|
40
40
|
exports.apiStatus = __importStar(require("./apiStatus"));
|
|
41
41
|
__exportStar(require("./apiStatus/types"), exports);
|
|
42
42
|
exports.auth = __importStar(require("./auth"));
|
|
43
43
|
__exportStar(require("./auth/types"), exports);
|
|
44
44
|
exports.embedding = __importStar(require("./embedding"));
|
|
45
45
|
__exportStar(require("./embedding/types"), exports);
|
|
46
|
+
exports.stt = __importStar(require("./stt"));
|
|
47
|
+
__exportStar(require("./stt/types"), exports);
|
|
46
48
|
exports.tts = __importStar(require("./tts"));
|
|
47
49
|
__exportStar(require("./tts/types"), exports);
|
|
48
50
|
exports.voiceChanger = __importStar(require("./voiceChanger"));
|