sarvamai 0.0.2 → 0.0.3
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.
- package/Client.d.ts +5 -5
- package/Client.js +3 -3
- package/README.md +8 -8
- package/api/errors/BadRequestError.d.ts +1 -1
- package/api/errors/BadRequestError.js +1 -1
- package/api/errors/ForbiddenError.d.ts +3 -3
- package/api/errors/ForbiddenError.js +1 -1
- package/api/errors/InternalServerError.d.ts +1 -1
- package/api/errors/InternalServerError.js +1 -1
- package/api/errors/ServiceUnavailableError.d.ts +3 -3
- package/api/errors/ServiceUnavailableError.js +1 -1
- package/api/errors/TooManyRequestsError.d.ts +3 -3
- package/api/errors/TooManyRequestsError.js +1 -1
- package/api/errors/UnprocessableEntityError.d.ts +1 -1
- package/api/errors/UnprocessableEntityError.js +1 -1
- package/api/resources/analytics/client/Client.d.ts +18 -18
- package/api/resources/analytics/client/Client.js +39 -39
- package/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +2 -2
- package/api/resources/pdf/client/Client.d.ts +12 -12
- package/api/resources/pdf/client/Client.js +27 -27
- package/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +3 -3
- package/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +2 -2
- package/api/resources/speechToText/client/Client.d.ts +18 -18
- package/api/resources/speechToText/client/Client.js +39 -39
- package/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +3 -3
- package/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +2 -2
- package/api/resources/text/client/Client.d.ts +23 -23
- package/api/resources/text/client/Client.js +52 -52
- package/api/resources/text/client/requests/TranslationRequest.d.ts +8 -8
- package/api/resources/text/client/requests/TransliterationRequest.d.ts +5 -5
- package/api/resources/textToSpeech/client/Client.d.ts +9 -9
- package/api/resources/textToSpeech/client/Client.js +18 -18
- package/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +5 -5
- package/api/types/CallAnalyticsJobParameters.d.ts +3 -3
- package/api/types/CallAnalyticsJobRequest.d.ts +2 -2
- package/api/types/CallAnalyticsResponse.d.ts +4 -4
- package/api/types/DiarizedTranscript.d.ts +2 -2
- package/api/types/ErrorDetails.d.ts +2 -2
- package/api/types/ErrorMessage.d.ts +2 -2
- package/api/types/Question.d.ts +2 -2
- package/api/types/SpeechToTextResponse.d.ts +3 -3
- package/api/types/SpeechToTextTranslateResponse.d.ts +3 -3
- package/api/types/TextAnalyticsResponse.d.ts +2 -2
- package/dist/Client.d.ts +5 -5
- package/dist/Client.js +3 -3
- package/dist/api/errors/BadRequestError.d.ts +1 -1
- package/dist/api/errors/BadRequestError.js +1 -1
- package/dist/api/errors/ForbiddenError.d.ts +3 -3
- package/dist/api/errors/ForbiddenError.js +1 -1
- package/dist/api/errors/InternalServerError.d.ts +1 -1
- package/dist/api/errors/InternalServerError.js +1 -1
- package/dist/api/errors/ServiceUnavailableError.d.ts +3 -3
- package/dist/api/errors/ServiceUnavailableError.js +1 -1
- package/dist/api/errors/TooManyRequestsError.d.ts +3 -3
- package/dist/api/errors/TooManyRequestsError.js +1 -1
- package/dist/api/errors/UnprocessableEntityError.d.ts +1 -1
- package/dist/api/errors/UnprocessableEntityError.js +1 -1
- package/dist/api/resources/analytics/client/Client.d.ts +18 -18
- package/dist/api/resources/analytics/client/Client.js +39 -39
- package/dist/api/resources/analytics/client/requests/CallAnalyticsRequest.d.ts +2 -2
- package/dist/api/resources/pdf/client/Client.d.ts +12 -12
- package/dist/api/resources/pdf/client/Client.js +27 -27
- package/dist/api/resources/pdf/client/requests/ParsePdfRequest.d.ts +3 -3
- package/dist/api/resources/pdf/client/requests/TranslatePdfRequest.d.ts +2 -2
- package/dist/api/resources/speechToText/client/Client.d.ts +18 -18
- package/dist/api/resources/speechToText/client/Client.js +39 -39
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranscriptionRequest.d.ts +3 -3
- package/dist/api/resources/speechToText/client/requests/SpeechToTextTranslationRequest.d.ts +2 -2
- package/dist/api/resources/text/client/Client.d.ts +23 -23
- package/dist/api/resources/text/client/Client.js +52 -52
- package/dist/api/resources/text/client/requests/TranslationRequest.d.ts +8 -8
- package/dist/api/resources/text/client/requests/TransliterationRequest.d.ts +5 -5
- package/dist/api/resources/textToSpeech/client/Client.d.ts +9 -9
- package/dist/api/resources/textToSpeech/client/Client.js +18 -18
- package/dist/api/resources/textToSpeech/client/requests/TextToSpeechRequest.d.ts +5 -5
- package/dist/api/types/CallAnalyticsJobParameters.d.ts +3 -3
- package/dist/api/types/CallAnalyticsJobRequest.d.ts +2 -2
- package/dist/api/types/CallAnalyticsResponse.d.ts +4 -4
- package/dist/api/types/DiarizedTranscript.d.ts +2 -2
- package/dist/api/types/ErrorDetails.d.ts +2 -2
- package/dist/api/types/ErrorMessage.d.ts +2 -2
- package/dist/api/types/Question.d.ts +2 -2
- package/dist/api/types/SpeechToTextResponse.d.ts +3 -3
- package/dist/api/types/SpeechToTextTranslateResponse.d.ts +3 -3
- package/dist/api/types/TextAnalyticsResponse.d.ts +2 -2
- package/dist/environments.d.ts +2 -2
- package/dist/environments.js +2 -2
- package/dist/errors/{SarvamError.d.ts → SarvamAIError.d.ts} +1 -1
- package/{errors/SarvamError.js → dist/errors/SarvamAIError.js} +4 -4
- package/dist/errors/{SarvamTimeoutError.d.ts → SarvamAITimeoutError.d.ts} +1 -1
- package/{errors/SarvamTimeoutError.js → dist/errors/SarvamAITimeoutError.js} +4 -4
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +5 -5
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/environments.d.ts +2 -2
- package/environments.js +2 -2
- package/errors/{SarvamError.d.ts → SarvamAIError.d.ts} +1 -1
- package/{dist/errors/SarvamError.js → errors/SarvamAIError.js} +4 -4
- package/errors/{SarvamTimeoutError.d.ts → SarvamAITimeoutError.d.ts} +1 -1
- package/{dist/errors/SarvamTimeoutError.js → errors/SarvamAITimeoutError.js} +4 -4
- package/errors/index.d.ts +2 -2
- package/errors/index.js +5 -5
- package/index.d.ts +4 -4
- package/index.js +6 -6
- package/package.json +1 -1
- package/reference.md +20 -20
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
4
|
+
import * as SarvamAI from "../index";
|
|
5
5
|
export interface SpeechToTextTranslateResponse {
|
|
6
6
|
request_id?: string;
|
|
7
7
|
/** Transcript of the provided speech */
|
|
8
8
|
transcript: string;
|
|
9
9
|
/** 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 */
|
|
10
|
-
language_code?:
|
|
10
|
+
language_code?: SarvamAI.SpeechToTextTranslateLanguage;
|
|
11
11
|
/** Diarized transcript of the provided speech */
|
|
12
|
-
diarized_transcript?:
|
|
12
|
+
diarized_transcript?: SarvamAI.DiarizedTranscript;
|
|
13
13
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
4
|
+
import * as SarvamAI from "../index";
|
|
5
5
|
export interface TextAnalyticsResponse {
|
|
6
6
|
request_id?: string;
|
|
7
7
|
/** List of answers derived from the text analysis. Each answer corresponds to a question from the original request. This field will be null if no valid answers could be generated. */
|
|
8
|
-
answers?:
|
|
8
|
+
answers?: SarvamAI.QnaResponse[];
|
|
9
9
|
}
|
package/dist/Client.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ import { Pdf } from "./api/resources/pdf/client/Client";
|
|
|
8
8
|
import { SpeechToText } from "./api/resources/speechToText/client/Client";
|
|
9
9
|
import { Analytics } from "./api/resources/analytics/client/Client";
|
|
10
10
|
import { TextToSpeech } from "./api/resources/textToSpeech/client/Client";
|
|
11
|
-
export declare namespace
|
|
11
|
+
export declare namespace SarvamAIClient {
|
|
12
12
|
interface Options {
|
|
13
|
-
environment?: core.Supplier<environments.
|
|
13
|
+
environment?: core.Supplier<environments.SarvamAIEnvironment | string>;
|
|
14
14
|
/** Specify a custom URL to connect the client to. */
|
|
15
15
|
baseUrl?: core.Supplier<string>;
|
|
16
16
|
/** Override the api-subscription-key header */
|
|
@@ -29,14 +29,14 @@ export declare namespace SarvamClient {
|
|
|
29
29
|
headers?: Record<string, string>;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
export declare class
|
|
33
|
-
protected readonly _options:
|
|
32
|
+
export declare class SarvamAIClient {
|
|
33
|
+
protected readonly _options: SarvamAIClient.Options;
|
|
34
34
|
protected _text: Text | undefined;
|
|
35
35
|
protected _pdf: Pdf | undefined;
|
|
36
36
|
protected _speechToText: SpeechToText | undefined;
|
|
37
37
|
protected _analytics: Analytics | undefined;
|
|
38
38
|
protected _textToSpeech: TextToSpeech | undefined;
|
|
39
|
-
constructor(_options?:
|
|
39
|
+
constructor(_options?: SarvamAIClient.Options);
|
|
40
40
|
get text(): Text;
|
|
41
41
|
get pdf(): Pdf;
|
|
42
42
|
get speechToText(): SpeechToText;
|
package/dist/Client.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* This file was auto-generated by Fern from our API Definition.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.SarvamAIClient = void 0;
|
|
7
7
|
const Client_1 = require("./api/resources/text/client/Client");
|
|
8
8
|
const Client_2 = require("./api/resources/pdf/client/Client");
|
|
9
9
|
const Client_3 = require("./api/resources/speechToText/client/Client");
|
|
10
10
|
const Client_4 = require("./api/resources/analytics/client/Client");
|
|
11
11
|
const Client_5 = require("./api/resources/textToSpeech/client/Client");
|
|
12
|
-
class
|
|
12
|
+
class SarvamAIClient {
|
|
13
13
|
constructor(_options = {}) {
|
|
14
14
|
this._options = _options;
|
|
15
15
|
}
|
|
@@ -34,4 +34,4 @@ class SarvamClient {
|
|
|
34
34
|
return ((_a = this._textToSpeech) !== null && _a !== void 0 ? _a : (this._textToSpeech = new Client_5.TextToSpeech(this._options)));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
exports.
|
|
37
|
+
exports.SarvamAIClient = SarvamAIClient;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from "../../errors/index";
|
|
5
|
-
export declare class BadRequestError extends errors.
|
|
5
|
+
export declare class BadRequestError extends errors.SarvamAIError {
|
|
6
6
|
constructor(body?: unknown);
|
|
7
7
|
}
|
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.BadRequestError = void 0;
|
|
40
40
|
const errors = __importStar(require("../../errors/index"));
|
|
41
|
-
class BadRequestError extends errors.
|
|
41
|
+
class BadRequestError extends errors.SarvamAIError {
|
|
42
42
|
constructor(body) {
|
|
43
43
|
super({
|
|
44
44
|
message: "BadRequestError",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from "../../errors/index";
|
|
5
|
-
import * as
|
|
6
|
-
export declare class ForbiddenError extends errors.
|
|
7
|
-
constructor(body:
|
|
5
|
+
import * as SarvamAI from "../index";
|
|
6
|
+
export declare class ForbiddenError extends errors.SarvamAIError {
|
|
7
|
+
constructor(body: SarvamAI.ErrorMessage);
|
|
8
8
|
}
|
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.ForbiddenError = void 0;
|
|
40
40
|
const errors = __importStar(require("../../errors/index"));
|
|
41
|
-
class ForbiddenError extends errors.
|
|
41
|
+
class ForbiddenError extends errors.SarvamAIError {
|
|
42
42
|
constructor(body) {
|
|
43
43
|
super({
|
|
44
44
|
message: "ForbiddenError",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from "../../errors/index";
|
|
5
|
-
export declare class InternalServerError extends errors.
|
|
5
|
+
export declare class InternalServerError extends errors.SarvamAIError {
|
|
6
6
|
constructor(body?: unknown);
|
|
7
7
|
}
|
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.InternalServerError = void 0;
|
|
40
40
|
const errors = __importStar(require("../../errors/index"));
|
|
41
|
-
class InternalServerError extends errors.
|
|
41
|
+
class InternalServerError extends errors.SarvamAIError {
|
|
42
42
|
constructor(body) {
|
|
43
43
|
super({
|
|
44
44
|
message: "InternalServerError",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from "../../errors/index";
|
|
5
|
-
import * as
|
|
6
|
-
export declare class ServiceUnavailableError extends errors.
|
|
7
|
-
constructor(body:
|
|
5
|
+
import * as SarvamAI from "../index";
|
|
6
|
+
export declare class ServiceUnavailableError extends errors.SarvamAIError {
|
|
7
|
+
constructor(body: SarvamAI.ErrorMessage);
|
|
8
8
|
}
|
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.ServiceUnavailableError = void 0;
|
|
40
40
|
const errors = __importStar(require("../../errors/index"));
|
|
41
|
-
class ServiceUnavailableError extends errors.
|
|
41
|
+
class ServiceUnavailableError extends errors.SarvamAIError {
|
|
42
42
|
constructor(body) {
|
|
43
43
|
super({
|
|
44
44
|
message: "ServiceUnavailableError",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from "../../errors/index";
|
|
5
|
-
import * as
|
|
6
|
-
export declare class TooManyRequestsError extends errors.
|
|
7
|
-
constructor(body:
|
|
5
|
+
import * as SarvamAI from "../index";
|
|
6
|
+
export declare class TooManyRequestsError extends errors.SarvamAIError {
|
|
7
|
+
constructor(body: SarvamAI.ErrorMessage);
|
|
8
8
|
}
|
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.TooManyRequestsError = void 0;
|
|
40
40
|
const errors = __importStar(require("../../errors/index"));
|
|
41
|
-
class TooManyRequestsError extends errors.
|
|
41
|
+
class TooManyRequestsError extends errors.SarvamAIError {
|
|
42
42
|
constructor(body) {
|
|
43
43
|
super({
|
|
44
44
|
message: "TooManyRequestsError",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from "../../errors/index";
|
|
5
|
-
export declare class UnprocessableEntityError extends errors.
|
|
5
|
+
export declare class UnprocessableEntityError extends errors.SarvamAIError {
|
|
6
6
|
constructor(body?: unknown);
|
|
7
7
|
}
|
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.UnprocessableEntityError = void 0;
|
|
40
40
|
const errors = __importStar(require("../../errors/index"));
|
|
41
|
-
class UnprocessableEntityError extends errors.
|
|
41
|
+
class UnprocessableEntityError extends errors.SarvamAIError {
|
|
42
42
|
constructor(body) {
|
|
43
43
|
super({
|
|
44
44
|
message: "UnprocessableEntityError",
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "../../../../environments";
|
|
5
5
|
import * as core from "../../../../core";
|
|
6
|
-
import * as
|
|
6
|
+
import * as SarvamAI from "../../../index";
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import { Blob } from "buffer";
|
|
9
9
|
export declare namespace Analytics {
|
|
10
10
|
interface Options {
|
|
11
|
-
environment?: core.Supplier<environments.
|
|
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 */
|
|
@@ -34,34 +34,34 @@ export declare class Analytics {
|
|
|
34
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
35
|
*
|
|
36
36
|
* @param {File | fs.ReadStream | Blob} file
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {SarvamAI.CallAnalyticsRequest} request
|
|
38
38
|
* @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
|
|
39
39
|
*
|
|
40
|
-
* @throws {@link
|
|
41
|
-
* @throws {@link
|
|
42
|
-
* @throws {@link
|
|
43
|
-
* @throws {@link
|
|
44
|
-
* @throws {@link
|
|
45
|
-
* @throws {@link
|
|
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
46
|
*
|
|
47
47
|
* @example
|
|
48
48
|
* await client.analytics.call(fs.createReadStream("/path/to/your/file"), {
|
|
49
49
|
* questions: "questions"
|
|
50
50
|
* })
|
|
51
51
|
*/
|
|
52
|
-
call(file: File | fs.ReadStream | Blob, request:
|
|
52
|
+
call(file: File | fs.ReadStream | Blob, request: SarvamAI.CallAnalyticsRequest, requestOptions?: Analytics.RequestOptions): Promise<SarvamAI.CallAnalyticsResponse>;
|
|
53
53
|
/**
|
|
54
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
55
|
*
|
|
56
|
-
* @param {
|
|
56
|
+
* @param {SarvamAI.TextAnalyticsRequest} request
|
|
57
57
|
* @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
|
|
58
58
|
*
|
|
59
|
-
* @throws {@link
|
|
60
|
-
* @throws {@link
|
|
61
|
-
* @throws {@link
|
|
62
|
-
* @throws {@link
|
|
63
|
-
* @throws {@link
|
|
64
|
-
* @throws {@link
|
|
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
65
|
*
|
|
66
66
|
* @example
|
|
67
67
|
* await client.analytics.text({
|
|
@@ -69,5 +69,5 @@ export declare class Analytics {
|
|
|
69
69
|
* questions: "questions"
|
|
70
70
|
* })
|
|
71
71
|
*/
|
|
72
|
-
text(request:
|
|
72
|
+
text(request: SarvamAI.TextAnalyticsRequest, requestOptions?: Analytics.RequestOptions): Promise<SarvamAI.TextAnalyticsResponse>;
|
|
73
73
|
}
|
|
@@ -51,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
51
51
|
exports.Analytics = void 0;
|
|
52
52
|
const environments = __importStar(require("../../../../environments"));
|
|
53
53
|
const core = __importStar(require("../../../../core"));
|
|
54
|
-
const
|
|
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 Analytics {
|
|
@@ -62,15 +62,15 @@ class Analytics {
|
|
|
62
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
63
|
*
|
|
64
64
|
* @param {File | fs.ReadStream | Blob} file
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {SarvamAI.CallAnalyticsRequest} request
|
|
66
66
|
* @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
|
|
67
67
|
*
|
|
68
|
-
* @throws {@link
|
|
69
|
-
* @throws {@link
|
|
70
|
-
* @throws {@link
|
|
71
|
-
* @throws {@link
|
|
72
|
-
* @throws {@link
|
|
73
|
-
* @throws {@link
|
|
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
74
|
*
|
|
75
75
|
* @example
|
|
76
76
|
* await client.analytics.call(fs.createReadStream("/path/to/your/file"), {
|
|
@@ -94,11 +94,11 @@ class Analytics {
|
|
|
94
94
|
}
|
|
95
95
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
96
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.
|
|
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
98
|
method: "POST",
|
|
99
99
|
headers: Object.assign(Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
|
|
100
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.
|
|
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
102
|
requestType: "file",
|
|
103
103
|
duplex: _maybeEncodedRequest.duplex,
|
|
104
104
|
body: _maybeEncodedRequest.body,
|
|
@@ -112,19 +112,19 @@ class Analytics {
|
|
|
112
112
|
if (_response.error.reason === "status-code") {
|
|
113
113
|
switch (_response.error.statusCode) {
|
|
114
114
|
case 400:
|
|
115
|
-
throw new
|
|
115
|
+
throw new SarvamAI.BadRequestError(_response.error.body);
|
|
116
116
|
case 403:
|
|
117
|
-
throw new
|
|
117
|
+
throw new SarvamAI.ForbiddenError(_response.error.body);
|
|
118
118
|
case 422:
|
|
119
|
-
throw new
|
|
119
|
+
throw new SarvamAI.UnprocessableEntityError(_response.error.body);
|
|
120
120
|
case 429:
|
|
121
|
-
throw new
|
|
121
|
+
throw new SarvamAI.TooManyRequestsError(_response.error.body);
|
|
122
122
|
case 500:
|
|
123
|
-
throw new
|
|
123
|
+
throw new SarvamAI.InternalServerError(_response.error.body);
|
|
124
124
|
case 503:
|
|
125
|
-
throw new
|
|
125
|
+
throw new SarvamAI.ServiceUnavailableError(_response.error.body);
|
|
126
126
|
default:
|
|
127
|
-
throw new errors.
|
|
127
|
+
throw new errors.SarvamAIError({
|
|
128
128
|
statusCode: _response.error.statusCode,
|
|
129
129
|
body: _response.error.body,
|
|
130
130
|
});
|
|
@@ -132,14 +132,14 @@ class Analytics {
|
|
|
132
132
|
}
|
|
133
133
|
switch (_response.error.reason) {
|
|
134
134
|
case "non-json":
|
|
135
|
-
throw new errors.
|
|
135
|
+
throw new errors.SarvamAIError({
|
|
136
136
|
statusCode: _response.error.statusCode,
|
|
137
137
|
body: _response.error.rawBody,
|
|
138
138
|
});
|
|
139
139
|
case "timeout":
|
|
140
|
-
throw new errors.
|
|
140
|
+
throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /call-analytics.");
|
|
141
141
|
case "unknown":
|
|
142
|
-
throw new errors.
|
|
142
|
+
throw new errors.SarvamAIError({
|
|
143
143
|
message: _response.error.errorMessage,
|
|
144
144
|
});
|
|
145
145
|
}
|
|
@@ -148,15 +148,15 @@ class Analytics {
|
|
|
148
148
|
/**
|
|
149
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
150
|
*
|
|
151
|
-
* @param {
|
|
151
|
+
* @param {SarvamAI.TextAnalyticsRequest} request
|
|
152
152
|
* @param {Analytics.RequestOptions} requestOptions - Request-specific configuration.
|
|
153
153
|
*
|
|
154
|
-
* @throws {@link
|
|
155
|
-
* @throws {@link
|
|
156
|
-
* @throws {@link
|
|
157
|
-
* @throws {@link
|
|
158
|
-
* @throws {@link
|
|
159
|
-
* @throws {@link
|
|
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
160
|
*
|
|
161
161
|
* @example
|
|
162
162
|
* await client.analytics.text({
|
|
@@ -168,11 +168,11 @@ class Analytics {
|
|
|
168
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169
169
|
var _a, _b;
|
|
170
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.
|
|
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
172
|
method: "POST",
|
|
173
173
|
headers: Object.assign({ "api-subscription-key": (yield core.Supplier.get(this._options.apiSubscriptionKey)) != null
|
|
174
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.
|
|
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
176
|
contentType: "application/x-www-form-urlencoded",
|
|
177
177
|
requestType: "json",
|
|
178
178
|
body: request,
|
|
@@ -186,19 +186,19 @@ class Analytics {
|
|
|
186
186
|
if (_response.error.reason === "status-code") {
|
|
187
187
|
switch (_response.error.statusCode) {
|
|
188
188
|
case 400:
|
|
189
|
-
throw new
|
|
189
|
+
throw new SarvamAI.BadRequestError(_response.error.body);
|
|
190
190
|
case 403:
|
|
191
|
-
throw new
|
|
191
|
+
throw new SarvamAI.ForbiddenError(_response.error.body);
|
|
192
192
|
case 422:
|
|
193
|
-
throw new
|
|
193
|
+
throw new SarvamAI.UnprocessableEntityError(_response.error.body);
|
|
194
194
|
case 429:
|
|
195
|
-
throw new
|
|
195
|
+
throw new SarvamAI.TooManyRequestsError(_response.error.body);
|
|
196
196
|
case 500:
|
|
197
|
-
throw new
|
|
197
|
+
throw new SarvamAI.InternalServerError(_response.error.body);
|
|
198
198
|
case 503:
|
|
199
|
-
throw new
|
|
199
|
+
throw new SarvamAI.ServiceUnavailableError(_response.error.body);
|
|
200
200
|
default:
|
|
201
|
-
throw new errors.
|
|
201
|
+
throw new errors.SarvamAIError({
|
|
202
202
|
statusCode: _response.error.statusCode,
|
|
203
203
|
body: _response.error.body,
|
|
204
204
|
});
|
|
@@ -206,14 +206,14 @@ class Analytics {
|
|
|
206
206
|
}
|
|
207
207
|
switch (_response.error.reason) {
|
|
208
208
|
case "non-json":
|
|
209
|
-
throw new errors.
|
|
209
|
+
throw new errors.SarvamAIError({
|
|
210
210
|
statusCode: _response.error.statusCode,
|
|
211
211
|
body: _response.error.rawBody,
|
|
212
212
|
});
|
|
213
213
|
case "timeout":
|
|
214
|
-
throw new errors.
|
|
214
|
+
throw new errors.SarvamAITimeoutError("Timeout exceeded when calling POST /text-analytics.");
|
|
215
215
|
case "unknown":
|
|
216
|
-
throw new errors.
|
|
216
|
+
throw new errors.SarvamAIError({
|
|
217
217
|
message: _response.error.errorMessage,
|
|
218
218
|
});
|
|
219
219
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
4
|
+
import * as SarvamAI from "../../../../index";
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
@@ -18,7 +18,7 @@ export interface CallAnalyticsRequest {
|
|
|
18
18
|
/** Optional comma-separated string of keywords specific to your domain. These keywords will be preserved as-is in the transcript. */
|
|
19
19
|
hotwords?: string;
|
|
20
20
|
/** Model to be used for converting speech to text in target language */
|
|
21
|
-
model?:
|
|
21
|
+
model?: SarvamAI.SpeechToTextTranslateModel;
|
|
22
22
|
/** Include diarization in the output */
|
|
23
23
|
with_diarization?: boolean;
|
|
24
24
|
}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "../../../../environments";
|
|
5
5
|
import * as core from "../../../../core";
|
|
6
|
-
import * as
|
|
6
|
+
import * as SarvamAI from "../../../index";
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import { Blob } from "buffer";
|
|
9
9
|
export declare namespace Pdf {
|
|
10
10
|
interface Options {
|
|
11
|
-
environment?: core.Supplier<environments.
|
|
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 */
|
|
@@ -34,30 +34,30 @@ export declare class Pdf {
|
|
|
34
34
|
* 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.
|
|
35
35
|
*
|
|
36
36
|
* @param {File | fs.ReadStream | Blob} pdf
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {SarvamAI.ParsePdfRequest} request
|
|
38
38
|
* @param {Pdf.RequestOptions} requestOptions - Request-specific configuration.
|
|
39
39
|
*
|
|
40
|
-
* @throws {@link
|
|
41
|
-
* @throws {@link
|
|
42
|
-
* @throws {@link
|
|
40
|
+
* @throws {@link SarvamAI.BadRequestError}
|
|
41
|
+
* @throws {@link SarvamAI.UnprocessableEntityError}
|
|
42
|
+
* @throws {@link SarvamAI.InternalServerError}
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
45
|
* await client.pdf.parse(fs.createReadStream("/path/to/your/file"), {})
|
|
46
46
|
*/
|
|
47
|
-
parse(pdf: File | fs.ReadStream | Blob, request:
|
|
47
|
+
parse(pdf: File | fs.ReadStream | Blob, request: SarvamAI.ParsePdfRequest, requestOptions?: Pdf.RequestOptions): Promise<SarvamAI.ParsedPageResponse>;
|
|
48
48
|
/**
|
|
49
49
|
* Given a PDF, this API helps to translate the content in the document
|
|
50
50
|
*
|
|
51
51
|
* @param {File | fs.ReadStream | Blob} pdf
|
|
52
|
-
* @param {
|
|
52
|
+
* @param {SarvamAI.TranslatePdfRequest} request
|
|
53
53
|
* @param {Pdf.RequestOptions} requestOptions - Request-specific configuration.
|
|
54
54
|
*
|
|
55
|
-
* @throws {@link
|
|
56
|
-
* @throws {@link
|
|
57
|
-
* @throws {@link
|
|
55
|
+
* @throws {@link SarvamAI.BadRequestError}
|
|
56
|
+
* @throws {@link SarvamAI.UnprocessableEntityError}
|
|
57
|
+
* @throws {@link SarvamAI.InternalServerError}
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* await client.pdf.translate(fs.createReadStream("/path/to/your/file"), {})
|
|
61
61
|
*/
|
|
62
|
-
translate(pdf: File | fs.ReadStream | Blob, request:
|
|
62
|
+
translate(pdf: File | fs.ReadStream | Blob, request: SarvamAI.TranslatePdfRequest, requestOptions?: Pdf.RequestOptions): Promise<SarvamAI.TranslatedPage>;
|
|
63
63
|
}
|