sarvamai 1.1.8-alpha.2 → 1.1.8-alpha.3
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/README.md +3 -3
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/chat/client/requests/ChatCompletionsRequest.d.ts +3 -2
- package/dist/cjs/api/resources/pronunciationDictionary/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/pronunciationDictionary/client/Client.js +1 -1
- package/dist/cjs/api/resources/pronunciationDictionary/client/requests/UpdatePronunciationDictionaryRequest.d.ts +1 -1
- package/dist/cjs/api/resources/speechToText/client/Client.js +9 -6
- package/dist/cjs/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +8 -0
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.d.ts +1 -1
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.js +1 -1
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.d.ts +3 -0
- package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.js +3 -0
- package/dist/cjs/api/resources/speechToTextTranslateJob/client/requests/SpeechToTextTranslateJobRequest.d.ts +0 -1
- package/dist/cjs/api/resources/text/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/text/client/Client.js +7 -7
- package/dist/cjs/api/resources/text/client/requests/LanguageIdentificationRequest.d.ts +1 -1
- package/dist/cjs/api/resources/text/client/requests/TranslationRequest.d.ts +3 -3
- package/dist/cjs/api/resources/text/client/requests/TransliterationRequest.d.ts +3 -3
- package/dist/cjs/api/resources/textToSpeech/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/textToSpeech/client/Client.js +2 -2
- package/dist/cjs/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +2 -2
- package/dist/cjs/api/resources/textToSpeech/client/requests/TextToSpeechStreamRequest.d.ts +1 -1
- package/dist/cjs/api/types/SpeechToTextBatchModel.d.ts +18 -0
- package/dist/cjs/api/types/SpeechToTextBatchModel.js +21 -0
- package/dist/cjs/api/types/SpeechToTextJobParameters.d.ts +10 -4
- package/dist/cjs/api/types/SpeechToTextModel.d.ts +3 -0
- package/dist/cjs/api/types/SpeechToTextModel.js +3 -0
- package/dist/cjs/api/types/SpeechToTextResponse.d.ts +2 -15
- package/dist/cjs/api/types/SpeechToTextTranscriptionData.d.ts +2 -4
- package/dist/cjs/api/types/SpeechToTextTranslateResponse.d.ts +1 -1
- package/dist/cjs/api/types/TimestampsModel.d.ts +3 -3
- 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/chat/client/requests/ChatCompletionsRequest.d.mts +3 -2
- package/dist/esm/api/resources/pronunciationDictionary/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/pronunciationDictionary/client/Client.mjs +1 -1
- package/dist/esm/api/resources/pronunciationDictionary/client/requests/UpdatePronunciationDictionaryRequest.d.mts +1 -1
- package/dist/esm/api/resources/speechToText/client/Client.mjs +9 -6
- package/dist/esm/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.mts +8 -0
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.d.mts +1 -1
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingMode.mjs +1 -1
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.d.mts +3 -0
- package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.mjs +3 -0
- package/dist/esm/api/resources/speechToTextTranslateJob/client/requests/SpeechToTextTranslateJobRequest.d.mts +0 -1
- package/dist/esm/api/resources/text/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/text/client/Client.mjs +7 -7
- package/dist/esm/api/resources/text/client/requests/LanguageIdentificationRequest.d.mts +1 -1
- package/dist/esm/api/resources/text/client/requests/TranslationRequest.d.mts +3 -3
- package/dist/esm/api/resources/text/client/requests/TransliterationRequest.d.mts +3 -3
- package/dist/esm/api/resources/textToSpeech/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/textToSpeech/client/Client.mjs +2 -2
- package/dist/esm/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.mts +2 -2
- package/dist/esm/api/resources/textToSpeech/client/requests/TextToSpeechStreamRequest.d.mts +1 -1
- package/dist/esm/api/types/SpeechToTextBatchModel.d.mts +18 -0
- package/dist/esm/api/types/SpeechToTextBatchModel.mjs +18 -0
- package/dist/esm/api/types/SpeechToTextJobParameters.d.mts +10 -4
- package/dist/esm/api/types/SpeechToTextModel.d.mts +3 -0
- package/dist/esm/api/types/SpeechToTextModel.mjs +3 -0
- package/dist/esm/api/types/SpeechToTextResponse.d.mts +2 -15
- package/dist/esm/api/types/SpeechToTextTranscriptionData.d.mts +2 -4
- package/dist/esm/api/types/SpeechToTextTranslateResponse.d.mts +1 -1
- package/dist/esm/api/types/TimestampsModel.d.mts +3 -3
- 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 +14 -14
package/README.md
CHANGED
|
@@ -50,9 +50,9 @@ import { SarvamAIClient } from "sarvamai";
|
|
|
50
50
|
|
|
51
51
|
const client = new SarvamAIClient({ apiSubscriptionKey: "YOUR_API_SUBSCRIPTION_KEY" });
|
|
52
52
|
await client.text.translate({
|
|
53
|
-
input: "
|
|
54
|
-
source_language_code: "
|
|
55
|
-
target_language_code: "
|
|
53
|
+
input: "Hello, how are you?",
|
|
54
|
+
source_language_code: "en-IN",
|
|
55
|
+
target_language_code: "hi-IN"
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
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.8-alpha.
|
|
47
|
-
"User-Agent": "sarvamai/1.1.8-alpha.
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.8-alpha.3",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.8-alpha.3",
|
|
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);
|
|
@@ -3,9 +3,10 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
5
|
* messages: [{
|
|
6
|
-
* role: "
|
|
6
|
+
* role: "user",
|
|
7
|
+
* content: "content"
|
|
7
8
|
* }],
|
|
8
|
-
* model: "sarvam-
|
|
9
|
+
* model: "sarvam-30b"
|
|
9
10
|
* }
|
|
10
11
|
*/
|
|
11
12
|
export interface ChatCompletionsRequest {
|
|
@@ -75,7 +75,7 @@ export declare class PronunciationDictionaryClient {
|
|
|
75
75
|
* import { createReadStream } from "fs";
|
|
76
76
|
* await client.pronunciationDictionary.update({
|
|
77
77
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
78
|
-
* dict_id: "
|
|
78
|
+
* dict_id: "p_5cb7faa6"
|
|
79
79
|
* })
|
|
80
80
|
*/
|
|
81
81
|
update(request: SarvamAI.UpdatePronunciationDictionaryRequest, requestOptions?: PronunciationDictionaryClient.RequestOptions): core.HttpResponsePromise<SarvamAI.PronunciationDictionaryUpdateResponse>;
|
|
@@ -220,7 +220,7 @@ class PronunciationDictionaryClient {
|
|
|
220
220
|
* import { createReadStream } from "fs";
|
|
221
221
|
* await client.pronunciationDictionary.update({
|
|
222
222
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
223
|
-
* dict_id: "
|
|
223
|
+
* dict_id: "p_5cb7faa6"
|
|
224
224
|
* })
|
|
225
225
|
*/
|
|
226
226
|
update(request, requestOptions) {
|
|
@@ -91,7 +91,7 @@ class SpeechToTextClient {
|
|
|
91
91
|
}
|
|
92
92
|
__transcribe(request, requestOptions) {
|
|
93
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
94
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
95
95
|
const _body = yield core.newFormData();
|
|
96
96
|
yield _body.appendFile("file", request.file);
|
|
97
97
|
if (request.model != null) {
|
|
@@ -103,24 +103,27 @@ class SpeechToTextClient {
|
|
|
103
103
|
if (request.language_code != null) {
|
|
104
104
|
_body.append("language_code", request.language_code);
|
|
105
105
|
}
|
|
106
|
+
if (request.with_timestamps != null) {
|
|
107
|
+
_body.append("with_timestamps", (_a = request.with_timestamps) === null || _a === void 0 ? void 0 : _a.toString());
|
|
108
|
+
}
|
|
106
109
|
if (request.input_audio_codec != null) {
|
|
107
110
|
_body.append("input_audio_codec", request.input_audio_codec);
|
|
108
111
|
}
|
|
109
112
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
110
113
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
111
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (
|
|
114
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
112
115
|
const _response = yield core.fetcher({
|
|
113
|
-
url: core.url.join((
|
|
116
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.SarvamAIEnvironment.Production).base, "speech-to-text"),
|
|
114
117
|
method: "POST",
|
|
115
118
|
headers: _headers,
|
|
116
119
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
117
120
|
requestType: "file",
|
|
118
121
|
duplex: _maybeEncodedRequest.duplex,
|
|
119
122
|
body: _maybeEncodedRequest.body,
|
|
120
|
-
timeoutMs: ((
|
|
121
|
-
maxRetries: (
|
|
123
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
124
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
122
125
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
123
|
-
fetchFn: (
|
|
126
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
124
127
|
logging: this._options.logging,
|
|
125
128
|
});
|
|
126
129
|
if (_response.ok) {
|
package/dist/cjs/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface SpeechToTextTranscriptionRequest {
|
|
|
17
17
|
*
|
|
18
18
|
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
19
19
|
*
|
|
20
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
21
|
+
*
|
|
20
22
|
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
21
23
|
*/
|
|
22
24
|
model?: SarvamAI.SpeechToTextModel;
|
|
@@ -75,6 +77,12 @@ export interface SpeechToTextTranscriptionRequest {
|
|
|
75
77
|
* - `doi-IN`: Dogri
|
|
76
78
|
*/
|
|
77
79
|
language_code?: SarvamAI.SpeechToTextLanguage;
|
|
80
|
+
/**
|
|
81
|
+
* Enables chunk-level timestamps in the response. If set to `true`, the response includes a `timestamps` object with `words`, `start_time_seconds`, and `end_time_seconds` (each entry covers a sentence or phrase, not an individual word).
|
|
82
|
+
*
|
|
83
|
+
* **Note:** Word-level timestamps are not supported. Speaker diarization is not supported on the REST API; use the Batch API for diarized, chunk-level timestamps.
|
|
84
|
+
*/
|
|
85
|
+
with_timestamps?: boolean;
|
|
78
86
|
/** Input Audio codec/format of the input file. PCM files are supported only at 16kHz sample rate. */
|
|
79
87
|
input_audio_codec?: SarvamAI.InputAudioCodec;
|
|
80
88
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SpeechToTextStreamingMode = void 0;
|
|
5
5
|
/**
|
|
6
|
-
* Mode of operation. **Only applicable when using saaras:v3
|
|
6
|
+
* Mode of operation. **Only applicable when using saaras:v3 or saaras:v4 models.**
|
|
7
7
|
*
|
|
8
8
|
* Example audio: 'मेरा फोन नंबर है 9840950950'
|
|
9
9
|
*
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
5
5
|
*
|
|
6
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
7
|
+
*
|
|
6
8
|
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
7
9
|
*/
|
|
8
10
|
export declare const SpeechToTextStreamingModel: {
|
|
9
11
|
readonly SaarasV3: "saaras:v3";
|
|
12
|
+
readonly SaarasV4: "saaras:v4";
|
|
10
13
|
readonly SaarikaV25: "saarika:v2.5";
|
|
11
14
|
};
|
|
12
15
|
export type SpeechToTextStreamingModel = (typeof SpeechToTextStreamingModel)[keyof typeof SpeechToTextStreamingModel];
|
|
@@ -7,9 +7,12 @@ exports.SpeechToTextStreamingModel = void 0;
|
|
|
7
7
|
*
|
|
8
8
|
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
9
9
|
*
|
|
10
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
11
|
+
*
|
|
10
12
|
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
11
13
|
*/
|
|
12
14
|
exports.SpeechToTextStreamingModel = {
|
|
13
15
|
SaarasV3: "saaras:v3",
|
|
16
|
+
SaarasV4: "saaras:v4",
|
|
14
17
|
SaarikaV25: "saarika:v2.5",
|
|
15
18
|
};
|
|
@@ -54,9 +54,9 @@ export declare class TextClient {
|
|
|
54
54
|
*
|
|
55
55
|
* @example
|
|
56
56
|
* await client.text.translate({
|
|
57
|
-
* input: "
|
|
58
|
-
* source_language_code: "
|
|
59
|
-
* target_language_code: "
|
|
57
|
+
* input: "Hello, how are you?",
|
|
58
|
+
* source_language_code: "en-IN",
|
|
59
|
+
* target_language_code: "hi-IN"
|
|
60
60
|
* })
|
|
61
61
|
*/
|
|
62
62
|
translate(request: SarvamAI.TranslationRequest, requestOptions?: TextClient.RequestOptions): core.HttpResponsePromise<SarvamAI.TranslationResponse>;
|
|
@@ -75,7 +75,7 @@ export declare class TextClient {
|
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
77
|
* await client.text.identifyLanguage({
|
|
78
|
-
* input: "
|
|
78
|
+
* input: "\u0928\u092E\u0938\u094D\u0924\u0947 \u0906\u092A \u0915\u0948\u0938\u0947 \u0939\u0948\u0902"
|
|
79
79
|
* })
|
|
80
80
|
*/
|
|
81
81
|
identifyLanguage(request: SarvamAI.LanguageIdentificationRequest, requestOptions?: TextClient.RequestOptions): core.HttpResponsePromise<SarvamAI.LanguageIdentificationResponse>;
|
|
@@ -116,9 +116,9 @@ export declare class TextClient {
|
|
|
116
116
|
*
|
|
117
117
|
* @example
|
|
118
118
|
* await client.text.transliterate({
|
|
119
|
-
* input: "
|
|
120
|
-
* source_language_code: "
|
|
121
|
-
* target_language_code: "
|
|
119
|
+
* input: "namaste",
|
|
120
|
+
* source_language_code: "en-IN",
|
|
121
|
+
* target_language_code: "hi-IN"
|
|
122
122
|
* })
|
|
123
123
|
*/
|
|
124
124
|
transliterate(request: SarvamAI.TransliterationRequest, requestOptions?: TextClient.RequestOptions): core.HttpResponsePromise<SarvamAI.TransliterationResponse>;
|
|
@@ -99,9 +99,9 @@ class TextClient {
|
|
|
99
99
|
*
|
|
100
100
|
* @example
|
|
101
101
|
* await client.text.translate({
|
|
102
|
-
* input: "
|
|
103
|
-
* source_language_code: "
|
|
104
|
-
* target_language_code: "
|
|
102
|
+
* input: "Hello, how are you?",
|
|
103
|
+
* source_language_code: "en-IN",
|
|
104
|
+
* target_language_code: "hi-IN"
|
|
105
105
|
* })
|
|
106
106
|
*/
|
|
107
107
|
translate(request, requestOptions) {
|
|
@@ -166,7 +166,7 @@ class TextClient {
|
|
|
166
166
|
*
|
|
167
167
|
* @example
|
|
168
168
|
* await client.text.identifyLanguage({
|
|
169
|
-
* input: "
|
|
169
|
+
* input: "\u0928\u092E\u0938\u094D\u0924\u0947 \u0906\u092A \u0915\u0948\u0938\u0947 \u0939\u0948\u0902"
|
|
170
170
|
* })
|
|
171
171
|
*/
|
|
172
172
|
identifyLanguage(request, requestOptions) {
|
|
@@ -256,9 +256,9 @@ class TextClient {
|
|
|
256
256
|
*
|
|
257
257
|
* @example
|
|
258
258
|
* await client.text.transliterate({
|
|
259
|
-
* input: "
|
|
260
|
-
* source_language_code: "
|
|
261
|
-
* target_language_code: "
|
|
259
|
+
* input: "namaste",
|
|
260
|
+
* source_language_code: "en-IN",
|
|
261
|
+
* target_language_code: "hi-IN"
|
|
262
262
|
* })
|
|
263
263
|
*/
|
|
264
264
|
transliterate(request, requestOptions) {
|
|
@@ -2,9 +2,9 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* input: "
|
|
6
|
-
* source_language_code: "
|
|
7
|
-
* target_language_code: "
|
|
5
|
+
* input: "Hello, how are you?",
|
|
6
|
+
* source_language_code: "en-IN",
|
|
7
|
+
* target_language_code: "hi-IN"
|
|
8
8
|
* }
|
|
9
9
|
*/
|
|
10
10
|
export interface TranslationRequest {
|
|
@@ -2,9 +2,9 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* input: "
|
|
6
|
-
* source_language_code: "
|
|
7
|
-
* target_language_code: "
|
|
5
|
+
* input: "namaste",
|
|
6
|
+
* source_language_code: "en-IN",
|
|
7
|
+
* target_language_code: "hi-IN"
|
|
8
8
|
* }
|
|
9
9
|
*/
|
|
10
10
|
export interface TransliterationRequest {
|
|
@@ -35,8 +35,8 @@ export declare class TextToSpeechClient {
|
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* await client.textToSpeech.convert({
|
|
38
|
-
* text: "
|
|
39
|
-
* target_language_code: "
|
|
38
|
+
* text: "Welcome to Sarvam AI!",
|
|
39
|
+
* target_language_code: "hi-IN"
|
|
40
40
|
* })
|
|
41
41
|
*/
|
|
42
42
|
convert(request: SarvamAI.TextToSpeechRequest, requestOptions?: TextToSpeechClient.RequestOptions): core.HttpResponsePromise<SarvamAI.TextToSpeechResponse>;
|
|
@@ -80,8 +80,8 @@ class TextToSpeechClient {
|
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* await client.textToSpeech.convert({
|
|
83
|
-
* text: "
|
|
84
|
-
* target_language_code: "
|
|
83
|
+
* text: "Welcome to Sarvam AI!",
|
|
84
|
+
* target_language_code: "hi-IN"
|
|
85
85
|
* })
|
|
86
86
|
*/
|
|
87
87
|
convert(request, requestOptions) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model to be used for speech to text.
|
|
3
|
+
*
|
|
4
|
+
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
5
|
+
*
|
|
6
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
7
|
+
*
|
|
8
|
+
* - **saaras:v4-multispk** (beta, batch-only): Optimized for multi-speaker, longer-form audio, supporting files up to 2 hours across all modes. Automatically enables speaker diarization (`with_diarization` is forced to `true`). Supports 11 languages and does not yet support automatic language detection, so `language_code` must be specified explicitly.
|
|
9
|
+
*
|
|
10
|
+
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SpeechToTextBatchModel: {
|
|
13
|
+
readonly SaarasV3: "saaras:v3";
|
|
14
|
+
readonly SaarasV4: "saaras:v4";
|
|
15
|
+
readonly SaarasV4Multispk: "saaras:v4-multispk";
|
|
16
|
+
readonly SaarikaV25: "saarika:v2.5";
|
|
17
|
+
};
|
|
18
|
+
export type SpeechToTextBatchModel = (typeof SpeechToTextBatchModel)[keyof typeof SpeechToTextBatchModel];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SpeechToTextBatchModel = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Model to be used for speech to text.
|
|
7
|
+
*
|
|
8
|
+
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
9
|
+
*
|
|
10
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
11
|
+
*
|
|
12
|
+
* - **saaras:v4-multispk** (beta, batch-only): Optimized for multi-speaker, longer-form audio, supporting files up to 2 hours across all modes. Automatically enables speaker diarization (`with_diarization` is forced to `true`). Supports 11 languages and does not yet support automatic language detection, so `language_code` must be specified explicitly.
|
|
13
|
+
*
|
|
14
|
+
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
15
|
+
*/
|
|
16
|
+
exports.SpeechToTextBatchModel = {
|
|
17
|
+
SaarasV3: "saaras:v3",
|
|
18
|
+
SaarasV4: "saaras:v4",
|
|
19
|
+
SaarasV4Multispk: "saaras:v4-multispk",
|
|
20
|
+
SaarikaV25: "saarika:v2.5",
|
|
21
|
+
};
|
|
@@ -17,7 +17,7 @@ export interface SpeechToTextJobParameters {
|
|
|
17
17
|
* - `en-IN`: English
|
|
18
18
|
* - `gu-IN`: Gujarati
|
|
19
19
|
*
|
|
20
|
-
* **Additional Options (saaras:v3 only):**
|
|
20
|
+
* **Additional Options (saaras:v3 / saaras:v4 only):**
|
|
21
21
|
* - `as-IN`: Assamese
|
|
22
22
|
* - `ur-IN`: Urdu
|
|
23
23
|
* - `ne-IN`: Nepali
|
|
@@ -30,6 +30,8 @@ export interface SpeechToTextJobParameters {
|
|
|
30
30
|
* - `brx-IN`: Bodo
|
|
31
31
|
* - `mai-IN`: Maithili
|
|
32
32
|
* - `doi-IN`: Dogri
|
|
33
|
+
*
|
|
34
|
+
* **Note:** `saaras:v4-multispk` only supports the first 11 languages listed above and does not support automatic language detection, so `language_code` cannot be `unknown` and must be specified explicitly.
|
|
33
35
|
*/
|
|
34
36
|
language_code?: SarvamAI.SpeechToTextLanguage | undefined;
|
|
35
37
|
/**
|
|
@@ -37,11 +39,15 @@ export interface SpeechToTextJobParameters {
|
|
|
37
39
|
*
|
|
38
40
|
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
39
41
|
*
|
|
42
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
43
|
+
*
|
|
44
|
+
* - **saaras:v4-multispk** (beta, batch-only): Optimized for multi-speaker, longer-form audio, supporting files up to 2 hours across all modes. Automatically enables speaker diarization (`with_diarization` is forced to `true`). Supports 11 languages and does not yet support automatic language detection, so `language_code` must be specified explicitly.
|
|
45
|
+
*
|
|
40
46
|
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
41
47
|
*/
|
|
42
|
-
model?: SarvamAI.
|
|
48
|
+
model?: SarvamAI.SpeechToTextBatchModel | undefined;
|
|
43
49
|
/**
|
|
44
|
-
* Mode of operation. **Only applicable when using saaras:v3
|
|
50
|
+
* Mode of operation. **Only applicable when using saaras:v3, saaras:v4, or saaras:v4-multispk models.**
|
|
45
51
|
*
|
|
46
52
|
* Example audio: 'मेरा फोन नंबर है 9840950950'
|
|
47
53
|
*
|
|
@@ -63,7 +69,7 @@ export interface SpeechToTextJobParameters {
|
|
|
63
69
|
mode?: SarvamAI.Mode | undefined;
|
|
64
70
|
/** Whether to include timestamps in the response */
|
|
65
71
|
with_timestamps?: boolean | undefined;
|
|
66
|
-
/** Enables speaker diarization, which identifies and separates different speakers in the audio. In beta mode */
|
|
72
|
+
/** Enables speaker diarization, which identifies and separates different speakers in the audio. In beta mode. Automatically enabled and cannot be disabled when `model` is `saaras:v4-multispk`. */
|
|
67
73
|
with_diarization?: boolean | undefined;
|
|
68
74
|
/** Number of speakers to be detected in the audio. This is used when with_diarization is true. */
|
|
69
75
|
num_speakers?: number | undefined;
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
5
5
|
*
|
|
6
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
7
|
+
*
|
|
6
8
|
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
7
9
|
*/
|
|
8
10
|
export declare const SpeechToTextModel: {
|
|
9
11
|
readonly SaarasV3: "saaras:v3";
|
|
12
|
+
readonly SaarasV4: "saaras:v4";
|
|
10
13
|
readonly SaarikaV25: "saarika:v2.5";
|
|
11
14
|
};
|
|
12
15
|
export type SpeechToTextModel = (typeof SpeechToTextModel)[keyof typeof SpeechToTextModel];
|
|
@@ -7,9 +7,12 @@ exports.SpeechToTextModel = void 0;
|
|
|
7
7
|
*
|
|
8
8
|
* - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
|
|
9
9
|
*
|
|
10
|
+
* - **saaras:v4** (latest): Flexible output formats across all modes (transcribe, translate, verbatim, translit, codemix), supporting Global + Indian English and 22 Indic languages.
|
|
11
|
+
*
|
|
10
12
|
* - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
|
|
11
13
|
*/
|
|
12
14
|
exports.SpeechToTextModel = {
|
|
13
15
|
SaarasV3: "saaras:v3",
|
|
16
|
+
SaarasV4: "saaras:v4",
|
|
14
17
|
SaarikaV25: "saarika:v2.5",
|
|
15
18
|
};
|
|
@@ -3,23 +3,10 @@ export interface SpeechToTextResponse {
|
|
|
3
3
|
request_id?: string | undefined;
|
|
4
4
|
/** The transcribed text from the provided audio file. */
|
|
5
5
|
transcript: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Chunk-level timestamps for the transcribed text (sentence/phrase segments, not individual words). Present only when `with_timestamps` is `true`; omitted otherwise. */
|
|
7
7
|
timestamps?: SarvamAI.TimestampsModel | undefined;
|
|
8
|
-
/** Diarized transcript of the provided speech */
|
|
9
|
-
diarized_transcript?: SarvamAI.DiarizedTranscript | undefined;
|
|
10
8
|
/** This will return the BCP-47 code of language spoken in the input. If multiple languages are detected, this will return language code of most predominant spoken language. If no language is detected, this will be null */
|
|
11
9
|
language_code?: string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Float value (0.0 to 1.0) indicating the probability of the detected language being correct. Higher values indicate higher confidence.
|
|
14
|
-
*
|
|
15
|
-
* **When it returns a value:**
|
|
16
|
-
* - When `language_code` is not provided in the request
|
|
17
|
-
* - When `language_code` is set to `unknown`
|
|
18
|
-
*
|
|
19
|
-
* **When it returns null:**
|
|
20
|
-
* - When a specific `language_code` is provided (language detection is skipped)
|
|
21
|
-
*
|
|
22
|
-
* The parameter is always present in the response.
|
|
23
|
-
*/
|
|
10
|
+
/** Float value (0.0 to 1.0) indicating confidence in the detected language. Present when `language_code` is omitted or set to `unknown`; omitted (or null) when a specific language code is provided. */
|
|
24
11
|
language_probability?: number | undefined;
|
|
25
12
|
}
|
|
@@ -4,9 +4,9 @@ export interface SpeechToTextTranscriptionData {
|
|
|
4
4
|
request_id: string;
|
|
5
5
|
/** Transcript of the provided speech in original language */
|
|
6
6
|
transcript: string;
|
|
7
|
-
/**
|
|
7
|
+
/** Always `null` over the WebSocket API — timestamps are not supported for streaming; use the REST or Batch API for timestamped transcripts. */
|
|
8
8
|
timestamps?: Record<string, unknown> | undefined;
|
|
9
|
-
/**
|
|
9
|
+
/** Always `null` over the WebSocket API — diarization is not supported for streaming; use the Batch API for diarized transcripts. */
|
|
10
10
|
diarized_transcript?: Record<string, unknown> | undefined;
|
|
11
11
|
/** BCP-47 code of detected language */
|
|
12
12
|
language_code?: string | undefined;
|
|
@@ -19,8 +19,6 @@ export interface SpeechToTextTranscriptionData {
|
|
|
19
19
|
*
|
|
20
20
|
* **When it returns null:**
|
|
21
21
|
* - When a specific `language_code` is provided (language detection is skipped)
|
|
22
|
-
*
|
|
23
|
-
* The parameter is always present in the response.
|
|
24
22
|
*/
|
|
25
23
|
language_probability?: number | undefined;
|
|
26
24
|
metrics: SarvamAI.TranscriptionMetrics;
|
|
@@ -5,7 +5,7 @@ export interface SpeechToTextTranslateResponse {
|
|
|
5
5
|
transcript: string;
|
|
6
6
|
/** This will return the BCP-47 code of language spoken in the input. If multiple languages are detected, this will return language code of most predominant spoken language. If no language is detected, this will be null */
|
|
7
7
|
language_code?: SarvamAI.SpeechToTextTranslateLanguage | undefined;
|
|
8
|
-
/** Diarized transcript of the provided speech */
|
|
8
|
+
/** Diarized transcript of the provided speech. Always `null` on the REST API — diarization is only available via the Batch API. */
|
|
9
9
|
diarized_transcript?: SarvamAI.DiarizedTranscript | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* Float value (0.0 to 1.0) indicating the probability of the detected language being correct. Higher values indicate higher confidence.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface TimestampsModel {
|
|
2
|
-
/** List of
|
|
2
|
+
/** List of transcript chunks (sentence or phrase segments). Not individual words. */
|
|
3
3
|
words: string[];
|
|
4
|
-
/** List of start times
|
|
4
|
+
/** List of start times for each chunk in seconds. */
|
|
5
5
|
start_time_seconds: number[];
|
|
6
|
-
/** List of end times
|
|
6
|
+
/** List of end times for each chunk in seconds. */
|
|
7
7
|
end_time_seconds: number[];
|
|
8
8
|
}
|
|
@@ -81,6 +81,7 @@ export * from "./SendText.js";
|
|
|
81
81
|
export * from "./SpeechSampleRate.js";
|
|
82
82
|
export * from "./SpeechStreamBitrate.js";
|
|
83
83
|
export * from "./SpeechStreamCodec.js";
|
|
84
|
+
export * from "./SpeechToTextBatchModel.js";
|
|
84
85
|
export * from "./SpeechToTextJobParameters.js";
|
|
85
86
|
export * from "./SpeechToTextLanguage.js";
|
|
86
87
|
export * from "./SpeechToTextModel.js";
|
|
@@ -97,6 +97,7 @@ __exportStar(require("./SendText.js"), exports);
|
|
|
97
97
|
__exportStar(require("./SpeechSampleRate.js"), exports);
|
|
98
98
|
__exportStar(require("./SpeechStreamBitrate.js"), exports);
|
|
99
99
|
__exportStar(require("./SpeechStreamCodec.js"), exports);
|
|
100
|
+
__exportStar(require("./SpeechToTextBatchModel.js"), exports);
|
|
100
101
|
__exportStar(require("./SpeechToTextJobParameters.js"), exports);
|
|
101
102
|
__exportStar(require("./SpeechToTextLanguage.js"), exports);
|
|
102
103
|
__exportStar(require("./SpeechToTextModel.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.8-alpha.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.8-alpha.3";
|
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.8-alpha.
|
|
10
|
-
"User-Agent": "sarvamai/1.1.8-alpha.
|
|
9
|
+
"X-Fern-SDK-Version": "1.1.8-alpha.3",
|
|
10
|
+
"User-Agent": "sarvamai/1.1.8-alpha.3",
|
|
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);
|
|
@@ -3,9 +3,10 @@ import type * as SarvamAI from "../../../../index.mjs";
|
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
5
|
* messages: [{
|
|
6
|
-
* role: "
|
|
6
|
+
* role: "user",
|
|
7
|
+
* content: "content"
|
|
7
8
|
* }],
|
|
8
|
-
* model: "sarvam-
|
|
9
|
+
* model: "sarvam-30b"
|
|
9
10
|
* }
|
|
10
11
|
*/
|
|
11
12
|
export interface ChatCompletionsRequest {
|
|
@@ -75,7 +75,7 @@ export declare class PronunciationDictionaryClient {
|
|
|
75
75
|
* import { createReadStream } from "fs";
|
|
76
76
|
* await client.pronunciationDictionary.update({
|
|
77
77
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
78
|
-
* dict_id: "
|
|
78
|
+
* dict_id: "p_5cb7faa6"
|
|
79
79
|
* })
|
|
80
80
|
*/
|
|
81
81
|
update(request: SarvamAI.UpdatePronunciationDictionaryRequest, requestOptions?: PronunciationDictionaryClient.RequestOptions): core.HttpResponsePromise<SarvamAI.PronunciationDictionaryUpdateResponse>;
|
|
@@ -184,7 +184,7 @@ export class PronunciationDictionaryClient {
|
|
|
184
184
|
* import { createReadStream } from "fs";
|
|
185
185
|
* await client.pronunciationDictionary.update({
|
|
186
186
|
* file: fs.createReadStream("/path/to/your/file"),
|
|
187
|
-
* dict_id: "
|
|
187
|
+
* dict_id: "p_5cb7faa6"
|
|
188
188
|
* })
|
|
189
189
|
*/
|
|
190
190
|
update(request, requestOptions) {
|