sarvamai 0.0.2 → 0.0.4

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 (111) hide show
  1. package/Client.d.ts +5 -5
  2. package/Client.js +3 -3
  3. package/README.md +8 -8
  4. package/api/errors/BadRequestError.d.ts +1 -1
  5. package/api/errors/BadRequestError.js +1 -1
  6. package/api/errors/ForbiddenError.d.ts +3 -3
  7. package/api/errors/ForbiddenError.js +1 -1
  8. package/api/errors/InternalServerError.d.ts +1 -1
  9. package/api/errors/InternalServerError.js +1 -1
  10. package/api/errors/ServiceUnavailableError.d.ts +3 -3
  11. package/api/errors/ServiceUnavailableError.js +1 -1
  12. package/api/errors/TooManyRequestsError.d.ts +3 -3
  13. package/api/errors/TooManyRequestsError.js +1 -1
  14. package/api/errors/UnprocessableEntityError.d.ts +1 -1
  15. package/api/errors/UnprocessableEntityError.js +1 -1
  16. package/api/resources/analytics/client/Client.d.ts +18 -18
  17. package/api/resources/analytics/client/Client.js +39 -39
  18. package/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +2 -2
  19. package/api/resources/pdf/client/Client.d.ts +12 -12
  20. package/api/resources/pdf/client/Client.js +27 -27
  21. package/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +3 -3
  22. package/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +2 -2
  23. package/api/resources/speechToText/client/Client.d.ts +18 -18
  24. package/api/resources/speechToText/client/Client.js +39 -39
  25. package/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +3 -3
  26. package/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +2 -2
  27. package/api/resources/text/client/Client.d.ts +23 -23
  28. package/api/resources/text/client/Client.js +52 -52
  29. package/api/resources/text/client/requests/TranslationRequest.d.ts +8 -8
  30. package/api/resources/text/client/requests/TransliterationRequest.d.ts +5 -5
  31. package/api/resources/textToSpeech/client/Client.d.ts +9 -9
  32. package/api/resources/textToSpeech/client/Client.js +18 -18
  33. package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +5 -5
  34. package/api/types/CallAnalyticsJobParameters.d.ts +3 -3
  35. package/api/types/CallAnalyticsJobRequest.d.ts +2 -2
  36. package/api/types/CallAnalyticsResponse.d.ts +4 -4
  37. package/api/types/DiarizedTranscript.d.ts +2 -2
  38. package/api/types/ErrorDetails.d.ts +2 -2
  39. package/api/types/ErrorMessage.d.ts +2 -2
  40. package/api/types/Question.d.ts +2 -2
  41. package/api/types/SpeechToTextResponse.d.ts +3 -3
  42. package/api/types/SpeechToTextTranslateResponse.d.ts +3 -3
  43. package/api/types/TextAnalyticsResponse.d.ts +2 -2
  44. package/dist/Client.d.ts +5 -5
  45. package/dist/Client.js +3 -3
  46. package/dist/api/errors/BadRequestError.d.ts +1 -1
  47. package/dist/api/errors/BadRequestError.js +1 -1
  48. package/dist/api/errors/ForbiddenError.d.ts +3 -3
  49. package/dist/api/errors/ForbiddenError.js +1 -1
  50. package/dist/api/errors/InternalServerError.d.ts +1 -1
  51. package/dist/api/errors/InternalServerError.js +1 -1
  52. package/dist/api/errors/ServiceUnavailableError.d.ts +3 -3
  53. package/dist/api/errors/ServiceUnavailableError.js +1 -1
  54. package/dist/api/errors/TooManyRequestsError.d.ts +3 -3
  55. package/dist/api/errors/TooManyRequestsError.js +1 -1
  56. package/dist/api/errors/UnprocessableEntityError.d.ts +1 -1
  57. package/dist/api/errors/UnprocessableEntityError.js +1 -1
  58. package/dist/api/resources/analytics/client/Client.d.ts +18 -18
  59. package/dist/api/resources/analytics/client/Client.js +39 -39
  60. package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +2 -2
  61. package/dist/api/resources/pdf/client/Client.d.ts +12 -12
  62. package/dist/api/resources/pdf/client/Client.js +27 -27
  63. package/dist/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +3 -3
  64. package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +2 -2
  65. package/dist/api/resources/speechToText/client/Client.d.ts +18 -18
  66. package/dist/api/resources/speechToText/client/Client.js +39 -39
  67. package/dist/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +3 -3
  68. package/dist/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +2 -2
  69. package/dist/api/resources/text/client/Client.d.ts +23 -23
  70. package/dist/api/resources/text/client/Client.js +52 -52
  71. package/dist/api/resources/text/client/requests/TranslationRequest.d.ts +8 -8
  72. package/dist/api/resources/text/client/requests/TransliterationRequest.d.ts +5 -5
  73. package/dist/api/resources/textToSpeech/client/Client.d.ts +9 -9
  74. package/dist/api/resources/textToSpeech/client/Client.js +18 -18
  75. package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +5 -5
  76. package/dist/api/types/CallAnalyticsJobParameters.d.ts +3 -3
  77. package/dist/api/types/CallAnalyticsJobRequest.d.ts +2 -2
  78. package/dist/api/types/CallAnalyticsResponse.d.ts +4 -4
  79. package/dist/api/types/DiarizedTranscript.d.ts +2 -2
  80. package/dist/api/types/ErrorDetails.d.ts +2 -2
  81. package/dist/api/types/ErrorMessage.d.ts +2 -2
  82. package/dist/api/types/Question.d.ts +2 -2
  83. package/dist/api/types/SpeechToTextResponse.d.ts +3 -3
  84. package/dist/api/types/SpeechToTextTranslateResponse.d.ts +3 -3
  85. package/dist/api/types/TextAnalyticsResponse.d.ts +2 -2
  86. package/dist/environments.d.ts +2 -2
  87. package/dist/environments.js +2 -2
  88. package/dist/errors/{SarvamError.d.ts → SarvamAIError.d.ts} +1 -1
  89. package/{errors/SarvamError.js → dist/errors/SarvamAIError.js} +4 -4
  90. package/dist/errors/{SarvamTimeoutError.d.ts → SarvamAITimeoutError.d.ts} +1 -1
  91. package/{errors/SarvamTimeoutError.js → dist/errors/SarvamAITimeoutError.js} +4 -4
  92. package/dist/errors/index.d.ts +2 -2
  93. package/dist/errors/index.js +5 -5
  94. package/dist/index.d.ts +4 -4
  95. package/dist/index.js +6 -6
  96. package/dist/version.d.ts +1 -1
  97. package/dist/version.js +1 -1
  98. package/environments.d.ts +2 -2
  99. package/environments.js +2 -2
  100. package/errors/{SarvamError.d.ts → SarvamAIError.d.ts} +1 -1
  101. package/{dist/errors/SarvamError.js → errors/SarvamAIError.js} +4 -4
  102. package/errors/{SarvamTimeoutError.d.ts → SarvamAITimeoutError.d.ts} +1 -1
  103. package/{dist/errors/SarvamTimeoutError.js → errors/SarvamAITimeoutError.js} +4 -4
  104. package/errors/index.d.ts +2 -2
  105. package/errors/index.js +5 -5
  106. package/index.d.ts +4 -4
  107. package/index.js +6 -6
  108. package/package.json +1 -1
  109. package/reference.md +20 -20
  110. package/version.d.ts +1 -1
  111. package/version.js +1 -1
@@ -51,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.Text = void 0;
52
52
  const environments = __importStar(require("../../../../environments"));
53
53
  const core = __importStar(require("../../../../core"));
54
- const Sarvam = __importStar(require("../../../index"));
54
+ const SarvamAI = __importStar(require("../../../index"));
55
55
  const url_join_1 = __importDefault(require("url-join"));
56
56
  const errors = __importStar(require("../../../../errors/index"));
57
57
  class Text {
@@ -77,14 +77,14 @@ class Text {
77
77
  *
78
78
  * For hands-on practice, you can explore the notebook tutorial on [Translate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/translate/Translate_API_Tutorial.ipynb).
79
79
  *
80
- * @param {Sarvam.TranslationRequest} request
80
+ * @param {SarvamAI.TranslationRequest} request
81
81
  * @param {Text.RequestOptions} requestOptions - Request-specific configuration.
82
82
  *
83
- * @throws {@link Sarvam.BadRequestError}
84
- * @throws {@link Sarvam.ForbiddenError}
85
- * @throws {@link Sarvam.UnprocessableEntityError}
86
- * @throws {@link Sarvam.TooManyRequestsError}
87
- * @throws {@link Sarvam.InternalServerError}
83
+ * @throws {@link SarvamAI.BadRequestError}
84
+ * @throws {@link SarvamAI.ForbiddenError}
85
+ * @throws {@link SarvamAI.UnprocessableEntityError}
86
+ * @throws {@link SarvamAI.TooManyRequestsError}
87
+ * @throws {@link SarvamAI.InternalServerError}
88
88
  *
89
89
  * @example
90
90
  * await client.text.translate({
@@ -97,11 +97,11 @@ class Text {
97
97
  return __awaiter(this, void 0, void 0, function* () {
98
98
  var _a, _b;
99
99
  const _response = yield core.fetcher({
100
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamEnvironment.Production, "translate"),
100
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "translate"),
101
101
  method: "POST",
102
102
  headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
103
103
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
104
- : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.2", "User-Agent": "sarvamai/0.0.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
104
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.4", "User-Agent": "sarvamai/0.0.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
105
105
  contentType: "application/json",
106
106
  requestType: "json",
107
107
  body: request,
@@ -115,17 +115,17 @@ class Text {
115
115
  if (_response.error.reason === "status-code") {
116
116
  switch (_response.error.statusCode) {
117
117
  case 400:
118
- throw new Sarvam.BadRequestError(_response.error.body);
118
+ throw new SarvamAI.BadRequestError(_response.error.body);
119
119
  case 403:
120
- throw new Sarvam.ForbiddenError(_response.error.body);
120
+ throw new SarvamAI.ForbiddenError(_response.error.body);
121
121
  case 422:
122
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
122
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
123
123
  case 429:
124
- throw new Sarvam.TooManyRequestsError(_response.error.body);
124
+ throw new SarvamAI.TooManyRequestsError(_response.error.body);
125
125
  case 500:
126
- throw new Sarvam.InternalServerError(_response.error.body);
126
+ throw new SarvamAI.InternalServerError(_response.error.body);
127
127
  default:
128
- throw new errors.SarvamError({
128
+ throw new errors.SarvamAIError({
129
129
  statusCode: _response.error.statusCode,
130
130
  body: _response.error.body,
131
131
  });
@@ -133,14 +133,14 @@ class Text {
133
133
  }
134
134
  switch (_response.error.reason) {
135
135
  case "non-json":
136
- throw new errors.SarvamError({
136
+ throw new errors.SarvamAIError({
137
137
  statusCode: _response.error.statusCode,
138
138
  body: _response.error.rawBody,
139
139
  });
140
140
  case "timeout":
141
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /translate.");
141
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /translate.");
142
142
  case "unknown":
143
- throw new errors.SarvamError({
143
+ throw new errors.SarvamAIError({
144
144
  message: _response.error.errorMessage,
145
145
  });
146
146
  }
@@ -149,14 +149,14 @@ class Text {
149
149
  /**
150
150
  * Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.
151
151
  *
152
- * @param {Sarvam.LanguageIdentificationRequest} request
152
+ * @param {SarvamAI.LanguageIdentificationRequest} request
153
153
  * @param {Text.RequestOptions} requestOptions - Request-specific configuration.
154
154
  *
155
- * @throws {@link Sarvam.BadRequestError}
156
- * @throws {@link Sarvam.ForbiddenError}
157
- * @throws {@link Sarvam.UnprocessableEntityError}
158
- * @throws {@link Sarvam.TooManyRequestsError}
159
- * @throws {@link Sarvam.InternalServerError}
155
+ * @throws {@link SarvamAI.BadRequestError}
156
+ * @throws {@link SarvamAI.ForbiddenError}
157
+ * @throws {@link SarvamAI.UnprocessableEntityError}
158
+ * @throws {@link SarvamAI.TooManyRequestsError}
159
+ * @throws {@link SarvamAI.InternalServerError}
160
160
  *
161
161
  * @example
162
162
  * await client.text.identifyLanguage({
@@ -167,11 +167,11 @@ class Text {
167
167
  return __awaiter(this, void 0, void 0, function* () {
168
168
  var _a, _b;
169
169
  const _response = yield core.fetcher({
170
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamEnvironment.Production, "text-lid"),
170
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "text-lid"),
171
171
  method: "POST",
172
172
  headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
173
173
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
174
- : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.2", "User-Agent": "sarvamai/0.0.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
174
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.4", "User-Agent": "sarvamai/0.0.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
175
175
  contentType: "application/json",
176
176
  requestType: "json",
177
177
  body: request,
@@ -185,17 +185,17 @@ class Text {
185
185
  if (_response.error.reason === "status-code") {
186
186
  switch (_response.error.statusCode) {
187
187
  case 400:
188
- throw new Sarvam.BadRequestError(_response.error.body);
188
+ throw new SarvamAI.BadRequestError(_response.error.body);
189
189
  case 403:
190
- throw new Sarvam.ForbiddenError(_response.error.body);
190
+ throw new SarvamAI.ForbiddenError(_response.error.body);
191
191
  case 422:
192
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
192
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
193
193
  case 429:
194
- throw new Sarvam.TooManyRequestsError(_response.error.body);
194
+ throw new SarvamAI.TooManyRequestsError(_response.error.body);
195
195
  case 500:
196
- throw new Sarvam.InternalServerError(_response.error.body);
196
+ throw new SarvamAI.InternalServerError(_response.error.body);
197
197
  default:
198
- throw new errors.SarvamError({
198
+ throw new errors.SarvamAIError({
199
199
  statusCode: _response.error.statusCode,
200
200
  body: _response.error.body,
201
201
  });
@@ -203,14 +203,14 @@ class Text {
203
203
  }
204
204
  switch (_response.error.reason) {
205
205
  case "non-json":
206
- throw new errors.SarvamError({
206
+ throw new errors.SarvamAIError({
207
207
  statusCode: _response.error.statusCode,
208
208
  body: _response.error.rawBody,
209
209
  });
210
210
  case "timeout":
211
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /text-lid.");
211
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /text-lid.");
212
212
  case "unknown":
213
- throw new errors.SarvamError({
213
+ throw new errors.SarvamAIError({
214
214
  message: _response.error.errorMessage,
215
215
  });
216
216
  }
@@ -241,14 +241,14 @@ class Text {
241
241
  *
242
242
  * For hands-on practice, you can explore the notebook tutorial on [Transliterate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/transliterate/Transliterate_API_Tutorial.ipynb).
243
243
  *
244
- * @param {Sarvam.TransliterationRequest} request
244
+ * @param {SarvamAI.TransliterationRequest} request
245
245
  * @param {Text.RequestOptions} requestOptions - Request-specific configuration.
246
246
  *
247
- * @throws {@link Sarvam.BadRequestError}
248
- * @throws {@link Sarvam.ForbiddenError}
249
- * @throws {@link Sarvam.UnprocessableEntityError}
250
- * @throws {@link Sarvam.TooManyRequestsError}
251
- * @throws {@link Sarvam.InternalServerError}
247
+ * @throws {@link SarvamAI.BadRequestError}
248
+ * @throws {@link SarvamAI.ForbiddenError}
249
+ * @throws {@link SarvamAI.UnprocessableEntityError}
250
+ * @throws {@link SarvamAI.TooManyRequestsError}
251
+ * @throws {@link SarvamAI.InternalServerError}
252
252
  *
253
253
  * @example
254
254
  * await client.text.transliterate({
@@ -261,11 +261,11 @@ class Text {
261
261
  return __awaiter(this, void 0, void 0, function* () {
262
262
  var _a, _b;
263
263
  const _response = yield core.fetcher({
264
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamEnvironment.Production, "transliterate"),
264
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "transliterate"),
265
265
  method: "POST",
266
266
  headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
267
267
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
268
- : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.2", "User-Agent": "sarvamai/0.0.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
268
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.4", "User-Agent": "sarvamai/0.0.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
269
269
  contentType: "application/json",
270
270
  requestType: "json",
271
271
  body: request,
@@ -279,17 +279,17 @@ class Text {
279
279
  if (_response.error.reason === "status-code") {
280
280
  switch (_response.error.statusCode) {
281
281
  case 400:
282
- throw new Sarvam.BadRequestError(_response.error.body);
282
+ throw new SarvamAI.BadRequestError(_response.error.body);
283
283
  case 403:
284
- throw new Sarvam.ForbiddenError(_response.error.body);
284
+ throw new SarvamAI.ForbiddenError(_response.error.body);
285
285
  case 422:
286
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
286
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
287
287
  case 429:
288
- throw new Sarvam.TooManyRequestsError(_response.error.body);
288
+ throw new SarvamAI.TooManyRequestsError(_response.error.body);
289
289
  case 500:
290
- throw new Sarvam.InternalServerError(_response.error.body);
290
+ throw new SarvamAI.InternalServerError(_response.error.body);
291
291
  default:
292
- throw new errors.SarvamError({
292
+ throw new errors.SarvamAIError({
293
293
  statusCode: _response.error.statusCode,
294
294
  body: _response.error.body,
295
295
  });
@@ -297,14 +297,14 @@ class Text {
297
297
  }
298
298
  switch (_response.error.reason) {
299
299
  case "non-json":
300
- throw new errors.SarvamError({
300
+ throw new errors.SarvamAIError({
301
301
  statusCode: _response.error.statusCode,
302
302
  body: _response.error.rawBody,
303
303
  });
304
304
  case "timeout":
305
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /transliterate.");
305
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /transliterate.");
306
306
  case "unknown":
307
- throw new errors.SarvamError({
307
+ throw new errors.SarvamAIError({
308
308
  message: _response.error.errorMessage,
309
309
  });
310
310
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../../../../index";
4
+ import * as SarvamAI from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
@@ -21,7 +21,7 @@ export interface TranslationRequest {
21
21
  * Note: The source language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic translation.
22
22
  *
23
23
  */
24
- source_language_code: Sarvam.TranslateSourceLanguage;
24
+ source_language_code: SarvamAI.TranslateSourceLanguage;
25
25
  /**
26
26
  * The language code of the translated text. This specifies the target language for translation.
27
27
  *
@@ -30,13 +30,13 @@ export interface TranslationRequest {
30
30
  * Note:The target language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic translation.
31
31
  *
32
32
  */
33
- target_language_code: Sarvam.TranslateTargetLanguage;
33
+ target_language_code: SarvamAI.TranslateTargetLanguage;
34
34
  /** Please specify the gender of the speaker for better translations. This feature is only supported for the code-mixed translation models currently. */
35
- speaker_gender?: Sarvam.TranslateSpeakerGender;
35
+ speaker_gender?: SarvamAI.TranslateSpeakerGender;
36
36
  /** Specifies the tone or style of the translation. Choose between formal, classic-colloquial and modern-colloquial translations. Default is formal. */
37
- mode?: Sarvam.TranslateMode;
37
+ mode?: SarvamAI.TranslateMode;
38
38
  /** Specifies the translation model to use. Currently, only one model is supported.Note:- This parameter is optional but will be deprecated by the end of January; avoid including it in your requests. */
39
- model?: Sarvam.TranslateModel;
39
+ model?: SarvamAI.TranslateModel;
40
40
  /** This will enable custom preprocessing of the input text which can result in better translations. */
41
41
  enable_preprocessing?: boolean;
42
42
  /**
@@ -62,7 +62,7 @@ export interface TranslationRequest {
62
62
  * - **fully-native output**: आपका रु. 3000 का ई.एम.ऐ. पेंडिंग है।
63
63
  * - **spoken-form-in-native output**: आपका थ्री थाउजेंड रूपीस का ईएमअइ पेंडिंग है।
64
64
  */
65
- output_script?: Sarvam.TranslatePostprocessing;
65
+ output_script?: SarvamAI.TranslatePostprocessing;
66
66
  /**
67
67
  * `numerals_format` is an optional parameter with two options:
68
68
  *
@@ -73,5 +73,5 @@ export interface TranslationRequest {
73
73
  * - If `international` format is selected, we use regular numerals (0-9). For example: `मेरा phone number है: 9840950950`.
74
74
  * - If `native` format is selected, we use language-specific native numerals, like: `मेरा phone number है: ९८४०९५०९५०`.
75
75
  */
76
- numerals_format?: Sarvam.NumeralsFormat;
76
+ numerals_format?: SarvamAI.NumeralsFormat;
77
77
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../../../../index";
4
+ import * as SarvamAI from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
@@ -21,7 +21,7 @@ export interface TransliterationRequest {
21
21
  * Note: The source language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
22
22
  *
23
23
  */
24
- source_language_code: Sarvam.TransliterateSourceLanguage;
24
+ source_language_code: SarvamAI.TransliterateSourceLanguage;
25
25
  /**
26
26
  * The language code of the transliteration text. This specifies the target language for transliteration.
27
27
  *
@@ -30,7 +30,7 @@ export interface TransliterationRequest {
30
30
  * Note:The target language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
31
31
  *
32
32
  */
33
- target_language_code: Sarvam.TranslatiterateTargetLanguage;
33
+ target_language_code: SarvamAI.TranslatiterateTargetLanguage;
34
34
  /**
35
35
  * `numerals_format` is an optional parameter with two options:
36
36
  *
@@ -41,7 +41,7 @@ export interface TransliterationRequest {
41
41
  * - If `international` format is selected, we use regular numerals (0-9). For example: `मेरा phone number है: 9840950950`.
42
42
  * - If `native` format is selected, we use language-specific native numerals, like: `मेरा phone number है: ९८४०९५०९५०`.
43
43
  */
44
- numerals_format?: Sarvam.NumeralsFormat;
44
+ numerals_format?: SarvamAI.NumeralsFormat;
45
45
  /**
46
46
  * `spoken_form_numerals_language` is an optional parameter with two options and only works when spoken_form is true:
47
47
  *
@@ -54,7 +54,7 @@ export interface TransliterationRequest {
54
54
  * - If `native` format is selected: "मेरे पास दो सौ रुपये है"
55
55
  *
56
56
  */
57
- spoken_form_numerals_language?: Sarvam.SpokenFormNumeralsFormat;
57
+ spoken_form_numerals_language?: SarvamAI.SpokenFormNumeralsFormat;
58
58
  /**
59
59
  * - Default: `False`
60
60
  * - Converts text into a natural spoken form when `True`.
@@ -3,10 +3,10 @@
3
3
  */
4
4
  import * as environments from "../../../../environments";
5
5
  import * as core from "../../../../core";
6
- import * as Sarvam from "../../../index";
6
+ import * as SarvamAI from "../../../index";
7
7
  export declare namespace TextToSpeech {
8
8
  interface Options {
9
- environment?: core.Supplier<environments.SarvamEnvironment | string>;
9
+ environment?: core.Supplier<environments.SarvamAIEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  /** Override the api-subscription-key header */
@@ -32,14 +32,14 @@ export declare class TextToSpeech {
32
32
  * This is the model to convert text into spoken audio.
33
33
  * The output is a wave file encoded as a base64 string.
34
34
  *
35
- * @param {Sarvam.TextToSpeechRequest} request
35
+ * @param {SarvamAI.TextToSpeechRequest} request
36
36
  * @param {TextToSpeech.RequestOptions} requestOptions - Request-specific configuration.
37
37
  *
38
- * @throws {@link Sarvam.BadRequestError}
39
- * @throws {@link Sarvam.ForbiddenError}
40
- * @throws {@link Sarvam.UnprocessableEntityError}
41
- * @throws {@link Sarvam.TooManyRequestsError}
42
- * @throws {@link Sarvam.InternalServerError}
38
+ * @throws {@link SarvamAI.BadRequestError}
39
+ * @throws {@link SarvamAI.ForbiddenError}
40
+ * @throws {@link SarvamAI.UnprocessableEntityError}
41
+ * @throws {@link SarvamAI.TooManyRequestsError}
42
+ * @throws {@link SarvamAI.InternalServerError}
43
43
  *
44
44
  * @example
45
45
  * await client.textToSpeech.convert({
@@ -47,5 +47,5 @@ export declare class TextToSpeech {
47
47
  * target_language_code: "hi-IN"
48
48
  * })
49
49
  */
50
- convert(request: Sarvam.TextToSpeechRequest, requestOptions?: TextToSpeech.RequestOptions): Promise<Sarvam.TextToSpeechResponse>;
50
+ convert(request: SarvamAI.TextToSpeechRequest, requestOptions?: TextToSpeech.RequestOptions): Promise<SarvamAI.TextToSpeechResponse>;
51
51
  }
@@ -51,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.TextToSpeech = void 0;
52
52
  const environments = __importStar(require("../../../../environments"));
53
53
  const core = __importStar(require("../../../../core"));
54
- const Sarvam = __importStar(require("../../../index"));
54
+ const SarvamAI = __importStar(require("../../../index"));
55
55
  const url_join_1 = __importDefault(require("url-join"));
56
56
  const errors = __importStar(require("../../../../errors/index"));
57
57
  class TextToSpeech {
@@ -62,14 +62,14 @@ class TextToSpeech {
62
62
  * This is the model to convert text into spoken audio.
63
63
  * The output is a wave file encoded as a base64 string.
64
64
  *
65
- * @param {Sarvam.TextToSpeechRequest} request
65
+ * @param {SarvamAI.TextToSpeechRequest} request
66
66
  * @param {TextToSpeech.RequestOptions} requestOptions - Request-specific configuration.
67
67
  *
68
- * @throws {@link Sarvam.BadRequestError}
69
- * @throws {@link Sarvam.ForbiddenError}
70
- * @throws {@link Sarvam.UnprocessableEntityError}
71
- * @throws {@link Sarvam.TooManyRequestsError}
72
- * @throws {@link Sarvam.InternalServerError}
68
+ * @throws {@link SarvamAI.BadRequestError}
69
+ * @throws {@link SarvamAI.ForbiddenError}
70
+ * @throws {@link SarvamAI.UnprocessableEntityError}
71
+ * @throws {@link SarvamAI.TooManyRequestsError}
72
+ * @throws {@link SarvamAI.InternalServerError}
73
73
  *
74
74
  * @example
75
75
  * await client.textToSpeech.convert({
@@ -81,11 +81,11 @@ class TextToSpeech {
81
81
  return __awaiter(this, void 0, void 0, function* () {
82
82
  var _a, _b;
83
83
  const _response = yield core.fetcher({
84
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamEnvironment.Production, "text-to-speech"),
84
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production, "text-to-speech"),
85
85
  method: "POST",
86
86
  headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
87
87
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
88
- : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.2", "User-Agent": "sarvamai/0.0.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
88
+ : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.4", "User-Agent": "sarvamai/0.0.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
89
89
  contentType: "application/json",
90
90
  requestType: "json",
91
91
  body: request,
@@ -99,17 +99,17 @@ class TextToSpeech {
99
99
  if (_response.error.reason === "status-code") {
100
100
  switch (_response.error.statusCode) {
101
101
  case 400:
102
- throw new Sarvam.BadRequestError(_response.error.body);
102
+ throw new SarvamAI.BadRequestError(_response.error.body);
103
103
  case 403:
104
- throw new Sarvam.ForbiddenError(_response.error.body);
104
+ throw new SarvamAI.ForbiddenError(_response.error.body);
105
105
  case 422:
106
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
106
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
107
107
  case 429:
108
- throw new Sarvam.TooManyRequestsError(_response.error.body);
108
+ throw new SarvamAI.TooManyRequestsError(_response.error.body);
109
109
  case 500:
110
- throw new Sarvam.InternalServerError(_response.error.body);
110
+ throw new SarvamAI.InternalServerError(_response.error.body);
111
111
  default:
112
- throw new errors.SarvamError({
112
+ throw new errors.SarvamAIError({
113
113
  statusCode: _response.error.statusCode,
114
114
  body: _response.error.body,
115
115
  });
@@ -117,14 +117,14 @@ class TextToSpeech {
117
117
  }
118
118
  switch (_response.error.reason) {
119
119
  case "non-json":
120
- throw new errors.SarvamError({
120
+ throw new errors.SarvamAIError({
121
121
  statusCode: _response.error.statusCode,
122
122
  body: _response.error.rawBody,
123
123
  });
124
124
  case "timeout":
125
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /text-to-speech.");
125
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /text-to-speech.");
126
126
  case "unknown":
127
- throw new errors.SarvamError({
127
+ throw new errors.SarvamAIError({
128
128
  message: _response.error.errorMessage,
129
129
  });
130
130
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../../../../index";
4
+ import * as SarvamAI from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
@@ -13,9 +13,9 @@ export interface TextToSpeechRequest {
13
13
  /** The text(s) to be converted into speech. Each text should be no longer than 500 characters. You can send up to 3 texts in a single API call. The text can be code-mixed, combining English and Indic languages. */
14
14
  inputs: string[];
15
15
  /** The language of the text is BCP-47 format */
16
- target_language_code: Sarvam.TextToSpeechLanguage;
16
+ target_language_code: SarvamAI.TextToSpeechLanguage;
17
17
  /** The speaker to be used for the output audio. If not provided, Meera will be used as default. */
18
- speaker?: Sarvam.TextToSpeechSpeaker;
18
+ speaker?: SarvamAI.TextToSpeechSpeaker;
19
19
  /** Controls the pitch of the audio. Lower values result in a deeper voice, while higher values make it sharper. The suitable range is between -0.75 and 0.75. */
20
20
  pitch?: number;
21
21
  /** Controls the speed of the audio. Lower values result in slower speech, while higher values make it faster. The suitable range is between 0.5 and 2.0. Default is 1.0. */
@@ -23,11 +23,11 @@ export interface TextToSpeechRequest {
23
23
  /** Controls the loudness of the audio. Lower values result in quieter audio, while higher values make it louder. The suitable range is between 0.3 and 3.0. */
24
24
  loudness?: number;
25
25
  /** Specifies the sample rate of the output audio. Supported values are 8000, 16000, and 22050 Hz. If not provided, the default is 22050 Hz. */
26
- speech_sample_rate?: Sarvam.SpeechSampleRate;
26
+ speech_sample_rate?: SarvamAI.SpeechSampleRate;
27
27
  /** Controls whether normalization of English words and numeric entities (e.g., numbers, dates) is performed. Set to true for better handling of mixed-language text. Default is false. */
28
28
  enable_preprocessing?: boolean;
29
29
  /** Specifies the model to use for text-to-speech conversion. */
30
- model?: Sarvam.TextToSpeechModel;
30
+ model?: SarvamAI.TextToSpeechModel;
31
31
  /** Weight for interpolating with English speaker at encoder */
32
32
  eng_interpolation_wt?: number;
33
33
  /** Override the default speaker triplets */
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface CallAnalyticsJobParameters {
6
6
  /**
7
7
  * List of questions to be answered based on the call content. Each question should be a valid JSON object with the following structure:
8
8
  * ```[{id: "q001", text: "What was the main issue discussed in the call?", description: "Identify the primary concern or topic of the conversation", type: "enum", properties: {"options": ["NEW_CONNECTION", "INTERNET_ISSUES", "REFUND"]}}].```The `type` field must be one of: `boolean`, `enum`, `short answer`, `long answer`, or `number`. For `enum` type questions, include an 'options' list in the properties.
9
9
  */
10
- questions: Sarvam.Question[];
10
+ questions: SarvamAI.Question[];
11
11
  /** Model to be used for converting speech to text in target language */
12
- model?: Sarvam.SpeechToTextTranslateModel;
12
+ model?: SarvamAI.SpeechToTextTranslateModel;
13
13
  /**
14
14
  * Enables speaker diarization, which identifies and separates different speakers in the audio.
15
15
  * When set to true, the API will provide speaker-specific segments in the response.
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface CallAnalyticsJobRequest {
6
6
  /** Job UUID */
7
7
  job_id: string;
8
8
  /** Job Parameters for the bulk call analytics job */
9
- job_parameters: Sarvam.CallAnalyticsJobParameters;
9
+ job_parameters: SarvamAI.CallAnalyticsJobParameters;
10
10
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface CallAnalyticsResponse {
6
6
  request_id?: string;
7
7
  /** Unique identifier for the analyzed audio file. */
@@ -9,11 +9,11 @@ export interface CallAnalyticsResponse {
9
9
  /** Full transcript of the call generated by Sarvam's inhouse speech-to-text model. */
10
10
  transcript: string;
11
11
  /** List of answers to predefined questions, derived from the call analysis. It can be null if no valid answers were generated. */
12
- answers?: Sarvam.QnaResponse[];
12
+ answers?: SarvamAI.QnaResponse[];
13
13
  /** Duration of the analyzed call in seconds. */
14
14
  duration_in_seconds?: number;
15
15
  /** This will return the BCP-47 code of language spoken in the input. If multiple languages are detected, this will return language code of most predominant spoken language. If no language is detected, this will be null */
16
- language_code?: Sarvam.SpeechToTextTranslateLanguage;
16
+ language_code?: SarvamAI.SpeechToTextTranslateLanguage;
17
17
  /** Diarized transcript of the provided speech */
18
- diarized_transcript?: Sarvam.DiarizedTranscript;
18
+ diarized_transcript?: SarvamAI.DiarizedTranscript;
19
19
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface DiarizedTranscript {
6
6
  /** List of diarized transcript entries. */
7
- entries: Sarvam.DiarizedEntry[];
7
+ entries: SarvamAI.DiarizedEntry[];
8
8
  }
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface ErrorDetails {
6
6
  /** Message describing the error */
7
7
  message: string;
8
8
  /** Error code for the specific error that has occured. Refer to the error code documentation for more details. */
9
- code: Sarvam.ErrorCode;
9
+ code: SarvamAI.ErrorCode;
10
10
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface ErrorMessage {
6
6
  /** Error details */
7
- error: Sarvam.ErrorDetails;
7
+ error: SarvamAI.ErrorDetails;
8
8
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface Question {
6
6
  /** Unique identifier for the question. This should be a short, distinct string or number. */
7
7
  id: string;
@@ -17,7 +17,7 @@ export interface Question {
17
17
  * - long answer: A question requiring a detailed text response
18
18
  * - number: A question expecting a numeric answer
19
19
  */
20
- type: Sarvam.QuestionType;
20
+ type: SarvamAI.QuestionType;
21
21
  /** Additional properties specific to the question type. For 'enum' types, this should include an 'options' list. */
22
22
  properties?: Record<string, unknown>;
23
23
  }
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Sarvam from "../index";
4
+ import * as SarvamAI from "../index";
5
5
  export interface SpeechToTextResponse {
6
6
  request_id?: string;
7
7
  /** The transcribed text from the provided audio file. */
8
8
  transcript: string;
9
9
  /** Contains timestamps for the transcribed text. This field is included only if with_timestamps is set to true */
10
- timestamps?: Sarvam.TimestampsModel;
10
+ timestamps?: SarvamAI.TimestampsModel;
11
11
  /** Diarized transcript of the provided speech */
12
- diarized_transcript?: Sarvam.DiarizedTranscript;
12
+ diarized_transcript?: SarvamAI.DiarizedTranscript;
13
13
  /** This will return the BCP-47 code of language spoken in the input. If multiple languages are detected, this will return language code of most predominant spoken language. If no language is detected, this will be null */
14
14
  language_code?: string;
15
15
  }