@docling/docling-client 2.130.0 → 2.132.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 +14 -7
- package/dist/index.cjs +65 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -7
- package/dist/index.d.ts +55 -7
- package/dist/index.js +65 -20
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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.132.0
|
|
4
|
+
at commit `5c349dd`, specifically:
|
|
5
5
|
|
|
6
6
|
- `DoclingServiceClient`
|
|
7
7
|
- `AsyncDoclingServiceClient`
|
|
@@ -81,9 +81,10 @@ because async is its native execution model.
|
|
|
81
81
|
| Generic connector | No | Yes | Forward-compatible `kind` plus connector fields. |
|
|
82
82
|
|
|
83
83
|
TypeScript mirrors Python's extension-to-input-format map, including Office
|
|
84
|
-
templates/macros, images, XML variants, `tar.gz`, audio/video, email, EPUB,
|
|
85
|
-
Box Note
|
|
86
|
-
|
|
84
|
+
templates/macros, images, XML variants, `tar.gz`, audio/video, email, EPUB,
|
|
85
|
+
Box Note, iWork (`.pages`, `.key`), EBCDIC, AFP, RTF, and MHTML. Unknown
|
|
86
|
+
extensions use the same PDF fallback. Local multipart MIME is inferred from the
|
|
87
|
+
filename when known.
|
|
87
88
|
|
|
88
89
|
## Targets and target-specific results
|
|
89
90
|
|
|
@@ -118,14 +119,20 @@ The explicit TypeScript option surface covers every field in Python
|
|
|
118
119
|
`ocr_custom_config`
|
|
119
120
|
- `pdf_backend`
|
|
120
121
|
- `table_mode`, `table_cell_matching`, `do_table_structure`
|
|
122
|
+
- `do_pdf_heading_hierarchy`, `pdf_heading_hierarchy_options`
|
|
123
|
+
(`HeadingHierarchyOptions` with `use_bookmarks`, `use_outline_levels`,
|
|
124
|
+
`use_style`, `max_level`)
|
|
121
125
|
- `do_code_enrichment`, `do_formula_enrichment`
|
|
122
126
|
- `do_picture_classification`, `do_picture_description`,
|
|
123
127
|
`do_chart_extraction`, `picture_description_area_threshold`
|
|
128
|
+
- `chart_extraction_preset`, `chart_extraction_custom_config`
|
|
124
129
|
- the deprecated `picture_description_local`, `picture_description_api`,
|
|
125
130
|
`vlm_pipeline_model`, `vlm_pipeline_model_local`, and
|
|
126
131
|
`vlm_pipeline_model_api`
|
|
127
|
-
- VLM, picture-description, code/formula, table-structure,
|
|
128
|
-
picture-classification preset/custom-config pairs
|
|
132
|
+
- VLM, picture-description, code/formula, chart-extraction, table-structure,
|
|
133
|
+
layout, and picture-classification preset/custom-config pairs
|
|
134
|
+
- `chunking_options` (inline `HybridChunkingOptions | HierarchicalChunkingOptions`)
|
|
135
|
+
and `chunking_preset` for inline chunking within a convert job
|
|
129
136
|
- `document_timeout`, `abort_on_error`, Markdown page-break placeholder,
|
|
130
137
|
and `md_compact_tables`
|
|
131
138
|
|
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;
|
|
@@ -792,6 +792,7 @@ var EXTENSION_FORMATS = {
|
|
|
792
792
|
dotm: "docx",
|
|
793
793
|
doc: "doc",
|
|
794
794
|
dot: "doc",
|
|
795
|
+
rtf: "rtf",
|
|
795
796
|
pptx: "pptx",
|
|
796
797
|
potx: "pptx",
|
|
797
798
|
ppsx: "pptx",
|
|
@@ -804,6 +805,8 @@ var EXTENSION_FORMATS = {
|
|
|
804
805
|
html: "html",
|
|
805
806
|
htm: "html",
|
|
806
807
|
xhtml: "html",
|
|
808
|
+
mhtml: "mhtml",
|
|
809
|
+
mht: "mhtml",
|
|
807
810
|
md: "md",
|
|
808
811
|
markdown: "md",
|
|
809
812
|
txt: "md",
|
|
@@ -813,6 +816,8 @@ var EXTENSION_FORMATS = {
|
|
|
813
816
|
csv: "csv",
|
|
814
817
|
xlsx: "xlsx",
|
|
815
818
|
xlsm: "xlsx",
|
|
819
|
+
xltx: "xlsx",
|
|
820
|
+
xltm: "xlsx",
|
|
816
821
|
xls: "xls",
|
|
817
822
|
xlt: "xls",
|
|
818
823
|
asciidoc: "asciidoc",
|
|
@@ -833,6 +838,7 @@ var EXTENSION_FORMATS = {
|
|
|
833
838
|
tiff: "image",
|
|
834
839
|
bmp: "image",
|
|
835
840
|
webp: "image",
|
|
841
|
+
gif: "image",
|
|
836
842
|
wav: "audio",
|
|
837
843
|
mp3: "audio",
|
|
838
844
|
m4a: "audio",
|
|
@@ -854,8 +860,14 @@ var EXTENSION_FORMATS = {
|
|
|
854
860
|
tex: "latex",
|
|
855
861
|
latex: "latex",
|
|
856
862
|
eml: "email",
|
|
863
|
+
msg: "email",
|
|
857
864
|
epub: "epub",
|
|
858
|
-
boxnote: "boxnote"
|
|
865
|
+
boxnote: "boxnote",
|
|
866
|
+
pages: "iwork_pages",
|
|
867
|
+
key: "iwork_keynote",
|
|
868
|
+
ebc: "ebcdic",
|
|
869
|
+
ebcdic: "ebcdic",
|
|
870
|
+
afp: "afp"
|
|
859
871
|
};
|
|
860
872
|
async function normalizeSourceInput(input, signal) {
|
|
861
873
|
throwIfAborted(signal);
|
|
@@ -1135,6 +1147,11 @@ function validateOptionExclusivity(options) {
|
|
|
1135
1147
|
}
|
|
1136
1148
|
for (const [name, preset, custom] of [
|
|
1137
1149
|
["code_formula", options.code_formula_preset, options.code_formula_custom_config],
|
|
1150
|
+
[
|
|
1151
|
+
"chart_extraction",
|
|
1152
|
+
options.chart_extraction_preset,
|
|
1153
|
+
options.chart_extraction_custom_config
|
|
1154
|
+
],
|
|
1138
1155
|
["layout", options.layout_preset, options.layout_custom_config],
|
|
1139
1156
|
[
|
|
1140
1157
|
"picture_classification",
|
|
@@ -1153,6 +1170,11 @@ function validateOptionExclusivity(options) {
|
|
|
1153
1170
|
"ocr_preset and ocr_custom_config are mutually exclusive"
|
|
1154
1171
|
);
|
|
1155
1172
|
}
|
|
1173
|
+
if (options.chunking_preset !== void 0 && options.chunking_preset !== null && options.chunking_options !== void 0 && options.chunking_options !== null) {
|
|
1174
|
+
throw new DoclingProtocolError(
|
|
1175
|
+
"chunking_preset and chunking_options are mutually exclusive"
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1156
1178
|
}
|
|
1157
1179
|
function applyPageLimits(options, pageRange, maxNumPages) {
|
|
1158
1180
|
let effectiveRange = pageRange ?? options.page_range;
|
|
@@ -1292,12 +1314,15 @@ function guessMimeType(filename) {
|
|
|
1292
1314
|
pdf: "application/pdf",
|
|
1293
1315
|
doc: "application/msword",
|
|
1294
1316
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1317
|
+
rtf: "application/rtf",
|
|
1295
1318
|
ppt: "application/vnd.ms-powerpoint",
|
|
1296
1319
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
1297
1320
|
xls: "application/vnd.ms-excel",
|
|
1298
1321
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1299
1322
|
html: "text/html",
|
|
1300
1323
|
htm: "text/html",
|
|
1324
|
+
mhtml: "application/x-mimearchive",
|
|
1325
|
+
mht: "application/x-mimearchive",
|
|
1301
1326
|
md: "text/markdown",
|
|
1302
1327
|
txt: "text/plain",
|
|
1303
1328
|
csv: "text/csv",
|
|
@@ -1307,44 +1332,54 @@ function guessMimeType(filename) {
|
|
|
1307
1332
|
jpeg: "image/jpeg",
|
|
1308
1333
|
tif: "image/tiff",
|
|
1309
1334
|
tiff: "image/tiff",
|
|
1335
|
+
gif: "image/gif",
|
|
1336
|
+
webp: "image/webp",
|
|
1337
|
+
bmp: "image/bmp",
|
|
1310
1338
|
wav: "audio/wav",
|
|
1311
1339
|
mp3: "audio/mpeg",
|
|
1312
1340
|
mp4: "video/mp4",
|
|
1313
1341
|
vtt: "text/vtt",
|
|
1314
1342
|
eml: "message/rfc822",
|
|
1343
|
+
msg: "application/vnd.ms-outlook",
|
|
1315
1344
|
epub: "application/epub+zip"
|
|
1316
1345
|
}[extension] ?? "application/octet-stream";
|
|
1317
1346
|
}
|
|
1318
1347
|
var INPUT_FORMATS = /* @__PURE__ */ new Set([
|
|
1319
1348
|
"docx",
|
|
1320
1349
|
"doc",
|
|
1350
|
+
"rtf",
|
|
1321
1351
|
"pptx",
|
|
1352
|
+
"ppt",
|
|
1322
1353
|
"html",
|
|
1354
|
+
"mhtml",
|
|
1323
1355
|
"image",
|
|
1324
1356
|
"pdf",
|
|
1325
1357
|
"asciidoc",
|
|
1326
1358
|
"md",
|
|
1327
1359
|
"csv",
|
|
1328
1360
|
"xlsx",
|
|
1329
|
-
"xml_uspto",
|
|
1330
|
-
"xml_jats",
|
|
1331
|
-
"json_docling",
|
|
1332
|
-
"dclx",
|
|
1333
|
-
"audio",
|
|
1334
|
-
"vtt",
|
|
1335
|
-
"xml_xbrl",
|
|
1336
|
-
"mets_gbs",
|
|
1337
|
-
"latex",
|
|
1338
|
-
"ppt",
|
|
1339
1361
|
"xls",
|
|
1340
1362
|
"odt",
|
|
1341
1363
|
"ods",
|
|
1342
1364
|
"odp",
|
|
1365
|
+
"xml_uspto",
|
|
1366
|
+
"xml_jats",
|
|
1367
|
+
"xml_xbrl",
|
|
1343
1368
|
"xml_doclang",
|
|
1369
|
+
"dclx",
|
|
1370
|
+
"mets_gbs",
|
|
1371
|
+
"json_docling",
|
|
1372
|
+
"audio",
|
|
1344
1373
|
"video",
|
|
1374
|
+
"vtt",
|
|
1375
|
+
"latex",
|
|
1345
1376
|
"email",
|
|
1346
1377
|
"epub",
|
|
1347
|
-
"boxnote"
|
|
1378
|
+
"boxnote",
|
|
1379
|
+
"iwork_pages",
|
|
1380
|
+
"iwork_keynote",
|
|
1381
|
+
"ebcdic",
|
|
1382
|
+
"afp"
|
|
1348
1383
|
]);
|
|
1349
1384
|
var OUTPUT_FORMATS = /* @__PURE__ */ new Set([
|
|
1350
1385
|
"md",
|
|
@@ -1357,15 +1392,17 @@ var OUTPUT_FORMATS = /* @__PURE__ */ new Set([
|
|
|
1357
1392
|
"vtt",
|
|
1358
1393
|
"doclang",
|
|
1359
1394
|
"dclx",
|
|
1360
|
-
"chunks"
|
|
1395
|
+
"chunks",
|
|
1396
|
+
"latex"
|
|
1361
1397
|
]);
|
|
1362
|
-
var PIPELINES = /* @__PURE__ */ new Set(["legacy", "standard", "vlm", "asr"]);
|
|
1398
|
+
var PIPELINES = /* @__PURE__ */ new Set(["legacy", "standard", "native", "vlm", "asr"]);
|
|
1363
1399
|
var IMAGE_EXPORT_MODES = /* @__PURE__ */ new Set(["placeholder", "embedded", "referenced"]);
|
|
1364
1400
|
var TABLE_MODES = /* @__PURE__ */ new Set(["fast", "accurate"]);
|
|
1365
1401
|
var PDF_BACKENDS = /* @__PURE__ */ new Set([
|
|
1366
1402
|
"pypdfium2",
|
|
1367
1403
|
"docling_parse",
|
|
1368
1404
|
"threaded_docling_parse",
|
|
1405
|
+
"_docling_parse",
|
|
1369
1406
|
"dlparse_v1",
|
|
1370
1407
|
"dlparse_v2",
|
|
1371
1408
|
"dlparse_v4"
|
|
@@ -1393,11 +1430,14 @@ var VLM_RESPONSE_FORMATS = /* @__PURE__ */ new Set([
|
|
|
1393
1430
|
"doclang",
|
|
1394
1431
|
"markdown",
|
|
1395
1432
|
"deepseekocr_markdown",
|
|
1433
|
+
"unlimited_ocr_markdown",
|
|
1396
1434
|
"html",
|
|
1397
1435
|
"otsl",
|
|
1398
1436
|
"plaintext",
|
|
1399
1437
|
"chandra_html",
|
|
1400
|
-
"dots_json"
|
|
1438
|
+
"dots_json",
|
|
1439
|
+
"nemotron_parse_v2",
|
|
1440
|
+
"mineru2"
|
|
1401
1441
|
]);
|
|
1402
1442
|
var VLM_INFERENCE_FRAMEWORKS = /* @__PURE__ */ new Set(["mlx", "transformers", "vllm"]);
|
|
1403
1443
|
var TRANSFORMERS_MODEL_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -1452,6 +1492,7 @@ var BOOLEAN_OPTIONS = [
|
|
|
1452
1492
|
"force_ocr",
|
|
1453
1493
|
"table_cell_matching",
|
|
1454
1494
|
"do_table_structure",
|
|
1495
|
+
"do_pdf_heading_hierarchy",
|
|
1455
1496
|
"include_images",
|
|
1456
1497
|
"include_page_images",
|
|
1457
1498
|
"do_code_enrichment",
|
|
@@ -1474,15 +1515,18 @@ var STRING_OPTIONS = [
|
|
|
1474
1515
|
"vlm_pipeline_preset",
|
|
1475
1516
|
"picture_description_preset",
|
|
1476
1517
|
"code_formula_preset",
|
|
1518
|
+
"chart_extraction_preset",
|
|
1477
1519
|
"table_structure_preset",
|
|
1478
1520
|
"layout_preset",
|
|
1479
|
-
"picture_classification_preset"
|
|
1521
|
+
"picture_classification_preset",
|
|
1522
|
+
"chunking_preset"
|
|
1480
1523
|
];
|
|
1481
1524
|
var RECORD_OPTIONS = [
|
|
1482
1525
|
"ocr_custom_config",
|
|
1483
1526
|
"vlm_pipeline_custom_config",
|
|
1484
1527
|
"picture_description_custom_config",
|
|
1485
1528
|
"code_formula_custom_config",
|
|
1529
|
+
"chart_extraction_custom_config",
|
|
1486
1530
|
"table_structure_custom_config",
|
|
1487
1531
|
"layout_custom_config",
|
|
1488
1532
|
"picture_classification_custom_config",
|
|
@@ -1638,15 +1682,16 @@ var FetchTransport = class {
|
|
|
1638
1682
|
#timeoutMs;
|
|
1639
1683
|
#backoffBaseMs;
|
|
1640
1684
|
#sleep;
|
|
1641
|
-
constructor(optionsOrFetch
|
|
1685
|
+
constructor(optionsOrFetch) {
|
|
1642
1686
|
const options = typeof optionsOrFetch === "function" ? { fetch: optionsOrFetch } : optionsOrFetch;
|
|
1643
|
-
const
|
|
1687
|
+
const userFetch = options?.fetch;
|
|
1688
|
+
const fetchImplementation = userFetch ?? globalThis.fetch;
|
|
1644
1689
|
if (fetchImplementation === void 0) {
|
|
1645
1690
|
throw new DoclingProtocolError(
|
|
1646
1691
|
"No fetch implementation is available; provide a DoclingTransport"
|
|
1647
1692
|
);
|
|
1648
1693
|
}
|
|
1649
|
-
this.#fetch = fetchImplementation;
|
|
1694
|
+
this.#fetch = userFetch ? fetchImplementation : fetchImplementation.bind(globalThis);
|
|
1650
1695
|
this.#retries = validateNonNegativeInteger(options?.retries ?? 3, "retries");
|
|
1651
1696
|
this.#timeoutMs = validatePositiveNumber(options?.timeoutMs ?? 6e4, "timeoutMs");
|
|
1652
1697
|
this.#backoffBaseMs = validatePositiveNumber(
|