@cartesia/cartesia-js 3.0.0-b11 → 3.0.0-b13
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 +18 -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/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/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/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/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/calls.ts +2 -3
- package/src/resources/infill.ts +2 -7
- package/src/resources/voice-changer.ts +2 -7
- 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.delete} instead. */
|
|
215
|
+
async delete(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.delete(id, options));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -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
|
}
|
package/src/resources/infill.ts
CHANGED
|
@@ -29,16 +29,11 @@ export class Infill extends APIResource {
|
|
|
29
29
|
* keeping as much silence in the left/right audio segments as possible
|
|
30
30
|
* - This helps the model generate more natural transitions
|
|
31
31
|
*/
|
|
32
|
-
create(body: InfillCreateParams, options?: RequestOptions): APIPromise<
|
|
32
|
+
create(body: InfillCreateParams, options?: RequestOptions): APIPromise<void> {
|
|
33
33
|
return this._client.post(
|
|
34
34
|
'/infill/bytes',
|
|
35
35
|
multipartFormRequestOptions(
|
|
36
|
-
{
|
|
37
|
-
body,
|
|
38
|
-
...options,
|
|
39
|
-
headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
|
|
40
|
-
__binaryResponse: true,
|
|
41
|
-
},
|
|
36
|
+
{ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
|
|
42
37
|
this._client,
|
|
43
38
|
),
|
|
44
39
|
);
|
|
@@ -15,16 +15,11 @@ export class VoiceChanger extends APIResource {
|
|
|
15
15
|
*
|
|
16
16
|
* This endpoint is priced at 15 characters per second of input audio.
|
|
17
17
|
*/
|
|
18
|
-
changeVoiceBytes(body: VoiceChangerChangeVoiceBytesParams, options?: RequestOptions): APIPromise<
|
|
18
|
+
changeVoiceBytes(body: VoiceChangerChangeVoiceBytesParams, options?: RequestOptions): APIPromise<void> {
|
|
19
19
|
return this._client.post(
|
|
20
20
|
'/voice-changer/bytes',
|
|
21
21
|
multipartFormRequestOptions(
|
|
22
|
-
{
|
|
23
|
-
body,
|
|
24
|
-
...options,
|
|
25
|
-
headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
|
|
26
|
-
__binaryResponse: true,
|
|
27
|
-
},
|
|
22
|
+
{ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
|
|
28
23
|
this._client,
|
|
29
24
|
),
|
|
30
25
|
);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '3.0.0-
|
|
1
|
+
export const VERSION = '3.0.0-b13'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.0-
|
|
1
|
+
export declare const VERSION = "3.0.0-b13";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.0-
|
|
1
|
+
export declare const VERSION = "3.0.0-b13";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.0.0-
|
|
1
|
+
export const VERSION = '3.0.0-b13'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|