@cartesia/cartesia-js 2.1.5 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/resources/apiStatus/client/Client.js +1 -1
- package/api/resources/datasets/client/Client.d.ts +2 -5
- package/api/resources/datasets/client/Client.js +6 -9
- package/api/resources/datasets/client/requests/UploadDatasetFileRequest.d.ts +0 -4
- package/api/resources/infill/client/Client.d.ts +9 -1
- package/api/resources/infill/client/Client.js +10 -2
- package/api/resources/voices/client/Client.d.ts +51 -41
- package/api/resources/voices/client/Client.js +83 -73
- package/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
- package/api/resources/voices/types/CreateVoiceRequest.d.ts +1 -0
- package/api/resources/voices/types/LocalizeVoiceRequest.d.ts +6 -1
- package/dist/api/resources/apiStatus/client/Client.js +1 -1
- package/dist/api/resources/datasets/client/Client.d.ts +2 -5
- package/dist/api/resources/datasets/client/Client.js +6 -9
- package/dist/api/resources/datasets/client/requests/UploadDatasetFileRequest.d.ts +0 -4
- package/dist/api/resources/infill/client/Client.d.ts +9 -1
- package/dist/api/resources/infill/client/Client.js +10 -2
- package/dist/api/resources/voices/client/Client.d.ts +51 -41
- package/dist/api/resources/voices/client/Client.js +83 -73
- package/dist/api/resources/voices/types/BaseVoiceId.d.ts +1 -1
- package/dist/api/resources/voices/types/CreateVoiceRequest.d.ts +1 -0
- package/dist/api/resources/voices/types/LocalizeVoiceRequest.d.ts +6 -1
- package/dist/serialization/resources/voices/types/CreateVoiceRequest.d.ts +2 -0
- package/dist/serialization/resources/voices/types/CreateVoiceRequest.js +2 -0
- package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.d.ts +3 -2
- package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.js +3 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/reference.md +91 -124
- package/serialization/resources/voices/types/CreateVoiceRequest.d.ts +2 -0
- package/serialization/resources/voices/types/CreateVoiceRequest.js +2 -0
- package/serialization/resources/voices/types/LocalizeVoiceRequest.d.ts +3 -2
- package/serialization/resources/voices/types/LocalizeVoiceRequest.js +3 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -40,24 +40,42 @@ export declare class Voices {
|
|
|
40
40
|
*/
|
|
41
41
|
list(requestOptions?: Voices.RequestOptions): Promise<Cartesia.Voice[]>;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Clone a voice from an audio clip. This endpoint has two modes, stability and similarity.
|
|
44
|
+
*
|
|
45
|
+
* Similarity mode clones are more similar to the source clip, but may reproduce background noise. For these, use an audio clip about 5 seconds long.
|
|
46
|
+
*
|
|
47
|
+
* Stability mode clones are more stable, but may not sound as similar to the source clip. For these, use an audio clip 10-20 seconds long.
|
|
48
|
+
*
|
|
49
|
+
* @param {File | fs.ReadStream | Blob} clip
|
|
50
|
+
* @param {Cartesia.CloneVoiceRequest} request
|
|
44
51
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
45
52
|
*
|
|
46
53
|
* @example
|
|
47
|
-
* await client.voices.
|
|
48
|
-
* name: "
|
|
49
|
-
* description: "
|
|
50
|
-
*
|
|
51
|
-
* language: "en"
|
|
54
|
+
* await client.voices.clone(fs.createReadStream("/path/to/your/file"), {
|
|
55
|
+
* name: "A high-stability cloned voice",
|
|
56
|
+
* description: "Copied from Cartesia docs",
|
|
57
|
+
* mode: "stability",
|
|
58
|
+
* language: "en",
|
|
59
|
+
* enhance: true
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* await client.voices.clone(fs.createReadStream("/path/to/your/file"), {
|
|
64
|
+
* name: "A high-similarity cloned voice",
|
|
65
|
+
* description: "Copied from Cartesia docs",
|
|
66
|
+
* mode: "similarity",
|
|
67
|
+
* language: "en",
|
|
68
|
+
* transcript: "A transcript of the words spoken in the audio clip.",
|
|
69
|
+
* enhance: false
|
|
52
70
|
* })
|
|
53
71
|
*/
|
|
54
|
-
|
|
72
|
+
clone(clip: File | fs.ReadStream | Blob, request: Cartesia.CloneVoiceRequest, requestOptions?: Voices.RequestOptions): Promise<Cartesia.VoiceMetadata>;
|
|
55
73
|
/**
|
|
56
74
|
* @param {Cartesia.VoiceId} id
|
|
57
75
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
58
76
|
*
|
|
59
77
|
* @example
|
|
60
|
-
* await client.voices.delete("
|
|
78
|
+
* await client.voices.delete("id")
|
|
61
79
|
*/
|
|
62
80
|
delete(id: Cartesia.VoiceId, requestOptions?: Voices.RequestOptions): Promise<void>;
|
|
63
81
|
/**
|
|
@@ -66,9 +84,9 @@ export declare class Voices {
|
|
|
66
84
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
67
85
|
*
|
|
68
86
|
* @example
|
|
69
|
-
* await client.voices.update("
|
|
70
|
-
* name: "
|
|
71
|
-
* description: "
|
|
87
|
+
* await client.voices.update("id", {
|
|
88
|
+
* name: "name",
|
|
89
|
+
* description: "description"
|
|
72
90
|
* })
|
|
73
91
|
*/
|
|
74
92
|
update(id: Cartesia.VoiceId, request: Cartesia.UpdateVoiceRequest, requestOptions?: Voices.RequestOptions): Promise<Cartesia.Voice>;
|
|
@@ -77,22 +95,26 @@ export declare class Voices {
|
|
|
77
95
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
78
96
|
*
|
|
79
97
|
* @example
|
|
80
|
-
* await client.voices.get("
|
|
98
|
+
* await client.voices.get("id")
|
|
81
99
|
*/
|
|
82
100
|
get(id: Cartesia.VoiceId, requestOptions?: Voices.RequestOptions): Promise<Cartesia.Voice>;
|
|
83
101
|
/**
|
|
102
|
+
* Create a new voice from an existing voice localized to a new language and dialect.
|
|
103
|
+
*
|
|
84
104
|
* @param {Cartesia.LocalizeVoiceRequest} request
|
|
85
105
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
86
106
|
*
|
|
87
107
|
* @example
|
|
88
108
|
* await client.voices.localize({
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
109
|
+
* voiceId: "694f9389-aac1-45b6-b726-9d9369183238",
|
|
110
|
+
* name: "Sarah Peninsular Spanish",
|
|
111
|
+
* description: "Sarah Voice in Peninsular Spanish",
|
|
112
|
+
* language: "es",
|
|
113
|
+
* originalSpeakerGender: "female",
|
|
114
|
+
* dialect: "pe"
|
|
93
115
|
* })
|
|
94
116
|
*/
|
|
95
|
-
localize(request: Cartesia.LocalizeVoiceRequest, requestOptions?: Voices.RequestOptions): Promise<Cartesia.
|
|
117
|
+
localize(request: Cartesia.LocalizeVoiceRequest, requestOptions?: Voices.RequestOptions): Promise<Cartesia.VoiceMetadata>;
|
|
96
118
|
/**
|
|
97
119
|
* @param {Cartesia.MixVoicesRequest} request
|
|
98
120
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -100,43 +122,31 @@ export declare class Voices {
|
|
|
100
122
|
* @example
|
|
101
123
|
* await client.voices.mix({
|
|
102
124
|
* voices: [{
|
|
103
|
-
* id: "
|
|
125
|
+
* id: "id",
|
|
126
|
+
* weight: 1.1
|
|
127
|
+
* }, {
|
|
128
|
+
* id: "id",
|
|
104
129
|
* weight: 1.1
|
|
105
130
|
* }]
|
|
106
131
|
* })
|
|
107
132
|
*/
|
|
108
133
|
mix(request: Cartesia.MixVoicesRequest, requestOptions?: Voices.RequestOptions): Promise<Cartesia.EmbeddingResponse>;
|
|
109
134
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* Similarity mode clones are more similar to the source clip, but may reproduce background noise. For these, use an audio clip about 5 seconds long.
|
|
113
|
-
*
|
|
114
|
-
* Stability mode clones are more stable, but may not sound as similar to the source clip. For these, use an audio clip 10-20 seconds long.
|
|
135
|
+
* Create voice from raw features. If you'd like to clone a voice from an audio file, please use Clone Voice instead.
|
|
115
136
|
*
|
|
116
|
-
* @param {
|
|
117
|
-
* @param {Cartesia.CloneVoiceRequest} request
|
|
137
|
+
* @param {Cartesia.CreateVoiceRequest} request
|
|
118
138
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
119
139
|
*
|
|
120
140
|
* @example
|
|
121
|
-
* await client.voices.
|
|
122
|
-
* name: "
|
|
123
|
-
* description: "
|
|
124
|
-
*
|
|
125
|
-
* language: "en",
|
|
126
|
-
* enhance: true
|
|
127
|
-
* })
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* await client.voices.clone(fs.createReadStream("/path/to/your/file"), {
|
|
131
|
-
* name: "A high-similarity cloned voice",
|
|
132
|
-
* description: "Copied from Cartesia docs",
|
|
133
|
-
* mode: "similarity",
|
|
141
|
+
* await client.voices.create({
|
|
142
|
+
* name: "My Custom Voice",
|
|
143
|
+
* description: "A custom voice created through the API",
|
|
144
|
+
* embedding: [],
|
|
134
145
|
* language: "en",
|
|
135
|
-
*
|
|
136
|
-
* enhance: false
|
|
146
|
+
* baseVoiceId: "123e4567-e89b-12d3-a456-426614174000"
|
|
137
147
|
* })
|
|
138
148
|
*/
|
|
139
|
-
|
|
149
|
+
create(request: Cartesia.CreateVoiceRequest, requestOptions?: Voices.RequestOptions): Promise<Cartesia.VoiceMetadata>;
|
|
140
150
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
141
151
|
"X-API-Key": string | undefined;
|
|
142
152
|
}>;
|
|
@@ -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.1.
|
|
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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,
|
|
@@ -108,33 +108,64 @@ class Voices {
|
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* Clone a voice from an audio clip. This endpoint has two modes, stability and similarity.
|
|
112
|
+
*
|
|
113
|
+
* Similarity mode clones are more similar to the source clip, but may reproduce background noise. For these, use an audio clip about 5 seconds long.
|
|
114
|
+
*
|
|
115
|
+
* Stability mode clones are more stable, but may not sound as similar to the source clip. For these, use an audio clip 10-20 seconds long.
|
|
116
|
+
*
|
|
117
|
+
* @param {File | fs.ReadStream | Blob} clip
|
|
118
|
+
* @param {Cartesia.CloneVoiceRequest} request
|
|
112
119
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
113
120
|
*
|
|
114
121
|
* @example
|
|
115
|
-
* await client.voices.
|
|
116
|
-
* name: "
|
|
117
|
-
* description: "
|
|
118
|
-
*
|
|
119
|
-
* language: "en"
|
|
122
|
+
* await client.voices.clone(fs.createReadStream("/path/to/your/file"), {
|
|
123
|
+
* name: "A high-stability cloned voice",
|
|
124
|
+
* description: "Copied from Cartesia docs",
|
|
125
|
+
* mode: "stability",
|
|
126
|
+
* language: "en",
|
|
127
|
+
* enhance: true
|
|
128
|
+
* })
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* await client.voices.clone(fs.createReadStream("/path/to/your/file"), {
|
|
132
|
+
* name: "A high-similarity cloned voice",
|
|
133
|
+
* description: "Copied from Cartesia docs",
|
|
134
|
+
* mode: "similarity",
|
|
135
|
+
* language: "en",
|
|
136
|
+
* transcript: "A transcript of the words spoken in the audio clip.",
|
|
137
|
+
* enhance: false
|
|
120
138
|
* })
|
|
121
139
|
*/
|
|
122
|
-
|
|
140
|
+
clone(clip, request, requestOptions) {
|
|
123
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
142
|
var _a, _b, _c, _d, _e, _f;
|
|
143
|
+
const _request = yield core.newFormData();
|
|
144
|
+
yield _request.appendFile("clip", clip);
|
|
145
|
+
_request.append("name", request.name);
|
|
146
|
+
if (request.description != null) {
|
|
147
|
+
_request.append("description", request.description);
|
|
148
|
+
}
|
|
149
|
+
_request.append("language", serializers.SupportedLanguage.jsonOrThrow(request.language, { unrecognizedObjectKeys: "strip" }));
|
|
150
|
+
_request.append("mode", serializers.CloneMode.jsonOrThrow(request.mode, { unrecognizedObjectKeys: "strip" }));
|
|
151
|
+
_request.append("enhance", request.enhance.toString());
|
|
152
|
+
if (request.transcript != null) {
|
|
153
|
+
_request.append("transcript", request.transcript);
|
|
154
|
+
}
|
|
155
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
125
156
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
126
|
-
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/"),
|
|
157
|
+
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"),
|
|
127
158
|
method: "POST",
|
|
128
|
-
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.1.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
body:
|
|
159
|
+
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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),
|
|
160
|
+
requestType: "file",
|
|
161
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
162
|
+
body: _maybeEncodedRequest.body,
|
|
132
163
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
133
164
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
134
165
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
135
166
|
});
|
|
136
167
|
if (_response.ok) {
|
|
137
|
-
return serializers.
|
|
168
|
+
return serializers.VoiceMetadata.parseOrThrow(_response.body, {
|
|
138
169
|
unrecognizedObjectKeys: "passthrough",
|
|
139
170
|
allowUnrecognizedUnionMembers: true,
|
|
140
171
|
allowUnrecognizedEnumValues: true,
|
|
@@ -155,7 +186,7 @@ class Voices {
|
|
|
155
186
|
body: _response.error.rawBody,
|
|
156
187
|
});
|
|
157
188
|
case "timeout":
|
|
158
|
-
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices
|
|
189
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices/clone.");
|
|
159
190
|
case "unknown":
|
|
160
191
|
throw new errors.CartesiaError({
|
|
161
192
|
message: _response.error.errorMessage,
|
|
@@ -168,7 +199,7 @@ class Voices {
|
|
|
168
199
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
169
200
|
*
|
|
170
201
|
* @example
|
|
171
|
-
* await client.voices.delete("
|
|
202
|
+
* await client.voices.delete("id")
|
|
172
203
|
*/
|
|
173
204
|
delete(id, requestOptions) {
|
|
174
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -176,7 +207,7 @@ class Voices {
|
|
|
176
207
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
177
208
|
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))}`),
|
|
178
209
|
method: "DELETE",
|
|
179
|
-
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.1.
|
|
210
|
+
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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),
|
|
180
211
|
contentType: "application/json",
|
|
181
212
|
requestType: "json",
|
|
182
213
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -213,9 +244,9 @@ class Voices {
|
|
|
213
244
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
214
245
|
*
|
|
215
246
|
* @example
|
|
216
|
-
* await client.voices.update("
|
|
217
|
-
* name: "
|
|
218
|
-
* description: "
|
|
247
|
+
* await client.voices.update("id", {
|
|
248
|
+
* name: "name",
|
|
249
|
+
* description: "description"
|
|
219
250
|
* })
|
|
220
251
|
*/
|
|
221
252
|
update(id, request, requestOptions) {
|
|
@@ -224,7 +255,7 @@ class Voices {
|
|
|
224
255
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
225
256
|
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))}`),
|
|
226
257
|
method: "PATCH",
|
|
227
|
-
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.1.
|
|
258
|
+
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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),
|
|
228
259
|
contentType: "application/json",
|
|
229
260
|
requestType: "json",
|
|
230
261
|
body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -267,7 +298,7 @@ class Voices {
|
|
|
267
298
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
268
299
|
*
|
|
269
300
|
* @example
|
|
270
|
-
* await client.voices.get("
|
|
301
|
+
* await client.voices.get("id")
|
|
271
302
|
*/
|
|
272
303
|
get(id, requestOptions) {
|
|
273
304
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -275,7 +306,7 @@ class Voices {
|
|
|
275
306
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
276
307
|
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))}`),
|
|
277
308
|
method: "GET",
|
|
278
|
-
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.1.
|
|
309
|
+
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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),
|
|
279
310
|
contentType: "application/json",
|
|
280
311
|
requestType: "json",
|
|
281
312
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -313,15 +344,19 @@ class Voices {
|
|
|
313
344
|
});
|
|
314
345
|
}
|
|
315
346
|
/**
|
|
347
|
+
* Create a new voice from an existing voice localized to a new language and dialect.
|
|
348
|
+
*
|
|
316
349
|
* @param {Cartesia.LocalizeVoiceRequest} request
|
|
317
350
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
318
351
|
*
|
|
319
352
|
* @example
|
|
320
353
|
* await client.voices.localize({
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
354
|
+
* voiceId: "694f9389-aac1-45b6-b726-9d9369183238",
|
|
355
|
+
* name: "Sarah Peninsular Spanish",
|
|
356
|
+
* description: "Sarah Voice in Peninsular Spanish",
|
|
357
|
+
* language: "es",
|
|
358
|
+
* originalSpeakerGender: "female",
|
|
359
|
+
* dialect: "pe"
|
|
325
360
|
* })
|
|
326
361
|
*/
|
|
327
362
|
localize(request, requestOptions) {
|
|
@@ -330,7 +365,7 @@ class Voices {
|
|
|
330
365
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
331
366
|
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"),
|
|
332
367
|
method: "POST",
|
|
333
|
-
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.1.
|
|
368
|
+
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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),
|
|
334
369
|
contentType: "application/json",
|
|
335
370
|
requestType: "json",
|
|
336
371
|
body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -339,7 +374,7 @@ class Voices {
|
|
|
339
374
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
340
375
|
});
|
|
341
376
|
if (_response.ok) {
|
|
342
|
-
return serializers.
|
|
377
|
+
return serializers.VoiceMetadata.parseOrThrow(_response.body, {
|
|
343
378
|
unrecognizedObjectKeys: "passthrough",
|
|
344
379
|
allowUnrecognizedUnionMembers: true,
|
|
345
380
|
allowUnrecognizedEnumValues: true,
|
|
@@ -375,7 +410,10 @@ class Voices {
|
|
|
375
410
|
* @example
|
|
376
411
|
* await client.voices.mix({
|
|
377
412
|
* voices: [{
|
|
378
|
-
* id: "
|
|
413
|
+
* id: "id",
|
|
414
|
+
* weight: 1.1
|
|
415
|
+
* }, {
|
|
416
|
+
* id: "id",
|
|
379
417
|
* weight: 1.1
|
|
380
418
|
* }]
|
|
381
419
|
* })
|
|
@@ -386,7 +424,7 @@ class Voices {
|
|
|
386
424
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
387
425
|
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"),
|
|
388
426
|
method: "POST",
|
|
389
|
-
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.1.
|
|
427
|
+
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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),
|
|
390
428
|
contentType: "application/json",
|
|
391
429
|
requestType: "json",
|
|
392
430
|
body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -425,58 +463,30 @@ class Voices {
|
|
|
425
463
|
});
|
|
426
464
|
}
|
|
427
465
|
/**
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* Similarity mode clones are more similar to the source clip, but may reproduce background noise. For these, use an audio clip about 5 seconds long.
|
|
466
|
+
* Create voice from raw features. If you'd like to clone a voice from an audio file, please use Clone Voice instead.
|
|
431
467
|
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
* @param {File | fs.ReadStream | Blob} clip
|
|
435
|
-
* @param {Cartesia.CloneVoiceRequest} request
|
|
468
|
+
* @param {Cartesia.CreateVoiceRequest} request
|
|
436
469
|
* @param {Voices.RequestOptions} requestOptions - Request-specific configuration.
|
|
437
470
|
*
|
|
438
471
|
* @example
|
|
439
|
-
* await client.voices.
|
|
440
|
-
* name: "
|
|
441
|
-
* description: "
|
|
442
|
-
*
|
|
472
|
+
* await client.voices.create({
|
|
473
|
+
* name: "My Custom Voice",
|
|
474
|
+
* description: "A custom voice created through the API",
|
|
475
|
+
* embedding: [],
|
|
443
476
|
* language: "en",
|
|
444
|
-
*
|
|
445
|
-
* })
|
|
446
|
-
*
|
|
447
|
-
* @example
|
|
448
|
-
* await client.voices.clone(fs.createReadStream("/path/to/your/file"), {
|
|
449
|
-
* name: "A high-similarity cloned voice",
|
|
450
|
-
* description: "Copied from Cartesia docs",
|
|
451
|
-
* mode: "similarity",
|
|
452
|
-
* language: "en",
|
|
453
|
-
* transcript: "A transcript of the words spoken in the audio clip.",
|
|
454
|
-
* enhance: false
|
|
477
|
+
* baseVoiceId: "123e4567-e89b-12d3-a456-426614174000"
|
|
455
478
|
* })
|
|
456
479
|
*/
|
|
457
|
-
|
|
480
|
+
create(request, requestOptions) {
|
|
458
481
|
return __awaiter(this, void 0, void 0, function* () {
|
|
459
482
|
var _a, _b, _c, _d, _e, _f;
|
|
460
|
-
const _request = yield core.newFormData();
|
|
461
|
-
yield _request.appendFile("clip", clip);
|
|
462
|
-
_request.append("name", request.name);
|
|
463
|
-
if (request.description != null) {
|
|
464
|
-
_request.append("description", request.description);
|
|
465
|
-
}
|
|
466
|
-
_request.append("language", serializers.SupportedLanguage.jsonOrThrow(request.language, { unrecognizedObjectKeys: "strip" }));
|
|
467
|
-
_request.append("mode", serializers.CloneMode.jsonOrThrow(request.mode, { unrecognizedObjectKeys: "strip" }));
|
|
468
|
-
_request.append("enhance", request.enhance.toString());
|
|
469
|
-
if (request.transcript != null) {
|
|
470
|
-
_request.append("transcript", request.transcript);
|
|
471
|
-
}
|
|
472
|
-
const _maybeEncodedRequest = yield _request.getRequest();
|
|
473
483
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
474
|
-
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
|
+
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/"),
|
|
475
485
|
method: "POST",
|
|
476
|
-
headers: Object.assign(Object.assign(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
body:
|
|
486
|
+
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.1.7", "User-Agent": "@cartesia/cartesia-js/2.1.7", "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),
|
|
487
|
+
contentType: "application/json",
|
|
488
|
+
requestType: "json",
|
|
489
|
+
body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
480
490
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
481
491
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
482
492
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -503,7 +513,7 @@ class Voices {
|
|
|
503
513
|
body: _response.error.rawBody,
|
|
504
514
|
});
|
|
505
515
|
case "timeout":
|
|
506
|
-
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices
|
|
516
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /voices/.");
|
|
507
517
|
case "unknown":
|
|
508
518
|
throw new errors.CartesiaError({
|
|
509
519
|
message: _response.error.errorMessage,
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Pull in features from a base voice, used for features like voice mixing.
|
|
7
7
|
*/
|
|
8
8
|
export type BaseVoiceId = Cartesia.VoiceId;
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
export interface LocalizeVoiceRequest {
|
|
6
|
-
|
|
6
|
+
/** The ID of the voice to localize. */
|
|
7
|
+
voiceId: string;
|
|
8
|
+
/** The name of the new localized voice. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** The description of the new localized voice. */
|
|
11
|
+
description: string;
|
|
7
12
|
language: Cartesia.LocalizeTargetLanguage;
|
|
8
13
|
originalSpeakerGender: Cartesia.Gender;
|
|
9
14
|
dialect?: Cartesia.LocalizeDialect;
|
|
@@ -6,6 +6,7 @@ import * as Cartesia from "../../../../api/index";
|
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
7
|
import { Embedding } from "../../embedding/types/Embedding";
|
|
8
8
|
import { SupportedLanguage } from "../../tts/types/SupportedLanguage";
|
|
9
|
+
import { BaseVoiceId } from "./BaseVoiceId";
|
|
9
10
|
export declare const CreateVoiceRequest: core.serialization.ObjectSchema<serializers.CreateVoiceRequest.Raw, Cartesia.CreateVoiceRequest>;
|
|
10
11
|
export declare namespace CreateVoiceRequest {
|
|
11
12
|
interface Raw {
|
|
@@ -13,5 +14,6 @@ export declare namespace CreateVoiceRequest {
|
|
|
13
14
|
description: string;
|
|
14
15
|
embedding: Embedding.Raw;
|
|
15
16
|
language?: SupportedLanguage.Raw | null;
|
|
17
|
+
base_voice_id?: BaseVoiceId.Raw | null;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -40,9 +40,11 @@ exports.CreateVoiceRequest = void 0;
|
|
|
40
40
|
const core = __importStar(require("../../../../core"));
|
|
41
41
|
const Embedding_1 = require("../../embedding/types/Embedding");
|
|
42
42
|
const SupportedLanguage_1 = require("../../tts/types/SupportedLanguage");
|
|
43
|
+
const BaseVoiceId_1 = require("./BaseVoiceId");
|
|
43
44
|
exports.CreateVoiceRequest = core.serialization.object({
|
|
44
45
|
name: core.serialization.string(),
|
|
45
46
|
description: core.serialization.string(),
|
|
46
47
|
embedding: Embedding_1.Embedding,
|
|
47
48
|
language: SupportedLanguage_1.SupportedLanguage.optional(),
|
|
49
|
+
baseVoiceId: core.serialization.property("base_voice_id", BaseVoiceId_1.BaseVoiceId.optional()),
|
|
48
50
|
});
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
import * as serializers from "../../../index";
|
|
5
5
|
import * as Cartesia from "../../../../api/index";
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
|
-
import { Embedding } from "../../embedding/types/Embedding";
|
|
8
7
|
import { LocalizeTargetLanguage } from "./LocalizeTargetLanguage";
|
|
9
8
|
import { Gender } from "./Gender";
|
|
10
9
|
import { LocalizeDialect } from "./LocalizeDialect";
|
|
11
10
|
export declare const LocalizeVoiceRequest: core.serialization.ObjectSchema<serializers.LocalizeVoiceRequest.Raw, Cartesia.LocalizeVoiceRequest>;
|
|
12
11
|
export declare namespace LocalizeVoiceRequest {
|
|
13
12
|
interface Raw {
|
|
14
|
-
|
|
13
|
+
voice_id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
15
16
|
language: LocalizeTargetLanguage.Raw;
|
|
16
17
|
original_speaker_gender: Gender.Raw;
|
|
17
18
|
dialect?: LocalizeDialect.Raw | null;
|
|
@@ -38,12 +38,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.LocalizeVoiceRequest = void 0;
|
|
40
40
|
const core = __importStar(require("../../../../core"));
|
|
41
|
-
const Embedding_1 = require("../../embedding/types/Embedding");
|
|
42
41
|
const LocalizeTargetLanguage_1 = require("./LocalizeTargetLanguage");
|
|
43
42
|
const Gender_1 = require("./Gender");
|
|
44
43
|
const LocalizeDialect_1 = require("./LocalizeDialect");
|
|
45
44
|
exports.LocalizeVoiceRequest = core.serialization.object({
|
|
46
|
-
|
|
45
|
+
voiceId: core.serialization.property("voice_id", core.serialization.string()),
|
|
46
|
+
name: core.serialization.string(),
|
|
47
|
+
description: core.serialization.string(),
|
|
47
48
|
language: LocalizeTargetLanguage_1.LocalizeTargetLanguage,
|
|
48
49
|
originalSpeakerGender: core.serialization.property("original_speaker_gender", Gender_1.Gender),
|
|
49
50
|
dialect: LocalizeDialect_1.LocalizeDialect.optional(),
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.1.
|
|
1
|
+
export declare const SDK_VERSION = "2.1.7";
|
package/dist/version.js
CHANGED