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.Pdf = 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 Pdf {
@@ -62,12 +62,12 @@ class Pdf {
62
62
  * Given a PDF, this API helps to get structured extraction of data in the document.The API returns a base64 encoded XML string containing the extracted data.
63
63
  *
64
64
  * @param {File | fs.ReadStream | Blob} pdf
65
- * @param {Sarvam.ParsePdfRequest} request
65
+ * @param {SarvamAI.ParsePdfRequest} request
66
66
  * @param {Pdf.RequestOptions} requestOptions - Request-specific configuration.
67
67
  *
68
- * @throws {@link Sarvam.BadRequestError}
69
- * @throws {@link Sarvam.UnprocessableEntityError}
70
- * @throws {@link Sarvam.InternalServerError}
68
+ * @throws {@link SarvamAI.BadRequestError}
69
+ * @throws {@link SarvamAI.UnprocessableEntityError}
70
+ * @throws {@link SarvamAI.InternalServerError}
71
71
  *
72
72
  * @example
73
73
  * await client.pdf.parse(fs.createReadStream("/path/to/your/file"), {})
@@ -88,11 +88,11 @@ class Pdf {
88
88
  }
89
89
  const _maybeEncodedRequest = yield _request.getRequest();
90
90
  const _response = yield core.fetcher({
91
- 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, "parse/parsepdf"),
91
+ 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, "parse/parsepdf"),
92
92
  method: "POST",
93
93
  headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
94
94
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
95
- : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
95
+ : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
96
96
  requestType: "file",
97
97
  duplex: _maybeEncodedRequest.duplex,
98
98
  body: _maybeEncodedRequest.body,
@@ -106,13 +106,13 @@ class Pdf {
106
106
  if (_response.error.reason === "status-code") {
107
107
  switch (_response.error.statusCode) {
108
108
  case 400:
109
- throw new Sarvam.BadRequestError(_response.error.body);
109
+ throw new SarvamAI.BadRequestError(_response.error.body);
110
110
  case 422:
111
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
111
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
112
112
  case 500:
113
- throw new Sarvam.InternalServerError(_response.error.body);
113
+ throw new SarvamAI.InternalServerError(_response.error.body);
114
114
  default:
115
- throw new errors.SarvamError({
115
+ throw new errors.SarvamAIError({
116
116
  statusCode: _response.error.statusCode,
117
117
  body: _response.error.body,
118
118
  });
@@ -120,14 +120,14 @@ class Pdf {
120
120
  }
121
121
  switch (_response.error.reason) {
122
122
  case "non-json":
123
- throw new errors.SarvamError({
123
+ throw new errors.SarvamAIError({
124
124
  statusCode: _response.error.statusCode,
125
125
  body: _response.error.rawBody,
126
126
  });
127
127
  case "timeout":
128
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /parse/parsepdf.");
128
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /parse/parsepdf.");
129
129
  case "unknown":
130
- throw new errors.SarvamError({
130
+ throw new errors.SarvamAIError({
131
131
  message: _response.error.errorMessage,
132
132
  });
133
133
  }
@@ -137,12 +137,12 @@ class Pdf {
137
137
  * Given a PDF, this API helps to translate the content in the document
138
138
  *
139
139
  * @param {File | fs.ReadStream | Blob} pdf
140
- * @param {Sarvam.TranslatePdfRequest} request
140
+ * @param {SarvamAI.TranslatePdfRequest} request
141
141
  * @param {Pdf.RequestOptions} requestOptions - Request-specific configuration.
142
142
  *
143
- * @throws {@link Sarvam.BadRequestError}
144
- * @throws {@link Sarvam.UnprocessableEntityError}
145
- * @throws {@link Sarvam.InternalServerError}
143
+ * @throws {@link SarvamAI.BadRequestError}
144
+ * @throws {@link SarvamAI.UnprocessableEntityError}
145
+ * @throws {@link SarvamAI.InternalServerError}
146
146
  *
147
147
  * @example
148
148
  * await client.pdf.translate(fs.createReadStream("/path/to/your/file"), {})
@@ -166,11 +166,11 @@ class Pdf {
166
166
  }
167
167
  const _maybeEncodedRequest = yield _request.getRequest();
168
168
  const _response = yield core.fetcher({
169
- 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, "parse/translatepdf"),
169
+ 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, "parse/translatepdf"),
170
170
  method: "POST",
171
171
  headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
172
172
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
173
- : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
173
+ : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
174
174
  requestType: "file",
175
175
  duplex: _maybeEncodedRequest.duplex,
176
176
  body: _maybeEncodedRequest.body,
@@ -184,13 +184,13 @@ class Pdf {
184
184
  if (_response.error.reason === "status-code") {
185
185
  switch (_response.error.statusCode) {
186
186
  case 400:
187
- throw new Sarvam.BadRequestError(_response.error.body);
187
+ throw new SarvamAI.BadRequestError(_response.error.body);
188
188
  case 422:
189
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
189
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
190
190
  case 500:
191
- throw new Sarvam.InternalServerError(_response.error.body);
191
+ throw new SarvamAI.InternalServerError(_response.error.body);
192
192
  default:
193
- throw new errors.SarvamError({
193
+ throw new errors.SarvamAIError({
194
194
  statusCode: _response.error.statusCode,
195
195
  body: _response.error.body,
196
196
  });
@@ -198,14 +198,14 @@ class Pdf {
198
198
  }
199
199
  switch (_response.error.reason) {
200
200
  case "non-json":
201
- throw new errors.SarvamError({
201
+ throw new errors.SarvamAIError({
202
202
  statusCode: _response.error.statusCode,
203
203
  body: _response.error.rawBody,
204
204
  });
205
205
  case "timeout":
206
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /parse/translatepdf.");
206
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /parse/translatepdf.");
207
207
  case "unknown":
208
- throw new errors.SarvamError({
208
+ throw new errors.SarvamAIError({
209
209
  message: _response.error.errorMessage,
210
210
  });
211
211
  }
@@ -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
  * {}
@@ -15,7 +15,7 @@ export interface ParsePdfRequest {
15
15
  * - small: Use this mode for economical and fast parsing
16
16
  * - large: Use this mode for highest precision parsing
17
17
  */
18
- sarvam_mode?: Sarvam.SarvamMode;
18
+ sarvam_mode?: SarvamAI.SarvamMode;
19
19
  /** Whether to cache the prompt for the parse request. This is useful when running multiple requests to the parsing endpoint. */
20
- prompt_caching?: Sarvam.PromptCaching;
20
+ prompt_caching?: SarvamAI.PromptCaching;
21
21
  }
@@ -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
  * {}
@@ -28,5 +28,5 @@ export interface TranslatePdfRequest {
28
28
  * te = "te-IN"
29
29
  * Example: "hi-IN" for Hindi
30
30
  */
31
- output_lang?: Sarvam.Language;
31
+ output_lang?: SarvamAI.Language;
32
32
  }
@@ -3,12 +3,12 @@
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
  import * as fs from "fs";
8
8
  import { Blob } from "buffer";
9
9
  export declare namespace SpeechToText {
10
10
  interface Options {
11
- environment?: core.Supplier<environments.SarvamEnvironment | string>;
11
+ environment?: core.Supplier<environments.SarvamAIEnvironment | string>;
12
12
  /** Specify a custom URL to connect the client to. */
13
13
  baseUrl?: core.Supplier<string>;
14
14
  /** Override the api-subscription-key header */
@@ -46,20 +46,20 @@ export declare class SpeechToText {
46
46
  * - Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
47
47
  *
48
48
  * @param {File | fs.ReadStream | Blob} file
49
- * @param {Sarvam.SpeechToTextTranscriptionRequest} request
49
+ * @param {SarvamAI.SpeechToTextTranscriptionRequest} request
50
50
  * @param {SpeechToText.RequestOptions} requestOptions - Request-specific configuration.
51
51
  *
52
- * @throws {@link Sarvam.BadRequestError}
53
- * @throws {@link Sarvam.ForbiddenError}
54
- * @throws {@link Sarvam.UnprocessableEntityError}
55
- * @throws {@link Sarvam.TooManyRequestsError}
56
- * @throws {@link Sarvam.InternalServerError}
57
- * @throws {@link Sarvam.ServiceUnavailableError}
52
+ * @throws {@link SarvamAI.BadRequestError}
53
+ * @throws {@link SarvamAI.ForbiddenError}
54
+ * @throws {@link SarvamAI.UnprocessableEntityError}
55
+ * @throws {@link SarvamAI.TooManyRequestsError}
56
+ * @throws {@link SarvamAI.InternalServerError}
57
+ * @throws {@link SarvamAI.ServiceUnavailableError}
58
58
  *
59
59
  * @example
60
60
  * await client.speechToText.transcribe(fs.createReadStream("/path/to/your/file"), {})
61
61
  */
62
- transcribe(file: File | fs.ReadStream | Blob, request: Sarvam.SpeechToTextTranscriptionRequest, requestOptions?: SpeechToText.RequestOptions): Promise<Sarvam.SpeechToTextResponse>;
62
+ transcribe(file: File | fs.ReadStream | Blob, request: SarvamAI.SpeechToTextTranscriptionRequest, requestOptions?: SpeechToText.RequestOptions): Promise<SarvamAI.SpeechToTextResponse>;
63
63
  /**
64
64
  * ## Real-Time Speech to Text Translation API
65
65
  *
@@ -76,18 +76,18 @@ export declare class SpeechToText {
76
76
  * - Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
77
77
  *
78
78
  * @param {File | fs.ReadStream | Blob} file
79
- * @param {Sarvam.SpeechToTextTranslationRequest} request
79
+ * @param {SarvamAI.SpeechToTextTranslationRequest} request
80
80
  * @param {SpeechToText.RequestOptions} requestOptions - Request-specific configuration.
81
81
  *
82
- * @throws {@link Sarvam.BadRequestError}
83
- * @throws {@link Sarvam.ForbiddenError}
84
- * @throws {@link Sarvam.UnprocessableEntityError}
85
- * @throws {@link Sarvam.TooManyRequestsError}
86
- * @throws {@link Sarvam.InternalServerError}
87
- * @throws {@link Sarvam.ServiceUnavailableError}
82
+ * @throws {@link SarvamAI.BadRequestError}
83
+ * @throws {@link SarvamAI.ForbiddenError}
84
+ * @throws {@link SarvamAI.UnprocessableEntityError}
85
+ * @throws {@link SarvamAI.TooManyRequestsError}
86
+ * @throws {@link SarvamAI.InternalServerError}
87
+ * @throws {@link SarvamAI.ServiceUnavailableError}
88
88
  *
89
89
  * @example
90
90
  * await client.speechToText.translate(fs.createReadStream("/path/to/your/file"), {})
91
91
  */
92
- translate(file: File | fs.ReadStream | Blob, request: Sarvam.SpeechToTextTranslationRequest, requestOptions?: SpeechToText.RequestOptions): Promise<Sarvam.SpeechToTextTranslateResponse>;
92
+ translate(file: File | fs.ReadStream | Blob, request: SarvamAI.SpeechToTextTranslationRequest, requestOptions?: SpeechToText.RequestOptions): Promise<SarvamAI.SpeechToTextTranslateResponse>;
93
93
  }
@@ -51,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.SpeechToText = 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 SpeechToText {
@@ -74,15 +74,15 @@ class SpeechToText {
74
74
  * - Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
75
75
  *
76
76
  * @param {File | fs.ReadStream | Blob} file
77
- * @param {Sarvam.SpeechToTextTranscriptionRequest} request
77
+ * @param {SarvamAI.SpeechToTextTranscriptionRequest} request
78
78
  * @param {SpeechToText.RequestOptions} requestOptions - Request-specific configuration.
79
79
  *
80
- * @throws {@link Sarvam.BadRequestError}
81
- * @throws {@link Sarvam.ForbiddenError}
82
- * @throws {@link Sarvam.UnprocessableEntityError}
83
- * @throws {@link Sarvam.TooManyRequestsError}
84
- * @throws {@link Sarvam.InternalServerError}
85
- * @throws {@link Sarvam.ServiceUnavailableError}
80
+ * @throws {@link SarvamAI.BadRequestError}
81
+ * @throws {@link SarvamAI.ForbiddenError}
82
+ * @throws {@link SarvamAI.UnprocessableEntityError}
83
+ * @throws {@link SarvamAI.TooManyRequestsError}
84
+ * @throws {@link SarvamAI.InternalServerError}
85
+ * @throws {@link SarvamAI.ServiceUnavailableError}
86
86
  *
87
87
  * @example
88
88
  * await client.speechToText.transcribe(fs.createReadStream("/path/to/your/file"), {})
@@ -109,11 +109,11 @@ class SpeechToText {
109
109
  }
110
110
  const _maybeEncodedRequest = yield _request.getRequest();
111
111
  const _response = yield core.fetcher({
112
- 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, "speech-to-text"),
112
+ 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, "speech-to-text"),
113
113
  method: "POST",
114
114
  headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
115
115
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
116
- : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
116
+ : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
117
117
  requestType: "file",
118
118
  duplex: _maybeEncodedRequest.duplex,
119
119
  body: _maybeEncodedRequest.body,
@@ -127,19 +127,19 @@ class SpeechToText {
127
127
  if (_response.error.reason === "status-code") {
128
128
  switch (_response.error.statusCode) {
129
129
  case 400:
130
- throw new Sarvam.BadRequestError(_response.error.body);
130
+ throw new SarvamAI.BadRequestError(_response.error.body);
131
131
  case 403:
132
- throw new Sarvam.ForbiddenError(_response.error.body);
132
+ throw new SarvamAI.ForbiddenError(_response.error.body);
133
133
  case 422:
134
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
134
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
135
135
  case 429:
136
- throw new Sarvam.TooManyRequestsError(_response.error.body);
136
+ throw new SarvamAI.TooManyRequestsError(_response.error.body);
137
137
  case 500:
138
- throw new Sarvam.InternalServerError(_response.error.body);
138
+ throw new SarvamAI.InternalServerError(_response.error.body);
139
139
  case 503:
140
- throw new Sarvam.ServiceUnavailableError(_response.error.body);
140
+ throw new SarvamAI.ServiceUnavailableError(_response.error.body);
141
141
  default:
142
- throw new errors.SarvamError({
142
+ throw new errors.SarvamAIError({
143
143
  statusCode: _response.error.statusCode,
144
144
  body: _response.error.body,
145
145
  });
@@ -147,14 +147,14 @@ class SpeechToText {
147
147
  }
148
148
  switch (_response.error.reason) {
149
149
  case "non-json":
150
- throw new errors.SarvamError({
150
+ throw new errors.SarvamAIError({
151
151
  statusCode: _response.error.statusCode,
152
152
  body: _response.error.rawBody,
153
153
  });
154
154
  case "timeout":
155
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /speech-to-text.");
155
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /speech-to-text.");
156
156
  case "unknown":
157
- throw new errors.SarvamError({
157
+ throw new errors.SarvamAIError({
158
158
  message: _response.error.errorMessage,
159
159
  });
160
160
  }
@@ -176,15 +176,15 @@ class SpeechToText {
176
176
  * - Please refer to [dashboard.sarvam.ai](https://dashboard.sarvam.ai) for detailed pricing information
177
177
  *
178
178
  * @param {File | fs.ReadStream | Blob} file
179
- * @param {Sarvam.SpeechToTextTranslationRequest} request
179
+ * @param {SarvamAI.SpeechToTextTranslationRequest} request
180
180
  * @param {SpeechToText.RequestOptions} requestOptions - Request-specific configuration.
181
181
  *
182
- * @throws {@link Sarvam.BadRequestError}
183
- * @throws {@link Sarvam.ForbiddenError}
184
- * @throws {@link Sarvam.UnprocessableEntityError}
185
- * @throws {@link Sarvam.TooManyRequestsError}
186
- * @throws {@link Sarvam.InternalServerError}
187
- * @throws {@link Sarvam.ServiceUnavailableError}
182
+ * @throws {@link SarvamAI.BadRequestError}
183
+ * @throws {@link SarvamAI.ForbiddenError}
184
+ * @throws {@link SarvamAI.UnprocessableEntityError}
185
+ * @throws {@link SarvamAI.TooManyRequestsError}
186
+ * @throws {@link SarvamAI.InternalServerError}
187
+ * @throws {@link SarvamAI.ServiceUnavailableError}
188
188
  *
189
189
  * @example
190
190
  * await client.speechToText.translate(fs.createReadStream("/path/to/your/file"), {})
@@ -208,11 +208,11 @@ class SpeechToText {
208
208
  }
209
209
  const _maybeEncodedRequest = yield _request.getRequest();
210
210
  const _response = yield core.fetcher({
211
- 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, "speech-to-text-translate"),
211
+ 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, "speech-to-text-translate"),
212
212
  method: "POST",
213
213
  headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
214
214
  ? yield core.Supplier.get(this._options.apiSubscriptionKey)
215
- : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
215
+ : 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 }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
216
216
  requestType: "file",
217
217
  duplex: _maybeEncodedRequest.duplex,
218
218
  body: _maybeEncodedRequest.body,
@@ -226,19 +226,19 @@ class SpeechToText {
226
226
  if (_response.error.reason === "status-code") {
227
227
  switch (_response.error.statusCode) {
228
228
  case 400:
229
- throw new Sarvam.BadRequestError(_response.error.body);
229
+ throw new SarvamAI.BadRequestError(_response.error.body);
230
230
  case 403:
231
- throw new Sarvam.ForbiddenError(_response.error.body);
231
+ throw new SarvamAI.ForbiddenError(_response.error.body);
232
232
  case 422:
233
- throw new Sarvam.UnprocessableEntityError(_response.error.body);
233
+ throw new SarvamAI.UnprocessableEntityError(_response.error.body);
234
234
  case 429:
235
- throw new Sarvam.TooManyRequestsError(_response.error.body);
235
+ throw new SarvamAI.TooManyRequestsError(_response.error.body);
236
236
  case 500:
237
- throw new Sarvam.InternalServerError(_response.error.body);
237
+ throw new SarvamAI.InternalServerError(_response.error.body);
238
238
  case 503:
239
- throw new Sarvam.ServiceUnavailableError(_response.error.body);
239
+ throw new SarvamAI.ServiceUnavailableError(_response.error.body);
240
240
  default:
241
- throw new errors.SarvamError({
241
+ throw new errors.SarvamAIError({
242
242
  statusCode: _response.error.statusCode,
243
243
  body: _response.error.body,
244
244
  });
@@ -246,14 +246,14 @@ class SpeechToText {
246
246
  }
247
247
  switch (_response.error.reason) {
248
248
  case "non-json":
249
- throw new errors.SarvamError({
249
+ throw new errors.SarvamAIError({
250
250
  statusCode: _response.error.statusCode,
251
251
  body: _response.error.rawBody,
252
252
  });
253
253
  case "timeout":
254
- throw new errors.SarvamTimeoutError("Timeout exceeded when calling POST /speech-to-text-translate.");
254
+ throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /speech-to-text-translate.");
255
255
  case "unknown":
256
- throw new errors.SarvamError({
256
+ throw new errors.SarvamAIError({
257
257
  message: _response.error.errorMessage,
258
258
  });
259
259
  }
@@ -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
  * {}
@@ -11,7 +11,7 @@ export interface SpeechToTextTranscriptionRequest {
11
11
  * Specifies the model to use for speech-to-text conversion.
12
12
  * Note:- Default model is `saarika:v2`
13
13
  */
14
- model?: Sarvam.SpeechToTextModel;
14
+ model?: SarvamAI.SpeechToTextModel;
15
15
  /**
16
16
  * Specifies the language of the input audio. This parameter is required to ensure accurate transcription.
17
17
  * For the `saarika:v1` model, this parameter is mandatory.
@@ -19,7 +19,7 @@ export interface SpeechToTextTranscriptionRequest {
19
19
  * `unknown`: Use this when the language is not known; the API will detect it automatically.
20
20
  * Note:- that the `saarika:v1` model does not support `unknown` language code.
21
21
  */
22
- language_code?: Sarvam.SpeechToTextLanguage;
22
+ language_code?: SarvamAI.SpeechToTextLanguage;
23
23
  /** Enables timestamps in the response. If set to `true`, the response will include timestamps in the transcript. */
24
24
  with_timestamps?: boolean;
25
25
  /**
@@ -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
  * {}
@@ -10,7 +10,7 @@ export interface SpeechToTextTranslationRequest {
10
10
  /** Conversation context can be passed as a prompt to boost model accuracy. However, the current system is at an experimentation stage and doesn’t match the prompt performance of large language models. */
11
11
  prompt?: string;
12
12
  /** Model to be used for converting speech to text in target language */
13
- model?: Sarvam.SpeechToTextTranslateModel;
13
+ model?: SarvamAI.SpeechToTextTranslateModel;
14
14
  /**
15
15
  * Enables speaker diarization, which identifies and separates different speakers in the audio.
16
16
  * When set to true, the API will provide speaker-specific segments in the response.
@@ -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 Text {
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 */
@@ -47,14 +47,14 @@ export declare class Text {
47
47
  *
48
48
  * 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).
49
49
  *
50
- * @param {Sarvam.TranslationRequest} request
50
+ * @param {SarvamAI.TranslationRequest} request
51
51
  * @param {Text.RequestOptions} requestOptions - Request-specific configuration.
52
52
  *
53
- * @throws {@link Sarvam.BadRequestError}
54
- * @throws {@link Sarvam.ForbiddenError}
55
- * @throws {@link Sarvam.UnprocessableEntityError}
56
- * @throws {@link Sarvam.TooManyRequestsError}
57
- * @throws {@link Sarvam.InternalServerError}
53
+ * @throws {@link SarvamAI.BadRequestError}
54
+ * @throws {@link SarvamAI.ForbiddenError}
55
+ * @throws {@link SarvamAI.UnprocessableEntityError}
56
+ * @throws {@link SarvamAI.TooManyRequestsError}
57
+ * @throws {@link SarvamAI.InternalServerError}
58
58
  *
59
59
  * @example
60
60
  * await client.text.translate({
@@ -63,25 +63,25 @@ export declare class Text {
63
63
  * target_language_code: "en-IN"
64
64
  * })
65
65
  */
66
- translate(request: Sarvam.TranslationRequest, requestOptions?: Text.RequestOptions): Promise<Sarvam.TranslationResponse>;
66
+ translate(request: SarvamAI.TranslationRequest, requestOptions?: Text.RequestOptions): Promise<SarvamAI.TranslationResponse>;
67
67
  /**
68
68
  * Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.
69
69
  *
70
- * @param {Sarvam.LanguageIdentificationRequest} request
70
+ * @param {SarvamAI.LanguageIdentificationRequest} request
71
71
  * @param {Text.RequestOptions} requestOptions - Request-specific configuration.
72
72
  *
73
- * @throws {@link Sarvam.BadRequestError}
74
- * @throws {@link Sarvam.ForbiddenError}
75
- * @throws {@link Sarvam.UnprocessableEntityError}
76
- * @throws {@link Sarvam.TooManyRequestsError}
77
- * @throws {@link Sarvam.InternalServerError}
73
+ * @throws {@link SarvamAI.BadRequestError}
74
+ * @throws {@link SarvamAI.ForbiddenError}
75
+ * @throws {@link SarvamAI.UnprocessableEntityError}
76
+ * @throws {@link SarvamAI.TooManyRequestsError}
77
+ * @throws {@link SarvamAI.InternalServerError}
78
78
  *
79
79
  * @example
80
80
  * await client.text.identifyLanguage({
81
81
  * input: "input"
82
82
  * })
83
83
  */
84
- identifyLanguage(request: Sarvam.LanguageIdentificationRequest, requestOptions?: Text.RequestOptions): Promise<Sarvam.LanguageIdentificationResponse>;
84
+ identifyLanguage(request: SarvamAI.LanguageIdentificationRequest, requestOptions?: Text.RequestOptions): Promise<SarvamAI.LanguageIdentificationResponse>;
85
85
  /**
86
86
  * **Transliteration** converts text from one script to another while preserving the original pronunciation. For example, **'नमस्ते'** becomes **'namaste'** in English, and **'how are you'** can be written as **'हाउ आर यू'** in Devanagari. This process ensures that the sound of the original text remains intact, even when written in a different script.
87
87
  *
@@ -107,14 +107,14 @@ export declare class Text {
107
107
  *
108
108
  * 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).
109
109
  *
110
- * @param {Sarvam.TransliterationRequest} request
110
+ * @param {SarvamAI.TransliterationRequest} request
111
111
  * @param {Text.RequestOptions} requestOptions - Request-specific configuration.
112
112
  *
113
- * @throws {@link Sarvam.BadRequestError}
114
- * @throws {@link Sarvam.ForbiddenError}
115
- * @throws {@link Sarvam.UnprocessableEntityError}
116
- * @throws {@link Sarvam.TooManyRequestsError}
117
- * @throws {@link Sarvam.InternalServerError}
113
+ * @throws {@link SarvamAI.BadRequestError}
114
+ * @throws {@link SarvamAI.ForbiddenError}
115
+ * @throws {@link SarvamAI.UnprocessableEntityError}
116
+ * @throws {@link SarvamAI.TooManyRequestsError}
117
+ * @throws {@link SarvamAI.InternalServerError}
118
118
  *
119
119
  * @example
120
120
  * await client.text.transliterate({
@@ -123,5 +123,5 @@ export declare class Text {
123
123
  * target_language_code: "en-IN"
124
124
  * })
125
125
  */
126
- transliterate(request: Sarvam.TransliterationRequest, requestOptions?: Text.RequestOptions): Promise<Sarvam.TransliterationResponse>;
126
+ transliterate(request: SarvamAI.TransliterationRequest, requestOptions?: Text.RequestOptions): Promise<SarvamAI.TransliterationResponse>;
127
127
  }