@docling/docling-client 2.142.0 → 2.146.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 +75 -2
- package/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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.146.0
|
|
4
|
+
at commit `c622bcb`, specifically:
|
|
5
5
|
|
|
6
6
|
- `DoclingServiceClient`
|
|
7
7
|
- `AsyncDoclingServiceClient`
|
|
@@ -159,6 +159,79 @@ High-level limits match Python:
|
|
|
159
159
|
TypeScript restricts limit values to safe integers, which is stricter than
|
|
160
160
|
Python's unbounded integer type.
|
|
161
161
|
|
|
162
|
+
## Service client changes (v2.146.0)
|
|
163
|
+
|
|
164
|
+
Python v2.146.0 at commit `c622bcb` includes two service-facing fixes since
|
|
165
|
+
v2.145.0. The remaining v2.146.0 changes (VLM presets, LightOnOCR-3,
|
|
166
|
+
Nemotron parsing, and backend fixes) are server-side or core-library behavior
|
|
167
|
+
with no service-client or service-datamodel surface.
|
|
168
|
+
|
|
169
|
+
- `ArtifactRef.artifact_type` now allows `"chunks"`:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
https://github.com/docling-project/docling/blob/v2.146.0/docling/datamodel/service/responses.py#L148
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The TypeScript `ArtifactType` union includes `'chunks'` and the presigned
|
|
176
|
+
response validator accepts it. `selectDocumentArtifact()` still materializes
|
|
177
|
+
only `resource_bundle` or `json` artifacts, so a `chunks` artifact is never
|
|
178
|
+
mistaken for a document.
|
|
179
|
+
|
|
180
|
+
- The presigned-first auto-target path no longer hides the presigned rejection
|
|
181
|
+
when the `InBody` fallback is also refused. When the fallback fails with HTTP
|
|
182
|
+
400 or 422, Python raises a combined `ServiceError` that keeps the fallback
|
|
183
|
+
status and appends the presigned detail:
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
https://github.com/docling-project/docling/blob/v2.146.0/docling/service_client/client.py#L857
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
TypeScript `combineInBodyFallbackError()` mirrors this and throws a
|
|
190
|
+
`DoclingServiceError` with the fallback status and the combined `detail`
|
|
191
|
+
that appends "The client tried the InBody target because the server rejected
|
|
192
|
+
the presigned_url target: <presigned detail>" to the fallback detail. Other
|
|
193
|
+
fallback failures propagate unchanged.
|
|
194
|
+
|
|
195
|
+
| Python (v2.146.0) | TypeScript | Wire key |
|
|
196
|
+
| --------------------------- | ------------------------------ | --------------- |
|
|
197
|
+
| `ArtifactRef.artifact_type` | `ArtifactType` | `artifact_type` |
|
|
198
|
+
| `_inbody_fallback_error()` | `combineInBodyFallbackError()` | `detail` |
|
|
199
|
+
|
|
200
|
+
## Service client changes (v2.145.0)
|
|
201
|
+
|
|
202
|
+
Python v2.145.0 at commit `45d334e` includes two service-facing changes since
|
|
203
|
+
v2.142.0. Everything else in the v2.143.0–v2.145.0 range (OCR, VLM, ASR,
|
|
204
|
+
backend fixes, mixed-format ZIP inputs) is server-side or core-library
|
|
205
|
+
behavior with no service-client or service-datamodel surface.
|
|
206
|
+
|
|
207
|
+
- `ZipArchiveResult` gained an optional `filename` (v2.143.0), a suggested
|
|
208
|
+
download name for the archive:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
https://github.com/docling-project/docling/blob/v2.145.0/docling/datamodel/service/responses.py#L122
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
The TypeScript `ZipArchiveResult` interface exposes `filename?: string | null`.
|
|
215
|
+
Raw ZIP downloads already surfaced the `Content-Disposition` name through
|
|
216
|
+
`RawServiceResult.filename`.
|
|
217
|
+
|
|
218
|
+
- The service client no longer sends the default page range in request options
|
|
219
|
+
(v2.145.0). Python's `_resolve_options()` only writes `page_range` back when
|
|
220
|
+
the effective range differs from the merged options:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
https://github.com/docling-project/docling/blob/v2.145.0/docling/service_client/client.py#L454
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
TypeScript `applyPageLimits()` mirrors this: with no `page_range`, `pageRange`,
|
|
227
|
+
or `maxNumPages`, no `page_range` is sent, and an unset range is never
|
|
228
|
+
materialized as the all-pages default.
|
|
229
|
+
|
|
230
|
+
| Python (v2.145.0) | TypeScript | Wire key |
|
|
231
|
+
| ------------------------------- | --------------------------- | ------------ |
|
|
232
|
+
| `ZipArchiveResult.filename` | `ZipArchiveResult.filename` | `filename` |
|
|
233
|
+
| `_resolve_options()` page range | `applyPageLimits()` | `page_range` |
|
|
234
|
+
|
|
162
235
|
## Version bump (v2.142.0)
|
|
163
236
|
|
|
164
237
|
Python v2.142.0 at commit `6aaf87e` is a version-only bump over v2.141.0.
|
package/dist/index.cjs
CHANGED
|
@@ -1192,6 +1192,9 @@ function applyPageLimits(options, pageRange, maxNumPages) {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
if (effectiveRange !== void 0) {
|
|
1194
1194
|
validatePageRange(effectiveRange);
|
|
1195
|
+
if (options.page_range === void 0 && effectiveRange[0] === 1 && effectiveRange[1] === Number.MAX_SAFE_INTEGER) {
|
|
1196
|
+
return clone(options);
|
|
1197
|
+
}
|
|
1195
1198
|
return { ...clone(options), page_range: [...effectiveRange] };
|
|
1196
1199
|
}
|
|
1197
1200
|
return clone(options);
|
|
@@ -2934,7 +2937,9 @@ var DoclingClient = class {
|
|
|
2934
2937
|
target: { kind: "inbody" }
|
|
2935
2938
|
},
|
|
2936
2939
|
options
|
|
2937
|
-
)
|
|
2940
|
+
).catch((fallbackError) => {
|
|
2941
|
+
throw combineInBodyFallbackError(error, fallbackError);
|
|
2942
|
+
});
|
|
2938
2943
|
});
|
|
2939
2944
|
}
|
|
2940
2945
|
#submitNormalizedWithAutoTarget(source, options, requestOptions) {
|
|
@@ -2952,7 +2957,9 @@ var DoclingClient = class {
|
|
|
2952
2957
|
withJsonOutput(options),
|
|
2953
2958
|
{ kind: "inbody" },
|
|
2954
2959
|
requestOptions
|
|
2955
|
-
)
|
|
2960
|
+
).catch((fallbackError) => {
|
|
2961
|
+
throw combineInBodyFallbackError(error, fallbackError);
|
|
2962
|
+
});
|
|
2956
2963
|
});
|
|
2957
2964
|
}
|
|
2958
2965
|
async #submitRequestForTarget(request, options) {
|
|
@@ -3478,7 +3485,8 @@ function parsePresignedResponse(value) {
|
|
|
3478
3485
|
"doctags",
|
|
3479
3486
|
"doclang",
|
|
3480
3487
|
"dclx",
|
|
3481
|
-
"resource_bundle"
|
|
3488
|
+
"resource_bundle",
|
|
3489
|
+
"chunks"
|
|
3482
3490
|
].includes(String(artifact.artifact_type))) {
|
|
3483
3491
|
throw schemaMismatch(`${artifactPath}.artifact_type is unsupported`);
|
|
3484
3492
|
}
|
|
@@ -3782,6 +3790,18 @@ function shouldFallbackFromPresigned(error) {
|
|
|
3782
3790
|
"enum"
|
|
3783
3791
|
].some((phrase) => detail.includes(phrase));
|
|
3784
3792
|
}
|
|
3793
|
+
function combineInBodyFallbackError(presignedError, fallbackError) {
|
|
3794
|
+
if (!(presignedError instanceof DoclingHttpError) || !(fallbackError instanceof DoclingHttpError) || ![400, 422].includes(fallbackError.status)) {
|
|
3795
|
+
return fallbackError;
|
|
3796
|
+
}
|
|
3797
|
+
const fallbackDetail = httpDetail2(fallbackError.body);
|
|
3798
|
+
const prefix = fallbackDetail === void 0 ? "" : `${fallbackDetail} `;
|
|
3799
|
+
return new DoclingServiceError(fallbackError.message, {
|
|
3800
|
+
status: fallbackError.status,
|
|
3801
|
+
detail: `${prefix}The client tried the InBody target because the server rejected the presigned_url target: ${httpDetail2(presignedError.body)}`,
|
|
3802
|
+
cause: fallbackError
|
|
3803
|
+
});
|
|
3804
|
+
}
|
|
3785
3805
|
function targetNeedsJson(target) {
|
|
3786
3806
|
return target.kind === "inbody";
|
|
3787
3807
|
}
|