@cartesia/cartesia-js 3.0.0-b3 → 3.0.0-b4

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 (97) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +21 -21
  3. package/client.d.mts +2 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/access-token.d.mts +5 -0
  11. package/resources/access-token.d.mts.map +1 -1
  12. package/resources/access-token.d.ts +5 -0
  13. package/resources/access-token.d.ts.map +1 -1
  14. package/resources/agents/agents.js +1 -1
  15. package/resources/agents/agents.js.map +1 -1
  16. package/resources/agents/agents.mjs +1 -1
  17. package/resources/agents/agents.mjs.map +1 -1
  18. package/resources/agents/metrics/index.d.mts +1 -1
  19. package/resources/agents/metrics/index.d.mts.map +1 -1
  20. package/resources/agents/metrics/index.d.ts +1 -1
  21. package/resources/agents/metrics/index.d.ts.map +1 -1
  22. package/resources/agents/metrics/index.js.map +1 -1
  23. package/resources/agents/metrics/index.mjs.map +1 -1
  24. package/resources/agents/metrics/metrics.d.mts +2 -2
  25. package/resources/agents/metrics/metrics.d.mts.map +1 -1
  26. package/resources/agents/metrics/metrics.d.ts +2 -2
  27. package/resources/agents/metrics/metrics.d.ts.map +1 -1
  28. package/resources/agents/metrics/metrics.js.map +1 -1
  29. package/resources/agents/metrics/metrics.mjs.map +1 -1
  30. package/resources/agents/metrics/results.d.mts +23 -22
  31. package/resources/agents/metrics/results.d.mts.map +1 -1
  32. package/resources/agents/metrics/results.d.ts +23 -22
  33. package/resources/agents/metrics/results.d.ts.map +1 -1
  34. package/resources/agents/metrics/results.js +4 -5
  35. package/resources/agents/metrics/results.js.map +1 -1
  36. package/resources/agents/metrics/results.mjs +4 -5
  37. package/resources/agents/metrics/results.mjs.map +1 -1
  38. package/resources/index.d.mts +1 -1
  39. package/resources/index.d.mts.map +1 -1
  40. package/resources/index.d.ts +1 -1
  41. package/resources/index.d.ts.map +1 -1
  42. package/resources/index.js.map +1 -1
  43. package/resources/index.mjs.map +1 -1
  44. package/resources/infill.d.mts +3 -4
  45. package/resources/infill.d.mts.map +1 -1
  46. package/resources/infill.d.ts +3 -4
  47. package/resources/infill.d.ts.map +1 -1
  48. package/resources/infill.js +0 -2
  49. package/resources/infill.js.map +1 -1
  50. package/resources/infill.mjs +0 -2
  51. package/resources/infill.mjs.map +1 -1
  52. package/resources/pronunciation-dicts.d.mts +0 -8
  53. package/resources/pronunciation-dicts.d.mts.map +1 -1
  54. package/resources/pronunciation-dicts.d.ts +0 -8
  55. package/resources/pronunciation-dicts.d.ts.map +1 -1
  56. package/resources/pronunciation-dicts.js +0 -18
  57. package/resources/pronunciation-dicts.js.map +1 -1
  58. package/resources/pronunciation-dicts.mjs +0 -18
  59. package/resources/pronunciation-dicts.mjs.map +1 -1
  60. package/resources/stt.d.mts +1 -104
  61. package/resources/stt.d.mts.map +1 -1
  62. package/resources/stt.d.ts +1 -104
  63. package/resources/stt.d.ts.map +1 -1
  64. package/resources/tts/tts.d.mts +79 -115
  65. package/resources/tts/tts.d.mts.map +1 -1
  66. package/resources/tts/tts.d.ts +79 -115
  67. package/resources/tts/tts.d.ts.map +1 -1
  68. package/resources/voice-changer.d.mts +2 -2
  69. package/resources/voice-changer.d.mts.map +1 -1
  70. package/resources/voice-changer.d.ts +2 -2
  71. package/resources/voice-changer.d.ts.map +1 -1
  72. package/resources/voices.d.mts +70 -34
  73. package/resources/voices.d.mts.map +1 -1
  74. package/resources/voices.d.ts +70 -34
  75. package/resources/voices.d.ts.map +1 -1
  76. package/resources/voices.js +45 -3
  77. package/resources/voices.js.map +1 -1
  78. package/resources/voices.mjs +45 -3
  79. package/resources/voices.mjs.map +1 -1
  80. package/src/client.ts +2 -0
  81. package/src/resources/access-token.ts +6 -0
  82. package/src/resources/agents/agents.ts +1 -1
  83. package/src/resources/agents/metrics/index.ts +1 -0
  84. package/src/resources/agents/metrics/metrics.ts +2 -0
  85. package/src/resources/agents/metrics/results.ts +27 -23
  86. package/src/resources/index.ts +1 -0
  87. package/src/resources/infill.ts +3 -4
  88. package/src/resources/pronunciation-dicts.ts +0 -20
  89. package/src/resources/stt.ts +102 -104
  90. package/src/resources/tts/tts.ts +146 -128
  91. package/src/resources/voice-changer.ts +2 -2
  92. package/src/resources/voices.ts +105 -38
  93. package/src/version.ts +1 -1
  94. package/version.d.mts +1 -1
  95. package/version.d.ts +1 -1
  96. package/version.js +1 -1
  97. package/version.mjs +1 -1
@@ -14,6 +14,14 @@ export class Voices extends APIResource {
14
14
  * Update the name, description, and gender of a voice. To set the gender back to
15
15
  * the default, set the gender to `null`. If gender is not specified, the gender
16
16
  * will not be updated.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const voice = await client.voices.update('id', {
21
+ * description: 'description',
22
+ * name: 'name',
23
+ * });
24
+ * ```
17
25
  */
18
26
  update(id: string, body: VoiceUpdateParams, options?: RequestOptions): APIPromise<Voice> {
19
27
  return this._client.patch(path`/voices/${id}`, { body, ...options });
@@ -21,16 +29,29 @@ export class Voices extends APIResource {
21
29
 
22
30
  /**
23
31
  * List Voices
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // Automatically fetches more pages as needed.
36
+ * for await (const voice of client.voices.list()) {
37
+ * // ...
38
+ * }
39
+ * ```
24
40
  */
25
41
  list(
26
42
  query: VoiceListParams | null | undefined = {},
27
43
  options?: RequestOptions,
28
44
  ): PagePromise<VoicesCursorIDPage, Voice> {
29
- return this._client.getAPIList('/voices/', CursorIDPage<Voice>, { query, ...options });
45
+ return this._client.getAPIList('/voices', CursorIDPage<Voice>, { query, ...options });
30
46
  }
31
47
 
32
48
  /**
33
49
  * Delete Voice
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * await client.voices.delete('id');
54
+ * ```
34
55
  */
35
56
  delete(id: string, options?: RequestOptions): APIPromise<void> {
36
57
  return this._client.delete(path`/voices/${id}`, {
@@ -43,6 +64,11 @@ export class Voices extends APIResource {
43
64
  * Clone a high similarity voice from an audio clip. Clones are more similar to the
44
65
  * source clip, but may reproduce background noise. For these, use an audio clip
45
66
  * about 5 seconds long.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const voiceMetadata = await client.voices.clone();
71
+ * ```
46
72
  */
47
73
  clone(body: VoiceCloneParams, options?: RequestOptions): APIPromise<VoiceMetadata> {
48
74
  return this._client.post(
@@ -53,14 +79,34 @@ export class Voices extends APIResource {
53
79
 
54
80
  /**
55
81
  * Get Voice
56
- */
57
- get(id: string, options?: RequestOptions): APIPromise<Voice> {
58
- return this._client.get(path`/voices/${id}`, options);
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const voice = await client.voices.get('id');
86
+ * ```
87
+ */
88
+ get(
89
+ id: string,
90
+ query: VoiceGetParams | null | undefined = {},
91
+ options?: RequestOptions,
92
+ ): APIPromise<Voice> {
93
+ return this._client.get(path`/voices/${id}`, { query, ...options });
59
94
  }
60
95
 
61
96
  /**
62
97
  * Create a new voice from an existing voice localized to a new language and
63
98
  * dialect.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * const voiceMetadata = await client.voices.localize({
103
+ * description: 'description',
104
+ * language: 'en',
105
+ * name: 'name',
106
+ * original_speaker_gender: 'male',
107
+ * voice_id: 'voice_id',
108
+ * });
109
+ * ```
64
110
  */
65
111
  localize(body: VoiceLocalizeParams, options?: RequestOptions): APIPromise<VoiceMetadata> {
66
112
  return this._client.post('/voices/localize', { body, ...options });
@@ -72,11 +118,8 @@ export type VoicesCursorIDPage = CursorIDPage<Voice>;
72
118
  export type GenderPresentation = 'masculine' | 'feminine' | 'gender_neutral';
73
119
 
74
120
  /**
75
- * The language that the given voice should speak the transcript in.
76
- *
77
- * Options: English (en), French (fr), German (de), Spanish (es), Portuguese (pt),
78
- * Chinese (zh), Japanese (ja), Hindi (hi), Italian (it), Korean (ko), Dutch (nl),
79
- * Polish (pl), Russian (ru), Swedish (sv), Turkish (tr).
121
+ * The language that the given voice should speak the transcript in. For valid
122
+ * options, see [Models](/build-with-cartesia/tts-models).
80
123
  */
81
124
  export type SupportedLanguage =
82
125
  | 'en'
@@ -93,7 +136,34 @@ export type SupportedLanguage =
93
136
  | 'pl'
94
137
  | 'ru'
95
138
  | 'sv'
96
- | 'tr';
139
+ | 'tr'
140
+ | 'tl'
141
+ | 'bg'
142
+ | 'ro'
143
+ | 'ar'
144
+ | 'cs'
145
+ | 'el'
146
+ | 'fi'
147
+ | 'hr'
148
+ | 'ms'
149
+ | 'sk'
150
+ | 'da'
151
+ | 'ta'
152
+ | 'uk'
153
+ | 'hu'
154
+ | 'no'
155
+ | 'vi'
156
+ | 'bn'
157
+ | 'th'
158
+ | 'he'
159
+ | 'ka'
160
+ | 'id'
161
+ | 'te'
162
+ | 'gu'
163
+ | 'kn'
164
+ | 'ml'
165
+ | 'mr'
166
+ | 'pa';
97
167
 
98
168
  export interface Voice {
99
169
  /**
@@ -112,7 +182,7 @@ export interface Voice {
112
182
  description: string;
113
183
 
114
184
  /**
115
- * Whether the current user is the owner of the voice.
185
+ * Whether your organization owns the voice.
116
186
  */
117
187
  is_owner: boolean;
118
188
 
@@ -122,11 +192,8 @@ export interface Voice {
122
192
  is_public: boolean;
123
193
 
124
194
  /**
125
- * The language that the given voice should speak the transcript in.
126
- *
127
- * Options: English (en), French (fr), German (de), Spanish (es), Portuguese (pt),
128
- * Chinese (zh), Japanese (ja), Hindi (hi), Italian (it), Korean (ko), Dutch (nl),
129
- * Polish (pl), Russian (ru), Swedish (sv), Turkish (tr).
195
+ * The language that the given voice should speak the transcript in. For valid
196
+ * options, see [Models](/build-with-cartesia/tts-models).
130
197
  */
131
198
  language: SupportedLanguage;
132
199
 
@@ -141,10 +208,13 @@ export interface Voice {
141
208
  gender?: GenderPresentation | null;
142
209
 
143
210
  /**
144
- * Whether the current user has starred the voice. Only included when `expand`
145
- * includes `is_starred`.
211
+ * A URL to download a preview audio file for this voice. Useful to avoid consuming
212
+ * credits when looking for the right voice. The URL requires the same
213
+ * Authorization header. Voice previews may be changed, moved, or deleted so you
214
+ * should avoid storing the URL permanently. This property will be null if there's
215
+ * no preview available. Only included when `expand[]` includes `preview_file_url`.
146
216
  */
147
- is_starred?: boolean | null;
217
+ preview_file_url?: string | null;
148
218
  }
149
219
 
150
220
  export interface VoiceMetadata {
@@ -169,11 +239,8 @@ export interface VoiceMetadata {
169
239
  is_public: boolean;
170
240
 
171
241
  /**
172
- * The language that the given voice should speak the transcript in.
173
- *
174
- * Options: English (en), French (fr), German (de), Spanish (es), Portuguese (pt),
175
- * Chinese (zh), Japanese (ja), Hindi (hi), Italian (it), Korean (ko), Dutch (nl),
176
- * Polish (pl), Russian (ru), Swedish (sv), Turkish (tr).
242
+ * The language that the given voice should speak the transcript in. For valid
243
+ * options, see [Models](/build-with-cartesia/tts-models).
177
244
  */
178
245
  language: SupportedLanguage;
179
246
 
@@ -206,7 +273,7 @@ export interface VoiceListParams extends CursorIDPageParams {
206
273
  /**
207
274
  * Additional fields to include in the response.
208
275
  */
209
- expand?: Array<'is_starred'> | null;
276
+ expand?: Array<'preview_file_url'> | null;
210
277
 
211
278
  /**
212
279
  * The gender presentation of the voices to return.
@@ -214,21 +281,19 @@ export interface VoiceListParams extends CursorIDPageParams {
214
281
  gender?: GenderPresentation | null;
215
282
 
216
283
  /**
217
- * Whether to only return voices owned by the current user.
284
+ * Whether to only return voices owned your organization.
218
285
  */
219
286
  is_owner?: boolean | null;
220
287
 
221
288
  /**
222
- * Whether to only return starred voices.
289
+ * The number of Voices to return per page, ranging between 1 and 100.
223
290
  */
224
- is_starred?: boolean | null;
225
-
226
- language?: string;
291
+ limit?: number | null;
227
292
 
228
293
  /**
229
- * The number of Voices to return per page, ranging between 1 and 100.
294
+ * Query string to search for voices by name, description, or Voice ID.
230
295
  */
231
- limit?: number | null;
296
+ q?: string | null;
232
297
  }
233
298
 
234
299
  export interface VoiceCloneParams {
@@ -244,12 +309,6 @@ export interface VoiceCloneParams {
244
309
  */
245
310
  description?: string | null;
246
311
 
247
- /**
248
- * Whether to apply AI enhancements to the clip to reduce background noise. This is
249
- * not recommended unless the source clip is extremely low quality.
250
- */
251
- enhance?: boolean | null;
252
-
253
312
  /**
254
313
  * The language of the voice.
255
314
  */
@@ -261,6 +320,13 @@ export interface VoiceCloneParams {
261
320
  name?: string;
262
321
  }
263
322
 
323
+ export interface VoiceGetParams {
324
+ /**
325
+ * Additional fields to include in the response.
326
+ */
327
+ expand?: Array<'preview_file_url'> | null;
328
+ }
329
+
264
330
  export interface VoiceLocalizeParams {
265
331
  /**
266
332
  * The description of the new localized voice.
@@ -320,6 +386,7 @@ export declare namespace Voices {
320
386
  type VoiceUpdateParams as VoiceUpdateParams,
321
387
  type VoiceListParams as VoiceListParams,
322
388
  type VoiceCloneParams as VoiceCloneParams,
389
+ type VoiceGetParams as VoiceGetParams,
323
390
  type VoiceLocalizeParams as VoiceLocalizeParams,
324
391
  };
325
392
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.0.0-b3'; // x-release-please-version
1
+ export const VERSION = '3.0.0-b4'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.0.0-b3";
1
+ export declare const VERSION = "3.0.0-b4";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.0.0-b3";
1
+ export declare const VERSION = "3.0.0-b4";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '3.0.0-b3'; // x-release-please-version
4
+ exports.VERSION = '3.0.0-b4'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.0.0-b3'; // x-release-please-version
1
+ export const VERSION = '3.0.0-b4'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map