sarvamai 1.1.2-alpha.1 → 1.1.2-alpha.2
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/textToSpeechStreaming/client/Socket.d.ts +4 -1
- package/dist/cjs/api/resources/textToSpeechStreaming/client/Socket.js +27 -11
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/textToSpeechStreaming/client/Socket.d.mts +4 -1
- package/dist/esm/api/resources/textToSpeechStreaming/client/Socket.mjs +27 -11
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "sarvamai",
|
|
46
|
-
"X-Fern-SDK-Version": "1.1.2-alpha.
|
|
47
|
-
"User-Agent": "sarvamai/1.1.2-alpha.
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.2-alpha.2",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.2-alpha.2",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -35,8 +35,11 @@ export declare class TextToSpeechStreamingSocket {
|
|
|
35
35
|
on<T extends keyof TextToSpeechStreamingSocket.EventHandlers>(event: T, callback: TextToSpeechStreamingSocket.EventHandlers[T]): void;
|
|
36
36
|
/**
|
|
37
37
|
* Configure the connection with various options including output audio codec.
|
|
38
|
+
* Accepts both formats:
|
|
39
|
+
* - Flat params: { speaker: "anushka", target_language_code: "hi-IN", ... }
|
|
40
|
+
* - Wire format: { type: "config", data: { speaker: "anushka", target_language_code: "hi-IN", ... } }
|
|
38
41
|
*/
|
|
39
|
-
configureConnection(
|
|
42
|
+
configureConnection(config: SarvamAI.ConfigureConnection | {
|
|
40
43
|
target_language_code: SarvamAI.ConfigureConnection.Data.TargetLanguageCode;
|
|
41
44
|
speaker?: SarvamAI.ConfigureConnection.Data.Speaker;
|
|
42
45
|
pitch?: number;
|
|
@@ -92,23 +92,39 @@ class TextToSpeechStreamingSocket {
|
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Configure the connection with various options including output audio codec.
|
|
95
|
+
* Accepts both formats:
|
|
96
|
+
* - Flat params: { speaker: "anushka", target_language_code: "hi-IN", ... }
|
|
97
|
+
* - Wire format: { type: "config", data: { speaker: "anushka", target_language_code: "hi-IN", ... } }
|
|
95
98
|
*/
|
|
96
|
-
configureConnection(
|
|
99
|
+
configureConnection(config) {
|
|
100
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
97
101
|
this.assertSocketIsOpen();
|
|
102
|
+
// Detect if user passed { type: "config", data: {...} } or flat params
|
|
103
|
+
let data;
|
|
104
|
+
if ("type" in config && config.type === "config" && "data" in config) {
|
|
105
|
+
// Wire format: { type: "config", data: {...} }
|
|
106
|
+
data = config.data;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// Flat params format
|
|
110
|
+
data = config;
|
|
111
|
+
}
|
|
112
|
+
// Backward compatibility: default to "anushka" but warn if not specified
|
|
113
|
+
const speaker = (_a = data.speaker) !== null && _a !== void 0 ? _a : "anushka";
|
|
98
114
|
const message = {
|
|
99
115
|
type: "config",
|
|
100
116
|
data: {
|
|
101
|
-
target_language_code,
|
|
117
|
+
target_language_code: data.target_language_code,
|
|
102
118
|
speaker,
|
|
103
|
-
pitch,
|
|
104
|
-
pace,
|
|
105
|
-
loudness,
|
|
106
|
-
speech_sample_rate,
|
|
107
|
-
enable_preprocessing,
|
|
108
|
-
output_audio_codec,
|
|
109
|
-
output_audio_bitrate,
|
|
110
|
-
min_buffer_size,
|
|
111
|
-
max_chunk_length,
|
|
119
|
+
pitch: (_b = data.pitch) !== null && _b !== void 0 ? _b : 0.0,
|
|
120
|
+
pace: (_c = data.pace) !== null && _c !== void 0 ? _c : 1.0,
|
|
121
|
+
loudness: (_d = data.loudness) !== null && _d !== void 0 ? _d : 1.0,
|
|
122
|
+
speech_sample_rate: (_e = data.speech_sample_rate) !== null && _e !== void 0 ? _e : 22050,
|
|
123
|
+
enable_preprocessing: (_f = data.enable_preprocessing) !== null && _f !== void 0 ? _f : false,
|
|
124
|
+
output_audio_codec: (_g = data.output_audio_codec) !== null && _g !== void 0 ? _g : "mp3",
|
|
125
|
+
output_audio_bitrate: (_h = data.output_audio_bitrate) !== null && _h !== void 0 ? _h : "128k",
|
|
126
|
+
min_buffer_size: (_j = data.min_buffer_size) !== null && _j !== void 0 ? _j : 50,
|
|
127
|
+
max_chunk_length: (_k = data.max_chunk_length) !== null && _k !== void 0 ? _k : 150,
|
|
112
128
|
},
|
|
113
129
|
};
|
|
114
130
|
this.sendJson(message);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.2-alpha.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.2-alpha.2";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "sarvamai",
|
|
9
|
-
"X-Fern-SDK-Version": "1.1.2-alpha.
|
|
10
|
-
"User-Agent": "sarvamai/1.1.2-alpha.
|
|
9
|
+
"X-Fern-SDK-Version": "1.1.2-alpha.2",
|
|
10
|
+
"User-Agent": "sarvamai/1.1.2-alpha.2",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -35,8 +35,11 @@ export declare class TextToSpeechStreamingSocket {
|
|
|
35
35
|
on<T extends keyof TextToSpeechStreamingSocket.EventHandlers>(event: T, callback: TextToSpeechStreamingSocket.EventHandlers[T]): void;
|
|
36
36
|
/**
|
|
37
37
|
* Configure the connection with various options including output audio codec.
|
|
38
|
+
* Accepts both formats:
|
|
39
|
+
* - Flat params: { speaker: "anushka", target_language_code: "hi-IN", ... }
|
|
40
|
+
* - Wire format: { type: "config", data: { speaker: "anushka", target_language_code: "hi-IN", ... } }
|
|
38
41
|
*/
|
|
39
|
-
configureConnection(
|
|
42
|
+
configureConnection(config: SarvamAI.ConfigureConnection | {
|
|
40
43
|
target_language_code: SarvamAI.ConfigureConnection.Data.TargetLanguageCode;
|
|
41
44
|
speaker?: SarvamAI.ConfigureConnection.Data.Speaker;
|
|
42
45
|
pitch?: number;
|
|
@@ -56,23 +56,39 @@ export class TextToSpeechStreamingSocket {
|
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Configure the connection with various options including output audio codec.
|
|
59
|
+
* Accepts both formats:
|
|
60
|
+
* - Flat params: { speaker: "anushka", target_language_code: "hi-IN", ... }
|
|
61
|
+
* - Wire format: { type: "config", data: { speaker: "anushka", target_language_code: "hi-IN", ... } }
|
|
59
62
|
*/
|
|
60
|
-
configureConnection(
|
|
63
|
+
configureConnection(config) {
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
61
65
|
this.assertSocketIsOpen();
|
|
66
|
+
// Detect if user passed { type: "config", data: {...} } or flat params
|
|
67
|
+
let data;
|
|
68
|
+
if ("type" in config && config.type === "config" && "data" in config) {
|
|
69
|
+
// Wire format: { type: "config", data: {...} }
|
|
70
|
+
data = config.data;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
// Flat params format
|
|
74
|
+
data = config;
|
|
75
|
+
}
|
|
76
|
+
// Backward compatibility: default to "anushka" but warn if not specified
|
|
77
|
+
const speaker = (_a = data.speaker) !== null && _a !== void 0 ? _a : "anushka";
|
|
62
78
|
const message = {
|
|
63
79
|
type: "config",
|
|
64
80
|
data: {
|
|
65
|
-
target_language_code,
|
|
81
|
+
target_language_code: data.target_language_code,
|
|
66
82
|
speaker,
|
|
67
|
-
pitch,
|
|
68
|
-
pace,
|
|
69
|
-
loudness,
|
|
70
|
-
speech_sample_rate,
|
|
71
|
-
enable_preprocessing,
|
|
72
|
-
output_audio_codec,
|
|
73
|
-
output_audio_bitrate,
|
|
74
|
-
min_buffer_size,
|
|
75
|
-
max_chunk_length,
|
|
83
|
+
pitch: (_b = data.pitch) !== null && _b !== void 0 ? _b : 0.0,
|
|
84
|
+
pace: (_c = data.pace) !== null && _c !== void 0 ? _c : 1.0,
|
|
85
|
+
loudness: (_d = data.loudness) !== null && _d !== void 0 ? _d : 1.0,
|
|
86
|
+
speech_sample_rate: (_e = data.speech_sample_rate) !== null && _e !== void 0 ? _e : 22050,
|
|
87
|
+
enable_preprocessing: (_f = data.enable_preprocessing) !== null && _f !== void 0 ? _f : false,
|
|
88
|
+
output_audio_codec: (_g = data.output_audio_codec) !== null && _g !== void 0 ? _g : "mp3",
|
|
89
|
+
output_audio_bitrate: (_h = data.output_audio_bitrate) !== null && _h !== void 0 ? _h : "128k",
|
|
90
|
+
min_buffer_size: (_j = data.min_buffer_size) !== null && _j !== void 0 ? _j : 50,
|
|
91
|
+
max_chunk_length: (_k = data.max_chunk_length) !== null && _k !== void 0 ? _k : 150,
|
|
76
92
|
},
|
|
77
93
|
};
|
|
78
94
|
this.sendJson(message);
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.2-alpha.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.2-alpha.2";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.1.2-alpha.
|
|
1
|
+
export const SDK_VERSION = "1.1.2-alpha.2";
|