sarvamai 1.1.14 → 1.1.15-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) 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 +39 -34
  4. package/dist/cjs/api/resources/decisions/client/Client.d.ts +62 -0
  5. package/dist/cjs/api/resources/decisions/client/Client.js +162 -0
  6. package/dist/cjs/api/resources/decisions/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/decisions/client/index.js +17 -0
  8. package/dist/cjs/api/resources/decisions/client/requests/SystemOneRequest.d.ts +35 -0
  9. package/dist/cjs/api/resources/decisions/client/requests/SystemOneRequest.js +3 -0
  10. package/dist/cjs/api/resources/decisions/client/requests/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/decisions/client/requests/index.js +2 -0
  12. package/dist/cjs/api/resources/decisions/exports.d.ts +2 -0
  13. package/dist/cjs/api/resources/decisions/exports.js +21 -0
  14. package/dist/cjs/api/resources/decisions/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/decisions/index.js +17 -0
  16. package/dist/cjs/api/resources/index.d.ts +2 -0
  17. package/dist/cjs/api/resources/index.js +3 -1
  18. package/dist/cjs/api/resources/voiceCloning/client/Client.d.ts +3 -4
  19. package/dist/cjs/api/resources/voiceCloning/client/Client.js +9 -6
  20. package/dist/cjs/api/resources/voiceCloning/client/requests/VoiceCloningRequest.d.ts +3 -4
  21. package/dist/cjs/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.d.ts +2 -3
  22. package/dist/cjs/api/types/ResponsesModelIds.d.ts +1 -1
  23. package/dist/cjs/api/types/ResponsesModelIds.js +1 -1
  24. package/dist/cjs/api/types/SystemOneAnswer.d.ts +13 -0
  25. package/dist/cjs/api/types/SystemOneAnswer.js +3 -0
  26. package/dist/cjs/api/types/SystemOneChoiceAnswer.d.ts +8 -0
  27. package/dist/cjs/api/types/SystemOneChoiceAnswer.js +3 -0
  28. package/dist/cjs/api/types/SystemOneChoiceQuestion.d.ts +15 -0
  29. package/dist/cjs/api/types/SystemOneChoiceQuestion.js +3 -0
  30. package/dist/cjs/api/types/SystemOneNoulAnswer.d.ts +4 -0
  31. package/dist/cjs/api/types/SystemOneNoulAnswer.js +3 -0
  32. package/dist/cjs/api/types/SystemOneNoulQuestion.d.ts +22 -0
  33. package/dist/cjs/api/types/SystemOneNoulQuestion.js +3 -0
  34. package/dist/cjs/api/types/SystemOneQuestion.d.ts +13 -0
  35. package/dist/cjs/api/types/SystemOneQuestion.js +3 -0
  36. package/dist/cjs/api/types/SystemOneResponse.d.ts +7 -0
  37. package/dist/cjs/api/types/SystemOneResponse.js +3 -0
  38. package/dist/cjs/api/types/SystemOneScoreAnswer.d.ts +10 -0
  39. package/dist/cjs/api/types/SystemOneScoreAnswer.js +3 -0
  40. package/dist/cjs/api/types/SystemOneScoreQuestion.d.ts +15 -0
  41. package/dist/cjs/api/types/SystemOneScoreQuestion.js +3 -0
  42. package/dist/cjs/api/types/SystemOneUsage.d.ts +6 -0
  43. package/dist/cjs/api/types/SystemOneUsage.js +3 -0
  44. package/dist/cjs/api/types/V2ModelIds.d.ts +1 -1
  45. package/dist/cjs/api/types/V2ModelIds.js +1 -1
  46. package/dist/cjs/api/types/VoiceCloningConfigureConnection.d.ts +17 -5
  47. package/dist/cjs/api/types/VoiceCloningConfigureConnection.js +6 -1
  48. package/dist/cjs/api/types/index.d.ts +10 -0
  49. package/dist/cjs/api/types/index.js +10 -0
  50. package/dist/cjs/version.d.ts +1 -1
  51. package/dist/cjs/version.js +1 -1
  52. package/dist/esm/BaseClient.mjs +2 -2
  53. package/dist/esm/Client.d.mts +3 -0
  54. package/dist/esm/Client.mjs +5 -0
  55. package/dist/esm/api/resources/decisions/client/Client.d.mts +62 -0
  56. package/dist/esm/api/resources/decisions/client/Client.mjs +125 -0
  57. package/dist/esm/api/resources/decisions/client/index.d.mts +1 -0
  58. package/dist/esm/api/resources/decisions/client/index.mjs +1 -0
  59. package/dist/esm/api/resources/decisions/client/requests/SystemOneRequest.d.mts +35 -0
  60. package/dist/esm/api/resources/decisions/client/requests/SystemOneRequest.mjs +2 -0
  61. package/dist/esm/api/resources/decisions/client/requests/index.d.mts +1 -0
  62. package/dist/esm/api/resources/decisions/client/requests/index.mjs +1 -0
  63. package/dist/esm/api/resources/decisions/exports.d.mts +2 -0
  64. package/dist/esm/api/resources/decisions/exports.mjs +3 -0
  65. package/dist/esm/api/resources/decisions/index.d.mts +1 -0
  66. package/dist/esm/api/resources/decisions/index.mjs +1 -0
  67. package/dist/esm/api/resources/index.d.mts +2 -0
  68. package/dist/esm/api/resources/index.mjs +2 -0
  69. package/dist/esm/api/resources/voiceCloning/client/Client.d.mts +3 -4
  70. package/dist/esm/api/resources/voiceCloning/client/Client.mjs +9 -6
  71. package/dist/esm/api/resources/voiceCloning/client/requests/VoiceCloningRequest.d.mts +3 -4
  72. package/dist/esm/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.d.mts +2 -3
  73. package/dist/esm/api/types/ResponsesModelIds.d.mts +1 -1
  74. package/dist/esm/api/types/ResponsesModelIds.mjs +1 -1
  75. package/dist/esm/api/types/SystemOneAnswer.d.mts +13 -0
  76. package/dist/esm/api/types/SystemOneAnswer.mjs +2 -0
  77. package/dist/esm/api/types/SystemOneChoiceAnswer.d.mts +8 -0
  78. package/dist/esm/api/types/SystemOneChoiceAnswer.mjs +2 -0
  79. package/dist/esm/api/types/SystemOneChoiceQuestion.d.mts +15 -0
  80. package/dist/esm/api/types/SystemOneChoiceQuestion.mjs +2 -0
  81. package/dist/esm/api/types/SystemOneNoulAnswer.d.mts +4 -0
  82. package/dist/esm/api/types/SystemOneNoulAnswer.mjs +2 -0
  83. package/dist/esm/api/types/SystemOneNoulQuestion.d.mts +22 -0
  84. package/dist/esm/api/types/SystemOneNoulQuestion.mjs +2 -0
  85. package/dist/esm/api/types/SystemOneQuestion.d.mts +13 -0
  86. package/dist/esm/api/types/SystemOneQuestion.mjs +2 -0
  87. package/dist/esm/api/types/SystemOneResponse.d.mts +7 -0
  88. package/dist/esm/api/types/SystemOneResponse.mjs +2 -0
  89. package/dist/esm/api/types/SystemOneScoreAnswer.d.mts +10 -0
  90. package/dist/esm/api/types/SystemOneScoreAnswer.mjs +2 -0
  91. package/dist/esm/api/types/SystemOneScoreQuestion.d.mts +15 -0
  92. package/dist/esm/api/types/SystemOneScoreQuestion.mjs +2 -0
  93. package/dist/esm/api/types/SystemOneUsage.d.mts +6 -0
  94. package/dist/esm/api/types/SystemOneUsage.mjs +2 -0
  95. package/dist/esm/api/types/V2ModelIds.d.mts +1 -1
  96. package/dist/esm/api/types/V2ModelIds.mjs +1 -1
  97. package/dist/esm/api/types/VoiceCloningConfigureConnection.d.mts +17 -5
  98. package/dist/esm/api/types/VoiceCloningConfigureConnection.mjs +6 -1
  99. package/dist/esm/api/types/index.d.mts +10 -0
  100. package/dist/esm/api/types/index.mjs +10 -0
  101. package/dist/esm/version.d.mts +1 -1
  102. package/dist/esm/version.mjs +1 -1
  103. package/package.json +13 -1
  104. package/reference.md +95 -5
@@ -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.14",
47
- "User-Agent": "sarvamai/1.1.14",
46
+ "X-Fern-SDK-Version": "1.1.15-alpha.2",
47
+ "User-Agent": "sarvamai/1.1.15-alpha.2",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,5 +1,6 @@
1
1
  import { ChatClient } from "./api/resources/chat/client/Client.js";
2
2
  import { ChatCompletionClient } from "./api/resources/chatCompletion/client/Client.js";
3
+ import { DecisionsClient } from "./api/resources/decisions/client/Client.js";
3
4
  import { DocAiClient } from "./api/resources/docAi/client/Client.js";
4
5
  import { DocumentIntelligenceClient } from "./api/resources/documentIntelligence/client/Client.js";
5
6
  import { DocumentTranslationClient } from "./api/resources/documentTranslation/client/Client.js";
@@ -40,6 +41,7 @@ export declare class SarvamAIClient {
40
41
  protected _docAi: DocAiClient | undefined;
41
42
  protected _responses: ResponsesClient | undefined;
42
43
  protected _chatCompletion: ChatCompletionClient | undefined;
44
+ protected _decisions: DecisionsClient | undefined;
43
45
  protected _speechToTextStreaming: SpeechToTextStreamingClient | undefined;
44
46
  protected _speechToTextTranslateStreaming: SpeechToTextTranslateStreamingClient | undefined;
45
47
  protected _speechToTextRealtimeStreaming: SpeechToTextRealtimeStreamingClient | undefined;
@@ -60,6 +62,7 @@ export declare class SarvamAIClient {
60
62
  get docAi(): DocAiClient;
61
63
  get responses(): ResponsesClient;
62
64
  get chatCompletion(): ChatCompletionClient;
65
+ get decisions(): DecisionsClient;
63
66
  get speechToTextStreaming(): SpeechToTextStreamingClient;
64
67
  get speechToTextTranslateStreaming(): SpeechToTextTranslateStreamingClient;
65
68
  get speechToTextRealtimeStreaming(): SpeechToTextRealtimeStreamingClient;
@@ -4,23 +4,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.SarvamAIClient = void 0;
5
5
  const Client_js_1 = require("./api/resources/chat/client/Client.js");
6
6
  const Client_js_2 = require("./api/resources/chatCompletion/client/Client.js");
7
- const Client_js_3 = require("./api/resources/docAi/client/Client.js");
8
- const Client_js_4 = require("./api/resources/documentIntelligence/client/Client.js");
9
- const Client_js_5 = require("./api/resources/documentTranslation/client/Client.js");
10
- const Client_js_6 = require("./api/resources/dubbing/client/Client.js");
11
- const Client_js_7 = require("./api/resources/pronunciationDictionary/client/Client.js");
12
- const Client_js_8 = require("./api/resources/responses/client/Client.js");
13
- const Client_js_9 = require("./api/resources/speechToText/client/Client.js");
14
- const Client_js_10 = require("./api/resources/speechToTextJob/client/Client.js");
15
- const Client_js_11 = require("./api/resources/speechToTextRealtimeStreaming/client/Client.js");
16
- const Client_js_12 = require("./api/resources/speechToTextStreaming/client/Client.js");
17
- const Client_js_13 = require("./api/resources/speechToTextTranslateJob/client/Client.js");
18
- const Client_js_14 = require("./api/resources/speechToTextTranslateStreaming/client/Client.js");
19
- const Client_js_15 = require("./api/resources/text/client/Client.js");
20
- const Client_js_16 = require("./api/resources/textToSpeech/client/Client.js");
21
- const Client_js_17 = require("./api/resources/textToSpeechStreaming/client/Client.js");
22
- const Client_js_18 = require("./api/resources/voiceCloning/client/Client.js");
23
- const Client_js_19 = require("./api/resources/voiceCloningStreaming/client/Client.js");
7
+ const Client_js_3 = require("./api/resources/decisions/client/Client.js");
8
+ const Client_js_4 = require("./api/resources/docAi/client/Client.js");
9
+ const Client_js_5 = require("./api/resources/documentIntelligence/client/Client.js");
10
+ const Client_js_6 = require("./api/resources/documentTranslation/client/Client.js");
11
+ const Client_js_7 = require("./api/resources/dubbing/client/Client.js");
12
+ const Client_js_8 = require("./api/resources/pronunciationDictionary/client/Client.js");
13
+ const Client_js_9 = require("./api/resources/responses/client/Client.js");
14
+ const Client_js_10 = require("./api/resources/speechToText/client/Client.js");
15
+ const Client_js_11 = require("./api/resources/speechToTextJob/client/Client.js");
16
+ const Client_js_12 = require("./api/resources/speechToTextRealtimeStreaming/client/Client.js");
17
+ const Client_js_13 = require("./api/resources/speechToTextStreaming/client/Client.js");
18
+ const Client_js_14 = require("./api/resources/speechToTextTranslateJob/client/Client.js");
19
+ const Client_js_15 = require("./api/resources/speechToTextTranslateStreaming/client/Client.js");
20
+ const Client_js_16 = require("./api/resources/text/client/Client.js");
21
+ const Client_js_17 = require("./api/resources/textToSpeech/client/Client.js");
22
+ const Client_js_18 = require("./api/resources/textToSpeechStreaming/client/Client.js");
23
+ const Client_js_19 = require("./api/resources/voiceCloning/client/Client.js");
24
+ const Client_js_20 = require("./api/resources/voiceCloningStreaming/client/Client.js");
24
25
  const BaseClient_js_1 = require("./BaseClient.js");
25
26
  class SarvamAIClient {
26
27
  constructor(options = {}) {
@@ -28,31 +29,31 @@ class SarvamAIClient {
28
29
  }
29
30
  get dubbing() {
30
31
  var _a;
31
- return ((_a = this._dubbing) !== null && _a !== void 0 ? _a : (this._dubbing = new Client_js_6.DubbingClient(this._options)));
32
+ return ((_a = this._dubbing) !== null && _a !== void 0 ? _a : (this._dubbing = new Client_js_7.DubbingClient(this._options)));
32
33
  }
33
34
  get documentTranslation() {
34
35
  var _a;
35
- return ((_a = this._documentTranslation) !== null && _a !== void 0 ? _a : (this._documentTranslation = new Client_js_5.DocumentTranslationClient(this._options)));
36
+ return ((_a = this._documentTranslation) !== null && _a !== void 0 ? _a : (this._documentTranslation = new Client_js_6.DocumentTranslationClient(this._options)));
36
37
  }
37
38
  get text() {
38
39
  var _a;
39
- return ((_a = this._text) !== null && _a !== void 0 ? _a : (this._text = new Client_js_15.TextClient(this._options)));
40
+ return ((_a = this._text) !== null && _a !== void 0 ? _a : (this._text = new Client_js_16.TextClient(this._options)));
40
41
  }
41
42
  get speechToText() {
42
43
  var _a;
43
- return ((_a = this._speechToText) !== null && _a !== void 0 ? _a : (this._speechToText = new Client_js_9.SpeechToTextClient(this._options)));
44
+ return ((_a = this._speechToText) !== null && _a !== void 0 ? _a : (this._speechToText = new Client_js_10.SpeechToTextClient(this._options)));
44
45
  }
45
46
  get textToSpeech() {
46
47
  var _a;
47
- return ((_a = this._textToSpeech) !== null && _a !== void 0 ? _a : (this._textToSpeech = new Client_js_16.TextToSpeechClient(this._options)));
48
+ return ((_a = this._textToSpeech) !== null && _a !== void 0 ? _a : (this._textToSpeech = new Client_js_17.TextToSpeechClient(this._options)));
48
49
  }
49
50
  get voiceCloning() {
50
51
  var _a;
51
- return ((_a = this._voiceCloning) !== null && _a !== void 0 ? _a : (this._voiceCloning = new Client_js_18.VoiceCloningClient(this._options)));
52
+ return ((_a = this._voiceCloning) !== null && _a !== void 0 ? _a : (this._voiceCloning = new Client_js_19.VoiceCloningClient(this._options)));
52
53
  }
53
54
  get pronunciationDictionary() {
54
55
  var _a;
55
- return ((_a = this._pronunciationDictionary) !== null && _a !== void 0 ? _a : (this._pronunciationDictionary = new Client_js_7.PronunciationDictionaryClient(this._options)));
56
+ return ((_a = this._pronunciationDictionary) !== null && _a !== void 0 ? _a : (this._pronunciationDictionary = new Client_js_8.PronunciationDictionaryClient(this._options)));
56
57
  }
57
58
  get chat() {
58
59
  var _a;
@@ -60,47 +61,51 @@ class SarvamAIClient {
60
61
  }
61
62
  get speechToTextJob() {
62
63
  var _a;
63
- return ((_a = this._speechToTextJob) !== null && _a !== void 0 ? _a : (this._speechToTextJob = new Client_js_10.SpeechToTextJobClient(this._options)));
64
+ return ((_a = this._speechToTextJob) !== null && _a !== void 0 ? _a : (this._speechToTextJob = new Client_js_11.SpeechToTextJobClient(this._options)));
64
65
  }
65
66
  get speechToTextTranslateJob() {
66
67
  var _a;
67
- return ((_a = this._speechToTextTranslateJob) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateJob = new Client_js_13.SpeechToTextTranslateJobClient(this._options)));
68
+ return ((_a = this._speechToTextTranslateJob) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateJob = new Client_js_14.SpeechToTextTranslateJobClient(this._options)));
68
69
  }
69
70
  get documentIntelligence() {
70
71
  var _a;
71
- return ((_a = this._documentIntelligence) !== null && _a !== void 0 ? _a : (this._documentIntelligence = new Client_js_4.DocumentIntelligenceClient(this._options)));
72
+ return ((_a = this._documentIntelligence) !== null && _a !== void 0 ? _a : (this._documentIntelligence = new Client_js_5.DocumentIntelligenceClient(this._options)));
72
73
  }
73
74
  get docAi() {
74
75
  var _a;
75
- return ((_a = this._docAi) !== null && _a !== void 0 ? _a : (this._docAi = new Client_js_3.DocAiClient(this._options)));
76
+ return ((_a = this._docAi) !== null && _a !== void 0 ? _a : (this._docAi = new Client_js_4.DocAiClient(this._options)));
76
77
  }
77
78
  get responses() {
78
79
  var _a;
79
- return ((_a = this._responses) !== null && _a !== void 0 ? _a : (this._responses = new Client_js_8.ResponsesClient(this._options)));
80
+ return ((_a = this._responses) !== null && _a !== void 0 ? _a : (this._responses = new Client_js_9.ResponsesClient(this._options)));
80
81
  }
81
82
  get chatCompletion() {
82
83
  var _a;
83
84
  return ((_a = this._chatCompletion) !== null && _a !== void 0 ? _a : (this._chatCompletion = new Client_js_2.ChatCompletionClient(this._options)));
84
85
  }
86
+ get decisions() {
87
+ var _a;
88
+ return ((_a = this._decisions) !== null && _a !== void 0 ? _a : (this._decisions = new Client_js_3.DecisionsClient(this._options)));
89
+ }
85
90
  get speechToTextStreaming() {
86
91
  var _a;
87
- return ((_a = this._speechToTextStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextStreaming = new Client_js_12.SpeechToTextStreamingClient(this._options)));
92
+ return ((_a = this._speechToTextStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextStreaming = new Client_js_13.SpeechToTextStreamingClient(this._options)));
88
93
  }
89
94
  get speechToTextTranslateStreaming() {
90
95
  var _a;
91
- return ((_a = this._speechToTextTranslateStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateStreaming = new Client_js_14.SpeechToTextTranslateStreamingClient(this._options)));
96
+ return ((_a = this._speechToTextTranslateStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateStreaming = new Client_js_15.SpeechToTextTranslateStreamingClient(this._options)));
92
97
  }
93
98
  get speechToTextRealtimeStreaming() {
94
99
  var _a;
95
- return ((_a = this._speechToTextRealtimeStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextRealtimeStreaming = new Client_js_11.SpeechToTextRealtimeStreamingClient(this._options)));
100
+ return ((_a = this._speechToTextRealtimeStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextRealtimeStreaming = new Client_js_12.SpeechToTextRealtimeStreamingClient(this._options)));
96
101
  }
97
102
  get textToSpeechStreaming() {
98
103
  var _a;
99
- return ((_a = this._textToSpeechStreaming) !== null && _a !== void 0 ? _a : (this._textToSpeechStreaming = new Client_js_17.TextToSpeechStreamingClient(this._options)));
104
+ return ((_a = this._textToSpeechStreaming) !== null && _a !== void 0 ? _a : (this._textToSpeechStreaming = new Client_js_18.TextToSpeechStreamingClient(this._options)));
100
105
  }
101
106
  get voiceCloningStreaming() {
102
107
  var _a;
103
- return ((_a = this._voiceCloningStreaming) !== null && _a !== void 0 ? _a : (this._voiceCloningStreaming = new Client_js_19.VoiceCloningStreamingClient(this._options)));
108
+ return ((_a = this._voiceCloningStreaming) !== null && _a !== void 0 ? _a : (this._voiceCloningStreaming = new Client_js_20.VoiceCloningStreamingClient(this._options)));
104
109
  }
105
110
  }
106
111
  exports.SarvamAIClient = SarvamAIClient;
@@ -0,0 +1,62 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as SarvamAI from "../../../index.js";
5
+ export declare namespace DecisionsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class DecisionsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<DecisionsClient.Options>;
12
+ constructor(options?: DecisionsClient.Options);
13
+ /**
14
+ * Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse. The order of `choice` options does not affect the answer.
15
+ *
16
+ * Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
17
+ *
18
+ * **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
19
+ *
20
+ * **Repeatability:** probabilities can vary slightly between identical requests; the top answer is stable.
21
+ *
22
+ * **Not supported:** images and streaming. Generation fields such as `temperature`, `max_tokens`, `stream` and `images` are refused: image URLs return `400`, and the others return `422`. Unknown keys inside a question also return `422`.
23
+ *
24
+ * **Limits:** 32,768 tokens per question (state + question + options), 2–255 options per `choice` and 2–10 levels per `score`. There is no cap on the number of questions. The state is not truncated, and if any one question breaks a limit the whole request fails with `422`.
25
+ *
26
+ * **Timeout:** each request must finish within 60 seconds. A longer request fails with `500 internal_server_error`; split very large batches across several requests.
27
+ *
28
+ * @param {SarvamAI.SystemOneRequest} request
29
+ * @param {DecisionsClient.RequestOptions} requestOptions - Request-specific configuration.
30
+ *
31
+ * @throws {@link SarvamAI.BadRequestError}
32
+ * @throws {@link SarvamAI.PaymentRequiredError}
33
+ * @throws {@link SarvamAI.ForbiddenError}
34
+ * @throws {@link SarvamAI.NotFoundError}
35
+ * @throws {@link SarvamAI.UnprocessableEntityError}
36
+ * @throws {@link SarvamAI.TooManyRequestsError}
37
+ * @throws {@link SarvamAI.InternalServerError}
38
+ * @throws {@link SarvamAI.BadGatewayError}
39
+ * @throws {@link SarvamAI.ServiceUnavailableError}
40
+ *
41
+ * @example
42
+ * await client.decisions.create({
43
+ * model: "sarvam-prism",
44
+ * state: "My Stripe integration stopped working and all checkout payments are failing.",
45
+ * questions: {
46
+ * "urgent": {
47
+ * type: "noul"
48
+ * },
49
+ * "department": {
50
+ * type: "choice",
51
+ * criteria: {}
52
+ * },
53
+ * "severity": {
54
+ * type: "score",
55
+ * criteria: ["trivial", "minor", "moderate", "major", "critical"]
56
+ * }
57
+ * }
58
+ * })
59
+ */
60
+ create(request: SarvamAI.SystemOneRequest, requestOptions?: DecisionsClient.RequestOptions): core.HttpResponsePromise<SarvamAI.SystemOneResponse>;
61
+ private __create;
62
+ }
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.DecisionsClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const SarvamAI = __importStar(require("../../../index.js"));
54
+ class DecisionsClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * Answers a set of typed questions about one input and returns a calibrated probability for every allowed option. The model does not generate text, so there is nothing to parse. The order of `choice` options does not affect the answer.
60
+ *
61
+ * Requires `api-subscription-key`, or `Authorization: Bearer <key>`.
62
+ *
63
+ * **Question types:** `noul` (yes/no), `choice` (one of your options) and `score` (a level on your ordered scale).
64
+ *
65
+ * **Repeatability:** probabilities can vary slightly between identical requests; the top answer is stable.
66
+ *
67
+ * **Not supported:** images and streaming. Generation fields such as `temperature`, `max_tokens`, `stream` and `images` are refused: image URLs return `400`, and the others return `422`. Unknown keys inside a question also return `422`.
68
+ *
69
+ * **Limits:** 32,768 tokens per question (state + question + options), 2–255 options per `choice` and 2–10 levels per `score`. There is no cap on the number of questions. The state is not truncated, and if any one question breaks a limit the whole request fails with `422`.
70
+ *
71
+ * **Timeout:** each request must finish within 60 seconds. A longer request fails with `500 internal_server_error`; split very large batches across several requests.
72
+ *
73
+ * @param {SarvamAI.SystemOneRequest} request
74
+ * @param {DecisionsClient.RequestOptions} requestOptions - Request-specific configuration.
75
+ *
76
+ * @throws {@link SarvamAI.BadRequestError}
77
+ * @throws {@link SarvamAI.PaymentRequiredError}
78
+ * @throws {@link SarvamAI.ForbiddenError}
79
+ * @throws {@link SarvamAI.NotFoundError}
80
+ * @throws {@link SarvamAI.UnprocessableEntityError}
81
+ * @throws {@link SarvamAI.TooManyRequestsError}
82
+ * @throws {@link SarvamAI.InternalServerError}
83
+ * @throws {@link SarvamAI.BadGatewayError}
84
+ * @throws {@link SarvamAI.ServiceUnavailableError}
85
+ *
86
+ * @example
87
+ * await client.decisions.create({
88
+ * model: "sarvam-prism",
89
+ * state: "My Stripe integration stopped working and all checkout payments are failing.",
90
+ * questions: {
91
+ * "urgent": {
92
+ * type: "noul"
93
+ * },
94
+ * "department": {
95
+ * type: "choice",
96
+ * criteria: {}
97
+ * },
98
+ * "severity": {
99
+ * type: "score",
100
+ * criteria: ["trivial", "minor", "moderate", "major", "critical"]
101
+ * }
102
+ * }
103
+ * })
104
+ */
105
+ create(request, requestOptions) {
106
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
107
+ }
108
+ __create(request, requestOptions) {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
111
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
112
+ 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);
113
+ const _response = yield core.fetcher({
114
+ url: core.url.join((_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, "v2/systemone"),
115
+ method: "POST",
116
+ headers: _headers,
117
+ contentType: "application/json",
118
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
119
+ requestType: "json",
120
+ body: request,
121
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
122
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
123
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
124
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
125
+ logging: this._options.logging,
126
+ });
127
+ if (_response.ok) {
128
+ return { data: _response.body, rawResponse: _response.rawResponse };
129
+ }
130
+ if (_response.error.reason === "status-code") {
131
+ switch (_response.error.statusCode) {
132
+ case 400:
133
+ throw new SarvamAI.BadRequestError(_response.error.body, _response.rawResponse);
134
+ case 402:
135
+ throw new SarvamAI.PaymentRequiredError(_response.error.body, _response.rawResponse);
136
+ case 403:
137
+ throw new SarvamAI.ForbiddenError(_response.error.body, _response.rawResponse);
138
+ case 404:
139
+ throw new SarvamAI.NotFoundError(_response.error.body, _response.rawResponse);
140
+ case 422:
141
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
142
+ case 429:
143
+ throw new SarvamAI.TooManyRequestsError(_response.error.body, _response.rawResponse);
144
+ case 500:
145
+ throw new SarvamAI.InternalServerError(_response.error.body, _response.rawResponse);
146
+ case 502:
147
+ throw new SarvamAI.BadGatewayError(_response.error.body, _response.rawResponse);
148
+ case 503:
149
+ throw new SarvamAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
150
+ default:
151
+ throw new errors.SarvamAIError({
152
+ statusCode: _response.error.statusCode,
153
+ body: _response.error.body,
154
+ rawResponse: _response.rawResponse,
155
+ });
156
+ }
157
+ }
158
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v2/systemone");
159
+ });
160
+ }
161
+ }
162
+ exports.DecisionsClient = DecisionsClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,35 @@
1
+ import type * as SarvamAI from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * model: "sarvam-prism",
6
+ * state: "My Stripe integration stopped working and all checkout payments are failing.",
7
+ * questions: {
8
+ * "urgent": {
9
+ * type: "noul"
10
+ * },
11
+ * "department": {
12
+ * type: "choice",
13
+ * criteria: {}
14
+ * },
15
+ * "severity": {
16
+ * type: "score",
17
+ * criteria: ["trivial", "minor", "moderate", "major", "critical"]
18
+ * }
19
+ * }
20
+ * }
21
+ */
22
+ export interface SystemOneRequest {
23
+ /** The decision model to use. Currently `sarvam-prism` (Sarvam Prism). */
24
+ model: string;
25
+ /** The input to decide on: text, or an object or array that is rendered as compact JSON. Required; an empty string is allowed. It is never truncated: if any one question (state + question + options) exceeds 32,768 tokens the request fails with `422`. */
26
+ state: SystemOneRequest.State;
27
+ /** Map of your question ID to a question, at least one. There is no cap on the number of questions. Every question is answered in one call, and the answer uses the same ID. */
28
+ questions: Record<string, SarvamAI.SystemOneQuestion>;
29
+ }
30
+ export declare namespace SystemOneRequest {
31
+ /**
32
+ * The input to decide on: text, or an object or array that is rendered as compact JSON. Required; an empty string is allowed. It is never truncated: if any one question (state + question + options) exceeds 32,768 tokens the request fails with `422`.
33
+ */
34
+ type State = string | Record<string, unknown> | unknown[];
35
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { SystemOneRequest } from "./SystemOneRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { DecisionsClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DecisionsClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "DecisionsClient", { enumerable: true, get: function () { return Client_js_1.DecisionsClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -1,6 +1,8 @@
1
1
  export * from "./chat/client/requests/index.js";
2
2
  export * as chat from "./chat/index.js";
3
3
  export * as chatCompletion from "./chatCompletion/index.js";
4
+ export * from "./decisions/client/requests/index.js";
5
+ export * as decisions from "./decisions/index.js";
4
6
  export * from "./docAi/client/requests/index.js";
5
7
  export * as docAi from "./docAi/index.js";
6
8
  export * from "./docAi/types/index.js";
@@ -36,10 +36,12 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
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;
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.decisions = 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"));
43
+ __exportStar(require("./decisions/client/requests/index.js"), exports);
44
+ exports.decisions = __importStar(require("./decisions/index.js"));
43
45
  __exportStar(require("./docAi/client/requests/index.js"), exports);
44
46
  exports.docAi = __importStar(require("./docAi/index.js"));
45
47
  __exportStar(require("./docAi/types/index.js"), exports);
@@ -24,7 +24,7 @@ export declare class VoiceCloningClient {
24
24
  * **Base URL:** `https://api.sarvam.ai`.
25
25
  * **Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer <key>` is also accepted.
26
26
  *
27
- * The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`.
27
+ * `language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`.
28
28
  *
29
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).
30
30
  *
@@ -45,8 +45,7 @@ export declare class VoiceCloningClient {
45
45
  * import { createReadStream } from "fs";
46
46
  * await client.voiceCloning.convert({
47
47
  * voice_id: "svc-123e4567-e89b-12d3-a456-426614174000",
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?",
49
- * language_code: "hi-IN"
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?"
50
49
  * })
51
50
  */
52
51
  convert(request: SarvamAI.VoiceCloningRequest, requestOptions?: VoiceCloningClient.RequestOptions): core.HttpResponsePromise<SarvamAI.VoiceCloningResponse>;
@@ -58,7 +57,7 @@ export declare class VoiceCloningClient {
58
57
  * - `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or
59
58
  * - `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript).
60
59
  *
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.
60
+ * Sending both returns `400`. `language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The response is a binary audio stream (not JSON), so you can begin playback as soon as the first sentence is ready.
62
61
  *
63
62
  * Accepts `multipart/form-data`.
64
63
  *
@@ -69,7 +69,7 @@ class VoiceCloningClient {
69
69
  * **Base URL:** `https://api.sarvam.ai`.
70
70
  * **Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer <key>` is also accepted.
71
71
  *
72
- * The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`.
72
+ * `language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`.
73
73
  *
74
74
  * **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).
75
75
  *
@@ -90,8 +90,7 @@ class VoiceCloningClient {
90
90
  * import { createReadStream } from "fs";
91
91
  * await client.voiceCloning.convert({
92
92
  * voice_id: "svc-123e4567-e89b-12d3-a456-426614174000",
93
- * 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?",
94
- * language_code: "hi-IN"
93
+ * 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?"
95
94
  * })
96
95
  */
97
96
  convert(request, requestOptions) {
@@ -111,7 +110,9 @@ class VoiceCloningClient {
111
110
  _body.append("ref_text", request.ref_text);
112
111
  }
113
112
  _body.append("text", request.text);
114
- _body.append("language_code", request.language_code);
113
+ if (request.language_code != null) {
114
+ _body.append("language_code", request.language_code);
115
+ }
115
116
  if (request.pace != null) {
116
117
  _body.append("pace", (_a = request.pace) === null || _a === void 0 ? void 0 : _a.toString());
117
118
  }
@@ -200,7 +201,7 @@ class VoiceCloningClient {
200
201
  * - `voice_id` — a saved cloned voice from `POST /voices/create` (or Content Studio), or
201
202
  * - `ref_audio` — a reference audio clip uploaded with this request (optional `ref_text` transcript).
202
203
  *
203
- * 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.
204
+ * Sending both returns `400`. `language_code` is optional — omit it to detect the language from `text`, or pass it when pronunciation has to be exact. The response is a binary audio stream (not JSON), so you can begin playback as soon as the first sentence is ready.
204
205
  *
205
206
  * Accepts `multipart/form-data`.
206
207
  *
@@ -239,7 +240,9 @@ class VoiceCloningClient {
239
240
  _body.append("ref_text", request.ref_text);
240
241
  }
241
242
  _body.append("text", request.text);
242
- _body.append("language_code", request.language_code);
243
+ if (request.language_code != null) {
244
+ _body.append("language_code", request.language_code);
245
+ }
243
246
  if (request.pace != null) {
244
247
  _body.append("pace", (_a = request.pace) === null || _a === void 0 ? void 0 : _a.toString());
245
248
  }