sarvamai 0.0.3 → 0.0.13

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 (148) hide show
  1. package/Client.d.ts +1 -10
  2. package/Client.js +4 -14
  3. package/api/resources/index.d.ts +0 -4
  4. package/api/resources/index.js +1 -5
  5. package/api/resources/speechToText/client/Client.d.ts +4 -4
  6. package/api/resources/speechToText/client/Client.js +9 -6
  7. package/api/resources/text/client/Client.d.ts +4 -4
  8. package/api/resources/text/client/Client.js +10 -9
  9. package/api/resources/textToSpeech/client/Client.d.ts +5 -5
  10. package/api/resources/textToSpeech/client/Client.js +9 -4
  11. package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +33 -11
  12. package/api/types/ErrorCode.d.ts +3 -5
  13. package/api/types/ErrorCode.js +2 -4
  14. package/api/types/TextToSpeechLanguage.d.ts +4 -4
  15. package/api/types/TextToSpeechLanguage.js +3 -3
  16. package/api/types/TextToSpeechModel.d.ts +5 -1
  17. package/api/types/TextToSpeechModel.js +5 -0
  18. package/api/types/TextToSpeechSpeaker.d.ts +8 -1
  19. package/api/types/TextToSpeechSpeaker.js +7 -0
  20. package/api/types/index.d.ts +0 -13
  21. package/api/types/index.js +0 -13
  22. package/dist/Client.d.ts +1 -10
  23. package/dist/Client.js +4 -14
  24. package/dist/api/resources/index.d.ts +0 -4
  25. package/dist/api/resources/index.js +1 -5
  26. package/dist/api/resources/speechToText/client/Client.d.ts +4 -4
  27. package/dist/api/resources/speechToText/client/Client.js +9 -6
  28. package/dist/api/resources/text/client/Client.d.ts +4 -4
  29. package/dist/api/resources/text/client/Client.js +10 -9
  30. package/dist/api/resources/textToSpeech/client/Client.d.ts +5 -5
  31. package/dist/api/resources/textToSpeech/client/Client.js +9 -4
  32. package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +33 -11
  33. package/dist/api/types/ErrorCode.d.ts +3 -5
  34. package/dist/api/types/ErrorCode.js +2 -4
  35. package/dist/api/types/TextToSpeechLanguage.d.ts +4 -4
  36. package/dist/api/types/TextToSpeechLanguage.js +3 -3
  37. package/dist/api/types/TextToSpeechModel.d.ts +5 -1
  38. package/dist/api/types/TextToSpeechModel.js +5 -0
  39. package/dist/api/types/TextToSpeechSpeaker.d.ts +8 -1
  40. package/dist/api/types/TextToSpeechSpeaker.js +7 -0
  41. package/dist/api/types/index.d.ts +0 -13
  42. package/dist/api/types/index.js +0 -13
  43. package/dist/environments.d.ts +1 -2
  44. package/dist/environments.js +0 -1
  45. package/dist/version.d.ts +1 -1
  46. package/dist/version.js +1 -1
  47. package/environments.d.ts +1 -2
  48. package/environments.js +0 -1
  49. package/package.json +1 -1
  50. package/reference.md +1 -286
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/api/resources/analytics/client/Client.d.ts +0 -73
  54. package/api/resources/analytics/client/Client.js +0 -223
  55. package/api/resources/analytics/client/index.d.ts +0 -1
  56. package/api/resources/analytics/client/index.js +0 -17
  57. package/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +0 -24
  58. package/api/resources/analytics/client/requests/CallAnalyticsRequest.js +0 -5
  59. package/api/resources/analytics/client/requests/index.d.ts +0 -1
  60. package/api/resources/analytics/client/requests/index.js +0 -2
  61. package/api/resources/analytics/index.d.ts +0 -1
  62. package/api/resources/analytics/index.js +0 -17
  63. package/api/resources/pdf/client/Client.d.ts +0 -63
  64. package/api/resources/pdf/client/Client.js +0 -215
  65. package/api/resources/pdf/client/index.d.ts +0 -1
  66. package/api/resources/pdf/client/index.js +0 -17
  67. package/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +0 -21
  68. package/api/resources/pdf/client/requests/ParsePdfRequest.js +0 -5
  69. package/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +0 -32
  70. package/api/resources/pdf/client/requests/TranslatePdfRequest.js +0 -5
  71. package/api/resources/pdf/client/requests/index.d.ts +0 -2
  72. package/api/resources/pdf/client/requests/index.js +0 -2
  73. package/api/resources/pdf/index.d.ts +0 -1
  74. package/api/resources/pdf/index.js +0 -17
  75. package/api/types/CallAnalyticsJobParameters.d.ts +0 -21
  76. package/api/types/CallAnalyticsJobParameters.js +0 -5
  77. package/api/types/CallAnalyticsJobRequest.d.ts +0 -10
  78. package/api/types/CallAnalyticsJobRequest.js +0 -5
  79. package/api/types/CallAnalyticsResponse.d.ts +0 -19
  80. package/api/types/CallAnalyticsResponse.js +0 -5
  81. package/api/types/Language.d.ts +0 -17
  82. package/api/types/Language.js +0 -19
  83. package/api/types/ParsedPageResponse.d.ts +0 -7
  84. package/api/types/ParsedPageResponse.js +0 -5
  85. package/api/types/PromptCaching.d.ts +0 -8
  86. package/api/types/PromptCaching.js +0 -10
  87. package/api/types/QnaResponse.d.ts +0 -15
  88. package/api/types/QnaResponse.js +0 -5
  89. package/api/types/Question.d.ts +0 -23
  90. package/api/types/Question.js +0 -5
  91. package/api/types/QuestionType.d.ts +0 -11
  92. package/api/types/QuestionType.js +0 -13
  93. package/api/types/SarvamMode.d.ts +0 -8
  94. package/api/types/SarvamMode.js +0 -10
  95. package/api/types/TextAnalyticsRequest.d.ts +0 -9
  96. package/api/types/TextAnalyticsRequest.js +0 -5
  97. package/api/types/TextAnalyticsResponse.d.ts +0 -9
  98. package/api/types/TextAnalyticsResponse.js +0 -5
  99. package/api/types/TranslatedPage.d.ts +0 -7
  100. package/api/types/TranslatedPage.js +0 -5
  101. package/dist/api/resources/analytics/client/Client.d.ts +0 -73
  102. package/dist/api/resources/analytics/client/Client.js +0 -223
  103. package/dist/api/resources/analytics/client/index.d.ts +0 -1
  104. package/dist/api/resources/analytics/client/index.js +0 -17
  105. package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +0 -24
  106. package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.js +0 -5
  107. package/dist/api/resources/analytics/client/requests/index.d.ts +0 -1
  108. package/dist/api/resources/analytics/client/requests/index.js +0 -2
  109. package/dist/api/resources/analytics/index.d.ts +0 -1
  110. package/dist/api/resources/analytics/index.js +0 -17
  111. package/dist/api/resources/pdf/client/Client.d.ts +0 -63
  112. package/dist/api/resources/pdf/client/Client.js +0 -215
  113. package/dist/api/resources/pdf/client/index.d.ts +0 -1
  114. package/dist/api/resources/pdf/client/index.js +0 -17
  115. package/dist/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +0 -21
  116. package/dist/api/resources/pdf/client/requests/ParsePdfRequest.js +0 -5
  117. package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +0 -32
  118. package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.js +0 -5
  119. package/dist/api/resources/pdf/client/requests/index.d.ts +0 -2
  120. package/dist/api/resources/pdf/client/requests/index.js +0 -2
  121. package/dist/api/resources/pdf/index.d.ts +0 -1
  122. package/dist/api/resources/pdf/index.js +0 -17
  123. package/dist/api/types/CallAnalyticsJobParameters.d.ts +0 -21
  124. package/dist/api/types/CallAnalyticsJobParameters.js +0 -5
  125. package/dist/api/types/CallAnalyticsJobRequest.d.ts +0 -10
  126. package/dist/api/types/CallAnalyticsJobRequest.js +0 -5
  127. package/dist/api/types/CallAnalyticsResponse.d.ts +0 -19
  128. package/dist/api/types/CallAnalyticsResponse.js +0 -5
  129. package/dist/api/types/Language.d.ts +0 -17
  130. package/dist/api/types/Language.js +0 -19
  131. package/dist/api/types/ParsedPageResponse.d.ts +0 -7
  132. package/dist/api/types/ParsedPageResponse.js +0 -5
  133. package/dist/api/types/PromptCaching.d.ts +0 -8
  134. package/dist/api/types/PromptCaching.js +0 -10
  135. package/dist/api/types/QnaResponse.d.ts +0 -15
  136. package/dist/api/types/QnaResponse.js +0 -5
  137. package/dist/api/types/Question.d.ts +0 -23
  138. package/dist/api/types/Question.js +0 -5
  139. package/dist/api/types/QuestionType.d.ts +0 -11
  140. package/dist/api/types/QuestionType.js +0 -13
  141. package/dist/api/types/SarvamMode.d.ts +0 -8
  142. package/dist/api/types/SarvamMode.js +0 -10
  143. package/dist/api/types/TextAnalyticsRequest.d.ts +0 -9
  144. package/dist/api/types/TextAnalyticsRequest.js +0 -5
  145. package/dist/api/types/TextAnalyticsResponse.d.ts +0 -9
  146. package/dist/api/types/TextAnalyticsResponse.js +0 -5
  147. package/dist/api/types/TranslatedPage.d.ts +0 -7
  148. package/dist/api/types/TranslatedPage.js +0 -5
package/reference.md CHANGED
@@ -243,150 +243,6 @@ await client.text.transliterate({
243
243
  </dl>
244
244
  </details>
245
245
 
246
- ## Pdf
247
-
248
- <details><summary><code>client.pdf.<a href="/src/api/resources/pdf/client/Client.ts">parse</a>(pdf, { ...params }) -> SarvamAI.ParsedPageResponse</code></summary>
249
- <dl>
250
- <dd>
251
-
252
- #### 📝 Description
253
-
254
- <dl>
255
- <dd>
256
-
257
- <dl>
258
- <dd>
259
-
260
- 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.
261
-
262
- </dd>
263
- </dl>
264
- </dd>
265
- </dl>
266
-
267
- #### 🔌 Usage
268
-
269
- <dl>
270
- <dd>
271
-
272
- <dl>
273
- <dd>
274
-
275
- ```typescript
276
- await client.pdf.parse(fs.createReadStream("/path/to/your/file"), {});
277
- ```
278
-
279
- </dd>
280
- </dl>
281
- </dd>
282
- </dl>
283
-
284
- #### ⚙️ Parameters
285
-
286
- <dl>
287
- <dd>
288
-
289
- <dl>
290
- <dd>
291
-
292
- **pdf:** `File | fs.ReadStream | Blob`
293
-
294
- </dd>
295
- </dl>
296
-
297
- <dl>
298
- <dd>
299
-
300
- **request:** `SarvamAI.ParsePdfRequest`
301
-
302
- </dd>
303
- </dl>
304
-
305
- <dl>
306
- <dd>
307
-
308
- **requestOptions:** `Pdf.RequestOptions`
309
-
310
- </dd>
311
- </dl>
312
- </dd>
313
- </dl>
314
-
315
- </dd>
316
- </dl>
317
- </details>
318
-
319
- <details><summary><code>client.pdf.<a href="/src/api/resources/pdf/client/Client.ts">translate</a>(pdf, { ...params }) -> SarvamAI.TranslatedPage</code></summary>
320
- <dl>
321
- <dd>
322
-
323
- #### 📝 Description
324
-
325
- <dl>
326
- <dd>
327
-
328
- <dl>
329
- <dd>
330
-
331
- Given a PDF, this API helps to translate the content in the document
332
-
333
- </dd>
334
- </dl>
335
- </dd>
336
- </dl>
337
-
338
- #### 🔌 Usage
339
-
340
- <dl>
341
- <dd>
342
-
343
- <dl>
344
- <dd>
345
-
346
- ```typescript
347
- await client.pdf.translate(fs.createReadStream("/path/to/your/file"), {});
348
- ```
349
-
350
- </dd>
351
- </dl>
352
- </dd>
353
- </dl>
354
-
355
- #### ⚙️ Parameters
356
-
357
- <dl>
358
- <dd>
359
-
360
- <dl>
361
- <dd>
362
-
363
- **pdf:** `File | fs.ReadStream | Blob`
364
-
365
- </dd>
366
- </dl>
367
-
368
- <dl>
369
- <dd>
370
-
371
- **request:** `SarvamAI.TranslatePdfRequest`
372
-
373
- </dd>
374
- </dl>
375
-
376
- <dl>
377
- <dd>
378
-
379
- **requestOptions:** `Pdf.RequestOptions`
380
-
381
- </dd>
382
- </dl>
383
- </dd>
384
- </dl>
385
-
386
- </dd>
387
- </dl>
388
- </details>
389
-
390
246
  ## SpeechToText
391
247
 
392
248
  <details><summary><code>client.speechToText.<a href="/src/api/resources/speechToText/client/Client.ts">transcribe</a>(file, { ...params }) -> SarvamAI.SpeechToTextResponse</code></summary>
@@ -557,147 +413,6 @@ await client.speechToText.translate(fs.createReadStream("/path/to/your/file"), {
557
413
  </dl>
558
414
  </details>
559
415
 
560
- ## Analytics
561
-
562
- <details><summary><code>client.analytics.<a href="/src/api/resources/analytics/client/Client.ts">call</a>(file, { ...params }) -> SarvamAI.CallAnalyticsResponse</code></summary>
563
- <dl>
564
- <dd>
565
-
566
- #### 📝 Description
567
-
568
- <dl>
569
- <dd>
570
-
571
- <dl>
572
- <dd>
573
-
574
- Given an audio file of a call between two parties and a list of questions, this API analyzes the content and returns the transcript, along with responses to the questions. Each response is supported by reasoning and exact phrases extracted from the transcript.
575
-
576
- </dd>
577
- </dl>
578
- </dd>
579
- </dl>
580
-
581
- #### 🔌 Usage
582
-
583
- <dl>
584
- <dd>
585
-
586
- <dl>
587
- <dd>
588
-
589
- ```typescript
590
- await client.analytics.call(fs.createReadStream("/path/to/your/file"), {
591
- questions: "questions",
592
- });
593
- ```
594
-
595
- </dd>
596
- </dl>
597
- </dd>
598
- </dl>
599
-
600
- #### ⚙️ Parameters
601
-
602
- <dl>
603
- <dd>
604
-
605
- <dl>
606
- <dd>
607
-
608
- **file:** `File | fs.ReadStream | Blob`
609
-
610
- </dd>
611
- </dl>
612
-
613
- <dl>
614
- <dd>
615
-
616
- **request:** `SarvamAI.CallAnalyticsRequest`
617
-
618
- </dd>
619
- </dl>
620
-
621
- <dl>
622
- <dd>
623
-
624
- **requestOptions:** `Analytics.RequestOptions`
625
-
626
- </dd>
627
- </dl>
628
- </dd>
629
- </dl>
630
-
631
- </dd>
632
- </dl>
633
- </details>
634
-
635
- <details><summary><code>client.analytics.<a href="/src/api/resources/analytics/client/Client.ts">text</a>({ ...params }) -> SarvamAI.TextAnalyticsResponse</code></summary>
636
- <dl>
637
- <dd>
638
-
639
- #### 📝 Description
640
-
641
- <dl>
642
- <dd>
643
-
644
- <dl>
645
- <dd>
646
-
647
- This endpoint performs comprehensive text analysis on provided content and answers specific questions about the text. Each response is supported by reasoning and the exact phrase extracted from the content.
648
-
649
- </dd>
650
- </dl>
651
- </dd>
652
- </dl>
653
-
654
- #### 🔌 Usage
655
-
656
- <dl>
657
- <dd>
658
-
659
- <dl>
660
- <dd>
661
-
662
- ```typescript
663
- await client.analytics.text({
664
- text: "Climate change is a critical global challenge that demands immediate attention. Rising temperatures, extreme weather events, and sea level rise are just a few of the consequences we're already experiencing. Scientists emphasize the urgency of limiting global warming to 1.5\u00B0C above pre-industrial levels to avoid the most severe consequences. This requires significant reductions in greenhouse gas emissions across all sectors of society.",
665
- questions: "questions",
666
- });
667
- ```
668
-
669
- </dd>
670
- </dl>
671
- </dd>
672
- </dl>
673
-
674
- #### ⚙️ Parameters
675
-
676
- <dl>
677
- <dd>
678
-
679
- <dl>
680
- <dd>
681
-
682
- **request:** `SarvamAI.TextAnalyticsRequest`
683
-
684
- </dd>
685
- </dl>
686
-
687
- <dl>
688
- <dd>
689
-
690
- **requestOptions:** `Analytics.RequestOptions`
691
-
692
- </dd>
693
- </dl>
694
- </dd>
695
- </dl>
696
-
697
- </dd>
698
- </dl>
699
- </details>
700
-
701
416
  ## TextToSpeech
702
417
 
703
418
  <details><summary><code>client.textToSpeech.<a href="/src/api/resources/textToSpeech/client/Client.ts">convert</a>({ ...params }) -> SarvamAI.TextToSpeechResponse</code></summary>
@@ -731,7 +446,7 @@ The output is a wave file encoded as a base64 string.
731
446
  ```typescript
732
447
  await client.textToSpeech.convert({
733
448
  inputs: ["inputs"],
734
- target_language_code: "hi-IN",
449
+ target_language_code: "bn-IN",
735
450
  });
736
451
  ```
737
452
 
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.3";
1
+ export declare const SDK_VERSION = "0.0.13";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.3";
4
+ exports.SDK_VERSION = "0.0.13";
@@ -1,73 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as environments from "../../../../environments";
5
- import * as core from "../../../../core";
6
- import * as SarvamAI from "../../../index";
7
- import * as fs from "fs";
8
- import { Blob } from "buffer";
9
- export declare namespace Analytics {
10
- interface Options {
11
- environment?: core.Supplier<environments.SarvamAIEnvironment | string>;
12
- /** Specify a custom URL to connect the client to. */
13
- baseUrl?: core.Supplier<string>;
14
- /** Override the api-subscription-key header */
15
- apiSubscriptionKey?: core.Supplier<string | undefined>;
16
- }
17
- interface RequestOptions {
18
- /** The maximum time to wait for a response in seconds. */
19
- timeoutInSeconds?: number;
20
- /** The number of times to retry the request. Defaults to 2. */
21
- maxRetries?: number;
22
- /** A hook to abort the request. */
23
- abortSignal?: AbortSignal;
24
- /** Override the api-subscription-key header */
25
- apiSubscriptionKey?: string | undefined;
26
- /** Additional headers to include in the request. */
27
- headers?: Record<string, string>;
28
- }
29
- }
30
- export declare class Analytics {
31
- protected readonly _options: Analytics.Options;
32
- constructor(_options?: Analytics.Options);
33
- /**
34
- * Given an audio file of a call between two parties and a list of questions, this API analyzes the content and returns the transcript, along with responses to the questions. Each response is supported by reasoning and exact phrases extracted from the transcript.
35
- *
36
- * @param {File | fs.ReadStream | Blob} file
37
- * @param {SarvamAI.CallAnalyticsRequest} request
38
- * @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
39
- *
40
- * @throws {@link SarvamAI.BadRequestError}
41
- * @throws {@link SarvamAI.ForbiddenError}
42
- * @throws {@link SarvamAI.UnprocessableEntityError}
43
- * @throws {@link SarvamAI.TooManyRequestsError}
44
- * @throws {@link SarvamAI.InternalServerError}
45
- * @throws {@link SarvamAI.ServiceUnavailableError}
46
- *
47
- * @example
48
- * await client.analytics.call(fs.createReadStream("/path/to/your/file"), {
49
- * questions: "questions"
50
- * })
51
- */
52
- call(file: File | fs.ReadStream | Blob, request: SarvamAI.CallAnalyticsRequest, requestOptions?: Analytics.RequestOptions): Promise<SarvamAI.CallAnalyticsResponse>;
53
- /**
54
- * This endpoint performs comprehensive text analysis on provided content and answers specific questions about the text. Each response is supported by reasoning and the exact phrase extracted from the content.
55
- *
56
- * @param {SarvamAI.TextAnalyticsRequest} request
57
- * @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
58
- *
59
- * @throws {@link SarvamAI.BadRequestError}
60
- * @throws {@link SarvamAI.ForbiddenError}
61
- * @throws {@link SarvamAI.UnprocessableEntityError}
62
- * @throws {@link SarvamAI.TooManyRequestsError}
63
- * @throws {@link SarvamAI.InternalServerError}
64
- * @throws {@link SarvamAI.ServiceUnavailableError}
65
- *
66
- * @example
67
- * await client.analytics.text({
68
- * text: "Climate change is a critical global challenge that demands immediate attention. Rising temperatures, extreme weather events, and sea level rise are just a few of the consequences we're already experiencing. Scientists emphasize the urgency of limiting global warming to 1.5\u00B0C above pre-industrial levels to avoid the most severe consequences. This requires significant reductions in greenhouse gas emissions across all sectors of society.",
69
- * questions: "questions"
70
- * })
71
- */
72
- text(request: SarvamAI.TextAnalyticsRequest, requestOptions?: Analytics.RequestOptions): Promise<SarvamAI.TextAnalyticsResponse>;
73
- }
@@ -1,223 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
- return new (P || (P = Promise))(function (resolve, reject) {
41
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
- step((generator = generator.apply(thisArg, _arguments || [])).next());
45
- });
46
- };
47
- var __importDefault = (this && this.__importDefault) || function (mod) {
48
- return (mod && mod.__esModule) ? mod : { "default": mod };
49
- };
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- exports.Analytics = void 0;
52
- const environments = __importStar(require("../../../../environments"));
53
- const core = __importStar(require("../../../../core"));
54
- const SarvamAI = __importStar(require("../../../index"));
55
- const url_join_1 = __importDefault(require("url-join"));
56
- const errors = __importStar(require("../../../../errors/index"));
57
- class Analytics {
58
- constructor(_options = {}) {
59
- this._options = _options;
60
- }
61
- /**
62
- * Given an audio file of a call between two parties and a list of questions, this API analyzes the content and returns the transcript, along with responses to the questions. Each response is supported by reasoning and exact phrases extracted from the transcript.
63
- *
64
- * @param {File | fs.ReadStream | Blob} file
65
- * @param {SarvamAI.CallAnalyticsRequest} request
66
- * @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
67
- *
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
- * @throws {@link SarvamAI.ServiceUnavailableError}
74
- *
75
- * @example
76
- * await client.analytics.call(fs.createReadStream("/path/to/your/file"), {
77
- * questions: "questions"
78
- * })
79
- */
80
- call(file, request, requestOptions) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- var _a, _b;
83
- const _request = yield core.newFormData();
84
- yield _request.appendFile("file", file);
85
- _request.append("questions", request.questions);
86
- if (request.hotwords != null) {
87
- _request.append("hotwords", request.hotwords);
88
- }
89
- if (request.model != null) {
90
- _request.append("model", request.model);
91
- }
92
- if (request.with_diarization != null) {
93
- _request.append("with_diarization", request.with_diarization.toString());
94
- }
95
- const _maybeEncodedRequest = yield _request.getRequest();
96
- const _response = yield core.fetcher({
97
- 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, "call-analytics"),
98
- method: "POST",
99
- headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
100
- ? yield core.Supplier.get(this._options.apiSubscriptionKey)
101
- : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.3", "User-Agent": "sarvamai/0.0.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
102
- requestType: "file",
103
- duplex: _maybeEncodedRequest.duplex,
104
- body: _maybeEncodedRequest.body,
105
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
106
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
107
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
108
- });
109
- if (_response.ok) {
110
- return _response.body;
111
- }
112
- if (_response.error.reason === "status-code") {
113
- switch (_response.error.statusCode) {
114
- case 400:
115
- throw new SarvamAI.BadRequestError(_response.error.body);
116
- case 403:
117
- throw new SarvamAI.ForbiddenError(_response.error.body);
118
- case 422:
119
- throw new SarvamAI.UnprocessableEntityError(_response.error.body);
120
- case 429:
121
- throw new SarvamAI.TooManyRequestsError(_response.error.body);
122
- case 500:
123
- throw new SarvamAI.InternalServerError(_response.error.body);
124
- case 503:
125
- throw new SarvamAI.ServiceUnavailableError(_response.error.body);
126
- default:
127
- throw new errors.SarvamAIError({
128
- statusCode: _response.error.statusCode,
129
- body: _response.error.body,
130
- });
131
- }
132
- }
133
- switch (_response.error.reason) {
134
- case "non-json":
135
- throw new errors.SarvamAIError({
136
- statusCode: _response.error.statusCode,
137
- body: _response.error.rawBody,
138
- });
139
- case "timeout":
140
- throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /call-analytics.");
141
- case "unknown":
142
- throw new errors.SarvamAIError({
143
- message: _response.error.errorMessage,
144
- });
145
- }
146
- });
147
- }
148
- /**
149
- * This endpoint performs comprehensive text analysis on provided content and answers specific questions about the text. Each response is supported by reasoning and the exact phrase extracted from the content.
150
- *
151
- * @param {SarvamAI.TextAnalyticsRequest} request
152
- * @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
153
- *
154
- * @throws {@link SarvamAI.BadRequestError}
155
- * @throws {@link SarvamAI.ForbiddenError}
156
- * @throws {@link SarvamAI.UnprocessableEntityError}
157
- * @throws {@link SarvamAI.TooManyRequestsError}
158
- * @throws {@link SarvamAI.InternalServerError}
159
- * @throws {@link SarvamAI.ServiceUnavailableError}
160
- *
161
- * @example
162
- * await client.analytics.text({
163
- * text: "Climate change is a critical global challenge that demands immediate attention. Rising temperatures, extreme weather events, and sea level rise are just a few of the consequences we're already experiencing. Scientists emphasize the urgency of limiting global warming to 1.5\u00B0C above pre-industrial levels to avoid the most severe consequences. This requires significant reductions in greenhouse gas emissions across all sectors of society.",
164
- * questions: "questions"
165
- * })
166
- */
167
- text(request, requestOptions) {
168
- return __awaiter(this, void 0, void 0, function* () {
169
- var _a, _b;
170
- const _response = yield core.fetcher({
171
- 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-analytics"),
172
- method: "POST",
173
- headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
174
- ? yield core.Supplier.get(this._options.apiSubscriptionKey)
175
- : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "sarvamai", "X-Fern-SDK-Version": "0.0.3", "User-Agent": "sarvamai/0.0.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
176
- contentType: "application/x-www-form-urlencoded",
177
- requestType: "json",
178
- body: request,
179
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
180
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
181
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
182
- });
183
- if (_response.ok) {
184
- return _response.body;
185
- }
186
- if (_response.error.reason === "status-code") {
187
- switch (_response.error.statusCode) {
188
- case 400:
189
- throw new SarvamAI.BadRequestError(_response.error.body);
190
- case 403:
191
- throw new SarvamAI.ForbiddenError(_response.error.body);
192
- case 422:
193
- throw new SarvamAI.UnprocessableEntityError(_response.error.body);
194
- case 429:
195
- throw new SarvamAI.TooManyRequestsError(_response.error.body);
196
- case 500:
197
- throw new SarvamAI.InternalServerError(_response.error.body);
198
- case 503:
199
- throw new SarvamAI.ServiceUnavailableError(_response.error.body);
200
- default:
201
- throw new errors.SarvamAIError({
202
- statusCode: _response.error.statusCode,
203
- body: _response.error.body,
204
- });
205
- }
206
- }
207
- switch (_response.error.reason) {
208
- case "non-json":
209
- throw new errors.SarvamAIError({
210
- statusCode: _response.error.statusCode,
211
- body: _response.error.rawBody,
212
- });
213
- case "timeout":
214
- throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /text-analytics.");
215
- case "unknown":
216
- throw new errors.SarvamAIError({
217
- message: _response.error.errorMessage,
218
- });
219
- }
220
- });
221
- }
222
- }
223
- exports.Analytics = Analytics;
@@ -1 +0,0 @@
1
- export * from "./requests";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./requests"), exports);
@@ -1,24 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as SarvamAI from "../../../../index";
5
- /**
6
- * @example
7
- * {
8
- * questions: "questions"
9
- * }
10
- */
11
- export interface CallAnalyticsRequest {
12
- /**
13
- * List of questions to be answered based on the call content. Each question should be a valid `JSON` object with the following structure: ```{id: string, text: string, description: string (optional), type: string, properties: object}```.
14
- * The `type` field must be one of: `boolean`, `enum`, `short answer`, `long answer`, or `number`.
15
- * For `enum` type questions, include an 'options' list in the properties.
16
- */
17
- questions: string;
18
- /** Optional comma-separated string of keywords specific to your domain. These keywords will be preserved as-is in the transcript. */
19
- hotwords?: string;
20
- /** Model to be used for converting speech to text in target language */
21
- model?: SarvamAI.SpeechToTextTranslateModel;
22
- /** Include diarization in the output */
23
- with_diarization?: boolean;
24
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export { type CallAnalyticsRequest } from "./CallAnalyticsRequest";
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export * from "./client";