sarvamai 1.1.5-alpha.1 → 1.1.5

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.
Files changed (55) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/chat/client/Client.d.ts +43 -6
  3. package/dist/cjs/api/resources/chat/client/Client.js +150 -37
  4. package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.d.ts +2 -2
  5. package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.js +2 -2
  6. package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.d.ts +3 -3
  7. package/dist/cjs/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.js +3 -3
  8. package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingMode.d.ts +22 -0
  9. package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingMode.js +25 -0
  10. package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingModel.d.ts +13 -0
  11. package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingModel.js +16 -0
  12. package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/index.d.ts +2 -0
  13. package/dist/cjs/api/resources/speechToTextTranslateStreaming/types/index.js +2 -0
  14. package/dist/cjs/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.d.ts +2 -2
  15. package/dist/cjs/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.js +2 -2
  16. package/dist/cjs/api/types/ChatCompletionChunk.d.ts +15 -0
  17. package/dist/cjs/api/types/ChatCompletionChunk.js +2 -0
  18. package/dist/cjs/api/types/ChoiceDelta.d.ts +9 -0
  19. package/dist/cjs/api/types/ChoiceDelta.js +2 -0
  20. package/dist/cjs/api/types/ChoiceDeltaToolCall.d.ts +10 -0
  21. package/dist/cjs/api/types/ChoiceDeltaToolCall.js +2 -0
  22. package/dist/cjs/api/types/ChunkChoice.d.ts +7 -0
  23. package/dist/cjs/api/types/ChunkChoice.js +2 -0
  24. package/dist/cjs/api/types/ConfigureConnection.d.ts +12 -12
  25. package/dist/cjs/api/types/ConfigureConnection.js +3 -3
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/BaseClient.mjs +2 -2
  29. package/dist/esm/api/resources/chat/client/Client.d.mts +43 -6
  30. package/dist/esm/api/resources/chat/client/Client.mjs +150 -37
  31. package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.d.mts +2 -2
  32. package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingLanguageCode.mjs +2 -2
  33. package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.d.mts +3 -3
  34. package/dist/esm/api/resources/speechToTextStreaming/types/SpeechToTextStreamingModel.mjs +3 -3
  35. package/dist/esm/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingMode.d.mts +22 -0
  36. package/dist/esm/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingMode.mjs +22 -0
  37. package/dist/esm/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingModel.d.mts +13 -0
  38. package/dist/esm/api/resources/speechToTextTranslateStreaming/types/SpeechToTextTranslateStreamingModel.mjs +13 -0
  39. package/dist/esm/api/resources/speechToTextTranslateStreaming/types/index.d.mts +2 -0
  40. package/dist/esm/api/resources/speechToTextTranslateStreaming/types/index.mjs +2 -0
  41. package/dist/esm/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.d.mts +2 -2
  42. package/dist/esm/api/resources/textToSpeechStreaming/types/TextToSpeechStreamingModel.mjs +2 -2
  43. package/dist/esm/api/types/ChatCompletionChunk.d.mts +15 -0
  44. package/dist/esm/api/types/ChatCompletionChunk.mjs +1 -0
  45. package/dist/esm/api/types/ChoiceDelta.d.mts +9 -0
  46. package/dist/esm/api/types/ChoiceDelta.mjs +1 -0
  47. package/dist/esm/api/types/ChoiceDeltaToolCall.d.mts +10 -0
  48. package/dist/esm/api/types/ChoiceDeltaToolCall.mjs +1 -0
  49. package/dist/esm/api/types/ChunkChoice.d.mts +7 -0
  50. package/dist/esm/api/types/ChunkChoice.mjs +1 -0
  51. package/dist/esm/api/types/ConfigureConnection.d.mts +12 -12
  52. package/dist/esm/api/types/ConfigureConnection.mjs +3 -3
  53. package/dist/esm/version.d.mts +1 -1
  54. package/dist/esm/version.mjs +1 -1
  55. package/package.json +1 -1
@@ -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.5-alpha.1",
47
- "User-Agent": "sarvamai/1.1.5-alpha.1",
46
+ "X-Fern-SDK-Version": "1.1.5",
47
+ "User-Agent": "sarvamai/1.1.5",
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);
@@ -2,6 +2,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
3
  import * as core from "../../../../core/index.js";
4
4
  import * as SarvamAI from "../../../index.js";
5
+ import type { ChatCompletionChunk } from "../../../types/ChatCompletionChunk.js";
5
6
  export declare namespace ChatClient {
6
7
  interface Options extends BaseClientOptions {
7
8
  }
@@ -12,6 +13,8 @@ export declare class ChatClient {
12
13
  protected readonly _options: NormalizedClientOptionsWithAuth<ChatClient.Options>;
13
14
  constructor(options?: ChatClient.Options);
14
15
  /**
16
+ * Create a chat completion. Supports both streaming and non-streaming modes.
17
+ *
15
18
  * @param {SarvamAI.ChatCompletionsRequest} request
16
19
  * @param {ChatClient.RequestOptions} requestOptions - Request-specific configuration.
17
20
  *
@@ -22,13 +25,47 @@ export declare class ChatClient {
22
25
  * @throws {@link SarvamAI.InternalServerError}
23
26
  *
24
27
  * @example
25
- * await client.chat.completions({
26
- * messages: [{
27
- * role: "assistant"
28
- * }],
28
+ * // Non-streaming
29
+ * const response = await client.chat.completions({
30
+ * messages: [{ role: "user", content: "Hello" }],
29
31
  * model: "sarvam-m"
30
- * })
32
+ * });
33
+ *
34
+ * @example
35
+ * // Streaming
36
+ * const stream = await client.chat.completions({
37
+ * messages: [{ role: "user", content: "Hello" }],
38
+ * model: "sarvam-m",
39
+ * stream: true
40
+ * });
41
+ * for await (const chunk of stream) {
42
+ * process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
43
+ * }
44
+ *
45
+ * @example
46
+ * // Tool calling
47
+ * const response = await client.chat.completions({
48
+ * messages: [{ role: "user", content: "What is the weather?" }],
49
+ * model: "sarvam-m",
50
+ * tools: [{
51
+ * type: "function",
52
+ * function: {
53
+ * name: "get_weather",
54
+ * description: "Get the weather",
55
+ * parameters: { type: "object", properties: { location: { type: "string" } } }
56
+ * }
57
+ * }]
58
+ * });
31
59
  */
32
- completions(request: SarvamAI.ChatCompletionsRequest, requestOptions?: ChatClient.RequestOptions): core.HttpResponsePromise<SarvamAI.CreateChatCompletionResponse>;
60
+ completions(request: SarvamAI.ChatCompletionsRequest & {
61
+ stream: true;
62
+ }, requestOptions?: ChatClient.RequestOptions): Promise<AsyncIterable<ChatCompletionChunk>>;
63
+ completions(request: SarvamAI.ChatCompletionsRequest & {
64
+ stream?: false | undefined;
65
+ }, requestOptions?: ChatClient.RequestOptions): core.HttpResponsePromise<SarvamAI.CreateChatCompletionResponse>;
66
+ completions(request: SarvamAI.ChatCompletionsRequest, requestOptions?: ChatClient.RequestOptions): core.HttpResponsePromise<SarvamAI.CreateChatCompletionResponse> | Promise<AsyncIterable<ChatCompletionChunk>>;
33
67
  private __completions;
68
+ private __completionsStream;
69
+ private _parseSSEStream;
70
+ private _throwStatusCodeError;
34
71
  }
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
5
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -42,10 +41,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
41
  step((generator = generator.apply(thisArg, _arguments || [])).next());
43
42
  });
44
43
  };
44
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
45
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
46
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
47
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
48
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
49
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
50
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
51
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
52
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
53
+ function fulfill(value) { resume("next", value); }
54
+ function reject(value) { resume("throw", value); }
55
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
56
+ };
45
57
  Object.defineProperty(exports, "__esModule", { value: true });
46
58
  exports.ChatClient = void 0;
47
59
  const BaseClient_js_1 = require("../../../../BaseClient.js");
48
60
  const headers_js_1 = require("../../../../core/headers.js");
61
+ const RawResponse_js_1 = require("../../../../core/fetcher/RawResponse.js");
49
62
  const core = __importStar(require("../../../../core/index.js"));
50
63
  const environments = __importStar(require("../../../../environments.js"));
51
64
  const errors = __importStar(require("../../../../errors/index.js"));
@@ -54,25 +67,10 @@ class ChatClient {
54
67
  constructor(options = {}) {
55
68
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
56
69
  }
57
- /**
58
- * @param {SarvamAI.ChatCompletionsRequest} request
59
- * @param {ChatClient.RequestOptions} requestOptions - Request-specific configuration.
60
- *
61
- * @throws {@link SarvamAI.BadRequestError}
62
- * @throws {@link SarvamAI.ForbiddenError}
63
- * @throws {@link SarvamAI.UnprocessableEntityError}
64
- * @throws {@link SarvamAI.TooManyRequestsError}
65
- * @throws {@link SarvamAI.InternalServerError}
66
- *
67
- * @example
68
- * await client.chat.completions({
69
- * messages: [{
70
- * role: "assistant"
71
- * }],
72
- * model: "sarvam-m"
73
- * })
74
- */
75
70
  completions(request, requestOptions) {
71
+ if (request.stream === true) {
72
+ return this.__completionsStream(request, requestOptions);
73
+ }
76
74
  return core.HttpResponsePromise.fromPromise(this.__completions(request, requestOptions));
77
75
  }
78
76
  __completions(request, requestOptions) {
@@ -101,24 +99,7 @@ class ChatClient {
101
99
  };
102
100
  }
103
101
  if (_response.error.reason === "status-code") {
104
- switch (_response.error.statusCode) {
105
- case 400:
106
- throw new SarvamAI.BadRequestError(_response.error.body, _response.rawResponse);
107
- case 403:
108
- throw new SarvamAI.ForbiddenError(_response.error.body, _response.rawResponse);
109
- case 422:
110
- throw new SarvamAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
111
- case 429:
112
- throw new SarvamAI.TooManyRequestsError(_response.error.body, _response.rawResponse);
113
- case 500:
114
- throw new SarvamAI.InternalServerError(_response.error.body, _response.rawResponse);
115
- default:
116
- throw new errors.SarvamAIError({
117
- statusCode: _response.error.statusCode,
118
- body: _response.error.body,
119
- rawResponse: _response.rawResponse,
120
- });
121
- }
102
+ this._throwStatusCodeError(_response.error.statusCode, _response.error.body, _response.rawResponse);
122
103
  }
123
104
  switch (_response.error.reason) {
124
105
  case "non-json":
@@ -142,5 +123,137 @@ class ChatClient {
142
123
  }
143
124
  });
144
125
  }
126
+ __completionsStream(request, requestOptions) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ var _a, _b, _c, _d, _e;
129
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
130
+ const _headers = {};
131
+ if (_authRequest.headers) {
132
+ for (const [key, value] of Object.entries(_authRequest.headers)) {
133
+ if (value != null) {
134
+ _headers[key] = String(value);
135
+ }
136
+ }
137
+ }
138
+ if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers) {
139
+ for (const [key, value] of Object.entries(this._options.headers)) {
140
+ if (value != null) {
141
+ _headers[key] = String(value);
142
+ }
143
+ }
144
+ }
145
+ if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers) {
146
+ for (const [key, value] of Object.entries(requestOptions.headers)) {
147
+ if (value != null) {
148
+ _headers[key] = String(value);
149
+ }
150
+ }
151
+ }
152
+ _headers["Content-Type"] = "application/json";
153
+ _headers["Accept"] = "text/event-stream";
154
+ const baseUrl = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SarvamAIEnvironment.Production).base;
155
+ const url = core.url.join(baseUrl, "v1/chat/completions");
156
+ const fetchFn = (_e = (_d = this._options) === null || _d === void 0 ? void 0 : _d.fetch) !== null && _e !== void 0 ? _e : (typeof fetch !== "undefined" ? fetch : undefined);
157
+ if (!fetchFn) {
158
+ throw new Error("No fetch function available. Please provide a fetch function in client options.");
159
+ }
160
+ const response = yield fetchFn(url, {
161
+ method: "POST",
162
+ headers: _headers,
163
+ body: JSON.stringify(request),
164
+ signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
165
+ });
166
+ if (!response.ok) {
167
+ let errorBody;
168
+ try {
169
+ errorBody = yield response.json();
170
+ }
171
+ catch (_f) {
172
+ errorBody = yield response.text();
173
+ }
174
+ this._throwStatusCodeError(response.status, errorBody, (0, RawResponse_js_1.toRawResponse)(response));
175
+ }
176
+ if (!response.body) {
177
+ throw new errors.SarvamAIError({
178
+ message: "Response body is null for streaming request.",
179
+ });
180
+ }
181
+ return this._parseSSEStream(response.body);
182
+ });
183
+ }
184
+ _parseSSEStream(body) {
185
+ return __asyncGenerator(this, arguments, function* _parseSSEStream_1() {
186
+ var _a;
187
+ const reader = body.getReader();
188
+ const decoder = new TextDecoder();
189
+ let buffer = "";
190
+ try {
191
+ while (true) {
192
+ const { done, value } = yield __await(reader.read());
193
+ if (done)
194
+ break;
195
+ buffer += decoder.decode(value, { stream: true });
196
+ const lines = buffer.split("\n");
197
+ buffer = (_a = lines.pop()) !== null && _a !== void 0 ? _a : "";
198
+ for (const line of lines) {
199
+ const trimmed = line.trim();
200
+ if (!trimmed)
201
+ continue;
202
+ if (trimmed.startsWith("data: ")) {
203
+ const dataStr = trimmed.slice(6);
204
+ if (dataStr.trim() === "[DONE]") {
205
+ return yield __await(void 0);
206
+ }
207
+ try {
208
+ const chunk = JSON.parse(dataStr);
209
+ yield yield __await(chunk);
210
+ }
211
+ catch (_b) {
212
+ continue;
213
+ }
214
+ }
215
+ }
216
+ }
217
+ if (buffer.trim()) {
218
+ const trimmed = buffer.trim();
219
+ if (trimmed.startsWith("data: ")) {
220
+ const dataStr = trimmed.slice(6);
221
+ if (dataStr.trim() !== "[DONE]") {
222
+ try {
223
+ const chunk = JSON.parse(dataStr);
224
+ yield yield __await(chunk);
225
+ }
226
+ catch (_c) {
227
+ // ignore parse errors
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
233
+ finally {
234
+ reader.releaseLock();
235
+ }
236
+ });
237
+ }
238
+ _throwStatusCodeError(statusCode, body, rawResponse) {
239
+ switch (statusCode) {
240
+ case 400:
241
+ throw new SarvamAI.BadRequestError(body, rawResponse);
242
+ case 403:
243
+ throw new SarvamAI.ForbiddenError(body, rawResponse);
244
+ case 422:
245
+ throw new SarvamAI.UnprocessableEntityError(body, rawResponse);
246
+ case 429:
247
+ throw new SarvamAI.TooManyRequestsError(body, rawResponse);
248
+ case 500:
249
+ throw new SarvamAI.InternalServerError(body, rawResponse);
250
+ default:
251
+ throw new errors.SarvamAIError({
252
+ statusCode,
253
+ body,
254
+ rawResponse,
255
+ });
256
+ }
257
+ }
145
258
  }
146
259
  exports.ChatClient = ChatClient;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Specifies the language of the input audio in BCP-47 format.
3
3
  *
4
- * **Available Options (saarika:v2.5):**
4
+ * **Available Options (saarika:v2.5, legacy):**
5
5
  * - `unknown` (default): Use when the language is not known; the API will auto-detect.
6
6
  * - `hi-IN`: Hindi
7
7
  * - `bn-IN`: Bengali
@@ -15,7 +15,7 @@
15
15
  * - `te-IN`: Telugu
16
16
  * - `en-IN`: English
17
17
  *
18
- * **Additional Options (saaras:v3 only):**
18
+ * **Additional Options (saaras:v3, recommended):**
19
19
  * - `as-IN`: Assamese
20
20
  * - `ur-IN`: Urdu
21
21
  * - `ne-IN`: Nepali
@@ -5,7 +5,7 @@ exports.SpeechToTextStreamingLanguageCode = void 0;
5
5
  /**
6
6
  * Specifies the language of the input audio in BCP-47 format.
7
7
  *
8
- * **Available Options (saarika:v2.5):**
8
+ * **Available Options (saarika:v2.5, legacy):**
9
9
  * - `unknown` (default): Use when the language is not known; the API will auto-detect.
10
10
  * - `hi-IN`: Hindi
11
11
  * - `bn-IN`: Bengali
@@ -19,7 +19,7 @@ exports.SpeechToTextStreamingLanguageCode = void 0;
19
19
  * - `te-IN`: Telugu
20
20
  * - `en-IN`: English
21
21
  *
22
- * **Additional Options (saaras:v3 only):**
22
+ * **Additional Options (saaras:v3, recommended):**
23
23
  * - `as-IN`: Assamese
24
24
  * - `ur-IN`: Urdu
25
25
  * - `ne-IN`: Nepali
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Specifies the model to use for speech-to-text conversion.
3
3
  *
4
- * - **saarika:v2.5** (default): Transcribes audio in the spoken language.
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:v3**: State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
6
+ * - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
7
7
  */
8
8
  export declare const SpeechToTextStreamingModel: {
9
- readonly SaarikaV25: "saarika:v2.5";
10
9
  readonly SaarasV3: "saaras:v3";
10
+ readonly SaarikaV25: "saarika:v2.5";
11
11
  };
12
12
  export type SpeechToTextStreamingModel = (typeof SpeechToTextStreamingModel)[keyof typeof SpeechToTextStreamingModel];
@@ -5,11 +5,11 @@ exports.SpeechToTextStreamingModel = void 0;
5
5
  /**
6
6
  * Specifies the model to use for speech-to-text conversion.
7
7
  *
8
- * - **saarika:v2.5** (default): Transcribes audio in the spoken language.
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:v3**: State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.
10
+ * - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.
11
11
  */
12
12
  exports.SpeechToTextStreamingModel = {
13
- SaarikaV25: "saarika:v2.5",
14
13
  SaarasV3: "saaras:v3",
14
+ SaarikaV25: "saarika:v2.5",
15
15
  };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Mode of operation. **Only applicable when using saaras:v3 model.**
3
+ *
4
+ * - **translate** (default): Translates speech from any supported Indic language to English.
5
+ * - Example: Hindi audio → English text output
6
+ *
7
+ * - **transcribe**: Standard transcription in the original language.
8
+ *
9
+ * - **verbatim**: Exact word-for-word transcription without normalization.
10
+ *
11
+ * - **translit**: Romanization - Transliterates speech to Latin/Roman script only.
12
+ *
13
+ * - **codemix**: Code-mixed text with English words in English and Indic words in native script.
14
+ */
15
+ export declare const SpeechToTextTranslateStreamingMode: {
16
+ readonly Translate: "translate";
17
+ readonly Transcribe: "transcribe";
18
+ readonly Verbatim: "verbatim";
19
+ readonly Translit: "translit";
20
+ readonly Codemix: "codemix";
21
+ };
22
+ export type SpeechToTextTranslateStreamingMode = (typeof SpeechToTextTranslateStreamingMode)[keyof typeof SpeechToTextTranslateStreamingMode];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SpeechToTextTranslateStreamingMode = void 0;
5
+ /**
6
+ * Mode of operation. **Only applicable when using saaras:v3 model.**
7
+ *
8
+ * - **translate** (default): Translates speech from any supported Indic language to English.
9
+ * - Example: Hindi audio → English text output
10
+ *
11
+ * - **transcribe**: Standard transcription in the original language.
12
+ *
13
+ * - **verbatim**: Exact word-for-word transcription without normalization.
14
+ *
15
+ * - **translit**: Romanization - Transliterates speech to Latin/Roman script only.
16
+ *
17
+ * - **codemix**: Code-mixed text with English words in English and Indic words in native script.
18
+ */
19
+ exports.SpeechToTextTranslateStreamingMode = {
20
+ Translate: "translate",
21
+ Transcribe: "transcribe",
22
+ Verbatim: "verbatim",
23
+ Translit: "translit",
24
+ Codemix: "codemix",
25
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Model to be used for speech to text translation.
3
+ *
4
+ * - **saaras:v3** (default, recommended): State-of-the-art translation model that translates audio from any spoken Indic language to English with flexible output formats via the `mode` parameter.
5
+ *
6
+ * - **saaras:v2.5** (legacy): Translation model that translates audio from any spoken Indic language to English. Kept for backward compatibility.
7
+ * - Example: Hindi audio → English text output
8
+ */
9
+ export declare const SpeechToTextTranslateStreamingModel: {
10
+ readonly SaarasV3: "saaras:v3";
11
+ readonly SaarasV25: "saaras:v2.5";
12
+ };
13
+ export type SpeechToTextTranslateStreamingModel = (typeof SpeechToTextTranslateStreamingModel)[keyof typeof SpeechToTextTranslateStreamingModel];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SpeechToTextTranslateStreamingModel = void 0;
5
+ /**
6
+ * Model to be used for speech to text translation.
7
+ *
8
+ * - **saaras:v3** (default, recommended): State-of-the-art translation model that translates audio from any spoken Indic language to English with flexible output formats via the `mode` parameter.
9
+ *
10
+ * - **saaras:v2.5** (legacy): Translation model that translates audio from any spoken Indic language to English. Kept for backward compatibility.
11
+ * - Example: Hindi audio → English text output
12
+ */
13
+ exports.SpeechToTextTranslateStreamingModel = {
14
+ SaarasV3: "saaras:v3",
15
+ SaarasV25: "saaras:v2.5",
16
+ };
@@ -1,4 +1,6 @@
1
1
  export * from "./SpeechToTextTranslateStreamingFlushSignal.js";
2
2
  export * from "./SpeechToTextTranslateStreamingHighVadSensitivity.js";
3
3
  export * from "./SpeechToTextTranslateStreamingInputAudioCodec.js";
4
+ export * from "./SpeechToTextTranslateStreamingMode.js";
5
+ export * from "./SpeechToTextTranslateStreamingModel.js";
4
6
  export * from "./SpeechToTextTranslateStreamingVadSignals.js";
@@ -17,4 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./SpeechToTextTranslateStreamingFlushSignal.js"), exports);
18
18
  __exportStar(require("./SpeechToTextTranslateStreamingHighVadSensitivity.js"), exports);
19
19
  __exportStar(require("./SpeechToTextTranslateStreamingInputAudioCodec.js"), exports);
20
+ __exportStar(require("./SpeechToTextTranslateStreamingMode.js"), exports);
21
+ __exportStar(require("./SpeechToTextTranslateStreamingModel.js"), exports);
20
22
  __exportStar(require("./SpeechToTextTranslateStreamingVadSignals.js"), exports);
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Text to speech model to use.
3
3
  * - **bulbul:v2** (default): Standard TTS model with pitch/loudness support
4
- * - **bulbul:v3-beta**: Advanced model with temperature control (no pitch/loudness)
4
+ * - **bulbul:v3**: Advanced model with temperature control (no pitch/loudness)
5
5
  */
6
6
  export declare const TextToSpeechStreamingModel: {
7
7
  readonly BulbulV2: "bulbul:v2";
8
- readonly BulbulV3Beta: "bulbul:v3-beta";
8
+ readonly BulbulV3: "bulbul:v3";
9
9
  };
10
10
  export type TextToSpeechStreamingModel = (typeof TextToSpeechStreamingModel)[keyof typeof TextToSpeechStreamingModel];
@@ -5,9 +5,9 @@ exports.TextToSpeechStreamingModel = void 0;
5
5
  /**
6
6
  * Text to speech model to use.
7
7
  * - **bulbul:v2** (default): Standard TTS model with pitch/loudness support
8
- * - **bulbul:v3-beta**: Advanced model with temperature control (no pitch/loudness)
8
+ * - **bulbul:v3**: Advanced model with temperature control (no pitch/loudness)
9
9
  */
10
10
  exports.TextToSpeechStreamingModel = {
11
11
  BulbulV2: "bulbul:v2",
12
- BulbulV3Beta: "bulbul:v3-beta",
12
+ BulbulV3: "bulbul:v3",
13
13
  };
@@ -0,0 +1,15 @@
1
+ import type { ChunkChoice } from "./ChunkChoice.js";
2
+ export interface ChatCompletionChunk {
3
+ id: string;
4
+ choices: ChunkChoice[];
5
+ created: number;
6
+ model: string;
7
+ object: "chat.completion.chunk";
8
+ service_tier?: string | null;
9
+ system_fingerprint?: string | null;
10
+ usage?: {
11
+ completion_tokens: number;
12
+ prompt_tokens: number;
13
+ total_tokens: number;
14
+ } | null;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import type { ChoiceDeltaToolCall } from "./ChoiceDeltaToolCall.js";
2
+ export interface ChoiceDelta {
3
+ content?: string | null;
4
+ refusal?: string | null;
5
+ reasoning_content?: string | null;
6
+ role?: string | null;
7
+ function_call?: Record<string, unknown> | null;
8
+ tool_calls?: ChoiceDeltaToolCall[] | null;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ export interface ChoiceDeltaToolCallFunction {
2
+ name?: string;
3
+ arguments?: string;
4
+ }
5
+ export interface ChoiceDeltaToolCall {
6
+ index: number;
7
+ id?: string;
8
+ type?: "function";
9
+ function?: ChoiceDeltaToolCallFunction;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import type { ChoiceDelta } from "./ChoiceDelta.js";
2
+ export interface ChunkChoice {
3
+ delta: ChoiceDelta;
4
+ finish_reason: string | null;
5
+ index: number;
6
+ logprobs?: Record<string, unknown> | null;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });