sarvamai 1.1.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/speechToText/client/Client.js +3 -0
- package/dist/cjs/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +42 -4
- package/dist/cjs/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +6 -1
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingInputAudioCodec.d.ts +4 -1
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingInputAudioCodec.js +4 -1
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.d.ts +16 -1
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.js +16 -1
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.d.ts +28 -0
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.js +31 -0
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.d.ts +12 -0
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.js +15 -0
- package/dist/cjs/api/resources/speechToTextStreaming/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/speechToTextStreaming/types/index.js +2 -0
- package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingInputAudioCodec.d.ts +4 -1
- package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingInputAudioCodec.js +4 -1
- package/dist/cjs/api/resources/textToSpeech/client/Client.d.ts +12 -2
- package/dist/cjs/api/resources/textToSpeech/client/Client.js +12 -2
- package/dist/cjs/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +51 -8
- 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/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.d.ts +10 -0
- package/dist/cjs/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.js +13 -0
- package/dist/cjs/api/resources/textToSpeechStreaming/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/textToSpeechStreaming/types/index.js +1 -0
- package/dist/cjs/api/types/AudioData.d.ts +0 -12
- package/dist/cjs/api/types/AudioData.js +0 -11
- package/dist/cjs/api/types/ConfigureConnection.d.ts +80 -18
- package/dist/cjs/api/types/ConfigureConnection.js +38 -7
- package/dist/cjs/api/types/Mode.d.ts +28 -0
- package/dist/cjs/api/types/Mode.js +31 -0
- package/dist/cjs/api/types/SpeechToTextJobParameters.d.ts +45 -2
- package/dist/cjs/api/types/SpeechToTextModel.d.ts +12 -1
- package/dist/cjs/api/types/SpeechToTextModel.js +12 -0
- package/dist/cjs/api/types/SpeechToTextTranslateJobParameters.d.ts +6 -1
- package/dist/cjs/api/types/SpeechToTextTranslateModel.d.ts +6 -0
- package/dist/cjs/api/types/TextToSpeechModel.d.ts +5 -1
- package/dist/cjs/api/types/TextToSpeechModel.js +5 -0
- package/dist/cjs/api/types/TextToSpeechSpeaker.d.ts +25 -0
- package/dist/cjs/api/types/TextToSpeechSpeaker.js +25 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- 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/speechToText/client/Client.mjs +3 -0
- package/dist/esm/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.mts +42 -4
- package/dist/esm/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.mts +6 -1
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingInputAudioCodec.d.mts +4 -1
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingInputAudioCodec.mjs +4 -1
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.d.mts +16 -1
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.mjs +16 -1
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.d.mts +28 -0
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.mjs +28 -0
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.d.mts +12 -0
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.mjs +12 -0
- package/dist/esm/api/resources/speechToTextStreaming/types/index.d.mts +2 -0
- package/dist/esm/api/resources/speechToTextStreaming/types/index.mjs +2 -0
- package/dist/esm/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingInputAudioCodec.d.mts +4 -1
- package/dist/esm/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingInputAudioCodec.mjs +4 -1
- package/dist/esm/api/resources/textToSpeech/client/Client.d.mts +12 -2
- package/dist/esm/api/resources/textToSpeech/client/Client.mjs +12 -2
- package/dist/esm/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.mts +51 -8
- 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/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.d.mts +10 -0
- package/dist/esm/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.mjs +10 -0
- package/dist/esm/api/resources/textToSpeechStreaming/types/index.d.mts +1 -0
- package/dist/esm/api/resources/textToSpeechStreaming/types/index.mjs +1 -0
- package/dist/esm/api/types/AudioData.d.mts +0 -12
- package/dist/esm/api/types/AudioData.mjs +1 -10
- package/dist/esm/api/types/ConfigureConnection.d.mts +80 -18
- package/dist/esm/api/types/ConfigureConnection.mjs +38 -7
- package/dist/esm/api/types/Mode.d.mts +28 -0
- package/dist/esm/api/types/Mode.mjs +28 -0
- package/dist/esm/api/types/SpeechToTextJobParameters.d.mts +45 -2
- package/dist/esm/api/types/SpeechToTextModel.d.mts +12 -1
- package/dist/esm/api/types/SpeechToTextModel.mjs +11 -1
- package/dist/esm/api/types/SpeechToTextTranslateJobParameters.d.mts +6 -1
- package/dist/esm/api/types/SpeechToTextTranslateModel.d.mts +6 -0
- package/dist/esm/api/types/TextToSpeechModel.d.mts +5 -1
- package/dist/esm/api/types/TextToSpeechModel.mjs +4 -1
- package/dist/esm/api/types/TextToSpeechSpeaker.d.mts +25 -0
- package/dist/esm/api/types/TextToSpeechSpeaker.mjs +25 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +12 -2
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.
|
|
47
|
-
"User-Agent": "sarvamai/1.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);
|
|
@@ -96,6 +96,9 @@ class SpeechToTextClient {
|
|
|
96
96
|
if (request.model != null) {
|
|
97
97
|
_request.append("model", request.model);
|
|
98
98
|
}
|
|
99
|
+
if (request.mode != null) {
|
|
100
|
+
_request.append("mode", request.mode);
|
|
101
|
+
}
|
|
99
102
|
if (request.language_code != null) {
|
|
100
103
|
_request.append("language_code", request.language_code);
|
|
101
104
|
}
|
package/dist/cjs/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts
CHANGED
|
@@ -14,13 +14,51 @@ export interface SpeechToTextTranscriptionRequest {
|
|
|
14
14
|
file: core.file.Uploadable;
|
|
15
15
|
/**
|
|
16
16
|
* Specifies the model to use for speech-to-text conversion.
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
|
+
* - **saarika:v2.5** (default): Transcribes audio in the spoken language.
|
|
19
|
+
*
|
|
20
|
+
* - **saaras:v3**: State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
18
21
|
*/
|
|
19
22
|
model?: SarvamAI.SpeechToTextModel;
|
|
20
23
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* Mode of operation. **Only applicable when using saaras:v3 model.**
|
|
25
|
+
*
|
|
26
|
+
* Example audio: 'मेरा फोन नंबर है 9840950950'
|
|
27
|
+
*
|
|
28
|
+
* - **transcribe** (default): Standard transcription in the original language with proper formatting and number normalization.
|
|
29
|
+
* - Output: `मेरा फोन नंबर है 9840950950`
|
|
30
|
+
*
|
|
31
|
+
* - **translate**: Translates speech from any supported Indic language to English.
|
|
32
|
+
* - Output: `My phone number is 9840950950`
|
|
33
|
+
*
|
|
34
|
+
* - **verbatim**: Exact word-for-word transcription without normalization, preserving filler words and spoken numbers as-is.
|
|
35
|
+
* - Output: `मेरा फोन नंबर है नौ आठ चार zero नौ पांच zero नौ पांच zero`
|
|
36
|
+
*
|
|
37
|
+
* - **translit**: Romanization - Transliterates speech to Latin/Roman script only.
|
|
38
|
+
* - Output: `mera phone number hai 9840950950`
|
|
39
|
+
*
|
|
40
|
+
* - **codemix**: Code-mixed text with English words in English and Indic words in native script.
|
|
41
|
+
* - Output: `मेरा phone number है 9840950950`
|
|
42
|
+
*/
|
|
43
|
+
mode?: SarvamAI.Mode;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies the language of the input audio in BCP-47 format.
|
|
46
|
+
*
|
|
47
|
+
* **Note:** This parameter is optional for `saarika:v2.5` model.
|
|
48
|
+
*
|
|
49
|
+
* **Available Options:**
|
|
50
|
+
* - `unknown`: Use when the language is not known; the API will auto-detect.
|
|
51
|
+
* - `hi-IN`: Hindi
|
|
52
|
+
* - `bn-IN`: Bengali
|
|
53
|
+
* - `kn-IN`: Kannada
|
|
54
|
+
* - `ml-IN`: Malayalam
|
|
55
|
+
* - `mr-IN`: Marathi
|
|
56
|
+
* - `od-IN`: Odia
|
|
57
|
+
* - `pa-IN`: Punjabi
|
|
58
|
+
* - `ta-IN`: Tamil
|
|
59
|
+
* - `te-IN`: Telugu
|
|
60
|
+
* - `en-IN`: English
|
|
61
|
+
* - `gu-IN`: Gujarati
|
|
24
62
|
*/
|
|
25
63
|
language_code?: SarvamAI.SpeechToTextLanguage;
|
|
26
64
|
/** Input Audio codec/format of the input file. PCM files are supported only at 16kHz sample rate. */
|
package/dist/cjs/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts
CHANGED
|
@@ -14,7 +14,12 @@ export interface SpeechToTextTranslationRequest {
|
|
|
14
14
|
file: core.file.Uploadable;
|
|
15
15
|
/** Conversation context can be passed as a prompt to boost model accuracy. However, the current system is at an experimentation stage and doesn't match the prompt performance of large language models. */
|
|
16
16
|
prompt?: string;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Model to be used for speech to text translation.
|
|
19
|
+
*
|
|
20
|
+
* - **saaras:v2.5** (default): Translation model that translates audio from any spoken Indic language to English.
|
|
21
|
+
* - Example: Hindi audio → English text output
|
|
22
|
+
*/
|
|
18
23
|
model?: SarvamAI.SpeechToTextTranslateModel;
|
|
19
24
|
/** Audio codec/format of the input file. Our API automatically detects all codec formats, but for PCM files specifically (pcm_s16le, pcm_l16, pcm_raw), you must pass this parameter. PCM files are supported only at 16kHz sample rate. */
|
|
20
25
|
input_audio_codec?: SarvamAI.InputAudioCodec;
|
package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingInputAudioCodec.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Audio codec/format of the input stream. Use this when sending raw PCM audio.
|
|
3
|
+
* Supported values: wav, pcm_s16le, pcm_l16, pcm_raw.
|
|
4
|
+
*/
|
|
2
5
|
export declare const SpeechToTextStreamingInputAudioCodec: {
|
|
3
6
|
readonly Wav: "wav";
|
|
4
7
|
readonly PcmS16Le: "pcm_s16le";
|
package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingInputAudioCodec.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SpeechToTextStreamingInputAudioCodec = void 0;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Audio codec/format of the input stream. Use this when sending raw PCM audio.
|
|
7
|
+
* Supported values: wav, pcm_s16le, pcm_l16, pcm_raw.
|
|
8
|
+
*/
|
|
6
9
|
exports.SpeechToTextStreamingInputAudioCodec = {
|
|
7
10
|
Wav: "wav",
|
|
8
11
|
PcmS16Le: "pcm_s16le",
|
package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the language of the input audio in BCP-47 format.
|
|
3
|
+
*
|
|
4
|
+
* **Available Options:**
|
|
5
|
+
* - `hi-IN`: Hindi
|
|
6
|
+
* - `bn-IN`: Bengali
|
|
7
|
+
* - `gu-IN`: Gujarati
|
|
8
|
+
* - `kn-IN`: Kannada
|
|
9
|
+
* - `ml-IN`: Malayalam
|
|
10
|
+
* - `mr-IN`: Marathi
|
|
11
|
+
* - `od-IN`: Odia
|
|
12
|
+
* - `pa-IN`: Punjabi
|
|
13
|
+
* - `ta-IN`: Tamil
|
|
14
|
+
* - `te-IN`: Telugu
|
|
15
|
+
* - `en-IN`: English
|
|
16
|
+
*/
|
|
2
17
|
export declare const SpeechToTextStreamingLanguageCode: {
|
|
3
18
|
readonly EnIn: "en-IN";
|
|
4
19
|
readonly HiIn: "hi-IN";
|
package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.js
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SpeechToTextStreamingLanguageCode = void 0;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Specifies the language of the input audio in BCP-47 format.
|
|
7
|
+
*
|
|
8
|
+
* **Available Options:**
|
|
9
|
+
* - `hi-IN`: Hindi
|
|
10
|
+
* - `bn-IN`: Bengali
|
|
11
|
+
* - `gu-IN`: Gujarati
|
|
12
|
+
* - `kn-IN`: Kannada
|
|
13
|
+
* - `ml-IN`: Malayalam
|
|
14
|
+
* - `mr-IN`: Marathi
|
|
15
|
+
* - `od-IN`: Odia
|
|
16
|
+
* - `pa-IN`: Punjabi
|
|
17
|
+
* - `ta-IN`: Tamil
|
|
18
|
+
* - `te-IN`: Telugu
|
|
19
|
+
* - `en-IN`: English
|
|
20
|
+
*/
|
|
6
21
|
exports.SpeechToTextStreamingLanguageCode = {
|
|
7
22
|
EnIn: "en-IN",
|
|
8
23
|
HiIn: "hi-IN",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mode of operation. **Only applicable when using saaras:v3 model.**
|
|
3
|
+
*
|
|
4
|
+
* Example audio: 'मेरा फोन नंबर है 9840950950'
|
|
5
|
+
*
|
|
6
|
+
* - **transcribe** (default): Standard transcription in the original language with proper formatting and number normalization.
|
|
7
|
+
* - Output: `मेरा फोन नंबर है 9840950950`
|
|
8
|
+
*
|
|
9
|
+
* - **translate**: Translates speech from any supported Indic language to English.
|
|
10
|
+
* - Output: `My phone number is 9840950950`
|
|
11
|
+
*
|
|
12
|
+
* - **verbatim**: Exact word-for-word transcription without normalization, preserving filler words and spoken numbers as-is.
|
|
13
|
+
* - Output: `मेरा फोन नंबर है नौ आठ चार zero नौ पांच zero नौ पांच zero`
|
|
14
|
+
*
|
|
15
|
+
* - **translit**: Romanization - Transliterates speech to Latin/Roman script only.
|
|
16
|
+
* - Output: `mera phone number hai 9840950950`
|
|
17
|
+
*
|
|
18
|
+
* - **codemix**: Code-mixed text with English words in English and Indic words in native script.
|
|
19
|
+
* - Output: `मेरा phone number है 9840950950`
|
|
20
|
+
*/
|
|
21
|
+
export declare const SpeechToTextStreamingMode: {
|
|
22
|
+
readonly Transcribe: "transcribe";
|
|
23
|
+
readonly Translate: "translate";
|
|
24
|
+
readonly Verbatim: "verbatim";
|
|
25
|
+
readonly Translit: "translit";
|
|
26
|
+
readonly Codemix: "codemix";
|
|
27
|
+
};
|
|
28
|
+
export type SpeechToTextStreamingMode = (typeof SpeechToTextStreamingMode)[keyof typeof SpeechToTextStreamingMode];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SpeechToTextStreamingMode = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Mode of operation. **Only applicable when using saaras:v3 model.**
|
|
7
|
+
*
|
|
8
|
+
* Example audio: 'मेरा फोन नंबर है 9840950950'
|
|
9
|
+
*
|
|
10
|
+
* - **transcribe** (default): Standard transcription in the original language with proper formatting and number normalization.
|
|
11
|
+
* - Output: `मेरा फोन नंबर है 9840950950`
|
|
12
|
+
*
|
|
13
|
+
* - **translate**: Translates speech from any supported Indic language to English.
|
|
14
|
+
* - Output: `My phone number is 9840950950`
|
|
15
|
+
*
|
|
16
|
+
* - **verbatim**: Exact word-for-word transcription without normalization, preserving filler words and spoken numbers as-is.
|
|
17
|
+
* - Output: `मेरा फोन नंबर है नौ आठ चार zero नौ पांच zero नौ पांच zero`
|
|
18
|
+
*
|
|
19
|
+
* - **translit**: Romanization - Transliterates speech to Latin/Roman script only.
|
|
20
|
+
* - Output: `mera phone number hai 9840950950`
|
|
21
|
+
*
|
|
22
|
+
* - **codemix**: Code-mixed text with English words in English and Indic words in native script.
|
|
23
|
+
* - Output: `मेरा phone number है 9840950950`
|
|
24
|
+
*/
|
|
25
|
+
exports.SpeechToTextStreamingMode = {
|
|
26
|
+
Transcribe: "transcribe",
|
|
27
|
+
Translate: "translate",
|
|
28
|
+
Verbatim: "verbatim",
|
|
29
|
+
Translit: "translit",
|
|
30
|
+
Codemix: "codemix",
|
|
31
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the model to use for speech-to-text conversion.
|
|
3
|
+
*
|
|
4
|
+
* - **saarika:v2.5** (default): Transcribes audio in the spoken language.
|
|
5
|
+
*
|
|
6
|
+
* - **saaras:v3**: State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SpeechToTextStreamingModel: {
|
|
9
|
+
readonly SaarikaV25: "saarika:v2.5";
|
|
10
|
+
readonly SaarasV3: "saaras:v3";
|
|
11
|
+
};
|
|
12
|
+
export type SpeechToTextStreamingModel = (typeof SpeechToTextStreamingModel)[keyof typeof SpeechToTextStreamingModel];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SpeechToTextStreamingModel = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Specifies the model to use for speech-to-text conversion.
|
|
7
|
+
*
|
|
8
|
+
* - **saarika:v2.5** (default): Transcribes audio in the spoken language.
|
|
9
|
+
*
|
|
10
|
+
* - **saaras:v3**: State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
11
|
+
*/
|
|
12
|
+
exports.SpeechToTextStreamingModel = {
|
|
13
|
+
SaarikaV25: "saarika:v2.5",
|
|
14
|
+
SaarasV3: "saaras:v3",
|
|
15
|
+
};
|
|
@@ -2,4 +2,6 @@ export * from "./SpeechToTextStreamingFlushSignal.js";
|
|
|
2
2
|
export * from "./SpeechToTextStreamingHighVadSensitivity.js";
|
|
3
3
|
export * from "./SpeechToTextStreamingInputAudioCodec.js";
|
|
4
4
|
export * from "./SpeechToTextStreamingLanguageCode.js";
|
|
5
|
+
export * from "./SpeechToTextStreamingMode.js";
|
|
6
|
+
export * from "./SpeechToTextStreamingModel.js";
|
|
5
7
|
export * from "./SpeechToTextStreamingVadSignals.js";
|
|
@@ -18,4 +18,6 @@ __exportStar(require("./SpeechToTextStreamingFlushSignal.js"), exports);
|
|
|
18
18
|
__exportStar(require("./SpeechToTextStreamingHighVadSensitivity.js"), exports);
|
|
19
19
|
__exportStar(require("./SpeechToTextStreamingInputAudioCodec.js"), exports);
|
|
20
20
|
__exportStar(require("./SpeechToTextStreamingLanguageCode.js"), exports);
|
|
21
|
+
__exportStar(require("./SpeechToTextStreamingMode.js"), exports);
|
|
22
|
+
__exportStar(require("./SpeechToTextStreamingModel.js"), exports);
|
|
21
23
|
__exportStar(require("./SpeechToTextStreamingVadSignals.js"), exports);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Audio codec/format of the input stream. Use this when sending raw PCM audio.
|
|
3
|
+
* Supported values: wav, pcm_s16le, pcm_l16, pcm_raw.
|
|
4
|
+
*/
|
|
2
5
|
export declare const SpeechToTextTranslateStreamingInputAudioCodec: {
|
|
3
6
|
readonly Wav: "wav";
|
|
4
7
|
readonly PcmS16Le: "pcm_s16le";
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SpeechToTextTranslateStreamingInputAudioCodec = void 0;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Audio codec/format of the input stream. Use this when sending raw PCM audio.
|
|
7
|
+
* Supported values: wav, pcm_s16le, pcm_l16, pcm_raw.
|
|
8
|
+
*/
|
|
6
9
|
exports.SpeechToTextTranslateStreamingInputAudioCodec = {
|
|
7
10
|
Wav: "wav",
|
|
8
11
|
PcmS16Le: "pcm_s16le",
|
|
@@ -12,8 +12,18 @@ export declare class TextToSpeechClient {
|
|
|
12
12
|
protected readonly _options: NormalizedClientOptionsWithAuth<TextToSpeechClient.Options>;
|
|
13
13
|
constructor(options?: TextToSpeechClient.Options);
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Convert text into spoken audio. The output is a wave file encoded as a base64 string.
|
|
16
|
+
*
|
|
17
|
+
* **Available Models:**
|
|
18
|
+
* - **bulbul:v2** (default): Supports pitch, loudness, and pace controls
|
|
19
|
+
* - **bulbul:v3-beta**: Newer model with temperature control and improved quality
|
|
20
|
+
*
|
|
21
|
+
* **Important Notes for bulbul:v3-beta:**
|
|
22
|
+
* - Pitch and loudness parameters are NOT supported
|
|
23
|
+
* - Pace must be between 0.5 and 2.0
|
|
24
|
+
* - Preprocessing is automatically enabled
|
|
25
|
+
* - Default sample rate is 24000 Hz
|
|
26
|
+
* - Temperature parameter available (0.01-1.0, default 0.6)
|
|
17
27
|
*
|
|
18
28
|
* @param {SarvamAI.TextToSpeechRequest} request
|
|
19
29
|
* @param {TextToSpeechClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -55,8 +55,18 @@ class TextToSpeechClient {
|
|
|
55
55
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* Convert text into spoken audio. The output is a wave file encoded as a base64 string.
|
|
59
|
+
*
|
|
60
|
+
* **Available Models:**
|
|
61
|
+
* - **bulbul:v2** (default): Supports pitch, loudness, and pace controls
|
|
62
|
+
* - **bulbul:v3-beta**: Newer model with temperature control and improved quality
|
|
63
|
+
*
|
|
64
|
+
* **Important Notes for bulbul:v3-beta:**
|
|
65
|
+
* - Pitch and loudness parameters are NOT supported
|
|
66
|
+
* - Pace must be between 0.5 and 2.0
|
|
67
|
+
* - Preprocessing is automatically enabled
|
|
68
|
+
* - Default sample rate is 24000 Hz
|
|
69
|
+
* - Temperature parameter available (0.01-1.0, default 0.6)
|
|
60
70
|
*
|
|
61
71
|
* @param {SarvamAI.TextToSpeechRequest} request
|
|
62
72
|
* @param {TextToSpeechClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -11,9 +11,12 @@ export interface TextToSpeechRequest {
|
|
|
11
11
|
* The text(s) to be converted into speech.
|
|
12
12
|
*
|
|
13
13
|
* **Features:**
|
|
14
|
-
* - Each text should be no longer than 1500 characters
|
|
15
14
|
* - Supports code-mixed text (English and Indic languages)
|
|
16
15
|
*
|
|
16
|
+
* **Model-specific limits:**
|
|
17
|
+
* - **bulbul:v2:** Max 1500 characters
|
|
18
|
+
* - **bulbul:v3-beta:** Max 2500 characters
|
|
19
|
+
*
|
|
17
20
|
* **Important Note:**
|
|
18
21
|
* - For numbers larger than 4 digits, use commas (e.g., '10,000' instead of '10000')
|
|
19
22
|
* - This ensures proper pronunciation as a whole number
|
|
@@ -24,28 +27,68 @@ export interface TextToSpeechRequest {
|
|
|
24
27
|
/**
|
|
25
28
|
* The speaker voice to be used for the output audio.
|
|
26
29
|
*
|
|
27
|
-
* **Default:** Anushka
|
|
30
|
+
* **Default:** Anushka (for bulbul:v2), Aditya (for bulbul:v3-beta)
|
|
28
31
|
*
|
|
29
32
|
* **Model Compatibility (Speakers compatible with respective model):**
|
|
30
33
|
* - **bulbul:v2:**
|
|
31
34
|
* - Female: Anushka, Manisha, Vidya, Arya
|
|
32
35
|
* - Male: Abhilash, Karun, Hitesh
|
|
36
|
+
* - **bulbul:v3-beta:**
|
|
37
|
+
* - Aditya, Ritu, Priya, Neha, Rahul, Pooja, Rohan, Simran, Kavya, Amit, Dev, Ishita, Shreya, Ratan, Varun, Manan, Sumit, Roopa, Kabir, Aayan, Shubh, Ashutosh, Advait, Amelia, Sophia
|
|
33
38
|
*
|
|
34
39
|
* **Note:** Speaker selection must match the chosen model version.
|
|
35
40
|
*/
|
|
36
41
|
speaker?: SarvamAI.TextToSpeechSpeaker;
|
|
37
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Controls the pitch of the audio. Lower values result in a deeper voice, while higher values make it sharper. The suitable range is between -0.75 and 0.75. Default is 0.0.
|
|
44
|
+
*
|
|
45
|
+
* **Note:** This parameter is only supported for bulbul:v2. It is NOT supported for bulbul:v3-beta and will cause a validation error if provided.
|
|
46
|
+
*/
|
|
38
47
|
pitch?: number;
|
|
39
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Controls the speed of the audio. Lower values result in slower speech, while higher values make it faster. Default is 1.0.
|
|
50
|
+
*
|
|
51
|
+
* **Model-specific ranges:**
|
|
52
|
+
* - **bulbul:v2:** 0.3 to 3.0
|
|
53
|
+
* - **bulbul:v3-beta:** 0.5 to 2.0
|
|
54
|
+
*/
|
|
40
55
|
pace?: number;
|
|
41
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Controls the loudness of the audio. Lower values result in quieter audio, while higher values make it louder. The suitable range is between 0.3 and 3.0. Default is 1.0.
|
|
58
|
+
*
|
|
59
|
+
* **Note:** This parameter is only supported for bulbul:v2. It is NOT supported for bulbul:v3-beta and will cause a validation error if provided.
|
|
60
|
+
*/
|
|
42
61
|
loudness?: number;
|
|
43
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Specifies the sample rate of the output audio. Supported values are 8000, 16000, 22050, 24000 Hz.
|
|
64
|
+
*
|
|
65
|
+
* **Model-specific defaults:**
|
|
66
|
+
* - **bulbul:v2:** Default is 22050 Hz
|
|
67
|
+
* - **bulbul:v3-beta:** Default is 24000 Hz
|
|
68
|
+
*/
|
|
44
69
|
speech_sample_rate?: SarvamAI.SpeechSampleRate;
|
|
45
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Controls whether normalization of English words and numeric entities (e.g., numbers, dates) is performed. Set to true for better handling of mixed-language text.
|
|
72
|
+
*
|
|
73
|
+
* **Model-specific behavior:**
|
|
74
|
+
* - **bulbul:v2:** Default is false
|
|
75
|
+
* - **bulbul:v3-beta:** Automatically enabled (true) and cannot be disabled
|
|
76
|
+
*/
|
|
46
77
|
enable_preprocessing?: boolean;
|
|
47
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Specifies the model to use for text-to-speech conversion.
|
|
80
|
+
*
|
|
81
|
+
* **Available models:**
|
|
82
|
+
* - **bulbul:v2:** Default model with pitch, loudness controls
|
|
83
|
+
* - **bulbul:v3-beta:** Newer model with temperature control, improved quality
|
|
84
|
+
*/
|
|
48
85
|
model?: SarvamAI.TextToSpeechModel;
|
|
49
86
|
/** Specifies the audio codec for the output audio file. Different codecs offer various compression and quality characteristics. */
|
|
50
87
|
output_audio_codec?: SarvamAI.TextToSpeechOutputAudioCodec;
|
|
88
|
+
/**
|
|
89
|
+
* Controls the randomness of the output. Lower values make the output more focused and deterministic, while higher values make it more random. The suitable range is between 0.01 and 1.0. Default is 0.6.
|
|
90
|
+
*
|
|
91
|
+
* **Note:** This parameter is only supported for bulbul:v3-beta. It has no effect on bulbul:v2.
|
|
92
|
+
*/
|
|
93
|
+
temperature?: number;
|
|
51
94
|
}
|
|
@@ -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);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text to speech model to use.
|
|
3
|
+
* - **bulbul:v2** (default): Standard TTS model with pitch/loudness support
|
|
4
|
+
* - **bulbul:v3-beta**: Advanced model with temperature control (no pitch/loudness)
|
|
5
|
+
*/
|
|
6
|
+
export declare const TextToSpeechStreamingModel: {
|
|
7
|
+
readonly BulbulV2: "bulbul:v2";
|
|
8
|
+
readonly BulbulV3Beta: "bulbul:v3-beta";
|
|
9
|
+
};
|
|
10
|
+
export type TextToSpeechStreamingModel = (typeof TextToSpeechStreamingModel)[keyof typeof TextToSpeechStreamingModel];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TextToSpeechStreamingModel = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Text to speech model to use.
|
|
7
|
+
* - **bulbul:v2** (default): Standard TTS model with pitch/loudness support
|
|
8
|
+
* - **bulbul:v3-beta**: Advanced model with temperature control (no pitch/loudness)
|
|
9
|
+
*/
|
|
10
|
+
exports.TextToSpeechStreamingModel = {
|
|
11
|
+
BulbulV2: "bulbul:v2",
|
|
12
|
+
BulbulV3Beta: "bulbul:v3-beta",
|
|
13
|
+
};
|
|
@@ -14,4 +14,5 @@ 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("./TextToSpeechStreamingModel.js"), exports);
|
|
17
18
|
__exportStar(require("./TextToSpeechStreamingSendCompletionEvent.js"), exports);
|
|
@@ -13,16 +13,4 @@ export interface AudioData {
|
|
|
13
13
|
sample_rate: number;
|
|
14
14
|
/** Audio encoding format */
|
|
15
15
|
encoding: "audio/wav";
|
|
16
|
-
/** Audio codec/format of the input file. For PCM files specifically (pcm_s16le, pcm_l16, pcm_raw), you must pass this parameter. PCM files supports sample rate 16000 and 8000. */
|
|
17
|
-
input_audio_codec?: AudioData.InputAudioCodec;
|
|
18
|
-
}
|
|
19
|
-
export declare namespace AudioData {
|
|
20
|
-
/** Audio codec/format of the input file. For PCM files specifically (pcm_s16le, pcm_l16, pcm_raw), you must pass this parameter. PCM files supports sample rate 16000 and 8000. */
|
|
21
|
-
const InputAudioCodec: {
|
|
22
|
-
readonly Wav: "wav";
|
|
23
|
-
readonly PcmS16Le: "pcm_s16le";
|
|
24
|
-
readonly PcmL16: "pcm_l16";
|
|
25
|
-
readonly PcmRaw: "pcm_raw";
|
|
26
|
-
};
|
|
27
|
-
type InputAudioCodec = (typeof InputAudioCodec)[keyof typeof InputAudioCodec];
|
|
28
16
|
}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.AudioData = void 0;
|
|
5
|
-
var AudioData;
|
|
6
|
-
(function (AudioData) {
|
|
7
|
-
/** Audio codec/format of the input file. For PCM files specifically (pcm_s16le, pcm_l16, pcm_raw), you must pass this parameter. PCM files supports sample rate 16000 and 8000. */
|
|
8
|
-
AudioData.InputAudioCodec = {
|
|
9
|
-
Wav: "wav",
|
|
10
|
-
PcmS16Le: "pcm_s16le",
|
|
11
|
-
PcmL16: "pcm_l16",
|
|
12
|
-
PcmRaw: "pcm_raw",
|
|
13
|
-
};
|
|
14
|
-
})(AudioData || (exports.AudioData = AudioData = {}));
|