@docling/docling-client 2.145.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 +40 -2
- package/dist/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,44 @@ 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
|
+
|
|
162
200
|
## Service client changes (v2.145.0)
|
|
163
201
|
|
|
164
202
|
Python v2.145.0 at commit `45d334e` includes two service-facing changes since
|
package/dist/index.cjs
CHANGED
|
@@ -2937,7 +2937,9 @@ var DoclingClient = class {
|
|
|
2937
2937
|
target: { kind: "inbody" }
|
|
2938
2938
|
},
|
|
2939
2939
|
options
|
|
2940
|
-
)
|
|
2940
|
+
).catch((fallbackError) => {
|
|
2941
|
+
throw combineInBodyFallbackError(error, fallbackError);
|
|
2942
|
+
});
|
|
2941
2943
|
});
|
|
2942
2944
|
}
|
|
2943
2945
|
#submitNormalizedWithAutoTarget(source, options, requestOptions) {
|
|
@@ -2955,7 +2957,9 @@ var DoclingClient = class {
|
|
|
2955
2957
|
withJsonOutput(options),
|
|
2956
2958
|
{ kind: "inbody" },
|
|
2957
2959
|
requestOptions
|
|
2958
|
-
)
|
|
2960
|
+
).catch((fallbackError) => {
|
|
2961
|
+
throw combineInBodyFallbackError(error, fallbackError);
|
|
2962
|
+
});
|
|
2959
2963
|
});
|
|
2960
2964
|
}
|
|
2961
2965
|
async #submitRequestForTarget(request, options) {
|
|
@@ -3481,7 +3485,8 @@ function parsePresignedResponse(value) {
|
|
|
3481
3485
|
"doctags",
|
|
3482
3486
|
"doclang",
|
|
3483
3487
|
"dclx",
|
|
3484
|
-
"resource_bundle"
|
|
3488
|
+
"resource_bundle",
|
|
3489
|
+
"chunks"
|
|
3485
3490
|
].includes(String(artifact.artifact_type))) {
|
|
3486
3491
|
throw schemaMismatch(`${artifactPath}.artifact_type is unsupported`);
|
|
3487
3492
|
}
|
|
@@ -3785,6 +3790,18 @@ function shouldFallbackFromPresigned(error) {
|
|
|
3785
3790
|
"enum"
|
|
3786
3791
|
].some((phrase) => detail.includes(phrase));
|
|
3787
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
|
+
}
|
|
3788
3805
|
function targetNeedsJson(target) {
|
|
3789
3806
|
return target.kind === "inbody";
|
|
3790
3807
|
}
|