sarvamai 1.1.2-alpha.4 → 1.1.2-alpha.6
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -3
- package/dist/cjs/Client.js +3 -3
- package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/Client.d.ts +57 -46
- package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/Client.js +50 -39
- package/dist/cjs/api/resources/{docDigitizationJob/client/requests/DocDigitizationJobRequest.d.ts → documentIntelligence/client/requests/DocumentIntelligenceJobRequest.d.ts} +1 -1
- package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/index.d.ts +2 -2
- package/dist/cjs/api/resources/index.js +3 -3
- package/dist/cjs/api/types/DocDigitizationJobParameters.d.ts +4 -2
- package/dist/cjs/api/types/DocDigitizationJobState.d.ts +1 -1
- package/dist/cjs/api/types/DocDigitizationJobState.js +1 -1
- package/dist/cjs/api/types/DocDigitizationPromptType.d.ts +23 -0
- package/dist/cjs/api/types/DocDigitizationPromptType.js +26 -0
- package/dist/cjs/api/types/DocDigitizationSupportedLanguage.d.ts +24 -23
- package/dist/cjs/api/types/DocDigitizationSupportedLanguage.js +24 -23
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -3
- package/dist/esm/Client.mjs +3 -3
- package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/Client.d.mts +57 -46
- package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/Client.mjs +48 -37
- package/dist/esm/api/resources/{docDigitizationJob/client/requests/DocDigitizationJobRequest.d.mts → documentIntelligence/client/requests/DocumentIntelligenceJobRequest.d.mts} +1 -1
- package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/index.d.mts +2 -2
- package/dist/esm/api/resources/index.mjs +2 -2
- package/dist/esm/api/types/DocDigitizationJobParameters.d.mts +4 -2
- package/dist/esm/api/types/DocDigitizationJobState.d.mts +1 -1
- package/dist/esm/api/types/DocDigitizationJobState.mjs +1 -1
- package/dist/esm/api/types/DocDigitizationPromptType.d.mts +23 -0
- package/dist/esm/api/types/DocDigitizationPromptType.mjs +23 -0
- package/dist/esm/api/types/DocDigitizationSupportedLanguage.d.mts +24 -23
- package/dist/esm/api/types/DocDigitizationSupportedLanguage.mjs +24 -23
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +53 -42
- /package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/index.js +0 -0
- /package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/DocDigitizationUploadFilesRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/DocDigitizationUploadFilesRequest.js +0 -0
- /package/dist/cjs/api/resources/{docDigitizationJob/client/requests/DocDigitizationJobRequest.js → documentIntelligence/client/requests/DocumentIntelligenceJobRequest.js} +0 -0
- /package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/index.js +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/DocDigitizationUploadFilesRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/DocDigitizationUploadFilesRequest.mjs +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob/client/requests/DocDigitizationJobRequest.mjs → documentIntelligence/client/requests/DocumentIntelligenceJobRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/index.d.mts +0 -0
- /package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/index.mjs +0 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "sarvamai",
|
|
46
|
-
"X-Fern-SDK-Version": "1.1.2-alpha.
|
|
47
|
-
"User-Agent": "sarvamai/1.1.2-alpha.
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.2-alpha.6",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.2-alpha.6",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChatClient } from "./api/resources/chat/client/Client.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DocumentIntelligenceClient } from "./api/resources/documentIntelligence/client/Client.js";
|
|
3
3
|
import { SpeechToTextClient } from "./api/resources/speechToText/client/Client.js";
|
|
4
4
|
import { SpeechToTextJobClient } from "./api/resources/speechToTextJob/client/Client.js";
|
|
5
5
|
import { SpeechToTextStreamingClient } from "./api/resources/speechToTextStreaming/client/Client.js";
|
|
@@ -24,7 +24,7 @@ export declare class SarvamAIClient {
|
|
|
24
24
|
protected _chat: ChatClient | undefined;
|
|
25
25
|
protected _speechToTextJob: SpeechToTextJobClient | undefined;
|
|
26
26
|
protected _speechToTextTranslateJob: SpeechToTextTranslateJobClient | undefined;
|
|
27
|
-
protected
|
|
27
|
+
protected _documentIntelligence: DocumentIntelligenceClient | undefined;
|
|
28
28
|
protected _speechToTextStreaming: SpeechToTextStreamingClient | undefined;
|
|
29
29
|
protected _speechToTextTranslateStreaming: SpeechToTextTranslateStreamingClient | undefined;
|
|
30
30
|
protected _textToSpeechStreaming: TextToSpeechStreamingClient | undefined;
|
|
@@ -35,7 +35,7 @@ export declare class SarvamAIClient {
|
|
|
35
35
|
get chat(): ChatClient;
|
|
36
36
|
get speechToTextJob(): SpeechToTextJobClient;
|
|
37
37
|
get speechToTextTranslateJob(): SpeechToTextTranslateJobClient;
|
|
38
|
-
get
|
|
38
|
+
get documentIntelligence(): DocumentIntelligenceClient;
|
|
39
39
|
get speechToTextStreaming(): SpeechToTextStreamingClient;
|
|
40
40
|
get speechToTextTranslateStreaming(): SpeechToTextTranslateStreamingClient;
|
|
41
41
|
get textToSpeechStreaming(): TextToSpeechStreamingClient;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SarvamAIClient = void 0;
|
|
5
5
|
const Client_js_1 = require("./api/resources/chat/client/Client.js");
|
|
6
|
-
const Client_js_2 = require("./api/resources/
|
|
6
|
+
const Client_js_2 = require("./api/resources/documentIntelligence/client/Client.js");
|
|
7
7
|
const Client_js_3 = require("./api/resources/speechToText/client/Client.js");
|
|
8
8
|
const Client_js_4 = require("./api/resources/speechToTextJob/client/Client.js");
|
|
9
9
|
const Client_js_5 = require("./api/resources/speechToTextStreaming/client/Client.js");
|
|
@@ -41,9 +41,9 @@ class SarvamAIClient {
|
|
|
41
41
|
var _a;
|
|
42
42
|
return ((_a = this._speechToTextTranslateJob) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateJob = new Client_js_6.SpeechToTextTranslateJobClient(this._options)));
|
|
43
43
|
}
|
|
44
|
-
get
|
|
44
|
+
get documentIntelligence() {
|
|
45
45
|
var _a;
|
|
46
|
-
return ((_a = this.
|
|
46
|
+
return ((_a = this._documentIntelligence) !== null && _a !== void 0 ? _a : (this._documentIntelligence = new Client_js_2.DocumentIntelligenceClient(this._options)));
|
|
47
47
|
}
|
|
48
48
|
get speechToTextStreaming() {
|
|
49
49
|
var _a;
|
package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/Client.d.ts
RENAMED
|
@@ -2,52 +2,63 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
3
|
import * as core from "../../../../core/index.js";
|
|
4
4
|
import * as SarvamAI from "../../../index.js";
|
|
5
|
-
export declare namespace
|
|
5
|
+
export declare namespace DocumentIntelligenceClient {
|
|
6
6
|
interface Options extends BaseClientOptions {
|
|
7
7
|
}
|
|
8
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export declare class
|
|
12
|
-
protected readonly _options: NormalizedClientOptionsWithAuth<
|
|
13
|
-
constructor(options?:
|
|
11
|
+
export declare class DocumentIntelligenceClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<DocumentIntelligenceClient.Options>;
|
|
13
|
+
constructor(options?: DocumentIntelligenceClient.Options);
|
|
14
14
|
/**
|
|
15
|
-
* Creates a new document
|
|
16
|
-
*
|
|
17
|
-
* **Supported Languages:**
|
|
18
|
-
* - `hi`: Hindi
|
|
19
|
-
* - `en`: English
|
|
20
|
-
* - `bn`: Bengali
|
|
21
|
-
* - `gu`: Gujarati
|
|
22
|
-
* - `kn`: Kannada
|
|
23
|
-
* - `ml`: Malayalam
|
|
24
|
-
* - `mr`: Marathi
|
|
25
|
-
* - `or`: Odia
|
|
26
|
-
* - `pa`: Punjabi
|
|
27
|
-
* - `ta`: Tamil
|
|
28
|
-
* - `te`: Telugu
|
|
29
|
-
* - `ur`: Urdu
|
|
30
|
-
* - `as`: Assamese
|
|
31
|
-
* - `bodo`: Bodo
|
|
32
|
-
* - `doi`: Dogri
|
|
33
|
-
* - `ks`: Kashmiri
|
|
34
|
-
* - `kok`: Konkani
|
|
35
|
-
* - `mai`: Maithili
|
|
36
|
-
* - `mni`: Manipuri
|
|
37
|
-
* - `ne`: Nepali
|
|
38
|
-
* - `sa`: Sanskrit
|
|
39
|
-
* - `sat`: Santali
|
|
40
|
-
* - `sd`: Sindhi
|
|
15
|
+
* Creates a new document intelligence job.
|
|
16
|
+
*
|
|
17
|
+
* **Supported Languages (BCP-47 format):**
|
|
18
|
+
* - `hi-IN`: Hindi (default)
|
|
19
|
+
* - `en-IN`: English
|
|
20
|
+
* - `bn-IN`: Bengali
|
|
21
|
+
* - `gu-IN`: Gujarati
|
|
22
|
+
* - `kn-IN`: Kannada
|
|
23
|
+
* - `ml-IN`: Malayalam
|
|
24
|
+
* - `mr-IN`: Marathi
|
|
25
|
+
* - `or-IN`: Odia
|
|
26
|
+
* - `pa-IN`: Punjabi
|
|
27
|
+
* - `ta-IN`: Tamil
|
|
28
|
+
* - `te-IN`: Telugu
|
|
29
|
+
* - `ur-IN`: Urdu
|
|
30
|
+
* - `as-IN`: Assamese
|
|
31
|
+
* - `bodo-IN`: Bodo
|
|
32
|
+
* - `doi-IN`: Dogri
|
|
33
|
+
* - `ks-IN`: Kashmiri
|
|
34
|
+
* - `kok-IN`: Konkani
|
|
35
|
+
* - `mai-IN`: Maithili
|
|
36
|
+
* - `mni-IN`: Manipuri
|
|
37
|
+
* - `ne-IN`: Nepali
|
|
38
|
+
* - `sa-IN`: Sanskrit
|
|
39
|
+
* - `sat-IN`: Santali
|
|
40
|
+
* - `sd-IN`: Sindhi
|
|
41
41
|
*
|
|
42
42
|
* **Output Formats:**
|
|
43
43
|
* - `html`: Structured HTML with layout preservation (default)
|
|
44
44
|
* - `md`: Markdown format
|
|
45
45
|
*
|
|
46
|
+
* **Prompt Types:**
|
|
47
|
+
* Customize how specific content types are processed:
|
|
48
|
+
* - `default_ocr`: Standard text extraction (default for all text blocks)
|
|
49
|
+
* - `table_to_html`: Convert tables to HTML format
|
|
50
|
+
* - `table_to_markdown`: Convert tables to Markdown format
|
|
51
|
+
* - `chart_to_markdown`: Extract chart data as Markdown table
|
|
52
|
+
* - `chart_to_json`: Extract chart data as JSON
|
|
53
|
+
* - `describe_image`: Generate image caption
|
|
54
|
+
* - `caption_en`: Same as describe_image (English)
|
|
55
|
+
* - `caption_in`: Caption in document language
|
|
56
|
+
*
|
|
46
57
|
* **Webhook Callback:**
|
|
47
58
|
* Optionally provide a callback URL to receive notification when processing completes.
|
|
48
59
|
*
|
|
49
|
-
* @param {SarvamAI.
|
|
50
|
-
* @param {
|
|
60
|
+
* @param {SarvamAI.DocumentIntelligenceJobRequest} request
|
|
61
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
51
62
|
*
|
|
52
63
|
* @throws {@link SarvamAI.BadRequestError}
|
|
53
64
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -56,9 +67,9 @@ export declare class DocDigitizationJobClient {
|
|
|
56
67
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
57
68
|
*
|
|
58
69
|
* @example
|
|
59
|
-
* await client.
|
|
70
|
+
* await client.documentIntelligence.initialise()
|
|
60
71
|
*/
|
|
61
|
-
initialise(request?: SarvamAI.
|
|
72
|
+
initialise(request?: SarvamAI.DocumentIntelligenceJobRequest, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationCreateJobResponse>;
|
|
62
73
|
private __initialise;
|
|
63
74
|
/**
|
|
64
75
|
* Returns presigned URLs for uploading input files.
|
|
@@ -69,7 +80,7 @@ export declare class DocDigitizationJobClient {
|
|
|
69
80
|
* - ZIP files: `.zip` extension
|
|
70
81
|
*
|
|
71
82
|
* @param {SarvamAI.DocDigitizationUploadFilesRequest} request
|
|
72
|
-
* @param {
|
|
83
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
73
84
|
*
|
|
74
85
|
* @throws {@link SarvamAI.BadRequestError}
|
|
75
86
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -78,12 +89,12 @@ export declare class DocDigitizationJobClient {
|
|
|
78
89
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
79
90
|
*
|
|
80
91
|
* @example
|
|
81
|
-
* await client.
|
|
92
|
+
* await client.documentIntelligence.getUploadLinks({
|
|
82
93
|
* job_id: "job_id",
|
|
83
94
|
* files: ["files"]
|
|
84
95
|
* })
|
|
85
96
|
*/
|
|
86
|
-
getUploadLinks(request: SarvamAI.DocDigitizationUploadFilesRequest, requestOptions?:
|
|
97
|
+
getUploadLinks(request: SarvamAI.DocDigitizationUploadFilesRequest, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationUploadFilesResponse>;
|
|
87
98
|
private __getUploadLinks;
|
|
88
99
|
/**
|
|
89
100
|
* Validates the uploaded file and starts processing.
|
|
@@ -102,7 +113,7 @@ export declare class DocDigitizationJobClient {
|
|
|
102
113
|
* Job runs asynchronously. Poll the status endpoint or use webhook callback for completion notification.
|
|
103
114
|
*
|
|
104
115
|
* @param {string} job_id - The unique identifier of the job
|
|
105
|
-
* @param {
|
|
116
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
106
117
|
*
|
|
107
118
|
* @throws {@link SarvamAI.BadRequestError}
|
|
108
119
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -111,9 +122,9 @@ export declare class DocDigitizationJobClient {
|
|
|
111
122
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
112
123
|
*
|
|
113
124
|
* @example
|
|
114
|
-
* await client.
|
|
125
|
+
* await client.documentIntelligence.start("job_id")
|
|
115
126
|
*/
|
|
116
|
-
start(job_id: string, requestOptions?:
|
|
127
|
+
start(job_id: string, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationJobStatusResponse>;
|
|
117
128
|
private __start;
|
|
118
129
|
/**
|
|
119
130
|
* Returns the current status of a job with page-level metrics.
|
|
@@ -130,7 +141,7 @@ export declare class DocDigitizationJobClient {
|
|
|
130
141
|
* Response includes detailed progress: total pages, pages processed, succeeded, failed, and per-page errors.
|
|
131
142
|
*
|
|
132
143
|
* @param {string} job_id - The unique identifier of the job
|
|
133
|
-
* @param {
|
|
144
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
134
145
|
*
|
|
135
146
|
* @throws {@link SarvamAI.BadRequestError}
|
|
136
147
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -139,9 +150,9 @@ export declare class DocDigitizationJobClient {
|
|
|
139
150
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
140
151
|
*
|
|
141
152
|
* @example
|
|
142
|
-
* await client.
|
|
153
|
+
* await client.documentIntelligence.getStatus("job_id")
|
|
143
154
|
*/
|
|
144
|
-
getStatus(job_id: string, requestOptions?:
|
|
155
|
+
getStatus(job_id: string, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationJobStatusResponse>;
|
|
145
156
|
private __getStatus;
|
|
146
157
|
/**
|
|
147
158
|
* Returns presigned URLs for downloading output files.
|
|
@@ -151,7 +162,7 @@ export declare class DocDigitizationJobClient {
|
|
|
151
162
|
* - Failed jobs have no output available
|
|
152
163
|
*
|
|
153
164
|
* @param {string} job_id - The unique identifier of the job
|
|
154
|
-
* @param {
|
|
165
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
155
166
|
*
|
|
156
167
|
* @throws {@link SarvamAI.BadRequestError}
|
|
157
168
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -160,8 +171,8 @@ export declare class DocDigitizationJobClient {
|
|
|
160
171
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
161
172
|
*
|
|
162
173
|
* @example
|
|
163
|
-
* await client.
|
|
174
|
+
* await client.documentIntelligence.getDownloadLinks("job_id")
|
|
164
175
|
*/
|
|
165
|
-
getDownloadLinks(job_id: string, requestOptions?:
|
|
176
|
+
getDownloadLinks(job_id: string, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationDownloadFilesResponse>;
|
|
166
177
|
private __getDownloadLinks;
|
|
167
178
|
}
|
|
@@ -43,54 +43,65 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.DocumentIntelligenceClient = void 0;
|
|
47
47
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
48
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
50
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
51
51
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
52
52
|
const SarvamAI = __importStar(require("../../../index.js"));
|
|
53
|
-
class
|
|
53
|
+
class DocumentIntelligenceClient {
|
|
54
54
|
constructor(options = {}) {
|
|
55
55
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Creates a new document
|
|
58
|
+
* Creates a new document intelligence job.
|
|
59
59
|
*
|
|
60
|
-
* **Supported Languages:**
|
|
61
|
-
* - `hi`: Hindi
|
|
62
|
-
* - `en`: English
|
|
63
|
-
* - `bn`: Bengali
|
|
64
|
-
* - `gu`: Gujarati
|
|
65
|
-
* - `kn`: Kannada
|
|
66
|
-
* - `ml`: Malayalam
|
|
67
|
-
* - `mr`: Marathi
|
|
68
|
-
* - `or`: Odia
|
|
69
|
-
* - `pa`: Punjabi
|
|
70
|
-
* - `ta`: Tamil
|
|
71
|
-
* - `te`: Telugu
|
|
72
|
-
* - `ur`: Urdu
|
|
73
|
-
* - `as`: Assamese
|
|
74
|
-
* - `bodo`: Bodo
|
|
75
|
-
* - `doi`: Dogri
|
|
76
|
-
* - `ks`: Kashmiri
|
|
77
|
-
* - `kok`: Konkani
|
|
78
|
-
* - `mai`: Maithili
|
|
79
|
-
* - `mni`: Manipuri
|
|
80
|
-
* - `ne`: Nepali
|
|
81
|
-
* - `sa`: Sanskrit
|
|
82
|
-
* - `sat`: Santali
|
|
83
|
-
* - `sd`: Sindhi
|
|
60
|
+
* **Supported Languages (BCP-47 format):**
|
|
61
|
+
* - `hi-IN`: Hindi (default)
|
|
62
|
+
* - `en-IN`: English
|
|
63
|
+
* - `bn-IN`: Bengali
|
|
64
|
+
* - `gu-IN`: Gujarati
|
|
65
|
+
* - `kn-IN`: Kannada
|
|
66
|
+
* - `ml-IN`: Malayalam
|
|
67
|
+
* - `mr-IN`: Marathi
|
|
68
|
+
* - `or-IN`: Odia
|
|
69
|
+
* - `pa-IN`: Punjabi
|
|
70
|
+
* - `ta-IN`: Tamil
|
|
71
|
+
* - `te-IN`: Telugu
|
|
72
|
+
* - `ur-IN`: Urdu
|
|
73
|
+
* - `as-IN`: Assamese
|
|
74
|
+
* - `bodo-IN`: Bodo
|
|
75
|
+
* - `doi-IN`: Dogri
|
|
76
|
+
* - `ks-IN`: Kashmiri
|
|
77
|
+
* - `kok-IN`: Konkani
|
|
78
|
+
* - `mai-IN`: Maithili
|
|
79
|
+
* - `mni-IN`: Manipuri
|
|
80
|
+
* - `ne-IN`: Nepali
|
|
81
|
+
* - `sa-IN`: Sanskrit
|
|
82
|
+
* - `sat-IN`: Santali
|
|
83
|
+
* - `sd-IN`: Sindhi
|
|
84
84
|
*
|
|
85
85
|
* **Output Formats:**
|
|
86
86
|
* - `html`: Structured HTML with layout preservation (default)
|
|
87
87
|
* - `md`: Markdown format
|
|
88
88
|
*
|
|
89
|
+
* **Prompt Types:**
|
|
90
|
+
* Customize how specific content types are processed:
|
|
91
|
+
* - `default_ocr`: Standard text extraction (default for all text blocks)
|
|
92
|
+
* - `table_to_html`: Convert tables to HTML format
|
|
93
|
+
* - `table_to_markdown`: Convert tables to Markdown format
|
|
94
|
+
* - `chart_to_markdown`: Extract chart data as Markdown table
|
|
95
|
+
* - `chart_to_json`: Extract chart data as JSON
|
|
96
|
+
* - `describe_image`: Generate image caption
|
|
97
|
+
* - `caption_en`: Same as describe_image (English)
|
|
98
|
+
* - `caption_in`: Caption in document language
|
|
99
|
+
*
|
|
89
100
|
* **Webhook Callback:**
|
|
90
101
|
* Optionally provide a callback URL to receive notification when processing completes.
|
|
91
102
|
*
|
|
92
|
-
* @param {SarvamAI.
|
|
93
|
-
* @param {
|
|
103
|
+
* @param {SarvamAI.DocumentIntelligenceJobRequest} request
|
|
104
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
94
105
|
*
|
|
95
106
|
* @throws {@link SarvamAI.BadRequestError}
|
|
96
107
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -99,7 +110,7 @@ class DocDigitizationJobClient {
|
|
|
99
110
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
100
111
|
*
|
|
101
112
|
* @example
|
|
102
|
-
* await client.
|
|
113
|
+
* await client.documentIntelligence.initialise()
|
|
103
114
|
*/
|
|
104
115
|
initialise(request = {}, requestOptions) {
|
|
105
116
|
return core.HttpResponsePromise.fromPromise(this.__initialise(request, requestOptions));
|
|
@@ -180,7 +191,7 @@ class DocDigitizationJobClient {
|
|
|
180
191
|
* - ZIP files: `.zip` extension
|
|
181
192
|
*
|
|
182
193
|
* @param {SarvamAI.DocDigitizationUploadFilesRequest} request
|
|
183
|
-
* @param {
|
|
194
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
184
195
|
*
|
|
185
196
|
* @throws {@link SarvamAI.BadRequestError}
|
|
186
197
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -189,7 +200,7 @@ class DocDigitizationJobClient {
|
|
|
189
200
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
190
201
|
*
|
|
191
202
|
* @example
|
|
192
|
-
* await client.
|
|
203
|
+
* await client.documentIntelligence.getUploadLinks({
|
|
193
204
|
* job_id: "job_id",
|
|
194
205
|
* files: ["files"]
|
|
195
206
|
* })
|
|
@@ -281,7 +292,7 @@ class DocDigitizationJobClient {
|
|
|
281
292
|
* Job runs asynchronously. Poll the status endpoint or use webhook callback for completion notification.
|
|
282
293
|
*
|
|
283
294
|
* @param {string} job_id - The unique identifier of the job
|
|
284
|
-
* @param {
|
|
295
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
285
296
|
*
|
|
286
297
|
* @throws {@link SarvamAI.BadRequestError}
|
|
287
298
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -290,7 +301,7 @@ class DocDigitizationJobClient {
|
|
|
290
301
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
291
302
|
*
|
|
292
303
|
* @example
|
|
293
|
-
* await client.
|
|
304
|
+
* await client.documentIntelligence.start("job_id")
|
|
294
305
|
*/
|
|
295
306
|
start(job_id, requestOptions) {
|
|
296
307
|
return core.HttpResponsePromise.fromPromise(this.__start(job_id, requestOptions));
|
|
@@ -374,7 +385,7 @@ class DocDigitizationJobClient {
|
|
|
374
385
|
* Response includes detailed progress: total pages, pages processed, succeeded, failed, and per-page errors.
|
|
375
386
|
*
|
|
376
387
|
* @param {string} job_id - The unique identifier of the job
|
|
377
|
-
* @param {
|
|
388
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
378
389
|
*
|
|
379
390
|
* @throws {@link SarvamAI.BadRequestError}
|
|
380
391
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -383,7 +394,7 @@ class DocDigitizationJobClient {
|
|
|
383
394
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
384
395
|
*
|
|
385
396
|
* @example
|
|
386
|
-
* await client.
|
|
397
|
+
* await client.documentIntelligence.getStatus("job_id")
|
|
387
398
|
*/
|
|
388
399
|
getStatus(job_id, requestOptions) {
|
|
389
400
|
return core.HttpResponsePromise.fromPromise(this.__getStatus(job_id, requestOptions));
|
|
@@ -460,7 +471,7 @@ class DocDigitizationJobClient {
|
|
|
460
471
|
* - Failed jobs have no output available
|
|
461
472
|
*
|
|
462
473
|
* @param {string} job_id - The unique identifier of the job
|
|
463
|
-
* @param {
|
|
474
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
464
475
|
*
|
|
465
476
|
* @throws {@link SarvamAI.BadRequestError}
|
|
466
477
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -469,7 +480,7 @@ class DocDigitizationJobClient {
|
|
|
469
480
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
470
481
|
*
|
|
471
482
|
* @example
|
|
472
|
-
* await client.
|
|
483
|
+
* await client.documentIntelligence.getDownloadLinks("job_id")
|
|
473
484
|
*/
|
|
474
485
|
getDownloadLinks(job_id, requestOptions) {
|
|
475
486
|
return core.HttpResponsePromise.fromPromise(this.__getDownloadLinks(job_id, requestOptions));
|
|
@@ -539,4 +550,4 @@ class DocDigitizationJobClient {
|
|
|
539
550
|
});
|
|
540
551
|
}
|
|
541
552
|
}
|
|
542
|
-
exports.
|
|
553
|
+
exports.DocumentIntelligenceClient = DocumentIntelligenceClient;
|
|
@@ -3,7 +3,7 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
3
3
|
* @example
|
|
4
4
|
* {}
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface DocumentIntelligenceJobRequest {
|
|
7
7
|
/** Job configuration parameters. Omit the request body to use defaults. */
|
|
8
8
|
job_parameters?: SarvamAI.DocDigitizationJobParameters;
|
|
9
9
|
/** Optional webhook for completion notification */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./chat/client/requests/index.js";
|
|
2
2
|
export * as chat from "./chat/index.js";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * as
|
|
3
|
+
export * from "./documentIntelligence/client/requests/index.js";
|
|
4
|
+
export * as documentIntelligence from "./documentIntelligence/index.js";
|
|
5
5
|
export * from "./speechToText/client/requests/index.js";
|
|
6
6
|
export * as speechToText from "./speechToText/index.js";
|
|
7
7
|
export * from "./speechToTextJob/client/requests/index.js";
|
|
@@ -36,11 +36,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.textToSpeechStreaming = exports.textToSpeech = exports.text = exports.speechToTextTranslateStreaming = exports.speechToTextTranslateJob = exports.speechToTextStreaming = exports.speechToTextJob = exports.speechToText = exports.
|
|
39
|
+
exports.textToSpeechStreaming = exports.textToSpeech = exports.text = exports.speechToTextTranslateStreaming = exports.speechToTextTranslateJob = exports.speechToTextStreaming = exports.speechToTextJob = exports.speechToText = exports.documentIntelligence = exports.chat = void 0;
|
|
40
40
|
__exportStar(require("./chat/client/requests/index.js"), exports);
|
|
41
41
|
exports.chat = __importStar(require("./chat/index.js"));
|
|
42
|
-
__exportStar(require("./
|
|
43
|
-
exports.
|
|
42
|
+
__exportStar(require("./documentIntelligence/client/requests/index.js"), exports);
|
|
43
|
+
exports.documentIntelligence = __importStar(require("./documentIntelligence/index.js"));
|
|
44
44
|
__exportStar(require("./speechToText/client/requests/index.js"), exports);
|
|
45
45
|
exports.speechToText = __importStar(require("./speechToText/index.js"));
|
|
46
46
|
__exportStar(require("./speechToTextJob/client/requests/index.js"), exports);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type * as SarvamAI from "../index.js";
|
|
2
2
|
/**
|
|
3
|
-
* Job parameters for document
|
|
3
|
+
* Job parameters for document intelligence.
|
|
4
4
|
*/
|
|
5
5
|
export interface DocDigitizationJobParameters {
|
|
6
|
-
/**
|
|
6
|
+
/** BCP-47 language code for the document */
|
|
7
7
|
language?: SarvamAI.DocDigitizationSupportedLanguage;
|
|
8
8
|
/** Output format: html or md */
|
|
9
9
|
output_format?: SarvamAI.DocDigitizationOutputFormat;
|
|
10
|
+
/** Processing mode for content extraction. When null (default), standard OCR is applied to text blocks, tables are converted based on output_format, and images/diagrams receive captions in the document language. */
|
|
11
|
+
prompt_type?: SarvamAI.DocDigitizationPromptType;
|
|
10
12
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.DocDigitizationJobState = void 0;
|
|
5
|
-
/** Current state of the document
|
|
5
|
+
/** Current state of the document intelligence job */
|
|
6
6
|
exports.DocDigitizationJobState = {
|
|
7
7
|
Accepted: "Accepted",
|
|
8
8
|
Pending: "Pending",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processing mode for content extraction.
|
|
3
|
+
*
|
|
4
|
+
* - **default_ocr**: Standard text extraction (default for all text blocks)
|
|
5
|
+
* - **table_to_html**: Convert tables to HTML format (applied to TABLE blocks)
|
|
6
|
+
* - **table_to_markdown**: Convert tables to Markdown format (applied to TABLE blocks)
|
|
7
|
+
* - **chart_to_markdown**: Extract chart data as Markdown table (applied to CHART blocks)
|
|
8
|
+
* - **chart_to_json**: Extract chart data as JSON (applied to CHART blocks)
|
|
9
|
+
* - **describe_image**: Generate image caption (applied to IMAGE/DIAGRAM blocks)
|
|
10
|
+
* - **caption_en**: Same as describe_image (English caption)
|
|
11
|
+
* - **caption_in**: Caption in document language (applied to IMAGE/DIAGRAM blocks)
|
|
12
|
+
*/
|
|
13
|
+
export declare const DocDigitizationPromptType: {
|
|
14
|
+
readonly DefaultOcr: "default_ocr";
|
|
15
|
+
readonly TableToHtml: "table_to_html";
|
|
16
|
+
readonly TableToMarkdown: "table_to_markdown";
|
|
17
|
+
readonly ChartToMarkdown: "chart_to_markdown";
|
|
18
|
+
readonly ChartToJson: "chart_to_json";
|
|
19
|
+
readonly DescribeImage: "describe_image";
|
|
20
|
+
readonly CaptionEn: "caption_en";
|
|
21
|
+
readonly CaptionIn: "caption_in";
|
|
22
|
+
};
|
|
23
|
+
export type DocDigitizationPromptType = (typeof DocDigitizationPromptType)[keyof typeof DocDigitizationPromptType];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DocDigitizationPromptType = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Processing mode for content extraction.
|
|
7
|
+
*
|
|
8
|
+
* - **default_ocr**: Standard text extraction (default for all text blocks)
|
|
9
|
+
* - **table_to_html**: Convert tables to HTML format (applied to TABLE blocks)
|
|
10
|
+
* - **table_to_markdown**: Convert tables to Markdown format (applied to TABLE blocks)
|
|
11
|
+
* - **chart_to_markdown**: Extract chart data as Markdown table (applied to CHART blocks)
|
|
12
|
+
* - **chart_to_json**: Extract chart data as JSON (applied to CHART blocks)
|
|
13
|
+
* - **describe_image**: Generate image caption (applied to IMAGE/DIAGRAM blocks)
|
|
14
|
+
* - **caption_en**: Same as describe_image (English caption)
|
|
15
|
+
* - **caption_in**: Caption in document language (applied to IMAGE/DIAGRAM blocks)
|
|
16
|
+
*/
|
|
17
|
+
exports.DocDigitizationPromptType = {
|
|
18
|
+
DefaultOcr: "default_ocr",
|
|
19
|
+
TableToHtml: "table_to_html",
|
|
20
|
+
TableToMarkdown: "table_to_markdown",
|
|
21
|
+
ChartToMarkdown: "chart_to_markdown",
|
|
22
|
+
ChartToJson: "chart_to_json",
|
|
23
|
+
DescribeImage: "describe_image",
|
|
24
|
+
CaptionEn: "caption_en",
|
|
25
|
+
CaptionIn: "caption_in",
|
|
26
|
+
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
+
/** BCP-47 language code for the document. Supported languages include Hindi, English, Bengali, Gujarati, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu, Urdu, Assamese, Bodo, Dogri, Kashmiri, Konkani, Maithili, Manipuri, Nepali, Sanskrit, Santali, and Sindhi. */
|
|
1
2
|
export declare const DocDigitizationSupportedLanguage: {
|
|
2
|
-
readonly
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
3
|
+
readonly HiIn: "hi-IN";
|
|
4
|
+
readonly EnIn: "en-IN";
|
|
5
|
+
readonly BnIn: "bn-IN";
|
|
6
|
+
readonly GuIn: "gu-IN";
|
|
7
|
+
readonly KnIn: "kn-IN";
|
|
8
|
+
readonly MlIn: "ml-IN";
|
|
9
|
+
readonly MrIn: "mr-IN";
|
|
10
|
+
readonly OrIn: "or-IN";
|
|
11
|
+
readonly PaIn: "pa-IN";
|
|
12
|
+
readonly TaIn: "ta-IN";
|
|
13
|
+
readonly TeIn: "te-IN";
|
|
14
|
+
readonly UrIn: "ur-IN";
|
|
15
|
+
readonly AsIn: "as-IN";
|
|
16
|
+
readonly BodoIn: "bodo-IN";
|
|
17
|
+
readonly DoiIn: "doi-IN";
|
|
18
|
+
readonly KsIn: "ks-IN";
|
|
19
|
+
readonly KokIn: "kok-IN";
|
|
20
|
+
readonly MaiIn: "mai-IN";
|
|
21
|
+
readonly MniIn: "mni-IN";
|
|
22
|
+
readonly NeIn: "ne-IN";
|
|
23
|
+
readonly SaIn: "sa-IN";
|
|
24
|
+
readonly SatIn: "sat-IN";
|
|
25
|
+
readonly SdIn: "sd-IN";
|
|
25
26
|
};
|
|
26
27
|
export type DocDigitizationSupportedLanguage = (typeof DocDigitizationSupportedLanguage)[keyof typeof DocDigitizationSupportedLanguage];
|