@cartesia/cartesia-js 3.0.0-b11 → 3.0.0-b12
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/CHANGELOG.md +9 -0
- package/backcompat/errors.d.mts +1 -1
- package/backcompat/errors.d.mts.map +1 -1
- package/backcompat/errors.d.ts +1 -1
- package/backcompat/errors.d.ts.map +1 -1
- package/backcompat/errors.js +1 -1
- package/backcompat/errors.js.map +1 -1
- package/backcompat/errors.mjs +1 -1
- package/backcompat/errors.mjs.map +1 -1
- package/backcompat/index.d.mts.map +1 -1
- package/backcompat/index.d.ts.map +1 -1
- package/backcompat/index.js +5 -5
- package/backcompat/index.js.map +1 -1
- package/backcompat/index.mjs +5 -5
- package/backcompat/index.mjs.map +1 -1
- package/backcompat/tts-wrapper.d.mts +33 -10
- package/backcompat/tts-wrapper.d.mts.map +1 -1
- package/backcompat/tts-wrapper.d.ts +33 -10
- package/backcompat/tts-wrapper.d.ts.map +1 -1
- package/backcompat/tts-wrapper.js +83 -26
- package/backcompat/tts-wrapper.js.map +1 -1
- package/backcompat/tts-wrapper.mjs +85 -28
- package/backcompat/tts-wrapper.mjs.map +1 -1
- package/backcompat/types.d.mts +1 -1
- package/backcompat/types.d.mts.map +1 -1
- package/backcompat/types.d.ts +1 -1
- package/backcompat/types.d.ts.map +1 -1
- package/backcompat/voice-changer-wrapper.d.mts +4 -4
- package/backcompat/voice-changer-wrapper.d.mts.map +1 -1
- package/backcompat/voice-changer-wrapper.d.ts +4 -4
- package/backcompat/voice-changer-wrapper.d.ts.map +1 -1
- package/backcompat/voice-changer-wrapper.js +6 -6
- package/backcompat/voice-changer-wrapper.js.map +1 -1
- package/backcompat/voice-changer-wrapper.mjs +7 -7
- package/backcompat/voice-changer-wrapper.mjs.map +1 -1
- package/backcompat/voices-wrapper.d.mts +18 -5
- package/backcompat/voices-wrapper.d.mts.map +1 -1
- package/backcompat/voices-wrapper.d.ts +18 -5
- package/backcompat/voices-wrapper.d.ts.map +1 -1
- package/backcompat/voices-wrapper.js +63 -0
- package/backcompat/voices-wrapper.js.map +1 -1
- package/backcompat/voices-wrapper.mjs +63 -0
- package/backcompat/voices-wrapper.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agents/agents.d.mts +4 -4
- package/resources/agents/agents.d.mts.map +1 -1
- package/resources/agents/agents.d.ts +4 -4
- package/resources/agents/agents.d.ts.map +1 -1
- package/resources/agents/agents.js +9 -9
- package/resources/agents/agents.js.map +1 -1
- package/resources/agents/agents.mjs +9 -9
- package/resources/agents/agents.mjs.map +1 -1
- package/resources/agents/calls.d.mts +1 -1
- package/resources/agents/calls.d.mts.map +1 -1
- package/resources/agents/calls.d.ts +1 -1
- package/resources/agents/calls.d.ts.map +1 -1
- package/resources/agents/calls.js +1 -2
- package/resources/agents/calls.js.map +1 -1
- package/resources/agents/calls.mjs +1 -2
- package/resources/agents/calls.mjs.map +1 -1
- package/resources/datasets/datasets.d.mts +3 -3
- package/resources/datasets/datasets.d.mts.map +1 -1
- package/resources/datasets/datasets.d.ts +3 -3
- package/resources/datasets/datasets.d.ts.map +1 -1
- package/resources/datasets/datasets.js +1 -1
- package/resources/datasets/datasets.mjs +1 -1
- package/resources/datasets/files.d.mts +3 -3
- package/resources/datasets/files.d.ts +3 -3
- package/resources/datasets/files.js +1 -1
- package/resources/datasets/files.mjs +1 -1
- package/resources/datasets/index.d.mts +1 -1
- package/resources/datasets/index.d.ts +1 -1
- package/resources/infill.d.mts +1 -1
- package/resources/infill.d.mts.map +1 -1
- package/resources/infill.d.ts +1 -1
- package/resources/infill.d.ts.map +1 -1
- package/resources/infill.js +1 -6
- package/resources/infill.js.map +1 -1
- package/resources/infill.mjs +1 -6
- package/resources/infill.mjs.map +1 -1
- package/resources/pronunciation-dicts.d.mts +1 -1
- package/resources/pronunciation-dicts.d.ts +1 -1
- package/resources/pronunciation-dicts.js +1 -1
- package/resources/pronunciation-dicts.mjs +1 -1
- package/resources/voice-changer.d.mts +1 -1
- package/resources/voice-changer.d.mts.map +1 -1
- package/resources/voice-changer.d.ts +1 -1
- package/resources/voice-changer.d.ts.map +1 -1
- package/resources/voice-changer.js +1 -6
- package/resources/voice-changer.js.map +1 -1
- package/resources/voice-changer.mjs +1 -6
- package/resources/voice-changer.mjs.map +1 -1
- package/resources/voices.d.mts +9 -9
- package/resources/voices.d.mts.map +1 -1
- package/resources/voices.d.ts +9 -9
- package/resources/voices.d.ts.map +1 -1
- package/resources/voices.js +14 -14
- package/resources/voices.js.map +1 -1
- package/resources/voices.mjs +14 -14
- package/resources/voices.mjs.map +1 -1
- package/src/backcompat/errors.ts +32 -40
- package/src/backcompat/index.ts +64 -67
- package/src/backcompat/tts-wrapper.ts +405 -322
- package/src/backcompat/types.ts +13 -13
- package/src/backcompat/voice-changer-wrapper.ts +58 -56
- package/src/backcompat/voices-wrapper.ts +217 -150
- package/src/resources/agents/agents.ts +10 -10
- package/src/resources/agents/calls.ts +2 -3
- package/src/resources/datasets/datasets.ts +3 -3
- package/src/resources/datasets/files.ts +3 -3
- package/src/resources/datasets/index.ts +1 -1
- package/src/resources/infill.ts +2 -7
- package/src/resources/pronunciation-dicts.ts +1 -1
- package/src/resources/voice-changer.ts +2 -7
- package/src/resources/voices.ts +15 -15
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/backcompat/types.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export type Supplier<T> = T | Promise<T> | (() => T | Promise<T>);
|
|
2
2
|
|
|
3
3
|
export interface CartesiaClientOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
environment?: Supplier<'https://api.cartesia.ai' | string>;
|
|
5
|
+
/** Specify a custom URL to connect the client to. */
|
|
6
|
+
baseUrl?: Supplier<string>;
|
|
7
|
+
apiKey?: Supplier<string | undefined>;
|
|
8
|
+
/** Override the Cartesia-Version header */
|
|
9
|
+
cartesiaVersion?: string;
|
|
10
|
+
fetcher?: any;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface BackCompatRequestOptions {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
14
|
+
timeoutInSeconds?: number;
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
17
|
+
cartesiaVersion?: string;
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
}
|
|
@@ -1,71 +1,73 @@
|
|
|
1
|
-
import * as fs from
|
|
2
|
-
import { Cartesia } from
|
|
3
|
-
import { type Uploadable } from
|
|
4
|
-
import { type RequestOptions as InternalRequestOptions } from
|
|
5
|
-
import { Readable } from
|
|
6
|
-
import { BackCompatRequestOptions } from
|
|
7
|
-
import { wrap } from
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import { Cartesia } from '../client';
|
|
3
|
+
import { type Uploadable } from '../core/uploads';
|
|
4
|
+
import { type RequestOptions as InternalRequestOptions } from '../internal/request-options';
|
|
5
|
+
import { Readable } from 'stream';
|
|
6
|
+
import { BackCompatRequestOptions } from './types';
|
|
7
|
+
import { wrap } from './errors';
|
|
8
8
|
|
|
9
9
|
export interface BackCompatVoiceChangerBytesRequest {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
voiceId: string;
|
|
11
|
+
outputFormatContainer: 'raw' | 'wav' | 'mp3';
|
|
12
|
+
outputFormatSampleRate: 8000 | 16000 | 22050 | 24000 | 44100 | 48000;
|
|
13
|
+
outputFormatEncoding?: 'pcm_f32le' | 'pcm_s16le' | 'mulaw' | 'alaw';
|
|
14
|
+
outputFormatBitRate?: 32000 | 64000 | 96000 | 128000 | 192000;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** @deprecated Use the new SDK's voice changer methods on the {@link Cartesia} instance instead. */
|
|
18
18
|
export class VoiceChangerWrapper {
|
|
19
|
-
|
|
19
|
+
private client: Cartesia;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
constructor(client: Cartesia) {
|
|
22
|
+
this.client = client;
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
/** @deprecated Use {@link Cartesia.voiceChanger.changeVoiceBytes} instead. */
|
|
26
|
+
async bytes(
|
|
27
|
+
clip: File | fs.ReadStream | Blob,
|
|
28
|
+
request: BackCompatVoiceChangerBytesRequest,
|
|
29
|
+
requestOptions?: BackCompatRequestOptions,
|
|
30
|
+
): Promise<Readable> {
|
|
31
|
+
const params: any = {
|
|
32
|
+
clip: clip as Uploadable,
|
|
33
|
+
'voice[id]': request.voiceId,
|
|
34
|
+
'output_format[container]': request.outputFormatContainer,
|
|
35
|
+
'output_format[sample_rate]': request.outputFormatSampleRate,
|
|
36
|
+
};
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
if (request.outputFormatEncoding) {
|
|
39
|
+
params['output_format[encoding]'] = request.outputFormatEncoding;
|
|
40
|
+
}
|
|
41
|
+
if (request.outputFormatBitRate) {
|
|
42
|
+
params['output_format[bit_rate]'] = request.outputFormatBitRate;
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
const options: InternalRequestOptions = {};
|
|
46
|
+
if (requestOptions) {
|
|
47
|
+
if (requestOptions.timeoutInSeconds) {
|
|
48
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
49
|
+
}
|
|
50
|
+
if (requestOptions.maxRetries !== undefined) {
|
|
51
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
52
|
+
}
|
|
53
|
+
options.headers = requestOptions.headers;
|
|
54
|
+
options.signal = requestOptions.abortSignal;
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const response = await wrap(
|
|
58
|
+
this.client.voiceChanger.changeVoiceBytes(params, {
|
|
59
|
+
...options,
|
|
60
|
+
__binaryResponse: true,
|
|
61
|
+
} as any),
|
|
62
|
+
);
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
const responseAny = response as any;
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
if (!responseAny.body) {
|
|
67
|
+
throw new Error('Response body is null');
|
|
68
|
+
}
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
return Readable.fromWeb(responseAny.body);
|
|
72
|
+
}
|
|
71
73
|
}
|
|
@@ -1,163 +1,230 @@
|
|
|
1
|
-
import * as fs from
|
|
2
|
-
import { Cartesia } from
|
|
3
|
-
import { type Uploadable } from
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import { Cartesia } from '../client';
|
|
3
|
+
import { type Uploadable } from '../core/uploads';
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
5
|
+
type VoiceCloneParams,
|
|
6
|
+
type VoiceMetadata,
|
|
7
|
+
type SupportedLanguage,
|
|
8
|
+
type VoiceUpdateParams,
|
|
9
|
+
type Voice,
|
|
10
|
+
type VoiceLocalizeParams,
|
|
11
|
+
type VoiceListParams,
|
|
12
|
+
} from '../resources/voices';
|
|
13
|
+
import { type RequestOptions as InternalRequestOptions } from '../internal/request-options';
|
|
14
|
+
import { BackCompatRequestOptions } from './types';
|
|
15
|
+
import { wrap } from './errors';
|
|
16
|
+
|
|
17
|
+
export interface BackCompatVoiceListOptions {
|
|
18
|
+
gender?: 'masculine' | 'feminine' | 'gender_neutral' | null;
|
|
19
|
+
isOwner?: boolean | null;
|
|
20
|
+
limit?: number | null;
|
|
21
|
+
q?: string | null;
|
|
22
|
+
expand?: Array<'preview_file_url'> | null;
|
|
23
|
+
}
|
|
15
24
|
|
|
16
25
|
export interface BackCompatCloneVoiceRequest {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
name: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
language: string;
|
|
29
|
+
mode: 'similarity' | 'stability';
|
|
30
|
+
enhance?: boolean;
|
|
31
|
+
baseVoiceId?: string;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
export interface BackCompatUpdateVoiceRequest {
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
export interface BackCompatLocalizeVoiceRequest {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
| "au"
|
|
53
|
-
| "in"
|
|
54
|
-
| "so"
|
|
55
|
-
| "uk"
|
|
56
|
-
| "us"
|
|
57
|
-
| "mx"
|
|
58
|
-
| "pe"
|
|
59
|
-
| "br"
|
|
60
|
-
| "eu"
|
|
61
|
-
| "ca";
|
|
40
|
+
voiceId: string;
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
language:
|
|
44
|
+
| 'en'
|
|
45
|
+
| 'de'
|
|
46
|
+
| 'es'
|
|
47
|
+
| 'fr'
|
|
48
|
+
| 'ja'
|
|
49
|
+
| 'pt'
|
|
50
|
+
| 'zh'
|
|
51
|
+
| 'hi'
|
|
52
|
+
| 'it'
|
|
53
|
+
| 'ko'
|
|
54
|
+
| 'nl'
|
|
55
|
+
| 'pl'
|
|
56
|
+
| 'ru'
|
|
57
|
+
| 'sv'
|
|
58
|
+
| 'tr';
|
|
59
|
+
originalSpeakerGender: 'male' | 'female';
|
|
60
|
+
dialect?: 'au' | 'in' | 'so' | 'uk' | 'us' | 'mx' | 'pe' | 'br' | 'eu' | 'ca';
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/** @deprecated Use the new SDK's voices methods on the {@link Cartesia} instance instead. */
|
|
65
64
|
export class VoicesWrapper {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
65
|
+
private client: Cartesia;
|
|
66
|
+
|
|
67
|
+
constructor(client: Cartesia) {
|
|
68
|
+
this.client = client;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @deprecated Use {@link Cartesia.voices.clone} instead. */
|
|
72
|
+
async clone(
|
|
73
|
+
clip: File | fs.ReadStream | Blob,
|
|
74
|
+
request: BackCompatCloneVoiceRequest,
|
|
75
|
+
requestOptions?: BackCompatRequestOptions,
|
|
76
|
+
): Promise<VoiceMetadata> {
|
|
77
|
+
const params: VoiceCloneParams = {
|
|
78
|
+
clip: clip as Uploadable,
|
|
79
|
+
name: request.name,
|
|
80
|
+
language: request.language as SupportedLanguage,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
if (request.description !== undefined) {
|
|
84
|
+
params.description = request.description;
|
|
85
|
+
}
|
|
86
|
+
if (request.baseVoiceId !== undefined) {
|
|
87
|
+
params.base_voice_id = request.baseVoiceId;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const options: InternalRequestOptions = {};
|
|
91
|
+
if (requestOptions) {
|
|
92
|
+
if (requestOptions.timeoutInSeconds) {
|
|
93
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
94
|
+
}
|
|
95
|
+
if (requestOptions.maxRetries !== undefined) {
|
|
96
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
97
|
+
}
|
|
98
|
+
options.headers = requestOptions.headers;
|
|
99
|
+
options.signal = requestOptions.abortSignal;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return wrap(this.client.voices.clone(params, options));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** @deprecated Use {@link Cartesia.voices.update} instead. */
|
|
106
|
+
async update(
|
|
107
|
+
id: string,
|
|
108
|
+
request: BackCompatUpdateVoiceRequest,
|
|
109
|
+
requestOptions?: BackCompatRequestOptions,
|
|
110
|
+
): Promise<Voice> {
|
|
111
|
+
const params: VoiceUpdateParams = {
|
|
112
|
+
name: request.name,
|
|
113
|
+
description: request.description,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const options: InternalRequestOptions = {};
|
|
117
|
+
if (requestOptions) {
|
|
118
|
+
if (requestOptions.timeoutInSeconds) {
|
|
119
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
120
|
+
}
|
|
121
|
+
if (requestOptions.maxRetries !== undefined) {
|
|
122
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
123
|
+
}
|
|
124
|
+
options.headers = requestOptions.headers;
|
|
125
|
+
options.signal = requestOptions.abortSignal;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return wrap(this.client.voices.update(id, params, options));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** @deprecated Use {@link Cartesia.voices.localize} instead. */
|
|
132
|
+
async localize(
|
|
133
|
+
request: BackCompatLocalizeVoiceRequest,
|
|
134
|
+
requestOptions?: BackCompatRequestOptions,
|
|
135
|
+
): Promise<VoiceMetadata> {
|
|
136
|
+
const params: VoiceLocalizeParams = {
|
|
137
|
+
voice_id: request.voiceId,
|
|
138
|
+
name: request.name,
|
|
139
|
+
description: request.description,
|
|
140
|
+
language: request.language as any,
|
|
141
|
+
original_speaker_gender: request.originalSpeakerGender,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
if (request.dialect) {
|
|
145
|
+
params.dialect = request.dialect as any; // Cast dialect as list might vary slightly or be strict
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const options: InternalRequestOptions = {};
|
|
149
|
+
if (requestOptions) {
|
|
150
|
+
if (requestOptions.timeoutInSeconds) {
|
|
151
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
152
|
+
}
|
|
153
|
+
if (requestOptions.maxRetries !== undefined) {
|
|
154
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
155
|
+
}
|
|
156
|
+
options.headers = requestOptions.headers;
|
|
157
|
+
options.signal = requestOptions.abortSignal;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return wrap(this.client.voices.localize(params, options));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** @deprecated Use {@link Cartesia.voices.get} instead. */
|
|
164
|
+
async get(id: string, requestOptions?: BackCompatRequestOptions): Promise<Voice> {
|
|
165
|
+
const options: InternalRequestOptions = {};
|
|
166
|
+
if (requestOptions) {
|
|
167
|
+
if (requestOptions.timeoutInSeconds) {
|
|
168
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
169
|
+
}
|
|
170
|
+
if (requestOptions.maxRetries !== undefined) {
|
|
171
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
172
|
+
}
|
|
173
|
+
options.headers = requestOptions.headers;
|
|
174
|
+
options.signal = requestOptions.abortSignal;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return wrap(this.client.voices.get(id, {}, options));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** @deprecated Use {@link Cartesia.voices.list} instead. */
|
|
181
|
+
async list(
|
|
182
|
+
listOptions?: BackCompatVoiceListOptions,
|
|
183
|
+
requestOptions?: BackCompatRequestOptions,
|
|
184
|
+
): Promise<Voice[]> {
|
|
185
|
+
const params: VoiceListParams = {};
|
|
186
|
+
if (listOptions) {
|
|
187
|
+
if (listOptions.gender !== undefined) params.gender = listOptions.gender;
|
|
188
|
+
if (listOptions.isOwner !== undefined) params.is_owner = listOptions.isOwner;
|
|
189
|
+
if (listOptions.limit !== undefined) params.limit = listOptions.limit;
|
|
190
|
+
if (listOptions.q !== undefined) params.q = listOptions.q;
|
|
191
|
+
if (listOptions.expand !== undefined) params.expand = listOptions.expand;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const options: InternalRequestOptions = {};
|
|
195
|
+
if (requestOptions) {
|
|
196
|
+
if (requestOptions.timeoutInSeconds) {
|
|
197
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
198
|
+
}
|
|
199
|
+
if (requestOptions.maxRetries !== undefined) {
|
|
200
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
201
|
+
}
|
|
202
|
+
options.headers = requestOptions.headers;
|
|
203
|
+
options.signal = requestOptions.abortSignal;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// The new SDK returns a paginated result, we collect all pages
|
|
207
|
+
const voices: Voice[] = [];
|
|
208
|
+
for await (const voice of this.client.voices.list(params, options)) {
|
|
209
|
+
voices.push(voice);
|
|
210
|
+
}
|
|
211
|
+
return voices;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** @deprecated Use {@link Cartesia.voices.remove} instead. */
|
|
215
|
+
async remove(id: string, requestOptions?: BackCompatRequestOptions): Promise<void> {
|
|
216
|
+
const options: InternalRequestOptions = {};
|
|
217
|
+
if (requestOptions) {
|
|
218
|
+
if (requestOptions.timeoutInSeconds) {
|
|
219
|
+
options.timeout = requestOptions.timeoutInSeconds * 1000;
|
|
220
|
+
}
|
|
221
|
+
if (requestOptions.maxRetries !== undefined) {
|
|
222
|
+
options.maxRetries = requestOptions.maxRetries;
|
|
223
|
+
}
|
|
224
|
+
options.headers = requestOptions.headers;
|
|
225
|
+
options.signal = requestOptions.abortSignal;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return wrap(this.client.voices.remove(id, options));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -47,16 +47,6 @@ export class Agents extends APIResource {
|
|
|
47
47
|
return this._client.get('/agents', options);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* Delete Agent
|
|
52
|
-
*/
|
|
53
|
-
delete(agentID: string, options?: RequestOptions): APIPromise<void> {
|
|
54
|
-
return this._client.delete(path`/agents/${agentID}`, {
|
|
55
|
-
...options,
|
|
56
|
-
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
/**
|
|
61
51
|
* List the phone numbers associated with an agent. Currently, you can only have
|
|
62
52
|
* one phone number per agent and these are provisioned by Cartesia.
|
|
@@ -71,6 +61,16 @@ export class Agents extends APIResource {
|
|
|
71
61
|
listTemplates(options?: RequestOptions): APIPromise<AgentListTemplatesResponse> {
|
|
72
62
|
return this._client.get('/agents/templates', options);
|
|
73
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Delete Agent
|
|
67
|
+
*/
|
|
68
|
+
remove(agentID: string, options?: RequestOptions): APIPromise<void> {
|
|
69
|
+
return this._client.delete(path`/agents/${agentID}`, {
|
|
70
|
+
...options,
|
|
71
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -28,11 +28,10 @@ export class Calls extends APIResource {
|
|
|
28
28
|
* The downloaded audio file is in .wav format. This endpoint streams the audio
|
|
29
29
|
* file content (WAV format) to the client.
|
|
30
30
|
*/
|
|
31
|
-
downloadAudio(callID: string, options?: RequestOptions): APIPromise<
|
|
31
|
+
downloadAudio(callID: string, options?: RequestOptions): APIPromise<void> {
|
|
32
32
|
return this._client.get(path`/agents/calls/${callID}/audio`, {
|
|
33
33
|
...options,
|
|
34
|
-
headers: buildHeaders([{ Accept: '
|
|
35
|
-
__binaryResponse: true,
|
|
34
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
37
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as FilesAPI from './files';
|
|
5
5
|
import {
|
|
6
|
-
FileDeleteParams,
|
|
7
6
|
FileListParams,
|
|
8
7
|
FileListResponse,
|
|
9
8
|
FileListResponsesCursorIDPage,
|
|
9
|
+
FileRemoveParams,
|
|
10
10
|
FileUploadParams,
|
|
11
11
|
Files,
|
|
12
12
|
} from './files';
|
|
@@ -57,7 +57,7 @@ export class Datasets extends APIResource {
|
|
|
57
57
|
/**
|
|
58
58
|
* Delete a dataset
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
remove(id: string, options?: RequestOptions): APIPromise<void> {
|
|
61
61
|
return this._client.delete(path`/datasets/${id}`, {
|
|
62
62
|
...options,
|
|
63
63
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
@@ -139,7 +139,7 @@ export declare namespace Datasets {
|
|
|
139
139
|
type FileListResponse as FileListResponse,
|
|
140
140
|
type FileListResponsesCursorIDPage as FileListResponsesCursorIDPage,
|
|
141
141
|
type FileListParams as FileListParams,
|
|
142
|
-
type
|
|
142
|
+
type FileRemoveParams as FileRemoveParams,
|
|
143
143
|
type FileUploadParams as FileUploadParams,
|
|
144
144
|
};
|
|
145
145
|
}
|
|
@@ -27,7 +27,7 @@ export class Files extends APIResource {
|
|
|
27
27
|
/**
|
|
28
28
|
* Remove a file from a dataset
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
remove(fileID: string, params: FileRemoveParams, options?: RequestOptions): APIPromise<void> {
|
|
31
31
|
const { id } = params;
|
|
32
32
|
return this._client.delete(path`/datasets/${id}/files/${fileID}`, {
|
|
33
33
|
...options,
|
|
@@ -83,7 +83,7 @@ export interface FileListParams extends CursorIDPageParams {
|
|
|
83
83
|
limit?: number | null;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export interface
|
|
86
|
+
export interface FileRemoveParams {
|
|
87
87
|
/**
|
|
88
88
|
* ID of the dataset containing the file
|
|
89
89
|
*/
|
|
@@ -104,7 +104,7 @@ export declare namespace Files {
|
|
|
104
104
|
type FileListResponse as FileListResponse,
|
|
105
105
|
type FileListResponsesCursorIDPage as FileListResponsesCursorIDPage,
|
|
106
106
|
type FileListParams as FileListParams,
|
|
107
|
-
type
|
|
107
|
+
type FileRemoveParams as FileRemoveParams,
|
|
108
108
|
type FileUploadParams as FileUploadParams,
|
|
109
109
|
};
|
|
110
110
|
}
|