@docling/docling-client 0.3.0 → 2.131.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 +13 -6
- package/dist/index.cjs +26 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -4
- package/dist/index.d.ts +56 -4
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/package.json +21 -12
package/PYTHON_CLIENT_PARITY.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Python client parity
|
|
2
2
|
|
|
3
|
-
This document compares `@docling/docling-client` with Docling Python 2.
|
|
4
|
-
at commit `
|
|
3
|
+
This document compares `@docling/docling-client` with Docling Python 2.131.0
|
|
4
|
+
at commit `cb14c87`, specifically:
|
|
5
5
|
|
|
6
6
|
- `DoclingServiceClient`
|
|
7
7
|
- `AsyncDoclingServiceClient`
|
|
@@ -74,7 +74,7 @@ because async is its native execution model.
|
|
|
74
74
|
| Base64 file | Yes | No | JSON `FileSource`. |
|
|
75
75
|
| Local path | Yes, Node | No | Read lazily when normalized, then multipart or base64 depending on target. |
|
|
76
76
|
| `Blob` / `ArrayBuffer` / typed array | Yes | No | TypeScript extension for Node/browser integrations. |
|
|
77
|
-
| S3 | No | Yes | Endpoint, SSL flag, keys, bucket, prefix,
|
|
77
|
+
| S3 | No | Yes | Endpoint, SSL flag, optional region, optional keys, bucket, prefix, limit. |
|
|
78
78
|
| Azure Blob | No | Yes | Account, container, connection string, prefix, enumeration limit. |
|
|
79
79
|
| Google Cloud Storage | No | Yes | Bucket, prefix, project/ADC, optional service-account object. |
|
|
80
80
|
| Google Drive | No | Yes | Path, token/refresh token, credentials path/object. |
|
|
@@ -118,15 +118,22 @@ The explicit TypeScript option surface covers every field in Python
|
|
|
118
118
|
`ocr_custom_config`
|
|
119
119
|
- `pdf_backend`
|
|
120
120
|
- `table_mode`, `table_cell_matching`, `do_table_structure`
|
|
121
|
+
- `do_pdf_heading_hierarchy`, `pdf_heading_hierarchy_options`
|
|
122
|
+
(`HeadingHierarchyOptions` with `use_bookmarks`, `use_outline_levels`,
|
|
123
|
+
`use_style`, `max_level`)
|
|
121
124
|
- `do_code_enrichment`, `do_formula_enrichment`
|
|
122
125
|
- `do_picture_classification`, `do_picture_description`,
|
|
123
126
|
`do_chart_extraction`, `picture_description_area_threshold`
|
|
127
|
+
- `chart_extraction_preset`, `chart_extraction_custom_config`
|
|
124
128
|
- the deprecated `picture_description_local`, `picture_description_api`,
|
|
125
129
|
`vlm_pipeline_model`, `vlm_pipeline_model_local`, and
|
|
126
130
|
`vlm_pipeline_model_api`
|
|
127
|
-
- VLM, picture-description, code/formula, table-structure,
|
|
128
|
-
picture-classification preset/custom-config pairs
|
|
129
|
-
- `
|
|
131
|
+
- VLM, picture-description, code/formula, chart-extraction, table-structure,
|
|
132
|
+
layout, and picture-classification preset/custom-config pairs
|
|
133
|
+
- `chunking_options` (inline `HybridChunkingOptions | HierarchicalChunkingOptions`)
|
|
134
|
+
and `chunking_preset` for inline chunking within a convert job
|
|
135
|
+
- `document_timeout`, `abort_on_error`, Markdown page-break placeholder,
|
|
136
|
+
and `md_compact_tables`
|
|
130
137
|
|
|
131
138
|
Known enums, page ranges, primitive shapes, and nested option object boundaries
|
|
132
139
|
are checked locally. Legacy VLM/picture-description model objects and the
|
package/dist/index.cjs
CHANGED
|
@@ -201,7 +201,7 @@ var ArtifactDownloader = class {
|
|
|
201
201
|
"No fetch implementation is available for artifact downloads"
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
|
-
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
204
|
+
this.#fetch = options.fetch ?? globalThis.fetch?.bind(globalThis);
|
|
205
205
|
this.#resolver = options.resolver ?? resolveAllAddresses;
|
|
206
206
|
this.#allowPrivateUrls = options.allowPrivateUrls ?? false;
|
|
207
207
|
this.#timeoutMs = options.timeoutMs ?? 6e4;
|
|
@@ -1135,6 +1135,11 @@ function validateOptionExclusivity(options) {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
for (const [name, preset, custom] of [
|
|
1137
1137
|
["code_formula", options.code_formula_preset, options.code_formula_custom_config],
|
|
1138
|
+
[
|
|
1139
|
+
"chart_extraction",
|
|
1140
|
+
options.chart_extraction_preset,
|
|
1141
|
+
options.chart_extraction_custom_config
|
|
1142
|
+
],
|
|
1138
1143
|
["layout", options.layout_preset, options.layout_custom_config],
|
|
1139
1144
|
[
|
|
1140
1145
|
"picture_classification",
|
|
@@ -1153,6 +1158,11 @@ function validateOptionExclusivity(options) {
|
|
|
1153
1158
|
"ocr_preset and ocr_custom_config are mutually exclusive"
|
|
1154
1159
|
);
|
|
1155
1160
|
}
|
|
1161
|
+
if (options.chunking_preset !== void 0 && options.chunking_preset !== null && options.chunking_options !== void 0 && options.chunking_options !== null) {
|
|
1162
|
+
throw new DoclingProtocolError(
|
|
1163
|
+
"chunking_preset and chunking_options are mutually exclusive"
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1156
1166
|
}
|
|
1157
1167
|
function applyPageLimits(options, pageRange, maxNumPages) {
|
|
1158
1168
|
let effectiveRange = pageRange ?? options.page_range;
|
|
@@ -1452,6 +1462,7 @@ var BOOLEAN_OPTIONS = [
|
|
|
1452
1462
|
"force_ocr",
|
|
1453
1463
|
"table_cell_matching",
|
|
1454
1464
|
"do_table_structure",
|
|
1465
|
+
"do_pdf_heading_hierarchy",
|
|
1455
1466
|
"include_images",
|
|
1456
1467
|
"include_page_images",
|
|
1457
1468
|
"do_code_enrichment",
|
|
@@ -1459,7 +1470,8 @@ var BOOLEAN_OPTIONS = [
|
|
|
1459
1470
|
"do_picture_classification",
|
|
1460
1471
|
"do_chart_extraction",
|
|
1461
1472
|
"do_picture_description",
|
|
1462
|
-
"abort_on_error"
|
|
1473
|
+
"abort_on_error",
|
|
1474
|
+
"md_compact_tables"
|
|
1463
1475
|
];
|
|
1464
1476
|
var NUMBER_OPTIONS = [
|
|
1465
1477
|
"document_timeout",
|
|
@@ -1473,15 +1485,18 @@ var STRING_OPTIONS = [
|
|
|
1473
1485
|
"vlm_pipeline_preset",
|
|
1474
1486
|
"picture_description_preset",
|
|
1475
1487
|
"code_formula_preset",
|
|
1488
|
+
"chart_extraction_preset",
|
|
1476
1489
|
"table_structure_preset",
|
|
1477
1490
|
"layout_preset",
|
|
1478
|
-
"picture_classification_preset"
|
|
1491
|
+
"picture_classification_preset",
|
|
1492
|
+
"chunking_preset"
|
|
1479
1493
|
];
|
|
1480
1494
|
var RECORD_OPTIONS = [
|
|
1481
1495
|
"ocr_custom_config",
|
|
1482
1496
|
"vlm_pipeline_custom_config",
|
|
1483
1497
|
"picture_description_custom_config",
|
|
1484
1498
|
"code_formula_custom_config",
|
|
1499
|
+
"chart_extraction_custom_config",
|
|
1485
1500
|
"table_structure_custom_config",
|
|
1486
1501
|
"layout_custom_config",
|
|
1487
1502
|
"picture_classification_custom_config",
|
|
@@ -1637,15 +1652,16 @@ var FetchTransport = class {
|
|
|
1637
1652
|
#timeoutMs;
|
|
1638
1653
|
#backoffBaseMs;
|
|
1639
1654
|
#sleep;
|
|
1640
|
-
constructor(optionsOrFetch
|
|
1655
|
+
constructor(optionsOrFetch) {
|
|
1641
1656
|
const options = typeof optionsOrFetch === "function" ? { fetch: optionsOrFetch } : optionsOrFetch;
|
|
1642
|
-
const
|
|
1657
|
+
const userFetch = options?.fetch;
|
|
1658
|
+
const fetchImplementation = userFetch ?? globalThis.fetch;
|
|
1643
1659
|
if (fetchImplementation === void 0) {
|
|
1644
1660
|
throw new DoclingProtocolError(
|
|
1645
1661
|
"No fetch implementation is available; provide a DoclingTransport"
|
|
1646
1662
|
);
|
|
1647
1663
|
}
|
|
1648
|
-
this.#fetch = fetchImplementation;
|
|
1664
|
+
this.#fetch = userFetch ? fetchImplementation : fetchImplementation.bind(globalThis);
|
|
1649
1665
|
this.#retries = validateNonNegativeInteger(options?.retries ?? 3, "retries");
|
|
1650
1666
|
this.#timeoutMs = validatePositiveNumber(options?.timeoutMs ?? 6e4, "timeoutMs");
|
|
1651
1667
|
this.#backoffBaseMs = validatePositiveNumber(
|
|
@@ -3837,13 +3853,11 @@ function validateKnownConnector(value, role) {
|
|
|
3837
3853
|
return;
|
|
3838
3854
|
}
|
|
3839
3855
|
if (value.kind === "s3") {
|
|
3840
|
-
requireStringFields(
|
|
3841
|
-
fields,
|
|
3842
|
-
["endpoint", "access_key", "secret_key", "bucket", "key_prefix"],
|
|
3843
|
-
role,
|
|
3844
|
-
true
|
|
3845
|
-
);
|
|
3856
|
+
requireStringFields(fields, ["endpoint", "bucket", "key_prefix"], role, true);
|
|
3846
3857
|
validateOptionalBoolean(fields.verify_ssl, `${role} verify_ssl`);
|
|
3858
|
+
validateOptionalString2(fields.region, `${role} region`);
|
|
3859
|
+
validateOptionalString2(fields.access_key, `${role} access_key`);
|
|
3860
|
+
validateOptionalString2(fields.secret_key, `${role} secret_key`);
|
|
3847
3861
|
validatePositiveMaxElements(fields.max_num_elements, role);
|
|
3848
3862
|
return;
|
|
3849
3863
|
}
|