sarvamai 1.1.11 → 1.1.12-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 (244) 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 +88 -2
  6. package/dist/cjs/api/resources/docAi/client/Client.js +241 -10
  7. package/dist/cjs/api/resources/docAi/client/requests/DocAiClassifyRequest.d.ts +28 -0
  8. package/dist/cjs/api/resources/docAi/client/requests/DocAiDigitiseRequest.d.ts +1 -10
  9. package/dist/cjs/api/resources/docAi/client/requests/DocAiDigitiseRequest.js +0 -6
  10. package/dist/cjs/api/resources/docAi/client/requests/DocAiExtractRequest.d.ts +0 -3
  11. package/dist/cjs/api/resources/docAi/client/requests/DocAiGetResultsRequest.d.ts +11 -2
  12. package/dist/cjs/api/resources/docAi/client/requests/DocAiSplitRequest.d.ts +23 -0
  13. package/dist/cjs/api/resources/docAi/client/requests/DocAiSplitRequest.js +3 -0
  14. package/dist/cjs/api/resources/docAi/client/requests/index.d.ts +2 -0
  15. package/dist/cjs/api/resources/docAi/types/DocAiGetResultsResponse.d.ts +7 -1
  16. package/dist/cjs/api/resources/docAi/types/Format.d.ts +6 -0
  17. package/dist/cjs/api/resources/docAi/types/Format.js +9 -0
  18. package/dist/cjs/api/resources/docAi/types/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/docAi/types/index.js +1 -0
  20. package/dist/cjs/api/resources/index.d.ts +2 -0
  21. package/dist/cjs/api/resources/index.js +3 -1
  22. package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateRequest.d.ts +2 -2
  23. package/dist/cjs/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.ts +2 -2
  24. package/dist/cjs/api/resources/voiceCloning/client/Client.d.ts +45 -12
  25. package/dist/cjs/api/resources/voiceCloning/client/Client.js +138 -14
  26. package/dist/cjs/api/resources/voiceCloning/client/requests/{VoiceCloningTextToSpeechRequest.d.ts → VoiceCloningRequest.d.ts} +12 -3
  27. package/dist/cjs/api/resources/voiceCloning/client/requests/VoiceCloningRequest.js +3 -0
  28. package/dist/cjs/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.d.ts +60 -0
  29. package/dist/cjs/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.js +3 -0
  30. package/dist/cjs/api/resources/voiceCloning/client/requests/index.d.ts +2 -1
  31. package/dist/cjs/api/resources/voiceCloningStreaming/client/Client.d.ts +24 -0
  32. package/dist/cjs/api/resources/voiceCloningStreaming/client/Client.js +75 -0
  33. package/dist/cjs/api/resources/voiceCloningStreaming/client/Socket.d.ts +52 -0
  34. package/dist/cjs/api/resources/voiceCloningStreaming/client/Socket.js +162 -0
  35. package/dist/cjs/api/resources/voiceCloningStreaming/client/index.d.ts +1 -0
  36. package/dist/cjs/api/resources/voiceCloningStreaming/client/index.js +2 -0
  37. package/dist/cjs/api/resources/voiceCloningStreaming/exports.d.ts +2 -0
  38. package/dist/cjs/api/resources/voiceCloningStreaming/exports.js +21 -0
  39. package/dist/cjs/api/resources/voiceCloningStreaming/index.d.ts +2 -0
  40. package/dist/cjs/api/resources/voiceCloningStreaming/index.js +18 -0
  41. package/dist/cjs/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.d.ts +6 -0
  42. package/dist/cjs/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.js +9 -0
  43. package/dist/cjs/api/resources/voiceCloningStreaming/types/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/voiceCloningStreaming/types/index.js +17 -0
  45. package/dist/cjs/api/types/Choice.d.ts +1 -1
  46. package/dist/cjs/api/types/ConfigureConnection.d.ts +3 -3
  47. package/dist/cjs/api/types/ConfigureConnection.js +3 -3
  48. package/dist/cjs/api/types/CreateResponseV2Request.d.ts +2 -2
  49. package/dist/cjs/api/types/DocAiBatchDocument.d.ts +10 -0
  50. package/dist/cjs/api/types/DocAiBatchDocument.js +3 -0
  51. package/dist/cjs/api/types/DocAiCapabilitiesResponse.d.ts +23 -0
  52. package/dist/cjs/api/types/DocAiCapabilitiesResponse.js +3 -0
  53. package/dist/cjs/api/types/DocAiCapabilityLimits.d.ts +12 -0
  54. package/dist/cjs/api/types/DocAiCapabilityLimits.js +3 -0
  55. package/dist/cjs/api/types/DocAiClassifyCategory.d.ts +9 -0
  56. package/dist/cjs/api/types/DocAiClassifyCategory.js +3 -0
  57. package/dist/cjs/api/types/DocAiClassifyConfig.d.ts +33 -0
  58. package/dist/cjs/api/types/DocAiClassifyConfig.js +17 -0
  59. package/dist/cjs/api/types/DocAiClassifyDecision.d.ts +24 -0
  60. package/dist/cjs/api/types/DocAiClassifyDecision.js +3 -0
  61. package/dist/cjs/api/types/DocAiClassifyInspection.d.ts +27 -0
  62. package/dist/cjs/api/types/DocAiClassifyInspection.js +15 -0
  63. package/dist/cjs/api/types/DocAiClassifyJobRequest.d.ts +24 -0
  64. package/dist/cjs/api/types/DocAiClassifyJobRequest.js +12 -0
  65. package/dist/cjs/api/types/DocAiClassifyOutput.d.ts +4 -0
  66. package/dist/cjs/api/types/DocAiClassifyOutput.js +3 -0
  67. package/dist/cjs/api/types/DocAiClassifyResult.d.ts +35 -0
  68. package/dist/cjs/api/types/DocAiClassifyResult.js +11 -0
  69. package/dist/cjs/api/types/DocAiClassifyResults.d.ts +14 -0
  70. package/dist/cjs/api/types/DocAiClassifyResults.js +3 -0
  71. package/dist/cjs/api/types/DocAiEvidence.d.ts +9 -0
  72. package/dist/cjs/api/types/DocAiEvidence.js +3 -0
  73. package/dist/cjs/api/types/DocAiJobAcceptedResponse.d.ts +23 -0
  74. package/dist/cjs/api/types/DocAiJobAcceptedResponse.js +3 -0
  75. package/dist/cjs/api/types/DocAiJobError.d.ts +23 -0
  76. package/dist/cjs/api/types/DocAiJobError.js +3 -0
  77. package/dist/cjs/api/types/DocAiJobStatusResponse.d.ts +16 -2
  78. package/dist/cjs/api/types/DocAiJobUsage.d.ts +6 -0
  79. package/dist/cjs/api/types/DocAiJobUsage.js +3 -0
  80. package/dist/cjs/api/types/DocAiPageRange.d.ts +7 -0
  81. package/dist/cjs/api/types/DocAiPageRange.js +3 -0
  82. package/dist/cjs/api/types/DocAiSplitConfig.d.ts +34 -0
  83. package/dist/cjs/api/types/DocAiSplitConfig.js +18 -0
  84. package/dist/cjs/api/types/DocAiSplitJobRequest.d.ts +21 -0
  85. package/dist/cjs/api/types/DocAiSplitJobRequest.js +11 -0
  86. package/dist/cjs/api/types/DocAiSplitResult.d.ts +21 -0
  87. package/dist/cjs/api/types/DocAiSplitResult.js +3 -0
  88. package/dist/cjs/api/types/DocAiSplitResults.d.ts +12 -0
  89. package/dist/cjs/api/types/DocAiSplitResults.js +3 -0
  90. package/dist/cjs/api/types/DocAiSplitSegment.d.ts +28 -0
  91. package/dist/cjs/api/types/DocAiSplitSegment.js +3 -0
  92. package/dist/cjs/api/types/DocAiSplitTrigger.d.ts +59 -0
  93. package/dist/cjs/api/types/DocAiSplitTrigger.js +42 -0
  94. package/dist/cjs/api/types/DocAiSplitTriggerMatch.d.ts +8 -0
  95. package/dist/cjs/api/types/DocAiSplitTriggerMatch.js +3 -0
  96. package/dist/cjs/api/types/DocAiSuggestedType.d.ts +8 -0
  97. package/dist/cjs/api/types/DocAiSuggestedType.js +3 -0
  98. package/dist/cjs/api/types/DocAiUsage.d.ts +6 -0
  99. package/dist/cjs/api/types/ReasoningEffort.d.ts +1 -1
  100. package/dist/cjs/api/types/ReasoningEffort.js +1 -1
  101. package/dist/cjs/api/types/ResponseReasoning.d.ts +1 -1
  102. package/dist/cjs/api/types/ResponseReasoningEffort.d.ts +1 -1
  103. package/dist/cjs/api/types/ResponseReasoningEffort.js +1 -1
  104. package/dist/cjs/api/types/ResponsesModelIds.d.ts +2 -2
  105. package/dist/cjs/api/types/ResponsesModelIds.js +2 -2
  106. package/dist/cjs/api/types/TextToSpeechSpeaker.d.ts +3 -3
  107. package/dist/cjs/api/types/TextToSpeechSpeaker.js +3 -3
  108. package/dist/cjs/api/types/V2ModelIds.d.ts +2 -2
  109. package/dist/cjs/api/types/V2ModelIds.js +2 -2
  110. package/dist/cjs/api/types/VoiceCloningConfigureConnection.d.ts +98 -0
  111. package/dist/cjs/api/types/VoiceCloningConfigureConnection.js +47 -0
  112. package/dist/cjs/api/types/VoiceCloningResponse.d.ts +3 -1
  113. package/dist/cjs/api/types/VoiceCloningSendText.d.ts +10 -0
  114. package/dist/cjs/api/types/VoiceCloningSendText.js +3 -0
  115. package/dist/cjs/api/types/VoiceCloningStreamCodec.d.ts +9 -0
  116. package/dist/cjs/api/types/VoiceCloningStreamCodec.js +12 -0
  117. package/dist/cjs/api/types/index.d.ts +27 -0
  118. package/dist/cjs/api/types/index.js +27 -0
  119. package/dist/cjs/version.d.ts +1 -1
  120. package/dist/cjs/version.js +1 -1
  121. package/dist/esm/BaseClient.mjs +2 -2
  122. package/dist/esm/Client.d.mts +3 -0
  123. package/dist/esm/Client.mjs +5 -0
  124. package/dist/esm/api/resources/chat/client/requests/CreateChatCompletionV2Request.d.mts +7 -4
  125. package/dist/esm/api/resources/docAi/client/Client.d.mts +88 -2
  126. package/dist/esm/api/resources/docAi/client/Client.mjs +241 -10
  127. package/dist/esm/api/resources/docAi/client/requests/DocAiClassifyRequest.d.mts +28 -0
  128. package/dist/esm/api/resources/docAi/client/requests/DocAiDigitiseRequest.d.mts +1 -10
  129. package/dist/esm/api/resources/docAi/client/requests/DocAiDigitiseRequest.mjs +0 -6
  130. package/dist/esm/api/resources/docAi/client/requests/DocAiExtractRequest.d.mts +0 -3
  131. package/dist/esm/api/resources/docAi/client/requests/DocAiGetResultsRequest.d.mts +11 -2
  132. package/dist/esm/api/resources/docAi/client/requests/DocAiSplitRequest.d.mts +23 -0
  133. package/dist/esm/api/resources/docAi/client/requests/DocAiSplitRequest.mjs +2 -0
  134. package/dist/esm/api/resources/docAi/client/requests/index.d.mts +2 -0
  135. package/dist/esm/api/resources/docAi/types/DocAiGetResultsResponse.d.mts +7 -1
  136. package/dist/esm/api/resources/docAi/types/Format.d.mts +6 -0
  137. package/dist/esm/api/resources/docAi/types/Format.mjs +6 -0
  138. package/dist/esm/api/resources/docAi/types/index.d.mts +1 -0
  139. package/dist/esm/api/resources/docAi/types/index.mjs +1 -0
  140. package/dist/esm/api/resources/index.d.mts +2 -0
  141. package/dist/esm/api/resources/index.mjs +2 -0
  142. package/dist/esm/api/resources/responses/client/requests/ResponsesCreateRequest.d.mts +2 -2
  143. package/dist/esm/api/resources/responses/client/requests/ResponsesCreateStreamRequest.d.mts +2 -2
  144. package/dist/esm/api/resources/voiceCloning/client/Client.d.mts +45 -12
  145. package/dist/esm/api/resources/voiceCloning/client/Client.mjs +138 -14
  146. package/dist/esm/api/resources/voiceCloning/client/requests/{VoiceCloningTextToSpeechRequest.d.mts → VoiceCloningRequest.d.mts} +12 -3
  147. package/dist/esm/api/resources/voiceCloning/client/requests/VoiceCloningRequest.mjs +2 -0
  148. package/dist/esm/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.d.mts +60 -0
  149. package/dist/esm/api/resources/voiceCloning/client/requests/VoiceCloningStreamRequest.mjs +2 -0
  150. package/dist/esm/api/resources/voiceCloning/client/requests/index.d.mts +2 -1
  151. package/dist/esm/api/resources/voiceCloningStreaming/client/Client.d.mts +24 -0
  152. package/dist/esm/api/resources/voiceCloningStreaming/client/Client.mjs +38 -0
  153. package/dist/esm/api/resources/voiceCloningStreaming/client/Socket.d.mts +52 -0
  154. package/dist/esm/api/resources/voiceCloningStreaming/client/Socket.mjs +125 -0
  155. package/dist/esm/api/resources/voiceCloningStreaming/client/index.d.mts +1 -0
  156. package/dist/esm/api/resources/voiceCloningStreaming/client/index.mjs +1 -0
  157. package/dist/esm/api/resources/voiceCloningStreaming/exports.d.mts +2 -0
  158. package/dist/esm/api/resources/voiceCloningStreaming/exports.mjs +3 -0
  159. package/dist/esm/api/resources/voiceCloningStreaming/index.d.mts +2 -0
  160. package/dist/esm/api/resources/voiceCloningStreaming/index.mjs +2 -0
  161. package/dist/esm/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.d.mts +6 -0
  162. package/dist/esm/api/resources/voiceCloningStreaming/types/VoiceCloningStreamingSendCompletionEvent.mjs +6 -0
  163. package/dist/esm/api/resources/voiceCloningStreaming/types/index.d.mts +1 -0
  164. package/dist/esm/api/resources/voiceCloningStreaming/types/index.mjs +1 -0
  165. package/dist/esm/api/types/Choice.d.mts +1 -1
  166. package/dist/esm/api/types/ConfigureConnection.d.mts +3 -3
  167. package/dist/esm/api/types/ConfigureConnection.mjs +3 -3
  168. package/dist/esm/api/types/CreateResponseV2Request.d.mts +2 -2
  169. package/dist/esm/api/types/DocAiBatchDocument.d.mts +10 -0
  170. package/dist/esm/api/types/DocAiBatchDocument.mjs +2 -0
  171. package/dist/esm/api/types/DocAiCapabilitiesResponse.d.mts +23 -0
  172. package/dist/esm/api/types/DocAiCapabilitiesResponse.mjs +2 -0
  173. package/dist/esm/api/types/DocAiCapabilityLimits.d.mts +12 -0
  174. package/dist/esm/api/types/DocAiCapabilityLimits.mjs +2 -0
  175. package/dist/esm/api/types/DocAiClassifyCategory.d.mts +9 -0
  176. package/dist/esm/api/types/DocAiClassifyCategory.mjs +2 -0
  177. package/dist/esm/api/types/DocAiClassifyConfig.d.mts +33 -0
  178. package/dist/esm/api/types/DocAiClassifyConfig.mjs +14 -0
  179. package/dist/esm/api/types/DocAiClassifyDecision.d.mts +24 -0
  180. package/dist/esm/api/types/DocAiClassifyDecision.mjs +2 -0
  181. package/dist/esm/api/types/DocAiClassifyInspection.d.mts +27 -0
  182. package/dist/esm/api/types/DocAiClassifyInspection.mjs +12 -0
  183. package/dist/esm/api/types/DocAiClassifyJobRequest.d.mts +24 -0
  184. package/dist/esm/api/types/DocAiClassifyJobRequest.mjs +9 -0
  185. package/dist/esm/api/types/DocAiClassifyOutput.d.mts +4 -0
  186. package/dist/esm/api/types/DocAiClassifyOutput.mjs +2 -0
  187. package/dist/esm/api/types/DocAiClassifyResult.d.mts +35 -0
  188. package/dist/esm/api/types/DocAiClassifyResult.mjs +8 -0
  189. package/dist/esm/api/types/DocAiClassifyResults.d.mts +14 -0
  190. package/dist/esm/api/types/DocAiClassifyResults.mjs +2 -0
  191. package/dist/esm/api/types/DocAiEvidence.d.mts +9 -0
  192. package/dist/esm/api/types/DocAiEvidence.mjs +2 -0
  193. package/dist/esm/api/types/DocAiJobAcceptedResponse.d.mts +23 -0
  194. package/dist/esm/api/types/DocAiJobAcceptedResponse.mjs +2 -0
  195. package/dist/esm/api/types/DocAiJobError.d.mts +23 -0
  196. package/dist/esm/api/types/DocAiJobError.mjs +2 -0
  197. package/dist/esm/api/types/DocAiJobStatusResponse.d.mts +16 -2
  198. package/dist/esm/api/types/DocAiJobUsage.d.mts +6 -0
  199. package/dist/esm/api/types/DocAiJobUsage.mjs +2 -0
  200. package/dist/esm/api/types/DocAiPageRange.d.mts +7 -0
  201. package/dist/esm/api/types/DocAiPageRange.mjs +2 -0
  202. package/dist/esm/api/types/DocAiSplitConfig.d.mts +34 -0
  203. package/dist/esm/api/types/DocAiSplitConfig.mjs +15 -0
  204. package/dist/esm/api/types/DocAiSplitJobRequest.d.mts +21 -0
  205. package/dist/esm/api/types/DocAiSplitJobRequest.mjs +8 -0
  206. package/dist/esm/api/types/DocAiSplitResult.d.mts +21 -0
  207. package/dist/esm/api/types/DocAiSplitResult.mjs +2 -0
  208. package/dist/esm/api/types/DocAiSplitResults.d.mts +12 -0
  209. package/dist/esm/api/types/DocAiSplitResults.mjs +2 -0
  210. package/dist/esm/api/types/DocAiSplitSegment.d.mts +28 -0
  211. package/dist/esm/api/types/DocAiSplitSegment.mjs +2 -0
  212. package/dist/esm/api/types/DocAiSplitTrigger.d.mts +59 -0
  213. package/dist/esm/api/types/DocAiSplitTrigger.mjs +39 -0
  214. package/dist/esm/api/types/DocAiSplitTriggerMatch.d.mts +8 -0
  215. package/dist/esm/api/types/DocAiSplitTriggerMatch.mjs +2 -0
  216. package/dist/esm/api/types/DocAiSuggestedType.d.mts +8 -0
  217. package/dist/esm/api/types/DocAiSuggestedType.mjs +2 -0
  218. package/dist/esm/api/types/DocAiUsage.d.mts +6 -0
  219. package/dist/esm/api/types/ReasoningEffort.d.mts +1 -1
  220. package/dist/esm/api/types/ReasoningEffort.mjs +1 -1
  221. package/dist/esm/api/types/ResponseReasoning.d.mts +1 -1
  222. package/dist/esm/api/types/ResponseReasoningEffort.d.mts +1 -1
  223. package/dist/esm/api/types/ResponseReasoningEffort.mjs +1 -1
  224. package/dist/esm/api/types/ResponsesModelIds.d.mts +2 -2
  225. package/dist/esm/api/types/ResponsesModelIds.mjs +2 -2
  226. package/dist/esm/api/types/TextToSpeechSpeaker.d.mts +3 -3
  227. package/dist/esm/api/types/TextToSpeechSpeaker.mjs +3 -3
  228. package/dist/esm/api/types/V2ModelIds.d.mts +2 -2
  229. package/dist/esm/api/types/V2ModelIds.mjs +2 -2
  230. package/dist/esm/api/types/VoiceCloningConfigureConnection.d.mts +98 -0
  231. package/dist/esm/api/types/VoiceCloningConfigureConnection.mjs +44 -0
  232. package/dist/esm/api/types/VoiceCloningResponse.d.mts +3 -1
  233. package/dist/esm/api/types/VoiceCloningSendText.d.mts +10 -0
  234. package/dist/esm/api/types/VoiceCloningSendText.mjs +2 -0
  235. package/dist/esm/api/types/VoiceCloningStreamCodec.d.mts +9 -0
  236. package/dist/esm/api/types/VoiceCloningStreamCodec.mjs +9 -0
  237. package/dist/esm/api/types/index.d.mts +27 -0
  238. package/dist/esm/api/types/index.mjs +27 -0
  239. package/dist/esm/version.d.mts +1 -1
  240. package/dist/esm/version.mjs +1 -1
  241. package/package.json +13 -1
  242. package/reference.md +320 -19
  243. /package/dist/cjs/api/resources/{voiceCloning/client/requests/VoiceCloningTextToSpeechRequest.js → docAi/client/requests/DocAiClassifyRequest.js} +0 -0
  244. /package/dist/esm/api/resources/{voiceCloning/client/requests/VoiceCloningTextToSpeechRequest.mjs → docAi/client/requests/DocAiClassifyRequest.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-alpha.2",
47
+ "User-Agent": "sarvamai/1.1.12-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);
@@ -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,12 +84,80 @@ 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
  */
91
90
  extract(request: SarvamAI.DocAiExtractRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiStartJobResponse>;
92
91
  private __extract;
92
+ /**
93
+ * Creates a Classify job. Classify labels a document, or each page, against the categories you define, or suggests a document type when you supply none.
94
+ *
95
+ * **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request` with the options below. You can also send a JSON body with `input` set to `{"document_ref": "..."}` to classify a child document returned by Split.
96
+ *
97
+ * **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. Add `?include=details` to the results for inspected pages, provenance and evidence.
98
+ *
99
+ * **Review:** `review_required` tells you whether a person should check the answer. `confidence` can be `null`; it is a token-based score, not a measured probability.
100
+ *
101
+ * @param {SarvamAI.DocAiClassifyRequest} request
102
+ * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
103
+ *
104
+ * @throws {@link SarvamAI.BadRequestError}
105
+ * @throws {@link SarvamAI.UnauthorizedError}
106
+ * @throws {@link SarvamAI.NotFoundError}
107
+ * @throws {@link SarvamAI.ConflictError}
108
+ * @throws {@link SarvamAI.UnprocessableEntityError}
109
+ *
110
+ * @example
111
+ * import { createReadStream } from "fs";
112
+ * await client.docAi.classify({
113
+ * request: {
114
+ * config: {
115
+ * scope: "document",
116
+ * categories: [{
117
+ * type: "Invoice",
118
+ * description: "A supplier bill with totals and payment details."
119
+ * }, {
120
+ * type: "Receipt",
121
+ * description: "Proof of a completed payment."
122
+ * }]
123
+ * }
124
+ * }
125
+ * })
126
+ */
127
+ classify(request: SarvamAI.DocAiClassifyRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiJobAcceptedResponse>;
128
+ private __classify;
129
+ /**
130
+ * Creates a Split job. Split divides a bundle of pages into separate child documents, each with its original page numbers and a `document_ref` you can reuse in other requests.
131
+ *
132
+ * **Methods:** `fixed_pages` (equal page groups), `page_ranges` (you give the boundaries), `triggers` (split at QR codes, barcodes, blank pages, text or photos) and `semantic` (the model finds the boundaries).
133
+ *
134
+ * **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request`.
135
+ *
136
+ * **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. `completed` means processing finished, not that every segment passed review: check each segment's `review.required`.
137
+ *
138
+ * @param {SarvamAI.DocAiSplitRequest} request
139
+ * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
140
+ *
141
+ * @throws {@link SarvamAI.BadRequestError}
142
+ * @throws {@link SarvamAI.UnauthorizedError}
143
+ * @throws {@link SarvamAI.NotFoundError}
144
+ * @throws {@link SarvamAI.ConflictError}
145
+ * @throws {@link SarvamAI.UnprocessableEntityError}
146
+ *
147
+ * @example
148
+ * import { createReadStream } from "fs";
149
+ * await client.docAi.split({
150
+ * request: {
151
+ * config: {
152
+ * method: "fixed_pages",
153
+ * pages_per_segment: 2,
154
+ * classify_segments: false
155
+ * }
156
+ * }
157
+ * })
158
+ */
159
+ split(request: SarvamAI.DocAiSplitRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiJobAcceptedResponse>;
160
+ private __split;
93
161
  /**
94
162
  * Returns a job's status and page-level usage.
95
163
  *
@@ -112,7 +180,7 @@ export declare class DocAiClient {
112
180
  *
113
181
  * **Extract results** include `job_id`, `type`, `status`, `usage`, `result`, `annotations` and `version`. `annotations` mirrors the result shape; every leaf has `confidence` and `sources`.
114
182
  *
115
- * @param {string} job_id - The unique identifier of the job
183
+ * @param {string} job_id - The unique identifier of the job.
116
184
  * @param {SarvamAI.DocAiGetResultsRequest} request
117
185
  * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
118
186
  *
@@ -128,6 +196,12 @@ export declare class DocAiClient {
128
196
  * await client.docAi.getResults("20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5", {
129
197
  * format: "json"
130
198
  * })
199
+ *
200
+ * @example
201
+ * await client.docAi.getResults("01a17998-120b-73dc-ad42-5cd66e0fe0ff")
202
+ *
203
+ * @example
204
+ * await client.docAi.getResults("01a17998-07ef-7040-800d-745a95140cf5")
131
205
  */
132
206
  getResults(job_id: string, request?: SarvamAI.DocAiGetResultsRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiGetResultsResponse>;
133
207
  private __getResults;
@@ -147,4 +221,16 @@ export declare class DocAiClient {
147
221
  */
148
222
  getDownloadUrl(job_id: string, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiDownloadUrlResponse>;
149
223
  private __getDownloadUrl;
224
+ /**
225
+ * Returns the Classify and Split features, input formats, limits and options enabled on this deployment. Check it before using options such as `reasoning_input` image modes or photo triggers.
226
+ *
227
+ * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
228
+ *
229
+ * @throws {@link SarvamAI.UnauthorizedError}
230
+ *
231
+ * @example
232
+ * await client.docAi.getCapabilities()
233
+ */
234
+ getCapabilities(requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocAiCapabilitiesResponse>;
235
+ private __getCapabilities;
150
236
  }
@@ -47,6 +47,7 @@ exports.DocAiClient = void 0;
47
47
  const BaseClient_js_1 = require("../../../../BaseClient.js");
48
48
  const headers_js_1 = require("../../../../core/headers.js");
49
49
  const core = __importStar(require("../../../../core/index.js"));
50
+ const json_js_1 = require("../../../../core/json.js");
50
51
  const environments = __importStar(require("../../../../environments.js"));
51
52
  const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
53
  const errors = __importStar(require("../../../../errors/index.js"));
@@ -166,9 +167,6 @@ class DocAiClient {
166
167
  if (request.language != null) {
167
168
  _body.append("language", request.language);
168
169
  }
169
- if (request.output_format != null) {
170
- _body.append("output_format", request.output_format);
171
- }
172
170
  if (request.content_type != null) {
173
171
  _body.append("content_type", request.content_type);
174
172
  }
@@ -245,7 +243,6 @@ class DocAiClient {
245
243
  * import { createReadStream } from "fs";
246
244
  * await client.docAi.extract({
247
245
  * 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
246
  * output_format: "json"
250
247
  * })
251
248
  */
@@ -270,9 +267,6 @@ class DocAiClient {
270
267
  if (request.config_id != null) {
271
268
  _body.append("config_id", request.config_id);
272
269
  }
273
- if (request.language != null) {
274
- _body.append("language", request.language);
275
- }
276
270
  if (request.output_format != null) {
277
271
  _body.append("output_format", request.output_format);
278
272
  }
@@ -327,6 +321,189 @@ class DocAiClient {
327
321
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/doc-ai/v1/job/extract");
328
322
  });
329
323
  }
324
+ /**
325
+ * Creates a Classify job. Classify labels a document, or each page, against the categories you define, or suggests a document type when you supply none.
326
+ *
327
+ * **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request` with the options below. You can also send a JSON body with `input` set to `{"document_ref": "..."}` to classify a child document returned by Split.
328
+ *
329
+ * **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. Add `?include=details` to the results for inspected pages, provenance and evidence.
330
+ *
331
+ * **Review:** `review_required` tells you whether a person should check the answer. `confidence` can be `null`; it is a token-based score, not a measured probability.
332
+ *
333
+ * @param {SarvamAI.DocAiClassifyRequest} request
334
+ * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
335
+ *
336
+ * @throws {@link SarvamAI.BadRequestError}
337
+ * @throws {@link SarvamAI.UnauthorizedError}
338
+ * @throws {@link SarvamAI.NotFoundError}
339
+ * @throws {@link SarvamAI.ConflictError}
340
+ * @throws {@link SarvamAI.UnprocessableEntityError}
341
+ *
342
+ * @example
343
+ * import { createReadStream } from "fs";
344
+ * await client.docAi.classify({
345
+ * request: {
346
+ * config: {
347
+ * scope: "document",
348
+ * categories: [{
349
+ * type: "Invoice",
350
+ * description: "A supplier bill with totals and payment details."
351
+ * }, {
352
+ * type: "Receipt",
353
+ * description: "Proof of a completed payment."
354
+ * }]
355
+ * }
356
+ * }
357
+ * })
358
+ */
359
+ classify(request, requestOptions) {
360
+ return core.HttpResponsePromise.fromPromise(this.__classify(request, requestOptions));
361
+ }
362
+ __classify(request, requestOptions) {
363
+ return __awaiter(this, void 0, void 0, function* () {
364
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
365
+ const _body = yield core.newFormData();
366
+ if (request.file != null) {
367
+ for (const _file of request.file) {
368
+ yield _body.appendFile("file", _file);
369
+ }
370
+ }
371
+ if (request.upload_ids != null) {
372
+ _body.append("upload_ids", request.upload_ids);
373
+ }
374
+ _body.append("request", (0, json_js_1.toJson)(request.request));
375
+ const _maybeEncodedRequest = yield _body.getRequest();
376
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
377
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ "Idempotency-Key": request["Idempotency-Key"] }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
378
+ const _response = yield core.fetcher({
379
+ 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, "doc-ai/v1/job/classify"),
380
+ method: "POST",
381
+ headers: _headers,
382
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
383
+ requestType: "file",
384
+ duplex: _maybeEncodedRequest.duplex,
385
+ body: _maybeEncodedRequest.body,
386
+ 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,
387
+ 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,
388
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
389
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
390
+ logging: this._options.logging,
391
+ });
392
+ if (_response.ok) {
393
+ return { data: _response.body, rawResponse: _response.rawResponse };
394
+ }
395
+ if (_response.error.reason === "status-code") {
396
+ switch (_response.error.statusCode) {
397
+ case 400:
398
+ throw new SarvamAI.BadRequestError(_response.error.body, _response.rawResponse);
399
+ case 401:
400
+ throw new SarvamAI.UnauthorizedError(_response.error.body, _response.rawResponse);
401
+ case 404:
402
+ throw new SarvamAI.NotFoundError(_response.error.body, _response.rawResponse);
403
+ case 409:
404
+ throw new SarvamAI.ConflictError(_response.error.body, _response.rawResponse);
405
+ case 422:
406
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
407
+ default:
408
+ throw new errors.SarvamAIError({
409
+ statusCode: _response.error.statusCode,
410
+ body: _response.error.body,
411
+ rawResponse: _response.rawResponse,
412
+ });
413
+ }
414
+ }
415
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/doc-ai/v1/job/classify");
416
+ });
417
+ }
418
+ /**
419
+ * Creates a Split job. Split divides a bundle of pages into separate child documents, each with its original page numbers and a `document_ref` you can reuse in other requests.
420
+ *
421
+ * **Methods:** `fixed_pages` (equal page groups), `page_ranges` (you give the boundaries), `triggers` (split at QR codes, barcodes, blank pages, text or photos) and `semantic` (the model finds the boundaries).
422
+ *
423
+ * **Input:** send `file` (PDF, PNG, JPEG or TIFF; repeat the field for up to 10 documents) or `upload_ids`, plus a JSON `request`.
424
+ *
425
+ * **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until it is `completed`, then fetch `GET /doc-ai/v1/job/{job_id}/results`. `completed` means processing finished, not that every segment passed review: check each segment's `review.required`.
426
+ *
427
+ * @param {SarvamAI.DocAiSplitRequest} request
428
+ * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
429
+ *
430
+ * @throws {@link SarvamAI.BadRequestError}
431
+ * @throws {@link SarvamAI.UnauthorizedError}
432
+ * @throws {@link SarvamAI.NotFoundError}
433
+ * @throws {@link SarvamAI.ConflictError}
434
+ * @throws {@link SarvamAI.UnprocessableEntityError}
435
+ *
436
+ * @example
437
+ * import { createReadStream } from "fs";
438
+ * await client.docAi.split({
439
+ * request: {
440
+ * config: {
441
+ * method: "fixed_pages",
442
+ * pages_per_segment: 2,
443
+ * classify_segments: false
444
+ * }
445
+ * }
446
+ * })
447
+ */
448
+ split(request, requestOptions) {
449
+ return core.HttpResponsePromise.fromPromise(this.__split(request, requestOptions));
450
+ }
451
+ __split(request, requestOptions) {
452
+ return __awaiter(this, void 0, void 0, function* () {
453
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
454
+ const _body = yield core.newFormData();
455
+ if (request.file != null) {
456
+ for (const _file of request.file) {
457
+ yield _body.appendFile("file", _file);
458
+ }
459
+ }
460
+ if (request.upload_ids != null) {
461
+ _body.append("upload_ids", request.upload_ids);
462
+ }
463
+ _body.append("request", (0, json_js_1.toJson)(request.request));
464
+ const _maybeEncodedRequest = yield _body.getRequest();
465
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
466
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ "Idempotency-Key": request["Idempotency-Key"] }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
467
+ const _response = yield core.fetcher({
468
+ 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, "doc-ai/v1/job/split"),
469
+ method: "POST",
470
+ headers: _headers,
471
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
472
+ requestType: "file",
473
+ duplex: _maybeEncodedRequest.duplex,
474
+ body: _maybeEncodedRequest.body,
475
+ 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,
476
+ 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,
477
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
478
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
479
+ logging: this._options.logging,
480
+ });
481
+ if (_response.ok) {
482
+ return { data: _response.body, rawResponse: _response.rawResponse };
483
+ }
484
+ if (_response.error.reason === "status-code") {
485
+ switch (_response.error.statusCode) {
486
+ case 400:
487
+ throw new SarvamAI.BadRequestError(_response.error.body, _response.rawResponse);
488
+ case 401:
489
+ throw new SarvamAI.UnauthorizedError(_response.error.body, _response.rawResponse);
490
+ case 404:
491
+ throw new SarvamAI.NotFoundError(_response.error.body, _response.rawResponse);
492
+ case 409:
493
+ throw new SarvamAI.ConflictError(_response.error.body, _response.rawResponse);
494
+ case 422:
495
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
496
+ default:
497
+ throw new errors.SarvamAIError({
498
+ statusCode: _response.error.statusCode,
499
+ body: _response.error.body,
500
+ rawResponse: _response.rawResponse,
501
+ });
502
+ }
503
+ }
504
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/doc-ai/v1/job/split");
505
+ });
506
+ }
330
507
  /**
331
508
  * Returns a job's status and page-level usage.
332
509
  *
@@ -384,7 +561,7 @@ class DocAiClient {
384
561
  *
385
562
  * **Extract results** include `job_id`, `type`, `status`, `usage`, `result`, `annotations` and `version`. `annotations` mirrors the result shape; every leaf has `confidence` and `sources`.
386
563
  *
387
- * @param {string} job_id - The unique identifier of the job
564
+ * @param {string} job_id - The unique identifier of the job.
388
565
  * @param {SarvamAI.DocAiGetResultsRequest} request
389
566
  * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
390
567
  *
@@ -400,6 +577,12 @@ class DocAiClient {
400
577
  * await client.docAi.getResults("20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5", {
401
578
  * format: "json"
402
579
  * })
580
+ *
581
+ * @example
582
+ * await client.docAi.getResults("01a17998-120b-73dc-ad42-5cd66e0fe0ff")
583
+ *
584
+ * @example
585
+ * await client.docAi.getResults("01a17998-07ef-7040-800d-745a95140cf5")
403
586
  */
404
587
  getResults(job_id, request = {}, requestOptions) {
405
588
  return core.HttpResponsePromise.fromPromise(this.__getResults(job_id, request, requestOptions));
@@ -407,9 +590,10 @@ class DocAiClient {
407
590
  __getResults(job_id_1) {
408
591
  return __awaiter(this, arguments, void 0, function* (job_id, request = {}, requestOptions) {
409
592
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
410
- const { format } = request;
593
+ const { format, include } = request;
411
594
  const _queryParams = {
412
- format,
595
+ format: format != null ? format : undefined,
596
+ include: include != null ? include : undefined,
413
597
  };
414
598
  const _authRequest = yield this._options.authProvider.getAuthRequest();
415
599
  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);
@@ -497,5 +681,52 @@ class DocAiClient {
497
681
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/doc-ai/v1/job/{job_id}/download-url");
498
682
  });
499
683
  }
684
+ /**
685
+ * Returns the Classify and Split features, input formats, limits and options enabled on this deployment. Check it before using options such as `reasoning_input` image modes or photo triggers.
686
+ *
687
+ * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration.
688
+ *
689
+ * @throws {@link SarvamAI.UnauthorizedError}
690
+ *
691
+ * @example
692
+ * await client.docAi.getCapabilities()
693
+ */
694
+ getCapabilities(requestOptions) {
695
+ return core.HttpResponsePromise.fromPromise(this.__getCapabilities(requestOptions));
696
+ }
697
+ __getCapabilities(requestOptions) {
698
+ return __awaiter(this, void 0, void 0, function* () {
699
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
700
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
701
+ 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);
702
+ const _response = yield core.fetcher({
703
+ 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, "doc-ai/v1/capabilities"),
704
+ method: "GET",
705
+ headers: _headers,
706
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
707
+ 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,
708
+ 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,
709
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
710
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
711
+ logging: this._options.logging,
712
+ });
713
+ if (_response.ok) {
714
+ return { data: _response.body, rawResponse: _response.rawResponse };
715
+ }
716
+ if (_response.error.reason === "status-code") {
717
+ switch (_response.error.statusCode) {
718
+ case 401:
719
+ throw new SarvamAI.UnauthorizedError(_response.error.body, _response.rawResponse);
720
+ default:
721
+ throw new errors.SarvamAIError({
722
+ statusCode: _response.error.statusCode,
723
+ body: _response.error.body,
724
+ rawResponse: _response.rawResponse,
725
+ });
726
+ }
727
+ }
728
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/doc-ai/v1/capabilities");
729
+ });
730
+ }
500
731
  }
501
732
  exports.DocAiClient = DocAiClient;
@@ -0,0 +1,28 @@
1
+ import type * as core from "../../../../../core/index.js";
2
+ import type * as SarvamAI from "../../../../index.js";
3
+ /**
4
+ * @example
5
+ * {
6
+ * request: {
7
+ * config: {
8
+ * scope: "document",
9
+ * categories: [{
10
+ * type: "Invoice",
11
+ * description: "A supplier bill with totals and payment details."
12
+ * }, {
13
+ * type: "Receipt",
14
+ * description: "Proof of a completed payment."
15
+ * }]
16
+ * }
17
+ * }
18
+ * }
19
+ */
20
+ export interface DocAiClassifyRequest {
21
+ /** Retry the same submission without creating another job. The same key with the same request returns the original job (`idempotency_replayed: true`); the same key with a changed request returns `409 IDEMPOTENCY_CONFLICT`. */
22
+ "Idempotency-Key"?: string;
23
+ /** Document file(s): PDF, PNG, JPEG or TIFF. Repeat the part for up to 10 documents with the same config. */
24
+ file?: core.file.Uploadable[] | undefined;
25
+ /** Comma-separated upload IDs returned by `POST /doc-ai/v1/job/upload`, with or instead of `file`. */
26
+ upload_ids?: string;
27
+ request: SarvamAI.DocAiClassifyJobRequest;
28
+ }
@@ -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
  * {
@@ -8,8 +9,16 @@
8
9
  * {
9
10
  * format: "json"
10
11
  * }
12
+ *
13
+ * @example
14
+ * {}
15
+ *
16
+ * @example
17
+ * {}
11
18
  */
12
19
  export interface DocAiGetResultsRequest {
13
- /** Output format of the results, e.g. `json`. */
14
- format?: string;
20
+ /** 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. */
21
+ format?: SarvamAI.Format;
22
+ /** Set to `details` for Classify and Split jobs to add inspected pages, provenance and boundary details. Supporting evidence also needs `output.include_evidence` on the request. */
23
+ include?: "details";
15
24
  }