sarvamai 1.1.9-alpha.1 → 1.1.9
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/api/resources/documentTranslation/client/Client.d.ts +6 -8
- package/dist/cjs/api/resources/documentTranslation/client/Client.js +7 -9
- package/dist/cjs/api/resources/documentTranslation/client/requests/CreateDocumentJobRequest.d.ts +14 -12
- package/dist/cjs/api/resources/documentTranslation/client/requests/DocumentTranslationTriggerExportRequest.d.ts +8 -4
- package/dist/cjs/api/types/ExportFormat.d.ts +1 -1
- package/dist/cjs/api/types/ExportFormat.js +1 -1
- package/dist/cjs/api/types/V2ModelIds.d.ts +5 -1
- package/dist/cjs/api/types/V2ModelIds.js +5 -1
- 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/api/resources/documentTranslation/client/Client.d.mts +6 -8
- package/dist/esm/api/resources/documentTranslation/client/Client.mjs +7 -9
- package/dist/esm/api/resources/documentTranslation/client/requests/CreateDocumentJobRequest.d.mts +14 -12
- package/dist/esm/api/resources/documentTranslation/client/requests/DocumentTranslationTriggerExportRequest.d.mts +8 -4
- package/dist/esm/api/types/ExportFormat.d.mts +1 -1
- package/dist/esm/api/types/ExportFormat.mjs +1 -1
- package/dist/esm/api/types/V2ModelIds.d.mts +5 -1
- package/dist/esm/api/types/V2ModelIds.mjs +5 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +6 -8
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.9
|
|
47
|
-
"User-Agent": "sarvamai/1.1.9
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.9",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.9",
|
|
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);
|
|
@@ -20,7 +20,7 @@ export declare class DocumentTranslationClient {
|
|
|
20
20
|
* 2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: <mime>`.
|
|
21
21
|
* 3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline.
|
|
22
22
|
* 4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes.
|
|
23
|
-
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code
|
|
23
|
+
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code>` to enqueue an async export for each target language (exports in the uploaded file's format by default).
|
|
24
24
|
* 6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
25
25
|
*
|
|
26
26
|
* A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response.
|
|
@@ -40,8 +40,6 @@ export declare class DocumentTranslationClient {
|
|
|
40
40
|
* target_language_codes: ["hi-IN", "ta-IN"],
|
|
41
41
|
* original_filename: "chapter1.pdf",
|
|
42
42
|
* genre: "NON_FICTION",
|
|
43
|
-
* auto_process: true,
|
|
44
|
-
* model_type: "plus",
|
|
45
43
|
* use_native_numerals: true
|
|
46
44
|
* })
|
|
47
45
|
*/
|
|
@@ -84,12 +82,13 @@ export declare class DocumentTranslationClient {
|
|
|
84
82
|
getLiveStatus(job_id: string, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise<SarvamAI.JobLiveStatusResponse>;
|
|
85
83
|
private __getLiveStatus;
|
|
86
84
|
/**
|
|
87
|
-
* Enqueue an async export for one target language
|
|
85
|
+
* Enqueue an async export for one target language.
|
|
88
86
|
*
|
|
89
87
|
* Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
90
88
|
*
|
|
91
|
-
* -
|
|
92
|
-
* -
|
|
89
|
+
* - When `format` is omitted, the export uses the uploaded file's native format.
|
|
90
|
+
* - **PDF uploads** may optionally set `format` to `pdf`, `docx`, `html`, `txt`, or `epub`.
|
|
91
|
+
* - **Microsoft Office uploads** always export in the original format only (for example, xlsx in → xlsx out).
|
|
93
92
|
* - Optional `fit_line_height` / `fit_font_shrink` tune PDF/DOCX shrink-to-fit.
|
|
94
93
|
* - Returns `409` when an export for the same language and format is already `Pending` or `Running`.
|
|
95
94
|
*
|
|
@@ -106,8 +105,7 @@ export declare class DocumentTranslationClient {
|
|
|
106
105
|
*
|
|
107
106
|
* @example
|
|
108
107
|
* await client.documentTranslation.triggerExport("550e8400-e29b-41d4-a716-446655440000", {
|
|
109
|
-
* lang: "hi-IN"
|
|
110
|
-
* format: "pdf"
|
|
108
|
+
* lang: "hi-IN"
|
|
111
109
|
* })
|
|
112
110
|
*/
|
|
113
111
|
triggerExport(job_id: string, request: SarvamAI.DocumentTranslationTriggerExportRequest, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocumentJobExportStatusResponse>;
|
|
@@ -65,7 +65,7 @@ class DocumentTranslationClient {
|
|
|
65
65
|
* 2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: <mime>`.
|
|
66
66
|
* 3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline.
|
|
67
67
|
* 4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes.
|
|
68
|
-
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code
|
|
68
|
+
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code>` to enqueue an async export for each target language (exports in the uploaded file's format by default).
|
|
69
69
|
* 6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
70
70
|
*
|
|
71
71
|
* A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response.
|
|
@@ -85,8 +85,6 @@ class DocumentTranslationClient {
|
|
|
85
85
|
* target_language_codes: ["hi-IN", "ta-IN"],
|
|
86
86
|
* original_filename: "chapter1.pdf",
|
|
87
87
|
* genre: "NON_FICTION",
|
|
88
|
-
* auto_process: true,
|
|
89
|
-
* model_type: "plus",
|
|
90
88
|
* use_native_numerals: true
|
|
91
89
|
* })
|
|
92
90
|
*/
|
|
@@ -257,12 +255,13 @@ class DocumentTranslationClient {
|
|
|
257
255
|
});
|
|
258
256
|
}
|
|
259
257
|
/**
|
|
260
|
-
* Enqueue an async export for one target language
|
|
258
|
+
* Enqueue an async export for one target language.
|
|
261
259
|
*
|
|
262
260
|
* Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
263
261
|
*
|
|
264
|
-
* -
|
|
265
|
-
* -
|
|
262
|
+
* - When `format` is omitted, the export uses the uploaded file's native format.
|
|
263
|
+
* - **PDF uploads** may optionally set `format` to `pdf`, `docx`, `html`, `txt`, or `epub`.
|
|
264
|
+
* - **Microsoft Office uploads** always export in the original format only (for example, xlsx in → xlsx out).
|
|
266
265
|
* - Optional `fit_line_height` / `fit_font_shrink` tune PDF/DOCX shrink-to-fit.
|
|
267
266
|
* - Returns `409` when an export for the same language and format is already `Pending` or `Running`.
|
|
268
267
|
*
|
|
@@ -279,8 +278,7 @@ class DocumentTranslationClient {
|
|
|
279
278
|
*
|
|
280
279
|
* @example
|
|
281
280
|
* await client.documentTranslation.triggerExport("550e8400-e29b-41d4-a716-446655440000", {
|
|
282
|
-
* lang: "hi-IN"
|
|
283
|
-
* format: "pdf"
|
|
281
|
+
* lang: "hi-IN"
|
|
284
282
|
* })
|
|
285
283
|
*/
|
|
286
284
|
triggerExport(job_id, request, requestOptions) {
|
|
@@ -292,7 +290,7 @@ class DocumentTranslationClient {
|
|
|
292
290
|
const { lang, format, fit_line_height: fitLineHeight, fit_font_shrink: fitFontShrink } = request;
|
|
293
291
|
const _queryParams = {
|
|
294
292
|
lang,
|
|
295
|
-
format,
|
|
293
|
+
format: format != null ? format : undefined,
|
|
296
294
|
fit_line_height: fitLineHeight,
|
|
297
295
|
fit_font_shrink: fitFontShrink,
|
|
298
296
|
};
|
package/dist/cjs/api/resources/documentTranslation/client/requests/CreateDocumentJobRequest.d.ts
CHANGED
|
@@ -7,29 +7,31 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
7
7
|
* target_language_codes: ["hi-IN", "ta-IN"],
|
|
8
8
|
* original_filename: "chapter1.pdf",
|
|
9
9
|
* genre: "NON_FICTION",
|
|
10
|
-
* auto_process: true,
|
|
11
|
-
* model_type: "plus",
|
|
12
10
|
* use_native_numerals: true
|
|
13
11
|
* }
|
|
14
12
|
*/
|
|
15
13
|
export interface CreateDocumentJobRequest {
|
|
16
|
-
/**
|
|
17
|
-
job_name
|
|
14
|
+
/** Optional human-readable job name. Defaults to `original_filename` when omitted. */
|
|
15
|
+
job_name?: string;
|
|
18
16
|
/** Source language (BCP-47). */
|
|
19
17
|
source_language_code: SarvamAI.DocumentLanguage;
|
|
20
|
-
/** Original filename with extension. Supported:
|
|
18
|
+
/** Original filename with extension. Supported: `.pdf`, `.doc`, `.docx`, `.odt`, `.xls`, `.xlsx`, `.ods`, `.ppt`, `.pptx`, `.odp`, `.html`, `.xhtml`, `.mhtml`. */
|
|
21
19
|
original_filename: string;
|
|
22
20
|
/** Genre enum name (e.g. `NON_FICTION`). Use the enum constant name, not the human-readable label. */
|
|
23
21
|
genre?: SarvamAI.DocumentGenre;
|
|
24
|
-
/** Arbitrary key-value metadata attached to the job. */
|
|
25
|
-
metadata?: Record<string, unknown>;
|
|
26
|
-
/** When true (default), translation begins automatically after the document is parsed. */
|
|
27
|
-
auto_process?: boolean;
|
|
28
22
|
/** Target languages (BCP-47). */
|
|
29
23
|
target_language_codes: SarvamAI.DocumentLanguage[];
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
/**
|
|
25
|
+
* `use_native_numerals` is an optional parameter with three options:
|
|
26
|
+
*
|
|
27
|
+
* - **`null`** (default): Uses the application default.
|
|
28
|
+
* - **`false`**: Uses international numerals (0-9).
|
|
29
|
+
* - **`true`**: Uses language-specific native numerals.
|
|
30
|
+
*
|
|
31
|
+
* ### Example:
|
|
32
|
+
* - If international numerals are used, numbers appear as regular digits (0-9). For example: `मेरा phone number है: 9840950950`.
|
|
33
|
+
* - If native numerals are used, numbers appear in the target script. For example: `मेरा phone number है: ९८४०९५०९५०`.
|
|
34
|
+
*/
|
|
33
35
|
use_native_numerals?: boolean;
|
|
34
36
|
/** Global tone, terminology, and formatting instructions (up to ~4000 characters). Applies to every target language. */
|
|
35
37
|
style_guidelines?: string;
|
|
@@ -2,15 +2,19 @@ import type * as SarvamAI from "../../../../index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* lang: "hi-IN"
|
|
6
|
-
* format: "pdf"
|
|
5
|
+
* lang: "hi-IN"
|
|
7
6
|
* }
|
|
8
7
|
*/
|
|
9
8
|
export interface DocumentTranslationTriggerExportRequest {
|
|
10
9
|
/** BCP-47 target language code (e.g. `hi-IN`). */
|
|
11
10
|
lang: SarvamAI.DocumentLanguage;
|
|
12
|
-
/**
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Optional target export format. When omitted, defaults to the uploaded file's native format.
|
|
13
|
+
*
|
|
14
|
+
* - **PDF uploads:** may be set to `pdf` (default), `docx`, `html`, `txt`, or `epub`.
|
|
15
|
+
* - **Microsoft Office uploads** (`.doc`, `.docx`, `.xls`, `.xlsx`, `.ppt`, `.pptx`, and related formats): always export in the original format only; other values are rejected.
|
|
16
|
+
*/
|
|
17
|
+
format?: SarvamAI.ExportFormat;
|
|
14
18
|
/** When true, the export may reduce line spacing to fit translated text within the original layout. PDF/DOCX only. */
|
|
15
19
|
fit_line_height?: boolean;
|
|
16
20
|
/** When true, the export may reduce font size to fit translated text within the original layout. PDF/DOCX only. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Explicit export format for **PDF uploads only**. Allowed: `pdf` (default), `docx`, `html`, `txt`, or `epub`. Microsoft Office uploads always export in the original format; omit `format` or pass the native extension. */
|
|
2
2
|
export declare const ExportFormat: {
|
|
3
3
|
readonly Pdf: "pdf";
|
|
4
4
|
readonly Docx: "docx";
|
|
@@ -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.ExportFormat = void 0;
|
|
5
|
-
/**
|
|
5
|
+
/** Explicit export format for **PDF uploads only**. Allowed: `pdf` (default), `docx`, `html`, `txt`, or `epub`. Microsoft Office uploads always export in the original format; omit `format` or pass the native extension. */
|
|
6
6
|
exports.ExportFormat = {
|
|
7
7
|
Pdf: "pdf",
|
|
8
8
|
Docx: "docx",
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Model IDs
|
|
2
|
+
* Model IDs accepted by `POST /v2/chat/completions`:
|
|
3
3
|
*
|
|
4
4
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
5
5
|
* - **`glm5.2`** — open-source; 512K context, tool calling, visible reasoning.
|
|
6
6
|
* - **`gemma4`** — open-source; image input, tool calling.
|
|
7
|
+
* - **`deepseekv4-flash`** — open-source; 1M context, tool calling, reasoning.
|
|
8
|
+
*
|
|
9
|
+
* `GET /v2/models` is environment-specific and may omit IDs that completions still accept.
|
|
7
10
|
*/
|
|
8
11
|
export declare const V2ModelIds: {
|
|
9
12
|
readonly Sarvam105B: "sarvam-105b";
|
|
10
13
|
readonly Glm52: "glm5.2";
|
|
11
14
|
readonly Gemma4: "gemma4";
|
|
15
|
+
readonly Deepseekv4Flash: "deepseekv4-flash";
|
|
12
16
|
};
|
|
13
17
|
export type V2ModelIds = (typeof V2ModelIds)[keyof typeof V2ModelIds];
|
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.V2ModelIds = void 0;
|
|
5
5
|
/**
|
|
6
|
-
* Model IDs
|
|
6
|
+
* Model IDs accepted by `POST /v2/chat/completions`:
|
|
7
7
|
*
|
|
8
8
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
9
9
|
* - **`glm5.2`** — open-source; 512K context, tool calling, visible reasoning.
|
|
10
10
|
* - **`gemma4`** — open-source; image input, tool calling.
|
|
11
|
+
* - **`deepseekv4-flash`** — open-source; 1M context, tool calling, reasoning.
|
|
12
|
+
*
|
|
13
|
+
* `GET /v2/models` is environment-specific and may omit IDs that completions still accept.
|
|
11
14
|
*/
|
|
12
15
|
exports.V2ModelIds = {
|
|
13
16
|
Sarvam105B: "sarvam-105b",
|
|
14
17
|
Glm52: "glm5.2",
|
|
15
18
|
Gemma4: "gemma4",
|
|
19
|
+
Deepseekv4Flash: "deepseekv4-flash",
|
|
16
20
|
};
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.9
|
|
1
|
+
export declare const SDK_VERSION = "1.1.9";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "sarvamai",
|
|
9
|
-
"X-Fern-SDK-Version": "1.1.9
|
|
10
|
-
"User-Agent": "sarvamai/1.1.9
|
|
9
|
+
"X-Fern-SDK-Version": "1.1.9",
|
|
10
|
+
"User-Agent": "sarvamai/1.1.9",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -20,7 +20,7 @@ export declare class DocumentTranslationClient {
|
|
|
20
20
|
* 2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: <mime>`.
|
|
21
21
|
* 3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline.
|
|
22
22
|
* 4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes.
|
|
23
|
-
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code
|
|
23
|
+
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code>` to enqueue an async export for each target language (exports in the uploaded file's format by default).
|
|
24
24
|
* 6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
25
25
|
*
|
|
26
26
|
* A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response.
|
|
@@ -40,8 +40,6 @@ export declare class DocumentTranslationClient {
|
|
|
40
40
|
* target_language_codes: ["hi-IN", "ta-IN"],
|
|
41
41
|
* original_filename: "chapter1.pdf",
|
|
42
42
|
* genre: "NON_FICTION",
|
|
43
|
-
* auto_process: true,
|
|
44
|
-
* model_type: "plus",
|
|
45
43
|
* use_native_numerals: true
|
|
46
44
|
* })
|
|
47
45
|
*/
|
|
@@ -84,12 +82,13 @@ export declare class DocumentTranslationClient {
|
|
|
84
82
|
getLiveStatus(job_id: string, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise<SarvamAI.JobLiveStatusResponse>;
|
|
85
83
|
private __getLiveStatus;
|
|
86
84
|
/**
|
|
87
|
-
* Enqueue an async export for one target language
|
|
85
|
+
* Enqueue an async export for one target language.
|
|
88
86
|
*
|
|
89
87
|
* Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
90
88
|
*
|
|
91
|
-
* -
|
|
92
|
-
* -
|
|
89
|
+
* - When `format` is omitted, the export uses the uploaded file's native format.
|
|
90
|
+
* - **PDF uploads** may optionally set `format` to `pdf`, `docx`, `html`, `txt`, or `epub`.
|
|
91
|
+
* - **Microsoft Office uploads** always export in the original format only (for example, xlsx in → xlsx out).
|
|
93
92
|
* - Optional `fit_line_height` / `fit_font_shrink` tune PDF/DOCX shrink-to-fit.
|
|
94
93
|
* - Returns `409` when an export for the same language and format is already `Pending` or `Running`.
|
|
95
94
|
*
|
|
@@ -106,8 +105,7 @@ export declare class DocumentTranslationClient {
|
|
|
106
105
|
*
|
|
107
106
|
* @example
|
|
108
107
|
* await client.documentTranslation.triggerExport("550e8400-e29b-41d4-a716-446655440000", {
|
|
109
|
-
* lang: "hi-IN"
|
|
110
|
-
* format: "pdf"
|
|
108
|
+
* lang: "hi-IN"
|
|
111
109
|
* })
|
|
112
110
|
*/
|
|
113
111
|
triggerExport(job_id: string, request: SarvamAI.DocumentTranslationTriggerExportRequest, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise<SarvamAI.DocumentJobExportStatusResponse>;
|
|
@@ -29,7 +29,7 @@ export class DocumentTranslationClient {
|
|
|
29
29
|
* 2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: <mime>`.
|
|
30
30
|
* 3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline.
|
|
31
31
|
* 4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes.
|
|
32
|
-
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code
|
|
32
|
+
* 5. `POST /translate/document/jobs/{job_id}/export?lang=<code>` to enqueue an async export for each target language (exports in the uploaded file's format by default).
|
|
33
33
|
* 6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
34
34
|
*
|
|
35
35
|
* A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response.
|
|
@@ -49,8 +49,6 @@ export class DocumentTranslationClient {
|
|
|
49
49
|
* target_language_codes: ["hi-IN", "ta-IN"],
|
|
50
50
|
* original_filename: "chapter1.pdf",
|
|
51
51
|
* genre: "NON_FICTION",
|
|
52
|
-
* auto_process: true,
|
|
53
|
-
* model_type: "plus",
|
|
54
52
|
* use_native_numerals: true
|
|
55
53
|
* })
|
|
56
54
|
*/
|
|
@@ -221,12 +219,13 @@ export class DocumentTranslationClient {
|
|
|
221
219
|
});
|
|
222
220
|
}
|
|
223
221
|
/**
|
|
224
|
-
* Enqueue an async export for one target language
|
|
222
|
+
* Enqueue an async export for one target language.
|
|
225
223
|
*
|
|
226
224
|
* Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
227
225
|
*
|
|
228
|
-
* -
|
|
229
|
-
* -
|
|
226
|
+
* - When `format` is omitted, the export uses the uploaded file's native format.
|
|
227
|
+
* - **PDF uploads** may optionally set `format` to `pdf`, `docx`, `html`, `txt`, or `epub`.
|
|
228
|
+
* - **Microsoft Office uploads** always export in the original format only (for example, xlsx in → xlsx out).
|
|
230
229
|
* - Optional `fit_line_height` / `fit_font_shrink` tune PDF/DOCX shrink-to-fit.
|
|
231
230
|
* - Returns `409` when an export for the same language and format is already `Pending` or `Running`.
|
|
232
231
|
*
|
|
@@ -243,8 +242,7 @@ export class DocumentTranslationClient {
|
|
|
243
242
|
*
|
|
244
243
|
* @example
|
|
245
244
|
* await client.documentTranslation.triggerExport("550e8400-e29b-41d4-a716-446655440000", {
|
|
246
|
-
* lang: "hi-IN"
|
|
247
|
-
* format: "pdf"
|
|
245
|
+
* lang: "hi-IN"
|
|
248
246
|
* })
|
|
249
247
|
*/
|
|
250
248
|
triggerExport(job_id, request, requestOptions) {
|
|
@@ -256,7 +254,7 @@ export class DocumentTranslationClient {
|
|
|
256
254
|
const { lang, format, fit_line_height: fitLineHeight, fit_font_shrink: fitFontShrink } = request;
|
|
257
255
|
const _queryParams = {
|
|
258
256
|
lang,
|
|
259
|
-
format,
|
|
257
|
+
format: format != null ? format : undefined,
|
|
260
258
|
fit_line_height: fitLineHeight,
|
|
261
259
|
fit_font_shrink: fitFontShrink,
|
|
262
260
|
};
|
package/dist/esm/api/resources/documentTranslation/client/requests/CreateDocumentJobRequest.d.mts
CHANGED
|
@@ -7,29 +7,31 @@ import type * as SarvamAI from "../../../../index.mjs";
|
|
|
7
7
|
* target_language_codes: ["hi-IN", "ta-IN"],
|
|
8
8
|
* original_filename: "chapter1.pdf",
|
|
9
9
|
* genre: "NON_FICTION",
|
|
10
|
-
* auto_process: true,
|
|
11
|
-
* model_type: "plus",
|
|
12
10
|
* use_native_numerals: true
|
|
13
11
|
* }
|
|
14
12
|
*/
|
|
15
13
|
export interface CreateDocumentJobRequest {
|
|
16
|
-
/**
|
|
17
|
-
job_name
|
|
14
|
+
/** Optional human-readable job name. Defaults to `original_filename` when omitted. */
|
|
15
|
+
job_name?: string;
|
|
18
16
|
/** Source language (BCP-47). */
|
|
19
17
|
source_language_code: SarvamAI.DocumentLanguage;
|
|
20
|
-
/** Original filename with extension. Supported:
|
|
18
|
+
/** Original filename with extension. Supported: `.pdf`, `.doc`, `.docx`, `.odt`, `.xls`, `.xlsx`, `.ods`, `.ppt`, `.pptx`, `.odp`, `.html`, `.xhtml`, `.mhtml`. */
|
|
21
19
|
original_filename: string;
|
|
22
20
|
/** Genre enum name (e.g. `NON_FICTION`). Use the enum constant name, not the human-readable label. */
|
|
23
21
|
genre?: SarvamAI.DocumentGenre;
|
|
24
|
-
/** Arbitrary key-value metadata attached to the job. */
|
|
25
|
-
metadata?: Record<string, unknown>;
|
|
26
|
-
/** When true (default), translation begins automatically after the document is parsed. */
|
|
27
|
-
auto_process?: boolean;
|
|
28
22
|
/** Target languages (BCP-47). */
|
|
29
23
|
target_language_codes: SarvamAI.DocumentLanguage[];
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
/**
|
|
25
|
+
* `use_native_numerals` is an optional parameter with three options:
|
|
26
|
+
*
|
|
27
|
+
* - **`null`** (default): Uses the application default.
|
|
28
|
+
* - **`false`**: Uses international numerals (0-9).
|
|
29
|
+
* - **`true`**: Uses language-specific native numerals.
|
|
30
|
+
*
|
|
31
|
+
* ### Example:
|
|
32
|
+
* - If international numerals are used, numbers appear as regular digits (0-9). For example: `मेरा phone number है: 9840950950`.
|
|
33
|
+
* - If native numerals are used, numbers appear in the target script. For example: `मेरा phone number है: ९८४०९५०९५०`.
|
|
34
|
+
*/
|
|
33
35
|
use_native_numerals?: boolean;
|
|
34
36
|
/** Global tone, terminology, and formatting instructions (up to ~4000 characters). Applies to every target language. */
|
|
35
37
|
style_guidelines?: string;
|
|
@@ -2,15 +2,19 @@ import type * as SarvamAI from "../../../../index.mjs";
|
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* lang: "hi-IN"
|
|
6
|
-
* format: "pdf"
|
|
5
|
+
* lang: "hi-IN"
|
|
7
6
|
* }
|
|
8
7
|
*/
|
|
9
8
|
export interface DocumentTranslationTriggerExportRequest {
|
|
10
9
|
/** BCP-47 target language code (e.g. `hi-IN`). */
|
|
11
10
|
lang: SarvamAI.DocumentLanguage;
|
|
12
|
-
/**
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Optional target export format. When omitted, defaults to the uploaded file's native format.
|
|
13
|
+
*
|
|
14
|
+
* - **PDF uploads:** may be set to `pdf` (default), `docx`, `html`, `txt`, or `epub`.
|
|
15
|
+
* - **Microsoft Office uploads** (`.doc`, `.docx`, `.xls`, `.xlsx`, `.ppt`, `.pptx`, and related formats): always export in the original format only; other values are rejected.
|
|
16
|
+
*/
|
|
17
|
+
format?: SarvamAI.ExportFormat;
|
|
14
18
|
/** When true, the export may reduce line spacing to fit translated text within the original layout. PDF/DOCX only. */
|
|
15
19
|
fit_line_height?: boolean;
|
|
16
20
|
/** When true, the export may reduce font size to fit translated text within the original layout. PDF/DOCX only. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Explicit export format for **PDF uploads only**. Allowed: `pdf` (default), `docx`, `html`, `txt`, or `epub`. Microsoft Office uploads always export in the original format; omit `format` or pass the native extension. */
|
|
2
2
|
export declare const ExportFormat: {
|
|
3
3
|
readonly Pdf: "pdf";
|
|
4
4
|
readonly Docx: "docx";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
/**
|
|
2
|
+
/** Explicit export format for **PDF uploads only**. Allowed: `pdf` (default), `docx`, `html`, `txt`, or `epub`. Microsoft Office uploads always export in the original format; omit `format` or pass the native extension. */
|
|
3
3
|
export const ExportFormat = {
|
|
4
4
|
Pdf: "pdf",
|
|
5
5
|
Docx: "docx",
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Model IDs
|
|
2
|
+
* Model IDs accepted by `POST /v2/chat/completions`:
|
|
3
3
|
*
|
|
4
4
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
5
5
|
* - **`glm5.2`** — open-source; 512K context, tool calling, visible reasoning.
|
|
6
6
|
* - **`gemma4`** — open-source; image input, tool calling.
|
|
7
|
+
* - **`deepseekv4-flash`** — open-source; 1M context, tool calling, reasoning.
|
|
8
|
+
*
|
|
9
|
+
* `GET /v2/models` is environment-specific and may omit IDs that completions still accept.
|
|
7
10
|
*/
|
|
8
11
|
export declare const V2ModelIds: {
|
|
9
12
|
readonly Sarvam105B: "sarvam-105b";
|
|
10
13
|
readonly Glm52: "glm5.2";
|
|
11
14
|
readonly Gemma4: "gemma4";
|
|
15
|
+
readonly Deepseekv4Flash: "deepseekv4-flash";
|
|
12
16
|
};
|
|
13
17
|
export type V2ModelIds = (typeof V2ModelIds)[keyof typeof V2ModelIds];
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
/**
|
|
3
|
-
* Model IDs
|
|
3
|
+
* Model IDs accepted by `POST /v2/chat/completions`:
|
|
4
4
|
*
|
|
5
5
|
* - **`sarvam-105b`** — Sarvam flagship chat model.
|
|
6
6
|
* - **`glm5.2`** — open-source; 512K context, tool calling, visible reasoning.
|
|
7
7
|
* - **`gemma4`** — open-source; image input, tool calling.
|
|
8
|
+
* - **`deepseekv4-flash`** — open-source; 1M context, tool calling, reasoning.
|
|
9
|
+
*
|
|
10
|
+
* `GET /v2/models` is environment-specific and may omit IDs that completions still accept.
|
|
8
11
|
*/
|
|
9
12
|
export const V2ModelIds = {
|
|
10
13
|
Sarvam105B: "sarvam-105b",
|
|
11
14
|
Glm52: "glm5.2",
|
|
12
15
|
Gemma4: "gemma4",
|
|
16
|
+
Deepseekv4Flash: "deepseekv4-flash",
|
|
13
17
|
};
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.9
|
|
1
|
+
export declare const SDK_VERSION = "1.1.9";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.1.9
|
|
1
|
+
export const SDK_VERSION = "1.1.9";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -312,7 +312,7 @@ Create a document translation job. Returns a `job_id` and a short-lived signed `
|
|
|
312
312
|
2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: <mime>`.
|
|
313
313
|
3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline.
|
|
314
314
|
4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes.
|
|
315
|
-
5. `POST /translate/document/jobs/{job_id}/export?lang=<code
|
|
315
|
+
5. `POST /translate/document/jobs/{job_id}/export?lang=<code>` to enqueue an async export for each target language (exports in the uploaded file's format by default).
|
|
316
316
|
6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
317
317
|
|
|
318
318
|
A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response.
|
|
@@ -336,8 +336,6 @@ await client.documentTranslation.create({
|
|
|
336
336
|
target_language_codes: ["hi-IN", "ta-IN"],
|
|
337
337
|
original_filename: "chapter1.pdf",
|
|
338
338
|
genre: "NON_FICTION",
|
|
339
|
-
auto_process: true,
|
|
340
|
-
model_type: "plus",
|
|
341
339
|
use_native_numerals: true
|
|
342
340
|
});
|
|
343
341
|
|
|
@@ -513,12 +511,13 @@ await client.documentTranslation.getLiveStatus("550e8400-e29b-41d4-a716-44665544
|
|
|
513
511
|
<dl>
|
|
514
512
|
<dd>
|
|
515
513
|
|
|
516
|
-
Enqueue an async export for one target language
|
|
514
|
+
Enqueue an async export for one target language.
|
|
517
515
|
|
|
518
516
|
Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.
|
|
519
517
|
|
|
520
|
-
-
|
|
521
|
-
-
|
|
518
|
+
- When `format` is omitted, the export uses the uploaded file's native format.
|
|
519
|
+
- **PDF uploads** may optionally set `format` to `pdf`, `docx`, `html`, `txt`, or `epub`.
|
|
520
|
+
- **Microsoft Office uploads** always export in the original format only (for example, xlsx in → xlsx out).
|
|
522
521
|
- Optional `fit_line_height` / `fit_font_shrink` tune PDF/DOCX shrink-to-fit.
|
|
523
522
|
- Returns `409` when an export for the same language and format is already `Pending` or `Running`.
|
|
524
523
|
</dd>
|
|
@@ -536,8 +535,7 @@ Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/documen
|
|
|
536
535
|
|
|
537
536
|
```typescript
|
|
538
537
|
await client.documentTranslation.triggerExport("550e8400-e29b-41d4-a716-446655440000", {
|
|
539
|
-
lang: "hi-IN"
|
|
540
|
-
format: "pdf"
|
|
538
|
+
lang: "hi-IN"
|
|
541
539
|
});
|
|
542
540
|
|
|
543
541
|
```
|