@docling/docling-client 2.151.1 → 2.153.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.
@@ -1,7 +1,7 @@
1
1
  # Python client parity
2
2
 
3
- This document compares `@docling/docling-client` with Docling Python 2.151.1
4
- at commit `56d39ff`, specifically:
3
+ This document compares `@docling/docling-client` with Docling Python 2.153.0
4
+ at commit `33f33aa`, specifically:
5
5
 
6
6
  - `DoclingServiceClient`
7
7
  - `AsyncDoclingServiceClient`
@@ -19,6 +19,7 @@ additional TypeScript capabilities are documented after the parity tables.
19
19
  | ----------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
20
20
  | Service URL | `baseUrl` | Both normalize trailing slashes and reject `/v1`, query, and fragment components. |
21
21
  | API key | `apiKey` | HTTP uses `X-Api-Key`; WebSocket uses the query parameter and also the header in Node. |
22
+ | Document-version header | `acceptDocumentVersion` | Python always sends `Accept-Docling-Document-Version`; TypeScript sends it on HTTP requests when configured. |
22
23
  | Default conversion options | `options` | Deep-copied at construction; per-call merge is shallow. |
23
24
  | Status watcher | `statusWatcher` | `websocket` default or `polling`. |
24
25
  | WebSocket polling fallback | `webSocketFallbackToPoll` | Enabled by default. |
@@ -160,6 +161,62 @@ High-level limits match Python:
160
161
  TypeScript restricts limit values to safe integers, which is stricter than
161
162
  Python's unbounded integer type.
162
163
 
164
+ ## Service client changes (v2.153.0)
165
+
166
+ Python v2.153.0 at commit `33f33aa` adds one service-client behavior. The
167
+ service datamodels (`options.py`, `requests.py`, `responses.py`, `sources.py`,
168
+ `targets.py`, `callbacks.py`, `chunking.py`, `tasks.py`) and the watcher,
169
+ scheduler, job, and exception modules were re-checked field by field and
170
+ already match the TypeScript contracts, so no other TypeScript type or option
171
+ changed.
172
+
173
+ - Both `DoclingServiceClient` and `AsyncDoclingServiceClient` now stamp an
174
+ `Accept-Docling-Document-Version` header on every HTTP request. Its value is
175
+ the newest DoclingDocument schema version (`CURRENT_VERSION`) the installed
176
+ docling-core can read, so the service can down-project newer documents. The
177
+ WebSocket status stream does not carry the header.
178
+ - TypeScript keeps the remote client schema-neutral and does not depend on
179
+ `@docling/docling-core`, so it cannot know which schema version the
180
+ application reads. The header is therefore opt-in through
181
+ `acceptDocumentVersion`; pass `CURRENT_VERSION` from
182
+ `@docling/docling-core` to match Python. The dedicated option overrides a
183
+ same-named entry in `headers`, mirrors Python's client-level (not per-call)
184
+ placement, and rejects empty or non-visible-ASCII values. Artifact downloads
185
+ never receive it, like `X-Api-Key`.
186
+
187
+ | Python change (v2.153.0) | TypeScript | Wire key | Notes |
188
+ | ----------------------------------------------- | -------------------------------------------- | --------------------------------- | ------------------------------------------------------------ |
189
+ | Client stamps `Accept-Docling-Document-Version` | `DoclingClientOptions.acceptDocumentVersion` | `Accept-Docling-Document-Version` | Opt-in; client-level header on every HTTP request. |
190
+ | Header name used by both sync and async clients | `ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER` | `Accept-Docling-Document-Version` | Exported constant; stored lowercase like other HTTP headers. |
191
+
192
+ References:
193
+
194
+ ```
195
+ https://github.com/docling-project/docling/blob/v2.153.0/docling/service_client/client.py#L969
196
+ https://github.com/docling-project/docling/blob/v2.153.0/docling/service_client/_async_client.py#L155
197
+ ```
198
+
199
+ ## Service client changes (v2.152.0)
200
+
201
+ Python v2.152.0 at commit `311b683` introduces options for customizing heading numbering and changes the default pipeline behavior on the wire.
202
+
203
+ - In `ConvertDocumentsOptions`, `pipeline` is now an optional `ProcessingPipeline` and defaults to `None`/`null` on the wire. This allows the server to select its configured default pipeline (normally `standard` unless overridden by an administrator) rather than forcing `standard` from the client.
204
+ - In `HeadingHierarchyOptions` (nested fine-tuning under `pdf_heading_hierarchy_options`), two new options have been introduced: `numbering_keywords` (a mapping of numeral scheme families to non-English keyword arrays) and `numbering_number_words` (extra number words for enumerators).
205
+
206
+ | Python change (v2.152.0) | TypeScript | Option/Wire key | Notes |
207
+ | ------------------------------------------------ | ------------------------------------------------------- | ------------------------ | ----------------------------------------------------------------- |
208
+ | `ConvertDocumentsOptions.pipeline` is optional | `pipeline?: ProcessingPipeline \| null` | `pipeline` | Defaults to `null` so the server can choose its default pipeline. |
209
+ | `HeadingHierarchyOptions.numbering_keywords` | `numbering_keywords?: Record<string, string[]> \| null` | `numbering_keywords` | Mapping for non-English numbering keyword families. |
210
+ | `HeadingHierarchyOptions.numbering_number_words` | `numbering_number_words?: string[] \| null` | `numbering_number_words` | Extra number words for matching enumerators. |
211
+
212
+ References:
213
+
214
+ ```
215
+ https://github.com/docling-project/docling/blob/v2.152.0/docling/datamodel/service/options.py#L459
216
+ https://github.com/docling-project/docling/blob/v2.152.0/docling/datamodel/pipeline_options.py#L2201
217
+ https://github.com/docling-project/docling/blob/v2.152.0/docling/datamodel/pipeline_options.py#L2219
218
+ ```
219
+
163
220
  ## Service client changes (v2.151.1)
164
221
 
165
222
  Python v2.151.1 at commit `56d39ff` (including v2.151.0 and v2.150.1) changes
package/README.md CHANGED
@@ -44,7 +44,9 @@ const client = new DoclingClient({
44
44
 
45
45
  The base URL is the service root, without `/v1`, a query, or a fragment.
46
46
  `X-Api-Key` is sent when `apiKey` is set. Per-call service headers override
47
- constructor headers.
47
+ constructor headers. Set `acceptDocumentVersion` (for example to `CURRENT_VERSION`
48
+ from `@docling/docling-core`) to send `Accept-Docling-Document-Version` so the
49
+ service can down-project documents to a schema your application reads.
48
50
 
49
51
  ## Convert
50
52
 
package/dist/index.cjs CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER: () => ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER,
33
34
  ArtifactDownloader: () => ArtifactDownloader,
34
35
  ChunkerKind: () => ChunkerKind,
35
36
  ChunkerType: () => ChunkerType,
@@ -2182,7 +2183,7 @@ var JSON_STRING_CONFIG_OPTIONS = [
2182
2183
  "chart_extraction_custom_config"
2183
2184
  ];
2184
2185
  function validateStringEnum(value, allowed, name) {
2185
- if (value !== void 0 && !allowed.has(value)) {
2186
+ if (value !== void 0 && value !== null && !allowed.has(value)) {
2186
2187
  throw new DoclingProtocolError(`${name} contains an unsupported value`);
2187
2188
  }
2188
2189
  }
@@ -2996,6 +2997,7 @@ function isRecord3(value) {
2996
2997
  var DEFAULT_JOB_TIMEOUT_MS = 3e5;
2997
2998
  var DEFAULT_MAX_CONCURRENCY = 8;
2998
2999
  var MAX_CONCURRENCY_LIMIT = 512;
3000
+ var ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER = "Accept-Docling-Document-Version";
2999
3001
  var DoclingClient = class {
3000
3002
  #baseUrl;
3001
3003
  #apiKey;
@@ -3018,6 +3020,9 @@ var DoclingClient = class {
3018
3020
  this.#headers = {
3019
3021
  accept: "application/json",
3020
3022
  ...normalizeHeaders(options.headers),
3023
+ ...options.acceptDocumentVersion === void 0 ? {} : {
3024
+ [ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER.toLowerCase()]: validateDocumentVersion(options.acceptDocumentVersion)
3025
+ },
3021
3026
  ...this.#apiKey === "" ? {} : { "x-api-key": this.#apiKey }
3022
3027
  };
3023
3028
  if (options.transport !== void 0 && (options.fetch !== void 0 || options.httpRetries !== void 0 || options.httpTimeoutMs !== void 0 || options.httpBackoffBaseMs !== void 0)) {
@@ -4839,6 +4844,14 @@ function normalizeHeaders(headers) {
4839
4844
  Object.entries(headers ?? {}).map(([name, value]) => [name.toLowerCase(), value])
4840
4845
  );
4841
4846
  }
4847
+ function validateDocumentVersion(value) {
4848
+ if (typeof value !== "string" || !/^[!-~]+$/.test(value)) {
4849
+ throw new DoclingProtocolError(
4850
+ "acceptDocumentVersion must be a non-empty visible ASCII string"
4851
+ );
4852
+ }
4853
+ return value;
4854
+ }
4842
4855
  function positiveNumber(value, name) {
4843
4856
  if (!Number.isFinite(value) || value <= 0) {
4844
4857
  throw new DoclingProtocolError(`${name} must be a positive number`);
@@ -4905,6 +4918,7 @@ function isRecord4(value) {
4905
4918
  }
4906
4919
  // Annotate the CommonJS export names for ESM import in node:
4907
4920
  0 && (module.exports = {
4921
+ ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER,
4908
4922
  ArtifactDownloader,
4909
4923
  ChunkerKind,
4910
4924
  ChunkerType,