sarvamai 1.1.2-alpha.5 → 1.1.2-alpha.7
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 -74
- package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/Client.js +50 -80
- package/dist/cjs/api/resources/documentIntelligence/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/{docDigitizationJob → documentIntelligence}/client/index.js +0 -3
- 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 -74
- package/dist/esm/api/resources/{docDigitizationJob → documentIntelligence}/client/Client.mjs +48 -78
- package/dist/esm/api/resources/documentIntelligence/client/index.d.mts +1 -0
- package/dist/esm/api/resources/documentIntelligence/client/index.mjs +1 -0
- 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/client/DocDigitizationJobInstance.d.ts +0 -82
- package/dist/cjs/api/resources/docDigitizationJob/client/DocDigitizationJobInstance.js +0 -268
- package/dist/cjs/api/resources/docDigitizationJob/client/index.d.ts +0 -2
- package/dist/esm/api/resources/docDigitizationJob/client/DocDigitizationJobInstance.d.mts +0 -82
- package/dist/esm/api/resources/docDigitizationJob/client/DocDigitizationJobInstance.mjs +0 -231
- package/dist/esm/api/resources/docDigitizationJob/client/index.d.mts +0 -2
- package/dist/esm/api/resources/docDigitizationJob/client/index.mjs +0 -2
- /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/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.7",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.2-alpha.7",
|
|
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,53 +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
|
-
|
|
6
|
-
export declare namespace DocDigitizationJobClient {
|
|
5
|
+
export declare namespace DocumentIntelligenceClient {
|
|
7
6
|
interface Options extends BaseClientOptions {
|
|
8
7
|
}
|
|
9
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
|
-
export declare class
|
|
13
|
-
protected readonly _options: NormalizedClientOptionsWithAuth<
|
|
14
|
-
constructor(options?:
|
|
11
|
+
export declare class DocumentIntelligenceClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<DocumentIntelligenceClient.Options>;
|
|
13
|
+
constructor(options?: DocumentIntelligenceClient.Options);
|
|
15
14
|
/**
|
|
16
|
-
* Creates a new document
|
|
17
|
-
*
|
|
18
|
-
* **Supported Languages:**
|
|
19
|
-
* - `hi`: Hindi
|
|
20
|
-
* - `en`: English
|
|
21
|
-
* - `bn`: Bengali
|
|
22
|
-
* - `gu`: Gujarati
|
|
23
|
-
* - `kn`: Kannada
|
|
24
|
-
* - `ml`: Malayalam
|
|
25
|
-
* - `mr`: Marathi
|
|
26
|
-
* - `or`: Odia
|
|
27
|
-
* - `pa`: Punjabi
|
|
28
|
-
* - `ta`: Tamil
|
|
29
|
-
* - `te`: Telugu
|
|
30
|
-
* - `ur`: Urdu
|
|
31
|
-
* - `as`: Assamese
|
|
32
|
-
* - `bodo`: Bodo
|
|
33
|
-
* - `doi`: Dogri
|
|
34
|
-
* - `ks`: Kashmiri
|
|
35
|
-
* - `kok`: Konkani
|
|
36
|
-
* - `mai`: Maithili
|
|
37
|
-
* - `mni`: Manipuri
|
|
38
|
-
* - `ne`: Nepali
|
|
39
|
-
* - `sa`: Sanskrit
|
|
40
|
-
* - `sat`: Santali
|
|
41
|
-
* - `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
|
|
42
41
|
*
|
|
43
42
|
* **Output Formats:**
|
|
44
43
|
* - `html`: Structured HTML with layout preservation (default)
|
|
45
44
|
* - `md`: Markdown format
|
|
46
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
|
+
*
|
|
47
57
|
* **Webhook Callback:**
|
|
48
58
|
* Optionally provide a callback URL to receive notification when processing completes.
|
|
49
59
|
*
|
|
50
|
-
* @param {SarvamAI.
|
|
51
|
-
* @param {
|
|
60
|
+
* @param {SarvamAI.DocumentIntelligenceJobRequest} request
|
|
61
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
52
62
|
*
|
|
53
63
|
* @throws {@link SarvamAI.BadRequestError}
|
|
54
64
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -57,9 +67,9 @@ export declare class DocDigitizationJobClient {
|
|
|
57
67
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
58
68
|
*
|
|
59
69
|
* @example
|
|
60
|
-
* await client.
|
|
70
|
+
* await client.documentIntelligence.initialise()
|
|
61
71
|
*/
|
|
62
|
-
initialise(request?: SarvamAI.
|
|
72
|
+
initialise(request?: SarvamAI.DocumentIntelligenceJobRequest, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationCreateJobResponse>;
|
|
63
73
|
private __initialise;
|
|
64
74
|
/**
|
|
65
75
|
* Returns presigned URLs for uploading input files.
|
|
@@ -70,7 +80,7 @@ export declare class DocDigitizationJobClient {
|
|
|
70
80
|
* - ZIP files: `.zip` extension
|
|
71
81
|
*
|
|
72
82
|
* @param {SarvamAI.DocDigitizationUploadFilesRequest} request
|
|
73
|
-
* @param {
|
|
83
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
74
84
|
*
|
|
75
85
|
* @throws {@link SarvamAI.BadRequestError}
|
|
76
86
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -79,12 +89,12 @@ export declare class DocDigitizationJobClient {
|
|
|
79
89
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
80
90
|
*
|
|
81
91
|
* @example
|
|
82
|
-
* await client.
|
|
92
|
+
* await client.documentIntelligence.getUploadLinks({
|
|
83
93
|
* job_id: "job_id",
|
|
84
94
|
* files: ["files"]
|
|
85
95
|
* })
|
|
86
96
|
*/
|
|
87
|
-
getUploadLinks(request: SarvamAI.DocDigitizationUploadFilesRequest, requestOptions?:
|
|
97
|
+
getUploadLinks(request: SarvamAI.DocDigitizationUploadFilesRequest, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationUploadFilesResponse>;
|
|
88
98
|
private __getUploadLinks;
|
|
89
99
|
/**
|
|
90
100
|
* Validates the uploaded file and starts processing.
|
|
@@ -103,7 +113,7 @@ export declare class DocDigitizationJobClient {
|
|
|
103
113
|
* Job runs asynchronously. Poll the status endpoint or use webhook callback for completion notification.
|
|
104
114
|
*
|
|
105
115
|
* @param {string} job_id - The unique identifier of the job
|
|
106
|
-
* @param {
|
|
116
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
107
117
|
*
|
|
108
118
|
* @throws {@link SarvamAI.BadRequestError}
|
|
109
119
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -112,9 +122,9 @@ export declare class DocDigitizationJobClient {
|
|
|
112
122
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
113
123
|
*
|
|
114
124
|
* @example
|
|
115
|
-
* await client.
|
|
125
|
+
* await client.documentIntelligence.start("job_id")
|
|
116
126
|
*/
|
|
117
|
-
start(job_id: string, requestOptions?:
|
|
127
|
+
start(job_id: string, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationJobStatusResponse>;
|
|
118
128
|
private __start;
|
|
119
129
|
/**
|
|
120
130
|
* Returns the current status of a job with page-level metrics.
|
|
@@ -131,7 +141,7 @@ export declare class DocDigitizationJobClient {
|
|
|
131
141
|
* Response includes detailed progress: total pages, pages processed, succeeded, failed, and per-page errors.
|
|
132
142
|
*
|
|
133
143
|
* @param {string} job_id - The unique identifier of the job
|
|
134
|
-
* @param {
|
|
144
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
135
145
|
*
|
|
136
146
|
* @throws {@link SarvamAI.BadRequestError}
|
|
137
147
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -140,9 +150,9 @@ export declare class DocDigitizationJobClient {
|
|
|
140
150
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
141
151
|
*
|
|
142
152
|
* @example
|
|
143
|
-
* await client.
|
|
153
|
+
* await client.documentIntelligence.getStatus("job_id")
|
|
144
154
|
*/
|
|
145
|
-
getStatus(job_id: string, requestOptions?:
|
|
155
|
+
getStatus(job_id: string, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationJobStatusResponse>;
|
|
146
156
|
private __getStatus;
|
|
147
157
|
/**
|
|
148
158
|
* Returns presigned URLs for downloading output files.
|
|
@@ -152,7 +162,7 @@ export declare class DocDigitizationJobClient {
|
|
|
152
162
|
* - Failed jobs have no output available
|
|
153
163
|
*
|
|
154
164
|
* @param {string} job_id - The unique identifier of the job
|
|
155
|
-
* @param {
|
|
165
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
156
166
|
*
|
|
157
167
|
* @throws {@link SarvamAI.BadRequestError}
|
|
158
168
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -161,35 +171,8 @@ export declare class DocDigitizationJobClient {
|
|
|
161
171
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
162
172
|
*
|
|
163
173
|
* @example
|
|
164
|
-
* await client.
|
|
174
|
+
* await client.documentIntelligence.getDownloadLinks("job_id")
|
|
165
175
|
*/
|
|
166
|
-
getDownloadLinks(job_id: string, requestOptions?:
|
|
176
|
+
getDownloadLinks(job_id: string, requestOptions?: DocumentIntelligenceClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocDigitizationDownloadFilesResponse>;
|
|
167
177
|
private __getDownloadLinks;
|
|
168
|
-
/**
|
|
169
|
-
* Create a new Document Digitization job and return a job instance.
|
|
170
|
-
*
|
|
171
|
-
* @param language - ISO language code for the document (default: "hi")
|
|
172
|
-
* @param outputFormat - Output format: "html" or "md" (default: "html")
|
|
173
|
-
* @param callback - Optional webhook configuration for job completion notification
|
|
174
|
-
* @returns Promise<DocDigitizationJobInstance> - A job instance for managing the job
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* const job = await client.docDigitizationJob.createJob("hi", "md");
|
|
178
|
-
* await job.uploadFile("/path/to/document.pdf");
|
|
179
|
-
* await job.start();
|
|
180
|
-
* await job.waitUntilComplete();
|
|
181
|
-
* await job.downloadOutput("./output.md");
|
|
182
|
-
*/
|
|
183
|
-
createJob(language?: SarvamAI.DocDigitizationSupportedLanguage, outputFormat?: SarvamAI.DocDigitizationOutputFormat, callback?: SarvamAI.DocDigitizationWebhookCallback): Promise<DocDigitizationJobInstance>;
|
|
184
|
-
/**
|
|
185
|
-
* Get an existing Document Digitization job instance by job ID.
|
|
186
|
-
*
|
|
187
|
-
* @param jobId - The job ID of a previously created job
|
|
188
|
-
* @returns DocDigitizationJobInstance - A job instance for managing the job
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* const job = client.docDigitizationJob.getJob("your-job-uuid");
|
|
192
|
-
* const status = await job.getStatus();
|
|
193
|
-
*/
|
|
194
|
-
getJob(jobId: string): DocDigitizationJobInstance;
|
|
195
178
|
}
|
|
@@ -43,55 +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
|
-
|
|
54
|
-
class DocDigitizationJobClient {
|
|
53
|
+
class DocumentIntelligenceClient {
|
|
55
54
|
constructor(options = {}) {
|
|
56
55
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
56
|
}
|
|
58
57
|
/**
|
|
59
|
-
* Creates a new document
|
|
58
|
+
* Creates a new document intelligence job.
|
|
60
59
|
*
|
|
61
|
-
* **Supported Languages:**
|
|
62
|
-
* - `hi`: Hindi
|
|
63
|
-
* - `en`: English
|
|
64
|
-
* - `bn`: Bengali
|
|
65
|
-
* - `gu`: Gujarati
|
|
66
|
-
* - `kn`: Kannada
|
|
67
|
-
* - `ml`: Malayalam
|
|
68
|
-
* - `mr`: Marathi
|
|
69
|
-
* - `or`: Odia
|
|
70
|
-
* - `pa`: Punjabi
|
|
71
|
-
* - `ta`: Tamil
|
|
72
|
-
* - `te`: Telugu
|
|
73
|
-
* - `ur`: Urdu
|
|
74
|
-
* - `as`: Assamese
|
|
75
|
-
* - `bodo`: Bodo
|
|
76
|
-
* - `doi`: Dogri
|
|
77
|
-
* - `ks`: Kashmiri
|
|
78
|
-
* - `kok`: Konkani
|
|
79
|
-
* - `mai`: Maithili
|
|
80
|
-
* - `mni`: Manipuri
|
|
81
|
-
* - `ne`: Nepali
|
|
82
|
-
* - `sa`: Sanskrit
|
|
83
|
-
* - `sat`: Santali
|
|
84
|
-
* - `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
|
|
85
84
|
*
|
|
86
85
|
* **Output Formats:**
|
|
87
86
|
* - `html`: Structured HTML with layout preservation (default)
|
|
88
87
|
* - `md`: Markdown format
|
|
89
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
|
+
*
|
|
90
100
|
* **Webhook Callback:**
|
|
91
101
|
* Optionally provide a callback URL to receive notification when processing completes.
|
|
92
102
|
*
|
|
93
|
-
* @param {SarvamAI.
|
|
94
|
-
* @param {
|
|
103
|
+
* @param {SarvamAI.DocumentIntelligenceJobRequest} request
|
|
104
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
95
105
|
*
|
|
96
106
|
* @throws {@link SarvamAI.BadRequestError}
|
|
97
107
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -100,7 +110,7 @@ class DocDigitizationJobClient {
|
|
|
100
110
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
101
111
|
*
|
|
102
112
|
* @example
|
|
103
|
-
* await client.
|
|
113
|
+
* await client.documentIntelligence.initialise()
|
|
104
114
|
*/
|
|
105
115
|
initialise(request = {}, requestOptions) {
|
|
106
116
|
return core.HttpResponsePromise.fromPromise(this.__initialise(request, requestOptions));
|
|
@@ -181,7 +191,7 @@ class DocDigitizationJobClient {
|
|
|
181
191
|
* - ZIP files: `.zip` extension
|
|
182
192
|
*
|
|
183
193
|
* @param {SarvamAI.DocDigitizationUploadFilesRequest} request
|
|
184
|
-
* @param {
|
|
194
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
185
195
|
*
|
|
186
196
|
* @throws {@link SarvamAI.BadRequestError}
|
|
187
197
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -190,7 +200,7 @@ class DocDigitizationJobClient {
|
|
|
190
200
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
191
201
|
*
|
|
192
202
|
* @example
|
|
193
|
-
* await client.
|
|
203
|
+
* await client.documentIntelligence.getUploadLinks({
|
|
194
204
|
* job_id: "job_id",
|
|
195
205
|
* files: ["files"]
|
|
196
206
|
* })
|
|
@@ -282,7 +292,7 @@ class DocDigitizationJobClient {
|
|
|
282
292
|
* Job runs asynchronously. Poll the status endpoint or use webhook callback for completion notification.
|
|
283
293
|
*
|
|
284
294
|
* @param {string} job_id - The unique identifier of the job
|
|
285
|
-
* @param {
|
|
295
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
286
296
|
*
|
|
287
297
|
* @throws {@link SarvamAI.BadRequestError}
|
|
288
298
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -291,7 +301,7 @@ class DocDigitizationJobClient {
|
|
|
291
301
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
292
302
|
*
|
|
293
303
|
* @example
|
|
294
|
-
* await client.
|
|
304
|
+
* await client.documentIntelligence.start("job_id")
|
|
295
305
|
*/
|
|
296
306
|
start(job_id, requestOptions) {
|
|
297
307
|
return core.HttpResponsePromise.fromPromise(this.__start(job_id, requestOptions));
|
|
@@ -375,7 +385,7 @@ class DocDigitizationJobClient {
|
|
|
375
385
|
* Response includes detailed progress: total pages, pages processed, succeeded, failed, and per-page errors.
|
|
376
386
|
*
|
|
377
387
|
* @param {string} job_id - The unique identifier of the job
|
|
378
|
-
* @param {
|
|
388
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
379
389
|
*
|
|
380
390
|
* @throws {@link SarvamAI.BadRequestError}
|
|
381
391
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -384,7 +394,7 @@ class DocDigitizationJobClient {
|
|
|
384
394
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
385
395
|
*
|
|
386
396
|
* @example
|
|
387
|
-
* await client.
|
|
397
|
+
* await client.documentIntelligence.getStatus("job_id")
|
|
388
398
|
*/
|
|
389
399
|
getStatus(job_id, requestOptions) {
|
|
390
400
|
return core.HttpResponsePromise.fromPromise(this.__getStatus(job_id, requestOptions));
|
|
@@ -461,7 +471,7 @@ class DocDigitizationJobClient {
|
|
|
461
471
|
* - Failed jobs have no output available
|
|
462
472
|
*
|
|
463
473
|
* @param {string} job_id - The unique identifier of the job
|
|
464
|
-
* @param {
|
|
474
|
+
* @param {DocumentIntelligenceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
465
475
|
*
|
|
466
476
|
* @throws {@link SarvamAI.BadRequestError}
|
|
467
477
|
* @throws {@link SarvamAI.ForbiddenError}
|
|
@@ -470,7 +480,7 @@ class DocDigitizationJobClient {
|
|
|
470
480
|
* @throws {@link SarvamAI.ServiceUnavailableError}
|
|
471
481
|
*
|
|
472
482
|
* @example
|
|
473
|
-
* await client.
|
|
483
|
+
* await client.documentIntelligence.getDownloadLinks("job_id")
|
|
474
484
|
*/
|
|
475
485
|
getDownloadLinks(job_id, requestOptions) {
|
|
476
486
|
return core.HttpResponsePromise.fromPromise(this.__getDownloadLinks(job_id, requestOptions));
|
|
@@ -539,45 +549,5 @@ class DocDigitizationJobClient {
|
|
|
539
549
|
}
|
|
540
550
|
});
|
|
541
551
|
}
|
|
542
|
-
/**
|
|
543
|
-
* Create a new Document Digitization job and return a job instance.
|
|
544
|
-
*
|
|
545
|
-
* @param language - ISO language code for the document (default: "hi")
|
|
546
|
-
* @param outputFormat - Output format: "html" or "md" (default: "html")
|
|
547
|
-
* @param callback - Optional webhook configuration for job completion notification
|
|
548
|
-
* @returns Promise<DocDigitizationJobInstance> - A job instance for managing the job
|
|
549
|
-
*
|
|
550
|
-
* @example
|
|
551
|
-
* const job = await client.docDigitizationJob.createJob("hi", "md");
|
|
552
|
-
* await job.uploadFile("/path/to/document.pdf");
|
|
553
|
-
* await job.start();
|
|
554
|
-
* await job.waitUntilComplete();
|
|
555
|
-
* await job.downloadOutput("./output.md");
|
|
556
|
-
*/
|
|
557
|
-
createJob() {
|
|
558
|
-
return __awaiter(this, arguments, void 0, function* (language = "hi", outputFormat = "html", callback) {
|
|
559
|
-
const response = yield this.initialise({
|
|
560
|
-
job_parameters: {
|
|
561
|
-
language,
|
|
562
|
-
output_format: outputFormat,
|
|
563
|
-
},
|
|
564
|
-
callback,
|
|
565
|
-
});
|
|
566
|
-
return new DocDigitizationJobInstance_js_1.DocDigitizationJobInstance(response.job_id, this);
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Get an existing Document Digitization job instance by job ID.
|
|
571
|
-
*
|
|
572
|
-
* @param jobId - The job ID of a previously created job
|
|
573
|
-
* @returns DocDigitizationJobInstance - A job instance for managing the job
|
|
574
|
-
*
|
|
575
|
-
* @example
|
|
576
|
-
* const job = client.docDigitizationJob.getJob("your-job-uuid");
|
|
577
|
-
* const status = await job.getStatus();
|
|
578
|
-
*/
|
|
579
|
-
getJob(jobId) {
|
|
580
|
-
return new DocDigitizationJobInstance_js_1.DocDigitizationJobInstance(jobId, this);
|
|
581
|
-
}
|
|
582
552
|
}
|
|
583
|
-
exports.
|
|
553
|
+
exports.DocumentIntelligenceClient = DocumentIntelligenceClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -14,7 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DocDigitizationJobInstance = void 0;
|
|
18
17
|
__exportStar(require("./requests/index.js"), exports);
|
|
19
|
-
var DocDigitizationJobInstance_js_1 = require("./DocDigitizationJobInstance.js");
|
|
20
|
-
Object.defineProperty(exports, "DocDigitizationJobInstance", { enumerable: true, get: function () { return DocDigitizationJobInstance_js_1.DocDigitizationJobInstance; } });
|
|
@@ -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
|
+
};
|