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.
@@ -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.1",
47
- "User-Agent": "sarvamai/1.1.2-alpha.1",
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({ target_language_code, speaker, pitch, pace, loudness, speech_sample_rate, enable_preprocessing, output_audio_codec, output_audio_bitrate, min_buffer_size, max_chunk_length, }: {
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({ target_language_code, speaker = "anushka", pitch = 0.0, pace = 1.0, loudness = 1.0, speech_sample_rate = 22050, enable_preprocessing = false, output_audio_codec = "mp3", output_audio_bitrate = "128k", min_buffer_size = 50, max_chunk_length = 150, }) {
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);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.1.2-alpha.1";
1
+ export declare const SDK_VERSION = "1.1.2-alpha.2";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.1.2-alpha.1";
4
+ exports.SDK_VERSION = "1.1.2-alpha.2";
@@ -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.1",
10
- "User-Agent": "sarvamai/1.1.2-alpha.1",
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({ target_language_code, speaker, pitch, pace, loudness, speech_sample_rate, enable_preprocessing, output_audio_codec, output_audio_bitrate, min_buffer_size, max_chunk_length, }: {
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({ target_language_code, speaker = "anushka", pitch = 0.0, pace = 1.0, loudness = 1.0, speech_sample_rate = 22050, enable_preprocessing = false, output_audio_codec = "mp3", output_audio_bitrate = "128k", min_buffer_size = 50, max_chunk_length = 150, }) {
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);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.1.2-alpha.1";
1
+ export declare const SDK_VERSION = "1.1.2-alpha.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.1.2-alpha.1";
1
+ export const SDK_VERSION = "1.1.2-alpha.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sarvamai",
3
- "version": "1.1.2-alpha.1",
3
+ "version": "1.1.2-alpha.2",
4
4
  "private": false,
5
5
  "repository": "github:sarvamai/sarvam-javascript-sdk",
6
6
  "type": "commonjs",