@docling/docling-client 0.2.0 → 2.130.0
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/PYTHON_CLIENT_PARITY.md +5 -4
- package/dist/index.cjs +31 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -13
- package/dist/index.d.ts +16 -13
- package/dist/index.js +31 -16
- package/dist/index.js.map +1 -1
- package/package.json +21 -12
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ interface DoclingDocument {
|
|
|
12
12
|
name: string;
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
}
|
|
15
|
-
type InputFormat = 'docx' | 'doc' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote';
|
|
15
|
+
type InputFormat = 'docx' | 'doc' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote' | 'ebcdic';
|
|
16
16
|
type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks';
|
|
17
17
|
type ProcessingPipeline = 'legacy' | 'standard' | 'vlm' | 'asr';
|
|
18
18
|
type TableMode = 'fast' | 'accurate';
|
|
@@ -123,6 +123,8 @@ interface ConvertDocumentsOptions {
|
|
|
123
123
|
layout_custom_config?: Record<string, unknown> | string | null;
|
|
124
124
|
picture_classification_preset?: string | null;
|
|
125
125
|
picture_classification_custom_config?: Record<string, unknown> | string | null;
|
|
126
|
+
/** Use compact table format without column padding in markdown output. */
|
|
127
|
+
md_compact_tables?: boolean;
|
|
126
128
|
abort_on_error?: boolean;
|
|
127
129
|
document_timeout?: number | null;
|
|
128
130
|
}
|
|
@@ -153,8 +155,10 @@ interface PutTarget {
|
|
|
153
155
|
interface S3Coordinates {
|
|
154
156
|
endpoint: string;
|
|
155
157
|
verify_ssl?: boolean;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
/** AWS region of the S3 bucket, e.g. 'us-east-2'. Required for correctly signed presigned URLs against real AWS S3 buckets. */
|
|
159
|
+
region?: string | null;
|
|
160
|
+
access_key?: string | null;
|
|
161
|
+
secret_key?: string | null;
|
|
158
162
|
bucket: string;
|
|
159
163
|
key_prefix?: string;
|
|
160
164
|
max_num_elements?: number | null;
|
|
@@ -225,18 +229,16 @@ interface GoogleDriveSource extends GoogleDriveCoordinates {
|
|
|
225
229
|
interface GoogleDriveTarget extends GoogleDriveCoordinates {
|
|
226
230
|
kind: 'google_drive';
|
|
227
231
|
}
|
|
228
|
-
|
|
232
|
+
type GenericSource = {
|
|
229
233
|
kind: string;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
interface GenericTarget {
|
|
234
|
+
} & Record<string, unknown>;
|
|
235
|
+
type GenericTarget = {
|
|
233
236
|
kind: string;
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
237
|
-
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
237
|
+
} & Record<string, unknown>;
|
|
238
238
|
type BatchSource = HttpSource | S3Source | AzureBlobSource | GoogleCloudStorageSource | GoogleDriveSource | GenericSource;
|
|
239
239
|
type BatchTarget = PresignedUrlTarget | StorageTarget | GenericTarget;
|
|
240
|
+
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
241
|
+
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
240
242
|
interface CallbackSpec {
|
|
241
243
|
url: string;
|
|
242
244
|
headers?: Record<string, string>;
|
|
@@ -252,7 +254,8 @@ interface ConvertSourcesRequest<TTarget extends SubmitTarget = SubmitTarget> {
|
|
|
252
254
|
interface BatchConvertSourcesRequest<TTarget extends BatchTarget = BatchTarget> {
|
|
253
255
|
options?: ConvertDocumentsOptions;
|
|
254
256
|
sources: BatchSource[];
|
|
255
|
-
target
|
|
257
|
+
target?: TTarget;
|
|
258
|
+
targets?: TTarget[];
|
|
256
259
|
callbacks?: CallbackSpec[];
|
|
257
260
|
}
|
|
258
261
|
type ChunkerKind = 'hybrid' | 'hierarchical';
|
|
@@ -359,7 +362,7 @@ interface ExportResult<TDocument = DoclingDocument> {
|
|
|
359
362
|
timings: Record<string, ProfilingItem>;
|
|
360
363
|
confidence?: ConfidenceScores | null;
|
|
361
364
|
}
|
|
362
|
-
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'resource_bundle';
|
|
365
|
+
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
|
|
363
366
|
interface ArtifactRef {
|
|
364
367
|
artifact_type: ArtifactType;
|
|
365
368
|
mime_type: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface DoclingDocument {
|
|
|
12
12
|
name: string;
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
}
|
|
15
|
-
type InputFormat = 'docx' | 'doc' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote';
|
|
15
|
+
type InputFormat = 'docx' | 'doc' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote' | 'ebcdic';
|
|
16
16
|
type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks';
|
|
17
17
|
type ProcessingPipeline = 'legacy' | 'standard' | 'vlm' | 'asr';
|
|
18
18
|
type TableMode = 'fast' | 'accurate';
|
|
@@ -123,6 +123,8 @@ interface ConvertDocumentsOptions {
|
|
|
123
123
|
layout_custom_config?: Record<string, unknown> | string | null;
|
|
124
124
|
picture_classification_preset?: string | null;
|
|
125
125
|
picture_classification_custom_config?: Record<string, unknown> | string | null;
|
|
126
|
+
/** Use compact table format without column padding in markdown output. */
|
|
127
|
+
md_compact_tables?: boolean;
|
|
126
128
|
abort_on_error?: boolean;
|
|
127
129
|
document_timeout?: number | null;
|
|
128
130
|
}
|
|
@@ -153,8 +155,10 @@ interface PutTarget {
|
|
|
153
155
|
interface S3Coordinates {
|
|
154
156
|
endpoint: string;
|
|
155
157
|
verify_ssl?: boolean;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
/** AWS region of the S3 bucket, e.g. 'us-east-2'. Required for correctly signed presigned URLs against real AWS S3 buckets. */
|
|
159
|
+
region?: string | null;
|
|
160
|
+
access_key?: string | null;
|
|
161
|
+
secret_key?: string | null;
|
|
158
162
|
bucket: string;
|
|
159
163
|
key_prefix?: string;
|
|
160
164
|
max_num_elements?: number | null;
|
|
@@ -225,18 +229,16 @@ interface GoogleDriveSource extends GoogleDriveCoordinates {
|
|
|
225
229
|
interface GoogleDriveTarget extends GoogleDriveCoordinates {
|
|
226
230
|
kind: 'google_drive';
|
|
227
231
|
}
|
|
228
|
-
|
|
232
|
+
type GenericSource = {
|
|
229
233
|
kind: string;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
interface GenericTarget {
|
|
234
|
+
} & Record<string, unknown>;
|
|
235
|
+
type GenericTarget = {
|
|
233
236
|
kind: string;
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
237
|
-
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
237
|
+
} & Record<string, unknown>;
|
|
238
238
|
type BatchSource = HttpSource | S3Source | AzureBlobSource | GoogleCloudStorageSource | GoogleDriveSource | GenericSource;
|
|
239
239
|
type BatchTarget = PresignedUrlTarget | StorageTarget | GenericTarget;
|
|
240
|
+
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
241
|
+
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
240
242
|
interface CallbackSpec {
|
|
241
243
|
url: string;
|
|
242
244
|
headers?: Record<string, string>;
|
|
@@ -252,7 +254,8 @@ interface ConvertSourcesRequest<TTarget extends SubmitTarget = SubmitTarget> {
|
|
|
252
254
|
interface BatchConvertSourcesRequest<TTarget extends BatchTarget = BatchTarget> {
|
|
253
255
|
options?: ConvertDocumentsOptions;
|
|
254
256
|
sources: BatchSource[];
|
|
255
|
-
target
|
|
257
|
+
target?: TTarget;
|
|
258
|
+
targets?: TTarget[];
|
|
256
259
|
callbacks?: CallbackSpec[];
|
|
257
260
|
}
|
|
258
261
|
type ChunkerKind = 'hybrid' | 'hierarchical';
|
|
@@ -359,7 +362,7 @@ interface ExportResult<TDocument = DoclingDocument> {
|
|
|
359
362
|
timings: Record<string, ProfilingItem>;
|
|
360
363
|
confidence?: ConfidenceScores | null;
|
|
361
364
|
}
|
|
362
|
-
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'resource_bundle';
|
|
365
|
+
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
|
|
363
366
|
interface ArtifactRef {
|
|
364
367
|
artifact_type: ArtifactType;
|
|
365
368
|
mime_type: string;
|
package/dist/index.js
CHANGED
|
@@ -1389,7 +1389,8 @@ var BOOLEAN_OPTIONS = [
|
|
|
1389
1389
|
"do_picture_classification",
|
|
1390
1390
|
"do_chart_extraction",
|
|
1391
1391
|
"do_picture_description",
|
|
1392
|
-
"abort_on_error"
|
|
1392
|
+
"abort_on_error",
|
|
1393
|
+
"md_compact_tables"
|
|
1393
1394
|
];
|
|
1394
1395
|
var NUMBER_OPTIONS = [
|
|
1395
1396
|
"document_timeout",
|
|
@@ -2397,7 +2398,8 @@ var DoclingClient = class {
|
|
|
2397
2398
|
const payload = {
|
|
2398
2399
|
options: convertOptions,
|
|
2399
2400
|
sources: structuredClone(request.sources),
|
|
2400
|
-
target: structuredClone(request.target),
|
|
2401
|
+
...request.target !== void 0 ? { target: structuredClone(request.target) } : {},
|
|
2402
|
+
...request.targets !== void 0 ? { targets: structuredClone(request.targets) } : {},
|
|
2401
2403
|
callbacks: structuredClone(request.callbacks ?? [])
|
|
2402
2404
|
};
|
|
2403
2405
|
throwIfAborted2(options.signal);
|
|
@@ -2408,7 +2410,8 @@ var DoclingClient = class {
|
|
|
2408
2410
|
signal: options.signal
|
|
2409
2411
|
})
|
|
2410
2412
|
);
|
|
2411
|
-
const
|
|
2413
|
+
const effectiveTargetList = request.targets?.length ? request.targets : request.target !== void 0 ? [request.target] : [];
|
|
2414
|
+
const loader = effectiveTargetList.some(isStorageTarget) ? (taskId, lastStatus, signal) => this.#fetchCountsResult(taskId, lastStatus, signal) : (taskId, lastStatus, signal) => this.#fetchPresignedResult(taskId, lastStatus, signal);
|
|
2412
2415
|
return new DoclingJob(
|
|
2413
2416
|
this,
|
|
2414
2417
|
status,
|
|
@@ -3333,6 +3336,7 @@ function parsePresignedResponse(value) {
|
|
|
3333
3336
|
"text",
|
|
3334
3337
|
"doctags",
|
|
3335
3338
|
"doclang",
|
|
3339
|
+
"dclx",
|
|
3336
3340
|
"resource_bundle"
|
|
3337
3341
|
].includes(String(artifact.artifact_type))) {
|
|
3338
3342
|
throw schemaMismatch(`${artifactPath}.artifact_type is unsupported`);
|
|
@@ -3629,8 +3633,8 @@ function shouldFallbackFromPresigned(error) {
|
|
|
3629
3633
|
function targetNeedsJson(target) {
|
|
3630
3634
|
return target.kind === "inbody";
|
|
3631
3635
|
}
|
|
3632
|
-
function
|
|
3633
|
-
return target.kind
|
|
3636
|
+
function isStorageTarget(target) {
|
|
3637
|
+
return target.kind !== "presigned_url";
|
|
3634
3638
|
}
|
|
3635
3639
|
function validateBatchRequest(request) {
|
|
3636
3640
|
if (!Array.isArray(request.sources) || request.sources.length === 0) {
|
|
@@ -3645,15 +3649,28 @@ function validateBatchRequest(request) {
|
|
|
3645
3649
|
}
|
|
3646
3650
|
validateKnownConnector(source, "source");
|
|
3647
3651
|
}
|
|
3648
|
-
if (
|
|
3649
|
-
throw new DoclingProtocolError(
|
|
3652
|
+
if (request.target === void 0 && (request.targets === void 0 || request.targets.length === 0)) {
|
|
3653
|
+
throw new DoclingProtocolError(
|
|
3654
|
+
"Batch conversion requires either 'target' or 'targets'"
|
|
3655
|
+
);
|
|
3650
3656
|
}
|
|
3651
|
-
if (
|
|
3657
|
+
if (request.target !== void 0 && request.targets !== void 0 && request.targets.length > 0) {
|
|
3652
3658
|
throw new DoclingProtocolError(
|
|
3653
|
-
|
|
3659
|
+
"Batch conversion received both 'target' and 'targets'; supply only one"
|
|
3654
3660
|
);
|
|
3655
3661
|
}
|
|
3656
|
-
|
|
3662
|
+
const effectiveTargets = request.targets && request.targets.length > 0 ? request.targets : request.target !== void 0 ? [request.target] : [];
|
|
3663
|
+
for (const target of effectiveTargets) {
|
|
3664
|
+
if (!isRecord4(target) || typeof target.kind !== "string" || target.kind === "") {
|
|
3665
|
+
throw new DoclingProtocolError("Batch target kind must not be empty");
|
|
3666
|
+
}
|
|
3667
|
+
if (["inbody", "zip", "put"].includes(target.kind)) {
|
|
3668
|
+
throw new DoclingProtocolError(
|
|
3669
|
+
`Batch conversion does not accept ${target.kind} targets`
|
|
3670
|
+
);
|
|
3671
|
+
}
|
|
3672
|
+
validateKnownConnector(target, "target");
|
|
3673
|
+
}
|
|
3657
3674
|
validateCallbacks(request.callbacks);
|
|
3658
3675
|
}
|
|
3659
3676
|
function validateChunkRequestOptions(request) {
|
|
@@ -3751,13 +3768,11 @@ function validateKnownConnector(value, role) {
|
|
|
3751
3768
|
return;
|
|
3752
3769
|
}
|
|
3753
3770
|
if (value.kind === "s3") {
|
|
3754
|
-
requireStringFields(
|
|
3755
|
-
fields,
|
|
3756
|
-
["endpoint", "access_key", "secret_key", "bucket", "key_prefix"],
|
|
3757
|
-
role,
|
|
3758
|
-
true
|
|
3759
|
-
);
|
|
3771
|
+
requireStringFields(fields, ["endpoint", "bucket", "key_prefix"], role, true);
|
|
3760
3772
|
validateOptionalBoolean(fields.verify_ssl, `${role} verify_ssl`);
|
|
3773
|
+
validateOptionalString2(fields.region, `${role} region`);
|
|
3774
|
+
validateOptionalString2(fields.access_key, `${role} access_key`);
|
|
3775
|
+
validateOptionalString2(fields.secret_key, `${role} secret_key`);
|
|
3761
3776
|
validatePositiveMaxElements(fields.max_num_elements, role);
|
|
3762
3777
|
return;
|
|
3763
3778
|
}
|