sarvamai 1.1.11 → 1.1.12

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 (124) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +5 -0
  4. package/dist/cjs/api/resources/chat/client/requests/CreateChatCompletionV2Request.d.ts +7 -4
  5. package/dist/cjs/api/resources/docAi/client/Client.d.ts +1 -2
  6. package/dist/cjs/api/resources/docAi/client/Client.js +2 -9
  7. package/dist/cjs/api/resources/docAi/client/requests/DocAiDigitiseRequest.d.ts +1 -10
  8. package/dist/cjs/api/resources/docAi/client/requests/DocAiDigitiseRequest.js +0 -6
  9. package/dist/cjs/api/resources/docAi/client/requests/DocAiExtractRequest.d.ts +0 -3
  10. package/dist/cjs/api/resources/docAi/client/requests/DocAiGetResultsRequest.d.ts +3 -2
  11. package/dist/cjs/api/resources/docAi/types/Format.d.ts +6 -0
  12. package/dist/cjs/api/resources/docAi/types/Format.js +9 -0
  13. package/dist/cjs/api/resources/docAi/types/index.d.ts +1 -0
  14. package/dist/cjs/api/resources/docAi/types/index.js +1 -0
  15. package/dist/cjs/api/resources/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/index.js +3 -1
  17. package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateRequest.d.ts +2 -2
  18. package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.ts +2 -2
  19. package/dist/cjs/api/resources/voiceCloning/client/Client.d.ts +45 -12
  20. package/dist/cjs/api/resources/voiceCloning/client/Client.js +138 -14
  21. package/dist/cjs/api/resources/voiceCloning/client/requests/{VoiceCloningTextToSpeechRequest.d.ts → VoiceCloningRequest.d.ts} +12 -3
  22. package/dist/cjs/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.d.ts +60 -0
  23. package/dist/cjs/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.js +3 -0
  24. package/dist/cjs/api/resources/voiceCloning/client/requests/index.d.ts +2 -1
  25. package/dist/cjs/api/resources/voiceCloningStreaming/client/Client.d.ts +24 -0
  26. package/dist/cjs/api/resources/voiceCloningStreaming/client/Client.js +75 -0
  27. package/dist/cjs/api/resources/voiceCloningStreaming/client/Socket.d.ts +52 -0
  28. package/dist/cjs/api/resources/voiceCloningStreaming/client/Socket.js +162 -0
  29. package/dist/cjs/api/resources/voiceCloningStreaming/client/index.d.ts +1 -0
  30. package/dist/cjs/api/resources/voiceCloningStreaming/client/index.js +2 -0
  31. package/dist/cjs/api/resources/voiceCloningStreaming/exports.d.ts +2 -0
  32. package/dist/cjs/api/resources/voiceCloningStreaming/exports.js +21 -0
  33. package/dist/cjs/api/resources/voiceCloningStreaming/index.d.ts +2 -0
  34. package/dist/cjs/api/resources/voiceCloningStreaming/index.js +18 -0
  35. package/dist/cjs/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.d.ts +6 -0
  36. package/dist/cjs/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.js +9 -0
  37. package/dist/cjs/api/resources/voiceCloningStreaming/types/index.d.ts +1 -0
  38. package/dist/cjs/api/resources/voiceCloningStreaming/types/index.js +17 -0
  39. package/dist/cjs/api/types/Choice.d.ts +1 -1
  40. package/dist/cjs/api/types/CreateResponseV2Request.d.ts +2 -2
  41. package/dist/cjs/api/types/ReasoningEffort.d.ts +1 -1
  42. package/dist/cjs/api/types/ReasoningEffort.js +1 -1
  43. package/dist/cjs/api/types/ResponseReasoning.d.ts +1 -1
  44. package/dist/cjs/api/types/ResponseReasoningEffort.d.ts +1 -1
  45. package/dist/cjs/api/types/ResponseReasoningEffort.js +1 -1
  46. package/dist/cjs/api/types/ResponsesModelIds.d.ts +2 -2
  47. package/dist/cjs/api/types/ResponsesModelIds.js +2 -2
  48. package/dist/cjs/api/types/V2ModelIds.d.ts +2 -2
  49. package/dist/cjs/api/types/V2ModelIds.js +2 -2
  50. package/dist/cjs/api/types/VoiceCloningConfigureConnection.d.ts +98 -0
  51. package/dist/cjs/api/types/VoiceCloningConfigureConnection.js +47 -0
  52. package/dist/cjs/api/types/VoiceCloningResponse.d.ts +3 -1
  53. package/dist/cjs/api/types/VoiceCloningSendText.d.ts +10 -0
  54. package/dist/cjs/api/types/VoiceCloningSendText.js +3 -0
  55. package/dist/cjs/api/types/VoiceCloningStreamCodec.d.ts +9 -0
  56. package/dist/cjs/api/types/VoiceCloningStreamCodec.js +12 -0
  57. package/dist/cjs/api/types/index.d.ts +3 -0
  58. package/dist/cjs/api/types/index.js +3 -0
  59. package/dist/cjs/version.d.ts +1 -1
  60. package/dist/cjs/version.js +1 -1
  61. package/dist/esm/BaseClient.mjs +2 -2
  62. package/dist/esm/Client.d.mts +3 -0
  63. package/dist/esm/Client.mjs +5 -0
  64. package/dist/esm/api/resources/chat/client/requests/CreateChatCompletionV2Request.d.mts +7 -4
  65. package/dist/esm/api/resources/docAi/client/Client.d.mts +1 -2
  66. package/dist/esm/api/resources/docAi/client/Client.mjs +2 -9
  67. package/dist/esm/api/resources/docAi/client/requests/DocAiDigitiseRequest.d.mts +1 -10
  68. package/dist/esm/api/resources/docAi/client/requests/DocAiDigitiseRequest.mjs +0 -6
  69. package/dist/esm/api/resources/docAi/client/requests/DocAiExtractRequest.d.mts +0 -3
  70. package/dist/esm/api/resources/docAi/client/requests/DocAiGetResultsRequest.d.mts +3 -2
  71. package/dist/esm/api/resources/docAi/types/Format.d.mts +6 -0
  72. package/dist/esm/api/resources/docAi/types/Format.mjs +6 -0
  73. package/dist/esm/api/resources/docAi/types/index.d.mts +1 -0
  74. package/dist/esm/api/resources/docAi/types/index.mjs +1 -0
  75. package/dist/esm/api/resources/index.d.mts +2 -0
  76. package/dist/esm/api/resources/index.mjs +2 -0
  77. package/dist/esm/api/resources/responses/client/requests/ResponsesCreateRequest.d.mts +2 -2
  78. package/dist/esm/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.mts +2 -2
  79. package/dist/esm/api/resources/voiceCloning/client/Client.d.mts +45 -12
  80. package/dist/esm/api/resources/voiceCloning/client/Client.mjs +138 -14
  81. package/dist/esm/api/resources/voiceCloning/client/requests/{VoiceCloningTextToSpeechRequest.d.mts → VoiceCloningRequest.d.mts} +12 -3
  82. package/dist/esm/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.d.mts +60 -0
  83. package/dist/esm/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.mjs +2 -0
  84. package/dist/esm/api/resources/voiceCloning/client/requests/index.d.mts +2 -1
  85. package/dist/esm/api/resources/voiceCloningStreaming/client/Client.d.mts +24 -0
  86. package/dist/esm/api/resources/voiceCloningStreaming/client/Client.mjs +38 -0
  87. package/dist/esm/api/resources/voiceCloningStreaming/client/Socket.d.mts +52 -0
  88. package/dist/esm/api/resources/voiceCloningStreaming/client/Socket.mjs +125 -0
  89. package/dist/esm/api/resources/voiceCloningStreaming/client/index.d.mts +1 -0
  90. package/dist/esm/api/resources/voiceCloningStreaming/client/index.mjs +1 -0
  91. package/dist/esm/api/resources/voiceCloningStreaming/exports.d.mts +2 -0
  92. package/dist/esm/api/resources/voiceCloningStreaming/exports.mjs +3 -0
  93. package/dist/esm/api/resources/voiceCloningStreaming/index.d.mts +2 -0
  94. package/dist/esm/api/resources/voiceCloningStreaming/index.mjs +2 -0
  95. package/dist/esm/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.d.mts +6 -0
  96. package/dist/esm/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.mjs +6 -0
  97. package/dist/esm/api/resources/voiceCloningStreaming/types/index.d.mts +1 -0
  98. package/dist/esm/api/resources/voiceCloningStreaming/types/index.mjs +1 -0
  99. package/dist/esm/api/types/Choice.d.mts +1 -1
  100. package/dist/esm/api/types/CreateResponseV2Request.d.mts +2 -2
  101. package/dist/esm/api/types/ReasoningEffort.d.mts +1 -1
  102. package/dist/esm/api/types/ReasoningEffort.mjs +1 -1
  103. package/dist/esm/api/types/ResponseReasoning.d.mts +1 -1
  104. package/dist/esm/api/types/ResponseReasoningEffort.d.mts +1 -1
  105. package/dist/esm/api/types/ResponseReasoningEffort.mjs +1 -1
  106. package/dist/esm/api/types/ResponsesModelIds.d.mts +2 -2
  107. package/dist/esm/api/types/ResponsesModelIds.mjs +2 -2
  108. package/dist/esm/api/types/V2ModelIds.d.mts +2 -2
  109. package/dist/esm/api/types/V2ModelIds.mjs +2 -2
  110. package/dist/esm/api/types/VoiceCloningConfigureConnection.d.mts +98 -0
  111. package/dist/esm/api/types/VoiceCloningConfigureConnection.mjs +44 -0
  112. package/dist/esm/api/types/VoiceCloningResponse.d.mts +3 -1
  113. package/dist/esm/api/types/VoiceCloningSendText.d.mts +10 -0
  114. package/dist/esm/api/types/VoiceCloningSendText.mjs +2 -0
  115. package/dist/esm/api/types/VoiceCloningStreamCodec.d.mts +9 -0
  116. package/dist/esm/api/types/VoiceCloningStreamCodec.mjs +9 -0
  117. package/dist/esm/api/types/index.d.mts +3 -0
  118. package/dist/esm/api/types/index.mjs +3 -0
  119. package/dist/esm/version.d.mts +1 -1
  120. package/dist/esm/version.mjs +1 -1
  121. package/package.json +13 -1
  122. package/reference.md +105 -18
  123. /package/dist/cjs/api/resources/voiceCloning/client/requests/{VoiceCloningTextToSpeechRequest.js → VoiceCloningRequest.js} +0 -0
  124. /package/dist/esm/api/resources/voiceCloning/client/requests/{VoiceCloningTextToSpeechRequest.mjs → VoiceCloningRequest.mjs} +0 -0
@@ -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.11",
47
- "User-Agent": "sarvamai/1.1.11",
46
+ "X-Fern-SDK-Version": "1.1.12",
47
+ "User-Agent": "sarvamai/1.1.12",
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);
@@ -16,6 +16,7 @@ import { TextClient } from "./api/resources/text/client/Client.js";
16
16
  import { TextToSpeechClient } from "./api/resources/textToSpeech/client/Client.js";
17
17
  import { TextToSpeechStreamingClient } from "./api/resources/textToSpeechStreaming/client/Client.js";
18
18
  import { VoiceCloningClient } from "./api/resources/voiceCloning/client/Client.js";
19
+ import { VoiceCloningStreamingClient } from "./api/resources/voiceCloningStreaming/client/Client.js";
19
20
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
20
21
  import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
21
22
  export declare namespace SarvamAIClient {
@@ -43,6 +44,7 @@ export declare class SarvamAIClient {
43
44
  protected _speechToTextTranslateStreaming: SpeechToTextTranslateStreamingClient | undefined;
44
45
  protected _speechToTextRealtimeStreaming: SpeechToTextRealtimeStreamingClient | undefined;
45
46
  protected _textToSpeechStreaming: TextToSpeechStreamingClient | undefined;
47
+ protected _voiceCloningStreaming: VoiceCloningStreamingClient | undefined;
46
48
  constructor(options?: SarvamAIClient.Options);
47
49
  get dubbing(): DubbingClient;
48
50
  get documentTranslation(): DocumentTranslationClient;
@@ -62,4 +64,5 @@ export declare class SarvamAIClient {
62
64
  get speechToTextTranslateStreaming(): SpeechToTextTranslateStreamingClient;
63
65
  get speechToTextRealtimeStreaming(): SpeechToTextRealtimeStreamingClient;
64
66
  get textToSpeechStreaming(): TextToSpeechStreamingClient;
67
+ get voiceCloningStreaming(): VoiceCloningStreamingClient;
65
68
  }
@@ -20,6 +20,7 @@ const Client_js_15 = require("./api/resources/text/client/Client.js");
20
20
  const Client_js_16 = require("./api/resources/textToSpeech/client/Client.js");
21
21
  const Client_js_17 = require("./api/resources/textToSpeechStreaming/client/Client.js");
22
22
  const Client_js_18 = require("./api/resources/voiceCloning/client/Client.js");
23
+ const Client_js_19 = require("./api/resources/voiceCloningStreaming/client/Client.js");
23
24
  const BaseClient_js_1 = require("./BaseClient.js");
24
25
  class SarvamAIClient {
25
26
  constructor(options = {}) {
@@ -97,5 +98,9 @@ class SarvamAIClient {
97
98
  var _a;
98
99
  return ((_a = this._textToSpeechStreaming) !== null && _a !== void 0 ? _a : (this._textToSpeechStreaming = new Client_js_17.TextToSpeechStreamingClient(this._options)));
99
100
  }
101
+ get voiceCloningStreaming() {
102
+ var _a;
103
+ return ((_a = this._voiceCloningStreaming) !== null && _a !== void 0 ? _a : (this._voiceCloningStreaming = new Client_js_19.VoiceCloningStreamingClient(this._options)));
104
+ }
100
105
  }
101
106
  exports.SarvamAIClient = SarvamAIClient;
@@ -2,6 +2,7 @@ import type * as SarvamAI from "../../../../index.js";
2
2
  /**
3
3
  * @example
4
4
  * {
5
+ * "x-session-affinity": "3f9c2b1e-7a4d-4e8b-9c1a-2d5e6f7a8b9c",
5
6
  * messages: [{
6
7
  * role: "user",
7
8
  * content: "Summarise the causes of the 2008 financial crisis."
@@ -10,6 +11,8 @@ import type * as SarvamAI from "../../../../index.js";
10
11
  * }
11
12
  */
12
13
  export interface CreateChatCompletionV2Request {
14
+ /** Optional session ID for a multi-turn conversation. Send the same value on every turn of a conversation so the turns are routed together and can reuse cached prompt context, which lowers latency on later turns. Use a new value for each conversation. The ID is scoped to your API subscription and is never shared with other customers. Use an opaque value such as a UUID, and do not put personal data in it. Requests without this header are unaffected. */
15
+ "x-session-affinity"?: string;
13
16
  /** Non-empty conversation history. Roles: `system`, `developer`, `user`, `assistant`, `tool`. Content is a string or an array of parts (`text`, `image_url`). Images must use inline `data:image/…;base64,…` URLs — remote HTTP(S) image URLs are rejected. */
14
17
  messages: SarvamAI.ChatCompletionRequestMessage[];
15
18
  model: SarvamAI.V2ModelIds;
@@ -17,7 +20,7 @@ export interface CreateChatCompletionV2Request {
17
20
  temperature?: number;
18
21
  /** Nucleus sampling: greater than `0` and at most `1`. On `glm5.3`, `top_p: 0` is rejected. Prefer changing either `top_p` or `temperature`, not both. */
19
22
  top_p?: number;
20
- /** On reasoning models (`glm5.3`, `deepseekv4-flash`): **`low`**, **`high`**, or **`max`**. Default when omitted is **`max`** — omit this field or set **`max`** for maximum reasoning. Trace in `message.reasoning_content`; billed as completion tokens and counts toward `max_tokens`. Ignored on non-reasoning models such as `gemma4`. */
23
+ /** On reasoning models (`glm5.3`, `deepseekv4.1-flash`): **`low`**, **`high`**, or **`max`**. Default when omitted is **`max`** — omit this field or set **`max`** for maximum reasoning. Trace in `message.reasoning_content`; billed as completion tokens and counts toward `max_tokens`. Ignored on non-reasoning models such as `gemma4`. */
21
24
  reasoning_effort?: SarvamAI.ReasoningEffort;
22
25
  /** Maximum tokens to generate in the completion, including reasoning tokens on reasoning models. Default `2048`. Set explicitly when you need longer answers — a low limit can yield `finish_reason: "length"` with little or no visible `content` if reasoning consumes the budget. */
23
26
  max_tokens?: number;
@@ -54,12 +57,12 @@ export interface CreateChatCompletionV2Request {
54
57
  min_p?: number;
55
58
  /** Repetition penalty. Must be greater than 0 and at most 2. `0` and values above 2 are `400`. */
56
59
  repetition_penalty?: number;
57
- /** **`false`** is correctly enforced (a single tool call) on **`gemma4`** and **`deepseekv4-flash`**. On **`glm5.3`** and **`sarvam-105b`**, **`false`** is accepted without error but is **not** enforced — the model may still return multiple tool calls in one turn. */
60
+ /** **`false`** is correctly enforced (a single tool call) on **`gemma4`** and **`deepseekv4.1-flash`**. On **`glm5.3`** and **`sarvam-105b`**, **`false`** is accepted without error but is **not** enforced — the model may still return multiple tool calls in one turn. */
58
61
  parallel_tool_calls?: boolean;
59
62
  /** Only valid with `stream: true` (otherwise `400`). Must be a top-level field, not inside `extra_body`. Use `{"include_usage": true}` to receive token usage in the final SSE chunk. */
60
63
  stream_options?: SarvamAI.ChatStreamOptions;
61
- /** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`** and **`gemma4`**. Not supported on **`glm5.3`** (`400` if enabled) or **`deepseekv4-flash`** (returns `503 model_overloaded` instead of a clean rejection — omit this field for that model). */
64
+ /** If `true`, return log probabilities for output tokens (use with `top_logprobs`). Supported on **`sarvam-105b`** and **`gemma4`**. Not supported on **`glm5.3`** (`400` if enabled) or **`deepseekv4.1-flash`** (returns `503 model_overloaded` instead of a clean rejection — omit this field for that model). */
62
65
  logprobs?: boolean;
63
- /** How many top token log probabilities to return at each position when `logprobs` is `true` (otherwise **`400`**). Same model support as `logprobs`: works on `sarvam-105b` and `gemma4`; on `glm5.3` and `deepseekv4-flash`, omit entirely — do not send `0`, since many SDKs add it by default. */
66
+ /** How many top token log probabilities to return at each position when `logprobs` is `true` (otherwise **`400`**). Same model support as `logprobs`: works on `sarvam-105b` and `gemma4`; on `glm5.3` and `deepseekv4.1-flash`, omit entirely — do not send `0`, since many SDKs add it by default. */
64
67
  top_logprobs?: number;
65
68
  }
@@ -84,7 +84,6 @@ export declare class DocAiClient {
84
84
  * import { createReadStream } from "fs";
85
85
  * await client.docAi.extract({
86
86
  * schema: "{\"type\":\"object\",\"properties\":{\"policy_number\":{\"type\":\"string\",\"description\":\"Insurance policy number\"},\"insured_name\":{\"type\":\"string\",\"description\":\"Name of the insured person\"},\"sum_insured\":{\"type\":\"number\",\"description\":\"Total sum insured, in INR\"}}}",
87
- * language: "en-IN",
88
87
  * output_format: "json"
89
88
  * })
90
89
  */
@@ -112,7 +111,7 @@ export declare class DocAiClient {
112
111
  *
113
112
  * **Extract results** include `job_id`, `type`, `status`, `usage`, `result`, `annotations` and `version`. `annotations` mirrors the result shape; every leaf has `confidence` and `sources`.
114
113
  *
115
- * @param {string} job_id - The unique identifier of the job
114
+ * @param {string} job_id - The unique identifier of the job.
116
115
  * @param {SarvamAI.DocAiGetResultsRequest} request
117
116
  * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
118
117
  *
@@ -166,9 +166,6 @@ class DocAiClient {
166
166
  if (request.language != null) {
167
167
  _body.append("language", request.language);
168
168
  }
169
- if (request.output_format != null) {
170
- _body.append("output_format", request.output_format);
171
- }
172
169
  if (request.content_type != null) {
173
170
  _body.append("content_type", request.content_type);
174
171
  }
@@ -245,7 +242,6 @@ class DocAiClient {
245
242
  * import { createReadStream } from "fs";
246
243
  * await client.docAi.extract({
247
244
  * schema: "{\"type\":\"object\",\"properties\":{\"policy_number\":{\"type\":\"string\",\"description\":\"Insurance policy number\"},\"insured_name\":{\"type\":\"string\",\"description\":\"Name of the insured person\"},\"sum_insured\":{\"type\":\"number\",\"description\":\"Total sum insured, in INR\"}}}",
248
- * language: "en-IN",
249
245
  * output_format: "json"
250
246
  * })
251
247
  */
@@ -270,9 +266,6 @@ class DocAiClient {
270
266
  if (request.config_id != null) {
271
267
  _body.append("config_id", request.config_id);
272
268
  }
273
- if (request.language != null) {
274
- _body.append("language", request.language);
275
- }
276
269
  if (request.output_format != null) {
277
270
  _body.append("output_format", request.output_format);
278
271
  }
@@ -384,7 +377,7 @@ class DocAiClient {
384
377
  *
385
378
  * **Extract results** include `job_id`, `type`, `status`, `usage`, `result`, `annotations` and `version`. `annotations` mirrors the result shape; every leaf has `confidence` and `sources`.
386
379
  *
387
- * @param {string} job_id - The unique identifier of the job
380
+ * @param {string} job_id - The unique identifier of the job.
388
381
  * @param {SarvamAI.DocAiGetResultsRequest} request
389
382
  * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
390
383
  *
@@ -409,7 +402,7 @@ class DocAiClient {
409
402
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
410
403
  const { format } = request;
411
404
  const _queryParams = {
412
- format,
405
+ format: format != null ? format : undefined,
413
406
  };
414
407
  const _authRequest = yield this._options.authProvider.getAuthRequest();
415
408
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -8,23 +8,14 @@ export interface DocAiDigitiseRequest {
8
8
  file?: core.file.Uploadable[] | undefined;
9
9
  /** Comma-separated upload IDs returned by `POST /doc-ai/v1/job/upload`. Exactly one of `file` and `upload_ids` must be provided. */
10
10
  upload_ids?: string;
11
- /** Language code of the document (BCP-47), e.g. `en-IN`, `hi-IN`. */
11
+ /** Language of the document in BCP-47 format (e.g. `hi-IN`, `en-IN`). Defaults to Indic: when omitted, the document is processed as an Indic-language document. To process an English document, set `language` to `en-IN`. Sarvam Vision supports 22 Indian languages plus English; see the [Sarvam Vision model page](/api/getting-started/models/sarvam-vision) for the full list. */
12
12
  language?: string;
13
- /** Output format of the digitised document. */
14
- output_format?: DocAiDigitiseRequest.OutputFormat;
15
13
  /** Nature of the document content. */
16
14
  content_type?: DocAiDigitiseRequest.ContentType;
17
15
  /** Model to use for digitisation. */
18
16
  model?: string;
19
17
  }
20
18
  export declare namespace DocAiDigitiseRequest {
21
- /** Output format of the digitised document. */
22
- const OutputFormat: {
23
- readonly Html: "html";
24
- readonly Md: "md";
25
- readonly Json: "json";
26
- };
27
- type OutputFormat = (typeof OutputFormat)[keyof typeof OutputFormat];
28
19
  /** Nature of the document content. */
29
20
  const ContentType: {
30
21
  readonly Printed: "printed";
@@ -4,12 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.DocAiDigitiseRequest = void 0;
5
5
  var DocAiDigitiseRequest;
6
6
  (function (DocAiDigitiseRequest) {
7
- /** Output format of the digitised document. */
8
- DocAiDigitiseRequest.OutputFormat = {
9
- Html: "html",
10
- Md: "md",
11
- Json: "json",
12
- };
13
7
  /** Nature of the document content. */
14
8
  DocAiDigitiseRequest.ContentType = {
15
9
  Printed: "printed",
@@ -3,7 +3,6 @@ import type * as core from "../../../../../core/index.js";
3
3
  * @example
4
4
  * {
5
5
  * schema: "{\"type\":\"object\",\"properties\":{\"policy_number\":{\"type\":\"string\",\"description\":\"Insurance policy number\"},\"insured_name\":{\"type\":\"string\",\"description\":\"Name of the insured person\"},\"sum_insured\":{\"type\":\"number\",\"description\":\"Total sum insured, in INR\"}}}",
6
- * language: "en-IN",
7
6
  * output_format: "json"
8
7
  * }
9
8
  */
@@ -16,8 +15,6 @@ export interface DocAiExtractRequest {
16
15
  schema?: string;
17
16
  /** Saved extraction configuration ID. Exactly one of `schema` and `config_id` is required. To get your config_id, follow the steps listed [here](/api/api-guides-tutorials/document-intelligence/how-to/get-your-config-id). */
18
17
  config_id?: string;
19
- /** Language code of the document (BCP-47), e.g. `en-IN`, `hi-IN`. */
20
- language?: string;
21
18
  /** Output format of the extraction results. */
22
19
  output_format?: DocAiExtractRequest.OutputFormat;
23
20
  /** Enable document classification. Boolean sent as text: `true` or `false`. */
@@ -1,3 +1,4 @@
1
+ import type * as SarvamAI from "../../../../index.js";
1
2
  /**
2
3
  * @example
3
4
  * {
@@ -10,6 +11,6 @@
10
11
  * }
11
12
  */
12
13
  export interface DocAiGetResultsRequest {
13
- /** Output format of the results, e.g. `json`. */
14
- format?: string;
14
+ /** Output format of the results. Choose `md` for Markdown, `html` for HTML, or `json` for structured JSON. If you omit `format`, the results are returned as `json` by default. */
15
+ format?: SarvamAI.Format;
15
16
  }
@@ -0,0 +1,6 @@
1
+ export declare const Format: {
2
+ readonly Md: "md";
3
+ readonly Html: "html";
4
+ readonly Json: "json";
5
+ };
6
+ export type Format = (typeof Format)[keyof typeof Format];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Format = void 0;
5
+ exports.Format = {
6
+ Md: "md",
7
+ Html: "html",
8
+ Json: "json",
9
+ };
@@ -1 +1,2 @@
1
1
  export * from "./DocAiGetResultsResponse.js";
2
+ export * from "./Format.js";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./DocAiGetResultsResponse.js"), exports);
18
+ __exportStar(require("./Format.js"), exports);
@@ -34,3 +34,5 @@ export * as textToSpeechStreaming from "./textToSpeechStreaming/index.js";
34
34
  export * from "./textToSpeechStreaming/types/index.js";
35
35
  export * from "./voiceCloning/client/requests/index.js";
36
36
  export * as voiceCloning from "./voiceCloning/index.js";
37
+ export * as voiceCloningStreaming from "./voiceCloningStreaming/index.js";
38
+ export * from "./voiceCloningStreaming/types/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.voiceCloning = exports.textToSpeechStreaming = exports.textToSpeech = exports.text = exports.speechToTextTranslateStreaming = exports.speechToTextTranslateJob = exports.speechToTextStreaming = exports.speechToTextRealtimeStreaming = exports.speechToTextJob = exports.speechToText = exports.responses = exports.pronunciationDictionary = exports.dubbing = exports.documentTranslation = exports.documentIntelligence = exports.docAi = exports.chatCompletion = exports.chat = void 0;
39
+ exports.voiceCloningStreaming = exports.voiceCloning = exports.textToSpeechStreaming = exports.textToSpeech = exports.text = exports.speechToTextTranslateStreaming = exports.speechToTextTranslateJob = exports.speechToTextStreaming = exports.speechToTextRealtimeStreaming = exports.speechToTextJob = exports.speechToText = exports.responses = exports.pronunciationDictionary = exports.dubbing = exports.documentTranslation = exports.documentIntelligence = exports.docAi = exports.chatCompletion = exports.chat = void 0;
40
40
  __exportStar(require("./chat/client/requests/index.js"), exports);
41
41
  exports.chat = __importStar(require("./chat/index.js"));
42
42
  exports.chatCompletion = __importStar(require("./chatCompletion/index.js"));
@@ -73,3 +73,5 @@ exports.textToSpeechStreaming = __importStar(require("./textToSpeechStreaming/in
73
73
  __exportStar(require("./textToSpeechStreaming/types/index.js"), exports);
74
74
  __exportStar(require("./voiceCloning/client/requests/index.js"), exports);
75
75
  exports.voiceCloning = __importStar(require("./voiceCloning/index.js"));
76
+ exports.voiceCloningStreaming = __importStar(require("./voiceCloningStreaming/index.js"));
77
+ __exportStar(require("./voiceCloningStreaming/types/index.js"), exports);
@@ -19,7 +19,7 @@ export interface ResponsesCreateRequest {
19
19
  tools?: SarvamAI.ResponseFunctionTool[];
20
20
  /** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
21
21
  tool_choice?: ResponsesCreateRequest.ToolChoice;
22
- /** Optional reasoning config for `glm5.3` and `deepseekv4-flash`. On `glm5.3`, a reasoning item is always in `output` — read `summary[0].text`. **`effort`:** on `glm5.3`, `low` or `high` only — omit for `max`-level reasoning (the literal string `max` returns `400`); on `deepseekv4-flash`, `low`, `high`, or `max` all work directly. Optional **`summary`:** `auto` or `detailed`. */
22
+ /** Optional reasoning config for `glm5.3` and `deepseekv4.1-flash`. On `glm5.3`, a reasoning item is always in `output` — read `summary[0].text`. **`effort`:** on `glm5.3`, `low` or `high` only — omit for `max`-level reasoning (the literal string `max` returns `400`); on `deepseekv4.1-flash`, `low`, `high`, or `max` all work directly. Optional **`summary`:** `auto` or `detailed`. */
23
23
  reasoning?: SarvamAI.ResponseReasoning;
24
24
  /** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
25
25
  extra_body?: Record<string, unknown>;
@@ -35,7 +35,7 @@ export interface ResponsesCreateRequest {
35
35
  presence_penalty?: number;
36
36
  /** Output format. If you send `text`, `format` is required (`400` when missing). `json_object` and strict `json_schema` are honoured on `glm5.3` and skip the reasoning item. */
37
37
  text?: SarvamAI.ResponseTextConfig;
38
- /** Not currently enforced on this route for any model that supports tool calling here (`glm5.3`, `gemma4`, `deepseekv4-flash`). Setting **`false`** is accepted without error, but the model may still return multiple tool calls in one turn. */
38
+ /** Not currently enforced on this route for any model that supports tool calling here (`glm5.3`, `gemma4`, `deepseekv4.1-flash`). Setting **`false`** is accepted without error, but the model may still return multiple tool calls in one turn. */
39
39
  parallel_tool_calls?: boolean;
40
40
  /** **Ignored** on this route — Responses always returns one output. Accepted for OpenAI SDK compatibility only; omit or leave at `1`. */
41
41
  n?: number;
@@ -19,7 +19,7 @@ export interface ResponsesCreateStreamRequest {
19
19
  tools?: SarvamAI.ResponseFunctionTool[];
20
20
  /** Forwarded exactly as written: `none`, `auto`, `required`, `{ "type": "function", "name": "..." }`, or another object. */
21
21
  tool_choice?: ResponsesCreateStreamRequest.ToolChoice;
22
- /** Optional reasoning config for `glm5.3` and `deepseekv4-flash`. On `glm5.3`, a reasoning item is always in `output` — read `summary[0].text`. **`effort`:** on `glm5.3`, `low` or `high` only — omit for `max`-level reasoning (the literal string `max` returns `400`); on `deepseekv4-flash`, `low`, `high`, or `max` all work directly. Optional **`summary`:** `auto` or `detailed`. */
22
+ /** Optional reasoning config for `glm5.3` and `deepseekv4.1-flash`. On `glm5.3`, a reasoning item is always in `output` — read `summary[0].text`. **`effort`:** on `glm5.3`, `low` or `high` only — omit for `max`-level reasoning (the literal string `max` returns `400`); on `deepseekv4.1-flash`, `low`, `high`, or `max` all work directly. Optional **`summary`:** `auto` or `detailed`. */
23
23
  reasoning?: SarvamAI.ResponseReasoning;
24
24
  /** Merged into the outbound body. Must not overwrite any modelled field (`400`). `max_tool_calls` and `prompt` are `400` here and in `extra_body` — not supported by any serving deployment. */
25
25
  extra_body?: Record<string, unknown>;
@@ -35,7 +35,7 @@ export interface ResponsesCreateStreamRequest {
35
35
  presence_penalty?: number;
36
36
  /** Output format. If you send `text`, `format` is required (`400` when missing). `json_object` and strict `json_schema` are honoured on `glm5.3` and skip the reasoning item. */
37
37
  text?: SarvamAI.ResponseTextConfig;
38
- /** Not currently enforced on this route for any model that supports tool calling here (`glm5.3`, `gemma4`, `deepseekv4-flash`). Setting **`false`** is accepted without error, but the model may still return multiple tool calls in one turn. */
38
+ /** Not currently enforced on this route for any model that supports tool calling here (`glm5.3`, `gemma4`, `deepseekv4.1-flash`). Setting **`false`** is accepted without error, but the model may still return multiple tool calls in one turn. */
39
39
  parallel_tool_calls?: boolean;
40
40
  /** **Ignored** on this route — Responses always returns one output. Accepted for OpenAI SDK compatibility only; omit or leave at `1`. */
41
41
  n?: number;
@@ -11,22 +11,24 @@ export declare class VoiceCloningClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<VoiceCloningClient.Options>;
12
12
  constructor(options?: VoiceCloningClient.Options);
13
13
  /**
14
- * Generates speech using a saved cloned voice.
14
+ * **Beta.** Generates speech in a cloned voice.
15
15
  *
16
- * **Step 1:** Create a voice with `POST /voices/create` and save the returned `voice_id`.
16
+ * Provide **exactly one** of:
17
+ * - `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or
18
+ * - `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript).
17
19
  *
18
- * **Step 2:** Pass that `voice_id` with `text` and `language_code` to this endpoint. Reference audio is accepted only by `POST /voices/create`, not by this endpoint.
20
+ * Sending both returns `400`. A saved `voice_id` avoids re-uploading the clip on every call.
19
21
  *
20
22
  * Accepts `multipart/form-data`.
21
23
  *
22
24
  * **Base URL:** `https://api.sarvam.ai`.
23
25
  * **Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer <key>` is also accepted.
24
26
  *
25
- * The cloned voice is cross-lingual: the saved reference clip's language does not need to match `language_code`.
27
+ * The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`.
26
28
  *
27
29
  * **Billing:** charged per character of `text` against the `text_to_speech_voice_cloning` API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing).
28
30
  *
29
- * @param {SarvamAI.VoiceCloningTextToSpeechRequest} request
31
+ * @param {SarvamAI.VoiceCloningRequest} request
30
32
  * @param {VoiceCloningClient.RequestOptions} requestOptions - Request-specific configuration.
31
33
  *
32
34
  * @throws {@link SarvamAI.BadRequestError}
@@ -41,16 +43,47 @@ export declare class VoiceCloningClient {
41
43
  *
42
44
  * @example
43
45
  * import { createReadStream } from "fs";
44
- * await client.voiceCloning.textToSpeech({
46
+ * await client.voiceCloning.convert({
45
47
  * voice_id: "svc-123e4567-e89b-12d3-a456-426614174000",
46
48
  * text: "\u0928\u092E\u0938\u094D\u0924\u0947, \u092E\u0948\u0902 \u0906\u092A\u0915\u0940 \u0915\u0948\u0938\u0947 \u092E\u0926\u0926 \u0915\u0930 \u0938\u0915\u0924\u093E \u0939\u0942\u0901?",
47
49
  * language_code: "hi-IN"
48
50
  * })
49
51
  */
50
- textToSpeech(request: SarvamAI.VoiceCloningTextToSpeechRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise<SarvamAI.VoiceCloningResponse>;
51
- private __textToSpeech;
52
+ convert(request: SarvamAI.VoiceCloningRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise<SarvamAI.VoiceCloningResponse>;
53
+ private __convert;
52
54
  /**
53
- * Creates a cloned voice from a reference audio clip in **one shot**. The whole pipeline runs inline: the audio is stored, validated for quality, transcribed via ASR, and cloned - the response returns the new `voice_id` and the auto-generated transcript (`reference_text`) together. No polling or status endpoint is needed; the voice is ready to use immediately with POST /voices/clone.
55
+ * **Beta.** Converts the input text into a streamed spoken audio response using a cloned voice.
56
+ *
57
+ * Provide **exactly one** of:
58
+ * - `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or
59
+ * - `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript).
60
+ *
61
+ * Sending both returns `400`. The response is a binary audio stream (not JSON), so you can begin playback as soon as the first sentence is ready.
62
+ *
63
+ * Accepts `multipart/form-data`.
64
+ *
65
+ * **Base URL:** `https://api.sarvam.ai`.
66
+ * **Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer <key>` is also accepted.
67
+ *
68
+ * **Streaming codecs:** `mp3` (default), `wav`, `linear16`, `mulaw`, `alaw`. `flac`, `aac`, and `opus` are not supported on this endpoint because each sentence would be a complete container that cannot be concatenated.
69
+ *
70
+ * Quality checks (QC/VAD) and duration bounds (`min_audio_duration` / `max_audio_duration`) are not accepted — the stream path optimizes for time-to-first-byte.
71
+ *
72
+ * **Billing:** charged per character of `text` against the `text_to_speech_voice_cloning` API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing).
73
+ * @throws {@link SarvamAI.BadRequestError}
74
+ * @throws {@link SarvamAI.PaymentRequiredError}
75
+ * @throws {@link SarvamAI.ForbiddenError}
76
+ * @throws {@link SarvamAI.UnprocessableEntityError}
77
+ * @throws {@link SarvamAI.TooManyRequestsError}
78
+ * @throws {@link SarvamAI.InternalServerError}
79
+ * @throws {@link SarvamAI.BadGatewayError}
80
+ * @throws {@link SarvamAI.ServiceUnavailableError}
81
+ * @throws {@link SarvamAI.GatewayTimeoutError}
82
+ */
83
+ convertStream(request: SarvamAI.VoiceCloningStreamRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
84
+ private __convertStream;
85
+ /**
86
+ * **Beta.** Creates a cloned voice from a reference audio clip in **one shot**. The whole pipeline runs inline: the audio is stored, validated for quality, transcribed via ASR, and cloned - the response returns the new `voice_id` and the auto-generated transcript (`reference_text`) together. No polling or status endpoint is needed; the voice is ready to use immediately with POST /voices/clone.
54
87
  *
55
88
  * A background job improves the reference audio (noise reduction) after the voice is created; this does not block the response.
56
89
  *
@@ -86,7 +119,7 @@ export declare class VoiceCloningClient {
86
119
  createVoice(request: SarvamAI.CreateVoiceRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise<SarvamAI.VoiceLibraryCreateResponse>;
87
120
  private __createVoice;
88
121
  /**
89
- * Lists the cloned voices in your workspace, newest first. Use the returned `id` with POST /voices/clone (`voice_id`) or GET /voices/{voice_id}.
122
+ * **Beta.** Lists the cloned voices in your workspace, newest first. Use the returned `id` with POST /voices/clone (`voice_id`) or GET /voices/{voice_id}.
90
123
  *
91
124
  * **Base URL:** `https://api.sarvam.ai`.
92
125
  * **Auth:** send your key in the `api-subscription-key` header.
@@ -109,7 +142,7 @@ export declare class VoiceCloningClient {
109
142
  listVoices(request?: SarvamAI.ListVoicesRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise<SarvamAI.VoiceLibraryListResponse>;
110
143
  private __listVoices;
111
144
  /**
112
- * Returns full details for one cloned voice, including its ASR transcript (`reference_text`) and time-limited signed URLs for the reference, recorded, and preview audio.
145
+ * **Beta.** Returns full details for one cloned voice, including its ASR transcript (`reference_text`) and time-limited signed URLs for the reference, recorded, and preview audio.
113
146
  *
114
147
  * **Base URL:** `https://api.sarvam.ai`.
115
148
  * **Auth:** send your key in the `api-subscription-key` header.
@@ -127,7 +160,7 @@ export declare class VoiceCloningClient {
127
160
  getVoice(voice_id: string, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise<SarvamAI.VoiceLibraryDetailResponse>;
128
161
  private __getVoice;
129
162
  /**
130
- * Deletes a cloned voice: its audio assets are removed and the voice is no longer listed or usable for synthesis. This frees a slot against your subscription tier's voice limit.
163
+ * **Beta.** Deletes a cloned voice: its audio assets are removed and the voice is no longer listed or usable for synthesis. On the free plan (capped at 5 voices), deleting a voice frees a slot. Paid plans are not capped.
131
164
  *
132
165
  * **Base URL:** `https://api.sarvam.ai`.
133
166
  * **Auth:** send your key in the `api-subscription-key` header. Returns `204 No Content` on success.