@cartesia/cartesia-js 2.2.5 → 2.2.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/Client.d.ts +3 -0
- package/Client.js +11 -6
- package/README.md +469 -144
- package/api/resources/apiStatus/client/Client.js +1 -1
- package/api/resources/auth/client/Client.d.ts +17 -0
- package/api/resources/auth/client/Client.js +18 -1
- package/api/resources/auth/types/TokenGrant.d.ts +3 -1
- package/api/resources/auth/types/TokenRequest.d.ts +2 -2
- package/api/resources/index.d.ts +1 -0
- package/api/resources/index.js +1 -0
- package/api/resources/infill/client/Client.js +1 -1
- package/api/resources/infill/client/requests/InfillBytesRequest.d.ts +3 -11
- package/api/resources/stt/client/Client.d.ts +43 -0
- package/api/resources/stt/client/Client.js +108 -0
- package/api/resources/stt/client/index.d.ts +1 -1
- package/api/resources/stt/client/index.js +15 -3
- package/api/resources/stt/client/requests/TranscriptionRequest.d.ts +147 -0
- package/api/resources/stt/client/requests/TranscriptionRequest.js +5 -0
- package/api/resources/stt/client/requests/index.d.ts +1 -0
- package/api/resources/stt/client/requests/index.js +2 -0
- package/api/resources/stt/index.d.ts +1 -0
- package/api/resources/stt/index.js +1 -0
- package/api/resources/stt/types/TimestampGranularity.d.ts +12 -0
- package/api/resources/stt/types/TimestampGranularity.js +9 -0
- package/api/resources/stt/types/TranscriptMessage.d.ts +1 -1
- package/api/resources/stt/types/TranscriptionResponse.d.ts +2 -2
- package/api/resources/stt/types/index.d.ts +1 -0
- package/api/resources/stt/types/index.js +1 -0
- package/api/resources/tts/client/Client.d.ts +7 -2
- package/api/resources/tts/client/Client.js +8 -8
- package/api/resources/tts/types/Controls.d.ts +1 -1
- package/api/resources/tts/types/Emotion.d.ts +2 -33
- package/api/resources/tts/types/Emotion.js +0 -28
- package/api/resources/tts/types/EmotionDeprecated.d.ts +38 -0
- package/api/resources/tts/types/EmotionDeprecated.js +33 -0
- package/api/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/api/resources/tts/types/GenerationConfig.js +5 -0
- package/api/resources/tts/types/GenerationRequest.d.ts +5 -4
- package/api/resources/tts/types/Mp3OutputFormat.d.ts +1 -0
- package/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/api/resources/tts/types/SseOutputFormat.d.ts +10 -0
- package/api/resources/tts/types/SseOutputFormat.js +5 -0
- package/api/resources/tts/types/TtsRequest.d.ts +1 -0
- package/api/resources/tts/types/TtssseRequest.d.ts +27 -0
- package/api/resources/tts/types/TtssseRequest.js +5 -0
- package/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +1 -0
- package/api/resources/tts/types/WebSocketRequest.d.ts +2 -4
- package/api/resources/tts/types/WebSocketTtsRequest.d.ts +4 -1
- package/api/resources/tts/types/index.d.ts +5 -1
- package/api/resources/tts/types/index.js +5 -1
- package/api/resources/voiceChanger/client/Client.d.ts +9 -4
- package/api/resources/voiceChanger/client/Client.js +24 -20
- package/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +3 -8
- package/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +3 -8
- package/api/resources/voices/client/Client.js +8 -8
- package/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +6 -24
- package/api/resources/voices/types/LocalizeDialect.d.ts +4 -8
- package/core/fetcher/Fetcher.d.ts +2 -2
- package/core/fetcher/Fetcher.js +4 -3
- package/core/fetcher/getResponseBody.js +3 -3
- package/dist/Client.d.ts +3 -0
- package/dist/Client.js +11 -6
- package/dist/api/resources/apiStatus/client/Client.js +1 -1
- package/dist/api/resources/auth/client/Client.d.ts +17 -0
- package/dist/api/resources/auth/client/Client.js +18 -1
- package/dist/api/resources/auth/types/TokenGrant.d.ts +3 -1
- package/dist/api/resources/auth/types/TokenRequest.d.ts +2 -2
- package/dist/api/resources/index.d.ts +1 -0
- package/dist/api/resources/index.js +1 -0
- package/dist/api/resources/infill/client/Client.js +1 -1
- package/dist/api/resources/infill/client/requests/InfillBytesRequest.d.ts +3 -11
- package/dist/api/resources/stt/client/Client.d.ts +43 -0
- package/dist/api/resources/stt/client/Client.js +108 -0
- package/dist/api/resources/stt/client/index.d.ts +1 -1
- package/dist/api/resources/stt/client/index.js +15 -3
- package/dist/api/resources/stt/client/requests/TranscriptionRequest.d.ts +147 -0
- package/dist/api/resources/stt/client/requests/TranscriptionRequest.js +5 -0
- package/dist/api/resources/stt/client/requests/index.d.ts +1 -0
- package/dist/api/resources/stt/client/requests/index.js +2 -0
- package/dist/api/resources/stt/index.d.ts +1 -0
- package/dist/api/resources/stt/index.js +1 -0
- package/dist/api/resources/stt/types/TimestampGranularity.d.ts +12 -0
- package/dist/api/resources/stt/types/TimestampGranularity.js +9 -0
- package/dist/api/resources/stt/types/TranscriptMessage.d.ts +1 -1
- package/dist/api/resources/stt/types/TranscriptionResponse.d.ts +2 -2
- package/dist/api/resources/stt/types/index.d.ts +1 -0
- package/dist/api/resources/stt/types/index.js +1 -0
- package/dist/api/resources/tts/client/Client.d.ts +7 -2
- package/dist/api/resources/tts/client/Client.js +8 -8
- package/dist/api/resources/tts/types/Controls.d.ts +1 -1
- package/dist/api/resources/tts/types/Emotion.d.ts +2 -33
- package/dist/api/resources/tts/types/Emotion.js +0 -28
- package/dist/api/resources/tts/types/EmotionDeprecated.d.ts +38 -0
- package/dist/api/resources/tts/types/EmotionDeprecated.js +33 -0
- package/dist/api/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/dist/api/resources/tts/types/GenerationConfig.js +5 -0
- package/dist/api/resources/tts/types/GenerationRequest.d.ts +5 -4
- package/dist/api/resources/tts/types/Mp3OutputFormat.d.ts +1 -0
- package/dist/api/resources/tts/types/RawOutputFormat.d.ts +1 -0
- package/dist/api/resources/tts/types/SseOutputFormat.d.ts +10 -0
- package/dist/api/resources/tts/types/SseOutputFormat.js +5 -0
- package/dist/api/resources/tts/types/TtsRequest.d.ts +1 -0
- package/dist/api/resources/tts/types/TtssseRequest.d.ts +27 -0
- package/dist/api/resources/tts/types/TtssseRequest.js +5 -0
- package/dist/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +1 -0
- package/dist/api/resources/tts/types/WebSocketRequest.d.ts +2 -4
- package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +4 -1
- package/dist/api/resources/tts/types/index.d.ts +5 -1
- package/dist/api/resources/tts/types/index.js +5 -1
- package/dist/api/resources/voiceChanger/client/Client.d.ts +9 -4
- package/dist/api/resources/voiceChanger/client/Client.js +24 -20
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +3 -8
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +3 -8
- package/dist/api/resources/voices/client/Client.js +8 -8
- package/dist/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +6 -24
- package/dist/api/resources/voices/types/LocalizeDialect.d.ts +4 -8
- package/dist/core/fetcher/Fetcher.d.ts +2 -2
- package/dist/core/fetcher/Fetcher.js +4 -3
- package/dist/core/fetcher/getResponseBody.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- package/dist/serialization/resources/auth/types/TokenGrant.d.ts +2 -1
- package/dist/serialization/resources/auth/types/TokenGrant.js +2 -1
- package/dist/serialization/resources/auth/types/TokenRequest.d.ts +1 -1
- package/dist/serialization/resources/auth/types/TokenRequest.js +1 -1
- package/dist/serialization/resources/stt/types/TimestampGranularity.d.ts +10 -0
- package/dist/serialization/resources/stt/types/TimestampGranularity.js +41 -0
- package/dist/serialization/resources/stt/types/index.d.ts +1 -0
- package/dist/serialization/resources/stt/types/index.js +1 -0
- package/dist/serialization/resources/tts/types/Controls.d.ts +2 -2
- package/dist/serialization/resources/tts/types/Controls.js +2 -2
- package/dist/serialization/resources/tts/types/Emotion.d.ts +1 -1
- package/dist/serialization/resources/tts/types/Emotion.js +1 -27
- package/dist/serialization/resources/tts/types/EmotionDeprecated.d.ts +10 -0
- package/dist/serialization/resources/tts/types/EmotionDeprecated.js +67 -0
- package/dist/serialization/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/dist/serialization/resources/tts/types/GenerationConfig.js +46 -0
- package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +3 -1
- package/dist/serialization/resources/tts/types/GenerationRequest.js +3 -1
- package/dist/serialization/resources/tts/types/SseOutputFormat.d.ts +15 -0
- package/dist/serialization/resources/tts/types/SseOutputFormat.js +46 -0
- package/dist/serialization/resources/tts/types/TtsRequest.d.ts +2 -0
- package/dist/serialization/resources/tts/types/TtsRequest.js +2 -0
- package/dist/serialization/resources/tts/types/TtssseRequest.d.ts +29 -0
- package/dist/serialization/resources/tts/types/TtssseRequest.js +60 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +3 -1
- package/dist/serialization/resources/tts/types/index.d.ts +5 -1
- package/dist/serialization/resources/tts/types/index.js +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/StreamingSTTClient.d.ts +22 -2
- package/dist/wrapper/StreamingSTTClient.js +124 -1
- package/dist/wrapper/SttWebsocket.d.ts +8 -3
- package/dist/wrapper/SttWebsocket.js +24 -3
- package/dist/wrapper/Websocket.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +8 -1
- package/package.json +1 -1
- package/reference.md +89 -1
- package/serialization/resources/auth/types/TokenGrant.d.ts +2 -1
- package/serialization/resources/auth/types/TokenGrant.js +2 -1
- package/serialization/resources/auth/types/TokenRequest.d.ts +1 -1
- package/serialization/resources/auth/types/TokenRequest.js +1 -1
- package/serialization/resources/stt/types/TimestampGranularity.d.ts +10 -0
- package/serialization/resources/stt/types/TimestampGranularity.js +41 -0
- package/serialization/resources/stt/types/index.d.ts +1 -0
- package/serialization/resources/stt/types/index.js +1 -0
- package/serialization/resources/tts/types/Controls.d.ts +2 -2
- package/serialization/resources/tts/types/Controls.js +2 -2
- package/serialization/resources/tts/types/Emotion.d.ts +1 -1
- package/serialization/resources/tts/types/Emotion.js +1 -27
- package/serialization/resources/tts/types/EmotionDeprecated.d.ts +10 -0
- package/serialization/resources/tts/types/EmotionDeprecated.js +67 -0
- package/serialization/resources/tts/types/GenerationConfig.d.ts +15 -0
- package/serialization/resources/tts/types/GenerationConfig.js +46 -0
- package/serialization/resources/tts/types/GenerationRequest.d.ts +3 -1
- package/serialization/resources/tts/types/GenerationRequest.js +3 -1
- package/serialization/resources/tts/types/SseOutputFormat.d.ts +15 -0
- package/serialization/resources/tts/types/SseOutputFormat.js +46 -0
- package/serialization/resources/tts/types/TtsRequest.d.ts +2 -0
- package/serialization/resources/tts/types/TtsRequest.js +2 -0
- package/serialization/resources/tts/types/TtssseRequest.d.ts +29 -0
- package/serialization/resources/tts/types/TtssseRequest.js +60 -0
- package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
- package/serialization/resources/tts/types/WebSocketTtsRequest.js +3 -1
- package/serialization/resources/tts/types/index.d.ts +5 -1
- package/serialization/resources/tts/types/index.js +5 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/StreamingSTTClient.d.ts +22 -2
- package/wrapper/StreamingSTTClient.js +124 -1
- package/wrapper/SttWebsocket.d.ts +8 -3
- package/wrapper/SttWebsocket.js +24 -3
- package/wrapper/Websocket.js +1 -1
|
@@ -66,7 +66,7 @@ class ApiStatus {
|
|
|
66
66
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
67
67
|
url: (_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production,
|
|
68
68
|
method: "GET",
|
|
69
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.
|
|
69
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.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),
|
|
70
70
|
contentType: "application/json",
|
|
71
71
|
requestType: "json",
|
|
72
72
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -39,10 +39,27 @@ export declare class Auth {
|
|
|
39
39
|
* @example
|
|
40
40
|
* await client.auth.accessToken({
|
|
41
41
|
* grants: {
|
|
42
|
+
* tts: true,
|
|
43
|
+
* stt: true
|
|
44
|
+
* },
|
|
45
|
+
* expiresIn: 60
|
|
46
|
+
* })
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* await client.auth.accessToken({
|
|
50
|
+
* grants: {
|
|
42
51
|
* tts: true
|
|
43
52
|
* },
|
|
44
53
|
* expiresIn: 60
|
|
45
54
|
* })
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* await client.auth.accessToken({
|
|
58
|
+
* grants: {
|
|
59
|
+
* stt: true
|
|
60
|
+
* },
|
|
61
|
+
* expiresIn: 60
|
|
62
|
+
* })
|
|
46
63
|
*/
|
|
47
64
|
accessToken(request: Cartesia.TokenRequest, requestOptions?: Auth.RequestOptions): Promise<Cartesia.TokenResponse>;
|
|
48
65
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
@@ -67,10 +67,27 @@ class Auth {
|
|
|
67
67
|
* @example
|
|
68
68
|
* await client.auth.accessToken({
|
|
69
69
|
* grants: {
|
|
70
|
+
* tts: true,
|
|
71
|
+
* stt: true
|
|
72
|
+
* },
|
|
73
|
+
* expiresIn: 60
|
|
74
|
+
* })
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* await client.auth.accessToken({
|
|
78
|
+
* grants: {
|
|
70
79
|
* tts: true
|
|
71
80
|
* },
|
|
72
81
|
* expiresIn: 60
|
|
73
82
|
* })
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* await client.auth.accessToken({
|
|
86
|
+
* grants: {
|
|
87
|
+
* stt: true
|
|
88
|
+
* },
|
|
89
|
+
* expiresIn: 60
|
|
90
|
+
* })
|
|
74
91
|
*/
|
|
75
92
|
accessToken(request, requestOptions) {
|
|
76
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -78,7 +95,7 @@ class Auth {
|
|
|
78
95
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
79
96
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "access-token"),
|
|
80
97
|
method: "POST",
|
|
81
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.
|
|
98
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.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),
|
|
82
99
|
contentType: "application/json",
|
|
83
100
|
requestType: "json",
|
|
84
101
|
body: serializers.TokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
export interface TokenRequest {
|
|
6
|
-
/** The permissions to be granted via the token. */
|
|
7
|
-
grants
|
|
6
|
+
/** The permissions to be granted via the token. Both TTS and STT grants are optional - specify only the capabilities you need. */
|
|
7
|
+
grants?: Cartesia.TokenGrant;
|
|
8
8
|
/** The number of seconds the token will be valid for since the time of generation. The maximum is 1 hour (3600 seconds). */
|
|
9
9
|
expiresIn?: number;
|
|
10
10
|
}
|
package/api/resources/index.d.ts
CHANGED
|
@@ -14,5 +14,6 @@ export * as voices from "./voices";
|
|
|
14
14
|
export * from "./voices/types";
|
|
15
15
|
export * as infill from "./infill";
|
|
16
16
|
export * from "./infill/client/requests";
|
|
17
|
+
export * from "./stt/client/requests";
|
|
17
18
|
export * from "./voiceChanger/client/requests";
|
|
18
19
|
export * from "./voices/client/requests";
|
package/api/resources/index.js
CHANGED
|
@@ -53,5 +53,6 @@ exports.voices = __importStar(require("./voices"));
|
|
|
53
53
|
__exportStar(require("./voices/types"), exports);
|
|
54
54
|
exports.infill = __importStar(require("./infill"));
|
|
55
55
|
__exportStar(require("./infill/client/requests"), exports);
|
|
56
|
+
__exportStar(require("./stt/client/requests"), exports);
|
|
56
57
|
__exportStar(require("./voiceChanger/client/requests"), exports);
|
|
57
58
|
__exportStar(require("./voices/client/requests"), exports);
|
|
@@ -113,7 +113,7 @@ class Infill {
|
|
|
113
113
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
114
114
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/infill/bytes"),
|
|
115
115
|
method: "POST",
|
|
116
|
-
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.
|
|
116
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.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),
|
|
117
117
|
requestType: "file",
|
|
118
118
|
duplex: _maybeEncodedRequest.duplex,
|
|
119
119
|
body: _maybeEncodedRequest.body,
|
|
@@ -40,23 +40,16 @@ export interface InfillBytesRequest {
|
|
|
40
40
|
voiceId: string;
|
|
41
41
|
/** The format of the output audio */
|
|
42
42
|
outputFormatContainer: Cartesia.OutputFormatContainer;
|
|
43
|
-
/** The sample rate of the output audio */
|
|
43
|
+
/** The sample rate of the output audio in Hz. Supported sample rates are 8000, 16000, 22050, 24000, 44100, 48000. */
|
|
44
44
|
outputFormatSampleRate: number;
|
|
45
|
-
/**
|
|
46
|
-
* Required for `raw` and `wav` containers.
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
45
|
+
/** Required for `raw` and `wav` containers. */
|
|
49
46
|
outputFormatEncoding?: Cartesia.RawEncoding;
|
|
50
|
-
/**
|
|
51
|
-
* Required for `mp3` containers.
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
47
|
+
/** Required for `mp3` containers. */
|
|
54
48
|
outputFormatBitRate?: number;
|
|
55
49
|
/**
|
|
56
50
|
* Either a number between -1.0 and 1.0 or a natural language description of speed.
|
|
57
51
|
*
|
|
58
52
|
* If you specify a number, 0.0 is the default speed, -1.0 is the slowest speed, and 1.0 is the fastest speed.
|
|
59
|
-
*
|
|
60
53
|
*/
|
|
61
54
|
voiceExperimentalControlsSpeed?: Cartesia.Speed;
|
|
62
55
|
/**
|
|
@@ -65,7 +58,6 @@ export interface InfillBytesRequest {
|
|
|
65
58
|
* Supported emotions are: anger, positivity, surprise, sadness, and curiosity.
|
|
66
59
|
*
|
|
67
60
|
* Supported levels are: lowest, low, (omit), high, highest.
|
|
68
|
-
*
|
|
69
61
|
*/
|
|
70
62
|
voiceExperimentalControlsEmotion?: Cartesia.Emotion[];
|
|
71
63
|
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
1
4
|
import * as environments from "../../../../environments";
|
|
2
5
|
import * as core from "../../../../core";
|
|
6
|
+
import * as Cartesia from "../../../index";
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
import { Blob } from "buffer";
|
|
3
9
|
export declare namespace Stt {
|
|
4
10
|
interface Options {
|
|
5
11
|
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
12
|
+
/** Specify a custom URL to connect the client to. */
|
|
13
|
+
baseUrl?: core.Supplier<string>;
|
|
6
14
|
apiKey?: core.Supplier<string | undefined>;
|
|
7
15
|
/** Override the Cartesia-Version header */
|
|
8
16
|
cartesiaVersion?: "2024-06-10";
|
|
@@ -17,11 +25,46 @@ export declare namespace Stt {
|
|
|
17
25
|
abortSignal?: AbortSignal;
|
|
18
26
|
/** Override the Cartesia-Version header */
|
|
19
27
|
cartesiaVersion?: "2024-06-10";
|
|
28
|
+
/** Additional headers to include in the request. */
|
|
29
|
+
headers?: Record<string, string>;
|
|
20
30
|
}
|
|
21
31
|
}
|
|
22
32
|
export declare class Stt {
|
|
23
33
|
protected readonly _options: Stt.Options;
|
|
24
34
|
constructor(_options?: Stt.Options);
|
|
35
|
+
/**
|
|
36
|
+
* Transcribes audio files into text using Cartesia's Speech-to-Text API.
|
|
37
|
+
*
|
|
38
|
+
* Upload an audio file and receive a complete transcription response. Supports arbitrarily long audio files with automatic intelligent chunking for longer audio.
|
|
39
|
+
*
|
|
40
|
+
* **Supported audio formats:** flac, m4a, mp3, mp4, mpeg, mpga, oga, ogg, wav, webm
|
|
41
|
+
*
|
|
42
|
+
* **Response format:** Returns JSON with transcribed text, duration, and language. Include `timestamp_granularities: ["word"]` to get word-level timestamps.
|
|
43
|
+
*
|
|
44
|
+
* **Pricing:** Batch transcription is priced at **1 credit per 2 seconds** of audio processed.
|
|
45
|
+
*
|
|
46
|
+
* <Note>
|
|
47
|
+
* For migrating from the OpenAI SDK, see our [OpenAI Whisper to Cartesia Ink Migration Guide](/api-reference/stt/migrate-from-open-ai).
|
|
48
|
+
* </Note>
|
|
49
|
+
*
|
|
50
|
+
* @param {File | fs.ReadStream | Blob} file
|
|
51
|
+
* @param {Cartesia.TranscriptionRequest} request
|
|
52
|
+
* @param {Stt.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* await client.stt.transcribe(fs.createReadStream("/path/to/your/file"), {
|
|
56
|
+
* model: "ink-whisper",
|
|
57
|
+
* language: "en"
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* await client.stt.transcribe(fs.createReadStream("/path/to/your/file"), {
|
|
62
|
+
* model: "ink-whisper",
|
|
63
|
+
* language: "en",
|
|
64
|
+
* timestampGranularities: ["word"]
|
|
65
|
+
* })
|
|
66
|
+
*/
|
|
67
|
+
transcribe(file: File | fs.ReadStream | Blob, request: Cartesia.TranscriptionRequest, requestOptions?: Stt.RequestOptions): Promise<Cartesia.TranscriptionResponse>;
|
|
25
68
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
26
69
|
"X-API-Key": string | undefined;
|
|
27
70
|
}>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
2
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
6
|
if (k2 === undefined) k2 = k;
|
|
4
7
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -41,13 +44,118 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
44
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
45
|
});
|
|
43
46
|
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
44
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
51
|
exports.Stt = void 0;
|
|
52
|
+
const environments = __importStar(require("../../../../environments"));
|
|
46
53
|
const core = __importStar(require("../../../../core"));
|
|
54
|
+
const serializers = __importStar(require("../../../../serialization/index"));
|
|
55
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
56
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
47
57
|
class Stt {
|
|
48
58
|
constructor(_options = {}) {
|
|
49
59
|
this._options = _options;
|
|
50
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Transcribes audio files into text using Cartesia's Speech-to-Text API.
|
|
63
|
+
*
|
|
64
|
+
* Upload an audio file and receive a complete transcription response. Supports arbitrarily long audio files with automatic intelligent chunking for longer audio.
|
|
65
|
+
*
|
|
66
|
+
* **Supported audio formats:** flac, m4a, mp3, mp4, mpeg, mpga, oga, ogg, wav, webm
|
|
67
|
+
*
|
|
68
|
+
* **Response format:** Returns JSON with transcribed text, duration, and language. Include `timestamp_granularities: ["word"]` to get word-level timestamps.
|
|
69
|
+
*
|
|
70
|
+
* **Pricing:** Batch transcription is priced at **1 credit per 2 seconds** of audio processed.
|
|
71
|
+
*
|
|
72
|
+
* <Note>
|
|
73
|
+
* For migrating from the OpenAI SDK, see our [OpenAI Whisper to Cartesia Ink Migration Guide](/api-reference/stt/migrate-from-open-ai).
|
|
74
|
+
* </Note>
|
|
75
|
+
*
|
|
76
|
+
* @param {File | fs.ReadStream | Blob} file
|
|
77
|
+
* @param {Cartesia.TranscriptionRequest} request
|
|
78
|
+
* @param {Stt.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* await client.stt.transcribe(fs.createReadStream("/path/to/your/file"), {
|
|
82
|
+
* model: "ink-whisper",
|
|
83
|
+
* language: "en"
|
|
84
|
+
* })
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* await client.stt.transcribe(fs.createReadStream("/path/to/your/file"), {
|
|
88
|
+
* model: "ink-whisper",
|
|
89
|
+
* language: "en",
|
|
90
|
+
* timestampGranularities: ["word"]
|
|
91
|
+
* })
|
|
92
|
+
*/
|
|
93
|
+
transcribe(file, request, requestOptions) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
var _a, _b, _c, _d, _e, _f;
|
|
96
|
+
const _queryParams = {};
|
|
97
|
+
if (request.encoding != null) {
|
|
98
|
+
_queryParams["encoding"] = serializers.SttEncoding.jsonOrThrow(request.encoding, {
|
|
99
|
+
unrecognizedObjectKeys: "strip",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (request.sampleRate != null) {
|
|
103
|
+
_queryParams["sample_rate"] = request.sampleRate.toString();
|
|
104
|
+
}
|
|
105
|
+
const _request = yield core.newFormData();
|
|
106
|
+
yield _request.appendFile("file", file);
|
|
107
|
+
_request.append("model", request.model);
|
|
108
|
+
if (request.language != null) {
|
|
109
|
+
_request.append("language", request.language);
|
|
110
|
+
}
|
|
111
|
+
if (request.timestampGranularities != null) {
|
|
112
|
+
for (const _item of request.timestampGranularities) {
|
|
113
|
+
_request.append("timestamp_granularities[]", serializers.TimestampGranularity.jsonOrThrow(_item, { unrecognizedObjectKeys: "strip" }));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
117
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
118
|
+
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, "/stt"),
|
|
119
|
+
method: "POST",
|
|
120
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.7", "User-Agent": "@cartesia/cartesia-js/2.2.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),
|
|
121
|
+
queryParameters: _queryParams,
|
|
122
|
+
requestType: "file",
|
|
123
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
124
|
+
body: _maybeEncodedRequest.body,
|
|
125
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
126
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
127
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
128
|
+
});
|
|
129
|
+
if (_response.ok) {
|
|
130
|
+
return serializers.TranscriptionResponse.parseOrThrow(_response.body, {
|
|
131
|
+
unrecognizedObjectKeys: "passthrough",
|
|
132
|
+
allowUnrecognizedUnionMembers: true,
|
|
133
|
+
allowUnrecognizedEnumValues: true,
|
|
134
|
+
skipValidation: true,
|
|
135
|
+
breadcrumbsPrefix: ["response"],
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (_response.error.reason === "status-code") {
|
|
139
|
+
throw new errors.CartesiaError({
|
|
140
|
+
statusCode: _response.error.statusCode,
|
|
141
|
+
body: _response.error.body,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
switch (_response.error.reason) {
|
|
145
|
+
case "non-json":
|
|
146
|
+
throw new errors.CartesiaError({
|
|
147
|
+
statusCode: _response.error.statusCode,
|
|
148
|
+
body: _response.error.rawBody,
|
|
149
|
+
});
|
|
150
|
+
case "timeout":
|
|
151
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /stt.");
|
|
152
|
+
case "unknown":
|
|
153
|
+
throw new errors.CartesiaError({
|
|
154
|
+
message: _response.error.errorMessage,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
51
159
|
_getCustomAuthorizationHeaders() {
|
|
52
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
161
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests";
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
var Client_1 = require("./Client");
|
|
5
|
-
Object.defineProperty(exports, "Stt", { enumerable: true, get: function () { return Client_1.Stt; } });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Cartesia from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {
|
|
8
|
+
* model: "ink-whisper",
|
|
9
|
+
* language: "en"
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* {
|
|
14
|
+
* model: "ink-whisper",
|
|
15
|
+
* language: "en",
|
|
16
|
+
* timestampGranularities: ["word"]
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export interface TranscriptionRequest {
|
|
20
|
+
/**
|
|
21
|
+
* The encoding format to process the audio as. If not specified, the audio file will be decoded automatically.
|
|
22
|
+
*
|
|
23
|
+
* **Supported formats:**
|
|
24
|
+
* - `pcm_s16le` - 16-bit signed integer PCM, little-endian (recommended for best performance)
|
|
25
|
+
* - `pcm_s32le` - 32-bit signed integer PCM, little-endian
|
|
26
|
+
* - `pcm_f16le` - 16-bit floating point PCM, little-endian
|
|
27
|
+
* - `pcm_f32le` - 32-bit floating point PCM, little-endian
|
|
28
|
+
* - `pcm_mulaw` - 8-bit μ-law encoded PCM
|
|
29
|
+
* - `pcm_alaw` - 8-bit A-law encoded PCM
|
|
30
|
+
*/
|
|
31
|
+
encoding?: Cartesia.SttEncoding;
|
|
32
|
+
/**
|
|
33
|
+
* The sample rate of the audio in Hz.
|
|
34
|
+
*/
|
|
35
|
+
sampleRate?: number;
|
|
36
|
+
/** ID of the model to use for transcription. Use `ink-whisper` for the latest Cartesia Whisper model. */
|
|
37
|
+
model: string;
|
|
38
|
+
/**
|
|
39
|
+
* The language of the input audio in ISO-639-1 format. Defaults to `en`.
|
|
40
|
+
*
|
|
41
|
+
* <Accordion title="Supported languages">
|
|
42
|
+
* - `en` (English)
|
|
43
|
+
* - `zh` (Chinese)
|
|
44
|
+
* - `de` (German)
|
|
45
|
+
* - `es` (Spanish)
|
|
46
|
+
* - `ru` (Russian)
|
|
47
|
+
* - `ko` (Korean)
|
|
48
|
+
* - `fr` (French)
|
|
49
|
+
* - `ja` (Japanese)
|
|
50
|
+
* - `pt` (Portuguese)
|
|
51
|
+
* - `tr` (Turkish)
|
|
52
|
+
* - `pl` (Polish)
|
|
53
|
+
* - `ca` (Catalan)
|
|
54
|
+
* - `nl` (Dutch)
|
|
55
|
+
* - `ar` (Arabic)
|
|
56
|
+
* - `sv` (Swedish)
|
|
57
|
+
* - `it` (Italian)
|
|
58
|
+
* - `id` (Indonesian)
|
|
59
|
+
* - `hi` (Hindi)
|
|
60
|
+
* - `fi` (Finnish)
|
|
61
|
+
* - `vi` (Vietnamese)
|
|
62
|
+
* - `he` (Hebrew)
|
|
63
|
+
* - `uk` (Ukrainian)
|
|
64
|
+
* - `el` (Greek)
|
|
65
|
+
* - `ms` (Malay)
|
|
66
|
+
* - `cs` (Czech)
|
|
67
|
+
* - `ro` (Romanian)
|
|
68
|
+
* - `da` (Danish)
|
|
69
|
+
* - `hu` (Hungarian)
|
|
70
|
+
* - `ta` (Tamil)
|
|
71
|
+
* - `no` (Norwegian)
|
|
72
|
+
* - `th` (Thai)
|
|
73
|
+
* - `ur` (Urdu)
|
|
74
|
+
* - `hr` (Croatian)
|
|
75
|
+
* - `bg` (Bulgarian)
|
|
76
|
+
* - `lt` (Lithuanian)
|
|
77
|
+
* - `la` (Latin)
|
|
78
|
+
* - `mi` (Maori)
|
|
79
|
+
* - `ml` (Malayalam)
|
|
80
|
+
* - `cy` (Welsh)
|
|
81
|
+
* - `sk` (Slovak)
|
|
82
|
+
* - `te` (Telugu)
|
|
83
|
+
* - `fa` (Persian)
|
|
84
|
+
* - `lv` (Latvian)
|
|
85
|
+
* - `bn` (Bengali)
|
|
86
|
+
* - `sr` (Serbian)
|
|
87
|
+
* - `az` (Azerbaijani)
|
|
88
|
+
* - `sl` (Slovenian)
|
|
89
|
+
* - `kn` (Kannada)
|
|
90
|
+
* - `et` (Estonian)
|
|
91
|
+
* - `mk` (Macedonian)
|
|
92
|
+
* - `br` (Breton)
|
|
93
|
+
* - `eu` (Basque)
|
|
94
|
+
* - `is` (Icelandic)
|
|
95
|
+
* - `hy` (Armenian)
|
|
96
|
+
* - `ne` (Nepali)
|
|
97
|
+
* - `mn` (Mongolian)
|
|
98
|
+
* - `bs` (Bosnian)
|
|
99
|
+
* - `kk` (Kazakh)
|
|
100
|
+
* - `sq` (Albanian)
|
|
101
|
+
* - `sw` (Swahili)
|
|
102
|
+
* - `gl` (Galician)
|
|
103
|
+
* - `mr` (Marathi)
|
|
104
|
+
* - `pa` (Punjabi)
|
|
105
|
+
* - `si` (Sinhala)
|
|
106
|
+
* - `km` (Khmer)
|
|
107
|
+
* - `sn` (Shona)
|
|
108
|
+
* - `yo` (Yoruba)
|
|
109
|
+
* - `so` (Somali)
|
|
110
|
+
* - `af` (Afrikaans)
|
|
111
|
+
* - `oc` (Occitan)
|
|
112
|
+
* - `ka` (Georgian)
|
|
113
|
+
* - `be` (Belarusian)
|
|
114
|
+
* - `tg` (Tajik)
|
|
115
|
+
* - `sd` (Sindhi)
|
|
116
|
+
* - `gu` (Gujarati)
|
|
117
|
+
* - `am` (Amharic)
|
|
118
|
+
* - `yi` (Yiddish)
|
|
119
|
+
* - `lo` (Lao)
|
|
120
|
+
* - `uz` (Uzbek)
|
|
121
|
+
* - `fo` (Faroese)
|
|
122
|
+
* - `ht` (Haitian Creole)
|
|
123
|
+
* - `ps` (Pashto)
|
|
124
|
+
* - `tk` (Turkmen)
|
|
125
|
+
* - `nn` (Nynorsk)
|
|
126
|
+
* - `mt` (Maltese)
|
|
127
|
+
* - `sa` (Sanskrit)
|
|
128
|
+
* - `lb` (Luxembourgish)
|
|
129
|
+
* - `my` (Myanmar)
|
|
130
|
+
* - `bo` (Tibetan)
|
|
131
|
+
* - `tl` (Tagalog)
|
|
132
|
+
* - `mg` (Malagasy)
|
|
133
|
+
* - `as` (Assamese)
|
|
134
|
+
* - `tt` (Tatar)
|
|
135
|
+
* - `haw` (Hawaiian)
|
|
136
|
+
* - `ln` (Lingala)
|
|
137
|
+
* - `ha` (Hausa)
|
|
138
|
+
* - `ba` (Bashkir)
|
|
139
|
+
* - `jw` (Javanese)
|
|
140
|
+
* - `su` (Sundanese)
|
|
141
|
+
* - `yue` (Cantonese)
|
|
142
|
+
* </Accordion>
|
|
143
|
+
*/
|
|
144
|
+
language?: string;
|
|
145
|
+
/** The timestamp granularities to populate for this transcription. Currently only `word` level timestamps are supported. */
|
|
146
|
+
timestampGranularities?: Cartesia.TimestampGranularity[];
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type TranscriptionRequest } from "./TranscriptionRequest";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The granularity of timestamps to include in the response.
|
|
6
|
+
*
|
|
7
|
+
* Currently only `word` level timestamps are supported, providing start and end times for each word.
|
|
8
|
+
*/
|
|
9
|
+
export type TimestampGranularity = "word";
|
|
10
|
+
export declare const TimestampGranularity: {
|
|
11
|
+
readonly Word: "word";
|
|
12
|
+
};
|
|
@@ -15,7 +15,7 @@ export interface TranscriptMessage {
|
|
|
15
15
|
isFinal: boolean;
|
|
16
16
|
/** The duration of the audio transcribed so far, in seconds. */
|
|
17
17
|
duration?: number;
|
|
18
|
-
/** The
|
|
18
|
+
/** The specified language of the input audio. */
|
|
19
19
|
language?: string;
|
|
20
20
|
/** Word-level timestamps showing the start and end time of each word in seconds. Always included in streaming responses. */
|
|
21
21
|
words?: Cartesia.TranscriptionWord[];
|
|
@@ -5,10 +5,10 @@ import * as Cartesia from "../../../index";
|
|
|
5
5
|
export interface TranscriptionResponse {
|
|
6
6
|
/** The transcribed text. */
|
|
7
7
|
text: string;
|
|
8
|
-
/** The
|
|
8
|
+
/** The specified language of the input audio. */
|
|
9
9
|
language?: string;
|
|
10
10
|
/** The duration of the input audio in seconds. */
|
|
11
11
|
duration?: number;
|
|
12
|
-
/** Word-level timestamps
|
|
12
|
+
/** Word-level timestamps showing the start and end time of each word. Only included when `[word]` is passed into `timestamp_granularities[]`. */
|
|
13
13
|
words?: Cartesia.TranscriptionWord[];
|
|
14
14
|
}
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TimestampGranularity"), exports);
|
|
17
18
|
__exportStar(require("./TranscriptionWord"), exports);
|
|
18
19
|
__exportStar(require("./TranscriptionResponse"), exports);
|
|
19
20
|
__exportStar(require("./StreamingTranscriptionResponse"), exports);
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
import * as environments from "../../../../environments";
|
|
5
5
|
import * as core from "../../../../core";
|
|
6
6
|
import * as Cartesia from "../../../index";
|
|
7
|
+
import * as stream from "stream";
|
|
7
8
|
export declare namespace Tts {
|
|
8
9
|
interface Options {
|
|
9
10
|
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
11
|
+
/** Specify a custom URL to connect the client to. */
|
|
12
|
+
baseUrl?: core.Supplier<string>;
|
|
10
13
|
apiKey?: core.Supplier<string | undefined>;
|
|
11
14
|
/** Override the Cartesia-Version header */
|
|
12
15
|
cartesiaVersion?: "2024-06-10";
|
|
@@ -21,13 +24,15 @@ export declare namespace Tts {
|
|
|
21
24
|
abortSignal?: AbortSignal;
|
|
22
25
|
/** Override the Cartesia-Version header */
|
|
23
26
|
cartesiaVersion?: "2024-06-10";
|
|
27
|
+
/** Additional headers to include in the request. */
|
|
28
|
+
headers?: Record<string, string>;
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
31
|
export declare class Tts {
|
|
27
32
|
protected readonly _options: Tts.Options;
|
|
28
33
|
constructor(_options?: Tts.Options);
|
|
29
|
-
bytes(request: Cartesia.TtsRequest, requestOptions?: Tts.RequestOptions): Promise<
|
|
30
|
-
sse(request: Cartesia.
|
|
34
|
+
bytes(request: Cartesia.TtsRequest, requestOptions?: Tts.RequestOptions): Promise<stream.Readable>;
|
|
35
|
+
sse(request: Cartesia.TtssseRequest, requestOptions?: Tts.RequestOptions): Promise<core.Stream<Cartesia.WebSocketResponse>>;
|
|
31
36
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
32
37
|
"X-API-Key": string | undefined;
|
|
33
38
|
}>;
|