@docling/docling-client 0.1.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 +360 -0
- package/README.md +367 -0
- package/dist/index.cjs +4162 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +865 -0
- package/dist/index.d.ts +865 -0
- package/dist/index.js +4091 -0
- package/dist/index.js.map +1 -0
- package/package.json +76 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,865 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version-neutral Docling JSON boundary used by the service client.
|
|
3
|
+
*
|
|
4
|
+
* Supply `DoclingClient<import('@docling/docling-core').DoclingDocument>` when
|
|
5
|
+
* an application wants the exact schema version from docling-core. Keeping the
|
|
6
|
+
* remote client generic prevents its release cadence from pinning a document
|
|
7
|
+
* schema version.
|
|
8
|
+
*/
|
|
9
|
+
interface DoclingDocument {
|
|
10
|
+
schema_name?: 'DoclingDocument';
|
|
11
|
+
version?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
type InputFormat = 'docx' | 'doc' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote';
|
|
16
|
+
type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks';
|
|
17
|
+
type ProcessingPipeline = 'legacy' | 'standard' | 'vlm' | 'asr';
|
|
18
|
+
type TableMode = 'fast' | 'accurate';
|
|
19
|
+
type ImageExportMode = 'placeholder' | 'embedded' | 'referenced';
|
|
20
|
+
type PdfBackend = 'pypdfium2' | 'docling_parse' | 'threaded_docling_parse' | 'dlparse_v1' | 'dlparse_v2' | 'dlparse_v4';
|
|
21
|
+
type VlmResponseFormat = 'doctags' | 'doclang' | 'markdown' | 'deepseekocr_markdown' | 'html' | 'otsl' | 'plaintext' | 'chandra_html' | 'dots_json';
|
|
22
|
+
type VlmInferenceFramework = 'mlx' | 'transformers' | 'vllm';
|
|
23
|
+
type TransformersModelType = 'automodel' | 'automodel-causallm' | 'automodel-imagetexttotext';
|
|
24
|
+
type LegacyVlmModelType = 'smoldocling' | 'smoldocling_vllm' | 'granite_vision' | 'granite_vision_vllm' | 'granite_vision_ollama' | 'got_ocr_2' | 'granite_docling' | 'granite_docling_vllm' | 'nanonets_ocr2' | 'nanonets_ocr2_vllm' | 'nanonets_ocr2_lmstudio' | 'glm_ocr' | 'glm_ocr_vllm' | 'lightonocr' | 'lightonocr_vllm' | 'deepseekocr_ollama';
|
|
25
|
+
type PictureClassificationLabel = 'bar_chart' | 'box_plot' | 'flow_chart' | 'line_chart' | 'pie_chart' | 'scatter_plot' | 'table' | 'other_chart' | 'full_page_image' | 'page_thumbnail' | 'photograph' | 'chemistry_structure' | 'bar_code' | 'icon' | 'logo' | 'qr_code' | 'signature' | 'stamp' | 'engineering_drawing' | 'screenshot_from_computer' | 'screenshot_from_manual' | 'geographical_map' | 'topographical_map' | 'calendar' | 'crossword_puzzle' | 'music' | 'other' | 'cad_drawing' | 'electrical_diagram' | 'map' | 'heatmap' | 'chemistry_markush_structure' | 'chemistry_molecular_structure' | 'natural_image' | 'picture_group' | 'remote_sensing' | 'scatter_chart' | 'screenshot' | 'stacked_bar_chart' | 'stratigraphic_chart';
|
|
26
|
+
/** @deprecated Prefer picture_description_preset or picture_description_custom_config. */
|
|
27
|
+
interface PictureDescriptionLocal {
|
|
28
|
+
repo_id: string;
|
|
29
|
+
prompt?: string;
|
|
30
|
+
generation_config?: Record<string, unknown>;
|
|
31
|
+
classification_allow?: PictureClassificationLabel[] | null;
|
|
32
|
+
classification_deny?: PictureClassificationLabel[] | null;
|
|
33
|
+
classification_min_confidence?: number;
|
|
34
|
+
}
|
|
35
|
+
/** @deprecated Prefer picture_description_preset or picture_description_custom_config. */
|
|
36
|
+
interface PictureDescriptionApi {
|
|
37
|
+
url: string;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
params?: Record<string, unknown>;
|
|
40
|
+
timeout?: number;
|
|
41
|
+
concurrency?: number;
|
|
42
|
+
prompt?: string;
|
|
43
|
+
classification_allow?: PictureClassificationLabel[] | null;
|
|
44
|
+
classification_deny?: PictureClassificationLabel[] | null;
|
|
45
|
+
classification_min_confidence?: number;
|
|
46
|
+
}
|
|
47
|
+
/** @deprecated Prefer vlm_pipeline_preset or vlm_pipeline_custom_config. */
|
|
48
|
+
interface VlmModelLocal {
|
|
49
|
+
repo_id: string;
|
|
50
|
+
prompt?: string;
|
|
51
|
+
scale?: number;
|
|
52
|
+
response_format: VlmResponseFormat;
|
|
53
|
+
inference_framework: VlmInferenceFramework;
|
|
54
|
+
transformers_model_type?: TransformersModelType;
|
|
55
|
+
extra_generation_config?: Record<string, unknown>;
|
|
56
|
+
temperature?: number;
|
|
57
|
+
}
|
|
58
|
+
/** @deprecated Prefer vlm_pipeline_preset or vlm_pipeline_custom_config. */
|
|
59
|
+
interface VlmModelApi {
|
|
60
|
+
url: string;
|
|
61
|
+
headers?: Record<string, string>;
|
|
62
|
+
params?: Record<string, unknown>;
|
|
63
|
+
timeout?: number;
|
|
64
|
+
concurrency?: number;
|
|
65
|
+
prompt?: string;
|
|
66
|
+
scale?: number;
|
|
67
|
+
response_format: VlmResponseFormat;
|
|
68
|
+
temperature?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Common Docling Serve conversion controls.
|
|
72
|
+
*
|
|
73
|
+
* The string index preserves forward compatibility with options added by the
|
|
74
|
+
* selected service. Its live OpenAPI document remains authoritative.
|
|
75
|
+
*/
|
|
76
|
+
interface ConvertDocumentsOptions {
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
from_formats?: InputFormat[];
|
|
79
|
+
to_formats?: OutputFormat[];
|
|
80
|
+
pipeline?: ProcessingPipeline;
|
|
81
|
+
page_range?: [number, number];
|
|
82
|
+
do_ocr?: boolean;
|
|
83
|
+
force_ocr?: boolean;
|
|
84
|
+
/** @deprecated Use ocr_preset instead. */
|
|
85
|
+
ocr_engine?: string;
|
|
86
|
+
ocr_preset?: string;
|
|
87
|
+
ocr_lang?: string[] | null;
|
|
88
|
+
ocr_custom_config?: Record<string, unknown> | string | null;
|
|
89
|
+
pdf_backend?: PdfBackend;
|
|
90
|
+
table_mode?: TableMode;
|
|
91
|
+
table_cell_matching?: boolean;
|
|
92
|
+
do_table_structure?: boolean;
|
|
93
|
+
image_export_mode?: ImageExportMode;
|
|
94
|
+
images_scale?: number;
|
|
95
|
+
include_images?: boolean;
|
|
96
|
+
include_page_images?: boolean;
|
|
97
|
+
md_page_break_placeholder?: string;
|
|
98
|
+
do_code_enrichment?: boolean;
|
|
99
|
+
do_formula_enrichment?: boolean;
|
|
100
|
+
do_picture_classification?: boolean;
|
|
101
|
+
do_picture_description?: boolean;
|
|
102
|
+
do_chart_extraction?: boolean;
|
|
103
|
+
picture_description_area_threshold?: number;
|
|
104
|
+
/** @deprecated Prefer picture_description_preset or picture_description_custom_config. */
|
|
105
|
+
picture_description_local?: PictureDescriptionLocal | null;
|
|
106
|
+
/** @deprecated Prefer picture_description_preset or picture_description_custom_config. */
|
|
107
|
+
picture_description_api?: PictureDescriptionApi | null;
|
|
108
|
+
/** @deprecated Prefer vlm_pipeline_preset or vlm_pipeline_custom_config. */
|
|
109
|
+
vlm_pipeline_model?: LegacyVlmModelType | null;
|
|
110
|
+
/** @deprecated Prefer vlm_pipeline_preset or vlm_pipeline_custom_config. */
|
|
111
|
+
vlm_pipeline_model_local?: VlmModelLocal | null;
|
|
112
|
+
/** @deprecated Prefer vlm_pipeline_preset or vlm_pipeline_custom_config. */
|
|
113
|
+
vlm_pipeline_model_api?: VlmModelApi | null;
|
|
114
|
+
vlm_pipeline_preset?: string | null;
|
|
115
|
+
vlm_pipeline_custom_config?: Record<string, unknown> | null;
|
|
116
|
+
picture_description_preset?: string | null;
|
|
117
|
+
picture_description_custom_config?: Record<string, unknown> | null;
|
|
118
|
+
code_formula_preset?: string | null;
|
|
119
|
+
code_formula_custom_config?: Record<string, unknown> | null;
|
|
120
|
+
table_structure_preset?: string | null;
|
|
121
|
+
table_structure_custom_config?: Record<string, unknown> | string | null;
|
|
122
|
+
layout_preset?: string | null;
|
|
123
|
+
layout_custom_config?: Record<string, unknown> | string | null;
|
|
124
|
+
picture_classification_preset?: string | null;
|
|
125
|
+
picture_classification_custom_config?: Record<string, unknown> | string | null;
|
|
126
|
+
abort_on_error?: boolean;
|
|
127
|
+
document_timeout?: number | null;
|
|
128
|
+
}
|
|
129
|
+
interface HttpSource {
|
|
130
|
+
kind: 'http';
|
|
131
|
+
url: string;
|
|
132
|
+
headers?: Record<string, unknown>;
|
|
133
|
+
}
|
|
134
|
+
interface FileSource {
|
|
135
|
+
kind: 'file';
|
|
136
|
+
base64_string: string;
|
|
137
|
+
filename: string;
|
|
138
|
+
}
|
|
139
|
+
type ConversionSource = HttpSource | FileSource;
|
|
140
|
+
interface InBodyTarget {
|
|
141
|
+
kind: 'inbody';
|
|
142
|
+
}
|
|
143
|
+
interface ZipTarget {
|
|
144
|
+
kind: 'zip';
|
|
145
|
+
}
|
|
146
|
+
interface PresignedUrlTarget {
|
|
147
|
+
kind: 'presigned_url';
|
|
148
|
+
}
|
|
149
|
+
interface PutTarget {
|
|
150
|
+
kind: 'put';
|
|
151
|
+
url: string;
|
|
152
|
+
}
|
|
153
|
+
interface S3Coordinates {
|
|
154
|
+
endpoint: string;
|
|
155
|
+
verify_ssl?: boolean;
|
|
156
|
+
access_key: string;
|
|
157
|
+
secret_key: string;
|
|
158
|
+
bucket: string;
|
|
159
|
+
key_prefix?: string;
|
|
160
|
+
max_num_elements?: number | null;
|
|
161
|
+
}
|
|
162
|
+
interface S3Source extends S3Coordinates {
|
|
163
|
+
kind: 's3';
|
|
164
|
+
}
|
|
165
|
+
interface S3Target extends S3Coordinates {
|
|
166
|
+
kind: 's3';
|
|
167
|
+
}
|
|
168
|
+
interface AzureBlobCoordinates {
|
|
169
|
+
account_name: string;
|
|
170
|
+
container: string;
|
|
171
|
+
connection_string: string;
|
|
172
|
+
blob_prefix?: string;
|
|
173
|
+
max_num_elements?: number | null;
|
|
174
|
+
}
|
|
175
|
+
interface AzureBlobSource extends AzureBlobCoordinates {
|
|
176
|
+
kind: 'azure_blob';
|
|
177
|
+
}
|
|
178
|
+
interface AzureBlobTarget extends AzureBlobCoordinates {
|
|
179
|
+
kind: 'azure_blob';
|
|
180
|
+
}
|
|
181
|
+
interface GoogleCloudStorageServiceAccountInfo {
|
|
182
|
+
project_id: string;
|
|
183
|
+
private_key_id: string;
|
|
184
|
+
private_key: string;
|
|
185
|
+
client_email: string;
|
|
186
|
+
client_id: string;
|
|
187
|
+
auth_uri: string;
|
|
188
|
+
token_uri: string;
|
|
189
|
+
auth_provider_x509_cert_url: string;
|
|
190
|
+
client_x509_cert_url: string;
|
|
191
|
+
universe_domain: string;
|
|
192
|
+
}
|
|
193
|
+
interface GoogleCloudStorageCoordinates {
|
|
194
|
+
bucket: string;
|
|
195
|
+
key_prefix?: string;
|
|
196
|
+
max_num_elements?: number | null;
|
|
197
|
+
project?: string | null;
|
|
198
|
+
service_account_key?: GoogleCloudStorageServiceAccountInfo | null;
|
|
199
|
+
}
|
|
200
|
+
interface GoogleCloudStorageSource extends GoogleCloudStorageCoordinates {
|
|
201
|
+
kind: 'google_cloud_storage';
|
|
202
|
+
}
|
|
203
|
+
interface GoogleCloudStorageTarget extends GoogleCloudStorageCoordinates {
|
|
204
|
+
kind: 'google_cloud_storage';
|
|
205
|
+
}
|
|
206
|
+
interface GoogleDriveCredentials {
|
|
207
|
+
client_id: string;
|
|
208
|
+
project_id: string;
|
|
209
|
+
auth_uri: string;
|
|
210
|
+
token_uri: string;
|
|
211
|
+
auth_provider_x509_cert_url: string;
|
|
212
|
+
client_secret: string;
|
|
213
|
+
redirect_uris: string[];
|
|
214
|
+
}
|
|
215
|
+
interface GoogleDriveCoordinates {
|
|
216
|
+
path_id: string;
|
|
217
|
+
token_path?: string | null;
|
|
218
|
+
refresh_token?: string | null;
|
|
219
|
+
credentials_path?: string | null;
|
|
220
|
+
credentials?: GoogleDriveCredentials | null;
|
|
221
|
+
}
|
|
222
|
+
interface GoogleDriveSource extends GoogleDriveCoordinates {
|
|
223
|
+
kind: 'google_drive';
|
|
224
|
+
}
|
|
225
|
+
interface GoogleDriveTarget extends GoogleDriveCoordinates {
|
|
226
|
+
kind: 'google_drive';
|
|
227
|
+
}
|
|
228
|
+
interface GenericSource {
|
|
229
|
+
kind: string;
|
|
230
|
+
[key: string]: unknown;
|
|
231
|
+
}
|
|
232
|
+
interface GenericTarget {
|
|
233
|
+
kind: string;
|
|
234
|
+
[key: string]: unknown;
|
|
235
|
+
}
|
|
236
|
+
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
237
|
+
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
238
|
+
type BatchSource = HttpSource | S3Source | AzureBlobSource | GoogleCloudStorageSource | GoogleDriveSource | GenericSource;
|
|
239
|
+
type BatchTarget = PresignedUrlTarget | StorageTarget | GenericTarget;
|
|
240
|
+
interface CallbackSpec {
|
|
241
|
+
url: string;
|
|
242
|
+
headers?: Record<string, string>;
|
|
243
|
+
ca_cert?: string;
|
|
244
|
+
[key: string]: unknown;
|
|
245
|
+
}
|
|
246
|
+
interface ConvertSourcesRequest<TTarget extends SubmitTarget = SubmitTarget> {
|
|
247
|
+
options?: ConvertDocumentsOptions;
|
|
248
|
+
sources: ConversionSource[];
|
|
249
|
+
target?: TTarget;
|
|
250
|
+
callbacks?: CallbackSpec[];
|
|
251
|
+
}
|
|
252
|
+
interface BatchConvertSourcesRequest<TTarget extends BatchTarget = BatchTarget> {
|
|
253
|
+
options?: ConvertDocumentsOptions;
|
|
254
|
+
sources: BatchSource[];
|
|
255
|
+
target: TTarget;
|
|
256
|
+
callbacks?: CallbackSpec[];
|
|
257
|
+
}
|
|
258
|
+
type ChunkerKind = 'hybrid' | 'hierarchical';
|
|
259
|
+
interface BaseChunkingOptions {
|
|
260
|
+
use_markdown_tables?: boolean;
|
|
261
|
+
use_markdown_images?: boolean;
|
|
262
|
+
image_placeholder?: string;
|
|
263
|
+
include_raw_text?: boolean;
|
|
264
|
+
}
|
|
265
|
+
interface HybridChunkingOptions extends BaseChunkingOptions {
|
|
266
|
+
max_tokens?: number | null;
|
|
267
|
+
tokenizer?: string;
|
|
268
|
+
merge_peers?: boolean;
|
|
269
|
+
}
|
|
270
|
+
type HierarchicalChunkingOptions = BaseChunkingOptions;
|
|
271
|
+
interface BaseChunkSourcesRequest {
|
|
272
|
+
convert_options?: ConvertDocumentsOptions;
|
|
273
|
+
sources: ConversionSource[];
|
|
274
|
+
include_converted_doc?: boolean;
|
|
275
|
+
target?: InBodyTarget;
|
|
276
|
+
callbacks?: CallbackSpec[];
|
|
277
|
+
}
|
|
278
|
+
interface HybridChunkSourcesRequest extends BaseChunkSourcesRequest {
|
|
279
|
+
chunker: 'hybrid';
|
|
280
|
+
chunking_options?: HybridChunkingOptions;
|
|
281
|
+
}
|
|
282
|
+
interface HierarchicalChunkSourcesRequest extends BaseChunkSourcesRequest {
|
|
283
|
+
chunker: 'hierarchical';
|
|
284
|
+
chunking_options?: HierarchicalChunkingOptions;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* A Docling Serve chunk job converts each source and then chunks the resulting
|
|
288
|
+
* DoclingDocument in the same task.
|
|
289
|
+
*/
|
|
290
|
+
type ChunkSourcesRequest = HybridChunkSourcesRequest | HierarchicalChunkSourcesRequest;
|
|
291
|
+
type ChunkSourceOptions = Omit<HybridChunkSourcesRequest, 'sources'> | Omit<HierarchicalChunkSourcesRequest, 'sources'>;
|
|
292
|
+
type TaskType = 'convert' | 'chunk';
|
|
293
|
+
type TaskStatus = 'pending' | 'started' | 'success' | 'failure' | 'partial_success' | 'skipped';
|
|
294
|
+
interface TaskProcessingMeta {
|
|
295
|
+
num_docs: number;
|
|
296
|
+
num_processed: number;
|
|
297
|
+
num_succeeded: number;
|
|
298
|
+
num_partially_succeeded: number;
|
|
299
|
+
num_failed: number;
|
|
300
|
+
}
|
|
301
|
+
interface PublicFailureInfo {
|
|
302
|
+
category: FailureCategory;
|
|
303
|
+
message: string;
|
|
304
|
+
retryable: boolean;
|
|
305
|
+
phase: 'admission' | 'source_enumeration' | 'execution' | 'orchestration';
|
|
306
|
+
details: Record<string, string>;
|
|
307
|
+
}
|
|
308
|
+
interface TaskStatusResponse {
|
|
309
|
+
task_id: string;
|
|
310
|
+
task_type: TaskType;
|
|
311
|
+
task_status: TaskStatus;
|
|
312
|
+
task_position?: number | null;
|
|
313
|
+
task_meta?: TaskProcessingMeta | null;
|
|
314
|
+
error_message?: string | null;
|
|
315
|
+
failure?: PublicFailureInfo | null;
|
|
316
|
+
}
|
|
317
|
+
type ConversionStatus = 'pending' | 'started' | 'success' | 'partial_success' | 'skipped' | 'failure';
|
|
318
|
+
type FailureCategory = 'policy' | 'capacity' | 'source_unavailable' | 'target_unavailable' | 'timeout' | 'internal' | 'backend_failure' | 'inference_failure' | 'unknown';
|
|
319
|
+
type DoclingComponentType = 'document_backend' | 'model' | 'doc_assembler' | 'user_input' | 'pipeline';
|
|
320
|
+
type QualityGrade = 'poor' | 'fair' | 'good' | 'excellent' | 'unspecified';
|
|
321
|
+
interface ConfidenceScores {
|
|
322
|
+
parse_score?: number | null;
|
|
323
|
+
layout_score?: number | null;
|
|
324
|
+
table_score?: number | null;
|
|
325
|
+
ocr_score?: number | null;
|
|
326
|
+
mean_score?: number | null;
|
|
327
|
+
low_score?: number | null;
|
|
328
|
+
mean_grade?: QualityGrade;
|
|
329
|
+
low_grade?: QualityGrade;
|
|
330
|
+
}
|
|
331
|
+
interface ErrorItem {
|
|
332
|
+
component_type: DoclingComponentType;
|
|
333
|
+
module_name: string;
|
|
334
|
+
error_message: string;
|
|
335
|
+
category?: FailureCategory;
|
|
336
|
+
page_no?: number | null;
|
|
337
|
+
}
|
|
338
|
+
type ProfilingScope = 'page' | 'document';
|
|
339
|
+
interface ProfilingItem {
|
|
340
|
+
scope: ProfilingScope;
|
|
341
|
+
count: number;
|
|
342
|
+
times: number[];
|
|
343
|
+
start_timestamps?: string[];
|
|
344
|
+
}
|
|
345
|
+
interface ExportDocumentResponse<TDocument = DoclingDocument> {
|
|
346
|
+
filename: string;
|
|
347
|
+
md_content?: string | null;
|
|
348
|
+
json_content?: TDocument | null;
|
|
349
|
+
html_content?: string | null;
|
|
350
|
+
text_content?: string | null;
|
|
351
|
+
doctags_content?: string | null;
|
|
352
|
+
doclang_content?: string | null;
|
|
353
|
+
}
|
|
354
|
+
interface ExportResult<TDocument = DoclingDocument> {
|
|
355
|
+
kind: 'ExportResult';
|
|
356
|
+
content: ExportDocumentResponse<TDocument>;
|
|
357
|
+
status: ConversionStatus;
|
|
358
|
+
errors: ErrorItem[];
|
|
359
|
+
timings: Record<string, ProfilingItem>;
|
|
360
|
+
confidence?: ConfidenceScores | null;
|
|
361
|
+
}
|
|
362
|
+
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'resource_bundle';
|
|
363
|
+
interface ArtifactRef {
|
|
364
|
+
artifact_type: ArtifactType;
|
|
365
|
+
mime_type: string;
|
|
366
|
+
uri: string;
|
|
367
|
+
url_expires_at?: string | null;
|
|
368
|
+
}
|
|
369
|
+
interface DocumentArtifactItem {
|
|
370
|
+
source_index: number;
|
|
371
|
+
source_uri: string;
|
|
372
|
+
filename: string;
|
|
373
|
+
status: ConversionStatus;
|
|
374
|
+
errors: ErrorItem[];
|
|
375
|
+
timings: Record<string, ProfilingItem>;
|
|
376
|
+
artifacts: ArtifactRef[];
|
|
377
|
+
confidence?: ConfidenceScores | null;
|
|
378
|
+
}
|
|
379
|
+
interface OutcomeCounts {
|
|
380
|
+
num_converted: number;
|
|
381
|
+
num_succeeded: number;
|
|
382
|
+
num_partially_succeeded: number;
|
|
383
|
+
num_failed: number;
|
|
384
|
+
}
|
|
385
|
+
interface PresignedUrlConvertDocumentResponse extends OutcomeCounts {
|
|
386
|
+
processing_time: number;
|
|
387
|
+
}
|
|
388
|
+
interface PresignedUrlConvertResponse extends PresignedUrlConvertDocumentResponse {
|
|
389
|
+
documents: DocumentArtifactItem[];
|
|
390
|
+
}
|
|
391
|
+
interface RawServiceResult {
|
|
392
|
+
content: Uint8Array;
|
|
393
|
+
content_type: string;
|
|
394
|
+
filename: string | null;
|
|
395
|
+
}
|
|
396
|
+
interface ChunkedDocumentResultItem {
|
|
397
|
+
filename: string;
|
|
398
|
+
chunk_index: number;
|
|
399
|
+
text: string;
|
|
400
|
+
raw_text?: string | null;
|
|
401
|
+
num_tokens?: number | null;
|
|
402
|
+
headings?: string[] | null;
|
|
403
|
+
captions?: string[] | null;
|
|
404
|
+
doc_items: string[];
|
|
405
|
+
page_numbers?: number[] | null;
|
|
406
|
+
metadata?: Record<string, unknown> | null;
|
|
407
|
+
}
|
|
408
|
+
interface ChunkDocumentResponse<TDocument = DoclingDocument> {
|
|
409
|
+
chunks: ChunkedDocumentResultItem[];
|
|
410
|
+
documents: ExportResult<TDocument>[];
|
|
411
|
+
processing_time: number;
|
|
412
|
+
}
|
|
413
|
+
interface ConvertDocumentResponse<TDocument = DoclingDocument> {
|
|
414
|
+
document: ExportDocumentResponse<TDocument>;
|
|
415
|
+
status: ConversionStatus;
|
|
416
|
+
errors: ErrorItem[];
|
|
417
|
+
processing_time: number;
|
|
418
|
+
timings: Record<string, ProfilingItem>;
|
|
419
|
+
confidence?: ConfidenceScores | null;
|
|
420
|
+
}
|
|
421
|
+
interface ConversionInput {
|
|
422
|
+
filename: string;
|
|
423
|
+
source: string;
|
|
424
|
+
format?: InputFormat;
|
|
425
|
+
file_size?: number | null;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* JavaScript counterpart of Python's high-level ConversionResult.
|
|
429
|
+
*
|
|
430
|
+
* The document remains plain Docling JSON so it works with @docling/docling-core
|
|
431
|
+
* traversal utilities without embedding a conversion runtime.
|
|
432
|
+
*/
|
|
433
|
+
interface ConversionResult<TDocument = DoclingDocument> {
|
|
434
|
+
input: ConversionInput;
|
|
435
|
+
document: TDocument;
|
|
436
|
+
status: ConversionStatus;
|
|
437
|
+
errors: ErrorItem[];
|
|
438
|
+
processing_time: number;
|
|
439
|
+
timings: Record<string, ProfilingItem>;
|
|
440
|
+
confidence?: ConfidenceScores | null;
|
|
441
|
+
}
|
|
442
|
+
type SubmitResultForTarget<TTarget extends SubmitTarget, TDocument = DoclingDocument> = TTarget extends InBodyTarget ? ConversionResult<TDocument> : TTarget extends ZipTarget ? RawServiceResult : TTarget extends PresignedUrlTarget ? PresignedUrlConvertResponse : PresignedUrlConvertDocumentResponse;
|
|
443
|
+
type AutoSubmitResult<TDocument = DoclingDocument> = ConversionResult<TDocument> | PresignedUrlConvertResponse;
|
|
444
|
+
/** Clearer alias for the legacy Python-compatible counts response name. */
|
|
445
|
+
type RemoteTargetResponse = PresignedUrlConvertDocumentResponse;
|
|
446
|
+
type BatchResultForTarget<TTarget extends BatchTarget> = TTarget extends PresignedUrlTarget ? PresignedUrlConvertResponse : PresignedUrlConvertDocumentResponse;
|
|
447
|
+
type InBodyConversionResponse<TDocument = DoclingDocument> = ConvertDocumentResponse<TDocument> | ChunkDocumentResponse<TDocument>;
|
|
448
|
+
interface TaskFailureResult {
|
|
449
|
+
kind: 'TaskFailureResult';
|
|
450
|
+
failure: PublicFailureInfo;
|
|
451
|
+
}
|
|
452
|
+
interface HealthCheckResponse {
|
|
453
|
+
status: string;
|
|
454
|
+
}
|
|
455
|
+
interface WaitForTaskOptions {
|
|
456
|
+
timeoutMs?: number;
|
|
457
|
+
pollIntervalMs?: number;
|
|
458
|
+
serverWaitSeconds?: number;
|
|
459
|
+
statusWatcher?: 'websocket' | 'polling';
|
|
460
|
+
signal?: AbortSignal;
|
|
461
|
+
onStatus?: (status: TaskStatusResponse) => void | Promise<void>;
|
|
462
|
+
}
|
|
463
|
+
interface DocumentLimits {
|
|
464
|
+
maxNumPages?: number;
|
|
465
|
+
maxFileSize?: number;
|
|
466
|
+
pageRange?: [number, number];
|
|
467
|
+
}
|
|
468
|
+
interface ConversionItem {
|
|
469
|
+
source: ConversionSourceInput;
|
|
470
|
+
options?: ConvertDocumentsOptions;
|
|
471
|
+
headers?: Record<string, string>;
|
|
472
|
+
metadata?: unknown;
|
|
473
|
+
}
|
|
474
|
+
interface BinaryFileSource {
|
|
475
|
+
data: Blob | ArrayBuffer | ArrayBufferView;
|
|
476
|
+
filename: string;
|
|
477
|
+
contentType?: string;
|
|
478
|
+
}
|
|
479
|
+
type ConversionSourceInput = ConversionSource | URL | string | BinaryFileSource;
|
|
480
|
+
interface SubmitAndRetrieveOptions<TTarget extends SubmitTarget> {
|
|
481
|
+
maxInFlight?: number;
|
|
482
|
+
ordered?: boolean;
|
|
483
|
+
target?: TTarget;
|
|
484
|
+
signal?: AbortSignal;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
type ArtifactAddressResolver = (hostname: string) => Promise<string[]>;
|
|
488
|
+
interface ArtifactDownloaderOptions {
|
|
489
|
+
fetch?: typeof globalThis.fetch;
|
|
490
|
+
resolver?: ArtifactAddressResolver;
|
|
491
|
+
allowPrivateUrls?: boolean;
|
|
492
|
+
timeoutMs?: number;
|
|
493
|
+
maxBytes?: number;
|
|
494
|
+
maxRedirects?: number;
|
|
495
|
+
}
|
|
496
|
+
declare class ArtifactDownloader {
|
|
497
|
+
#private;
|
|
498
|
+
constructor(options?: ArtifactDownloaderOptions);
|
|
499
|
+
download(url: string, signal?: AbortSignal): Promise<Uint8Array>;
|
|
500
|
+
}
|
|
501
|
+
declare function materializePresignedResult<TDocument = DoclingDocument>(response: PresignedUrlConvertResponse, input: ConversionInput, downloader: ArtifactDownloader, signal?: AbortSignal): Promise<ConversionResult<TDocument>>;
|
|
502
|
+
declare function selectDocumentArtifact(item: DocumentArtifactItem): ArtifactRef;
|
|
503
|
+
declare function documentFromBundle<TDocument>(bytes: Uint8Array): TDocument;
|
|
504
|
+
declare function documentFromJson<TDocument>(bytes: Uint8Array): TDocument;
|
|
505
|
+
|
|
506
|
+
type DoclingResponseType = 'json' | 'text' | 'bytes' | 'auto';
|
|
507
|
+
type DoclingRequestBodyType = 'json' | 'form' | 'raw';
|
|
508
|
+
interface DoclingTransportRequest {
|
|
509
|
+
method: 'GET' | 'HEAD' | 'OPTIONS' | 'POST';
|
|
510
|
+
url: string;
|
|
511
|
+
headers: Readonly<Record<string, string>>;
|
|
512
|
+
body?: unknown;
|
|
513
|
+
bodyType?: DoclingRequestBodyType;
|
|
514
|
+
responseType?: DoclingResponseType;
|
|
515
|
+
retries?: number;
|
|
516
|
+
timeoutMs?: number;
|
|
517
|
+
signal?: AbortSignal;
|
|
518
|
+
}
|
|
519
|
+
interface DoclingBinaryResponse {
|
|
520
|
+
content: Uint8Array;
|
|
521
|
+
headers: Readonly<Record<string, string>>;
|
|
522
|
+
contentType: string;
|
|
523
|
+
}
|
|
524
|
+
interface DoclingTransport {
|
|
525
|
+
request<T>(request: DoclingTransportRequest): Promise<T>;
|
|
526
|
+
close?(): void | Promise<void>;
|
|
527
|
+
}
|
|
528
|
+
type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
529
|
+
interface FetchTransportOptions {
|
|
530
|
+
fetch?: FetchLike;
|
|
531
|
+
retries?: number;
|
|
532
|
+
timeoutMs?: number;
|
|
533
|
+
backoffBaseMs?: number;
|
|
534
|
+
sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
535
|
+
}
|
|
536
|
+
declare class FetchTransport implements DoclingTransport {
|
|
537
|
+
#private;
|
|
538
|
+
constructor(optionsOrFetch?: FetchTransportOptions | FetchLike | undefined);
|
|
539
|
+
request<T>(request: DoclingTransportRequest): Promise<T>;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
type StatusWatcherKind = 'websocket' | 'polling';
|
|
543
|
+
interface WebSocketLike {
|
|
544
|
+
readonly readyState: number;
|
|
545
|
+
send(data: string): void;
|
|
546
|
+
close(): void;
|
|
547
|
+
addEventListener(type: 'open' | 'message' | 'error' | 'close', listener: (event: {
|
|
548
|
+
data?: unknown;
|
|
549
|
+
error?: unknown;
|
|
550
|
+
message?: string;
|
|
551
|
+
code?: number;
|
|
552
|
+
reason?: string;
|
|
553
|
+
wasClean?: boolean;
|
|
554
|
+
}) => void): void;
|
|
555
|
+
}
|
|
556
|
+
interface WebSocketFactoryOptions {
|
|
557
|
+
headers: Readonly<Record<string, string>>;
|
|
558
|
+
}
|
|
559
|
+
type WebSocketFactory = (url: string, options: WebSocketFactoryOptions) => WebSocketLike;
|
|
560
|
+
interface WatchTaskOptions extends WaitForTaskOptions {
|
|
561
|
+
taskId: string;
|
|
562
|
+
baseUrl: string;
|
|
563
|
+
apiKey?: string;
|
|
564
|
+
watcher: StatusWatcherKind;
|
|
565
|
+
fallbackToPoll: boolean;
|
|
566
|
+
connectTimeoutMs: number;
|
|
567
|
+
webSocketFactory?: WebSocketFactory;
|
|
568
|
+
sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
569
|
+
poll: (taskId: string, options: {
|
|
570
|
+
waitSeconds: number;
|
|
571
|
+
signal?: AbortSignal;
|
|
572
|
+
}) => Promise<TaskStatusResponse>;
|
|
573
|
+
parseStatus: (value: unknown) => TaskStatusResponse;
|
|
574
|
+
}
|
|
575
|
+
declare function watchTask(options: WatchTaskOptions): AsyncGenerator<TaskStatusResponse>;
|
|
576
|
+
|
|
577
|
+
declare const DEFAULT_MAX_CONCURRENCY = 8;
|
|
578
|
+
declare const MAX_CONCURRENCY_LIMIT = 512;
|
|
579
|
+
interface DoclingClientOptions {
|
|
580
|
+
baseUrl: string;
|
|
581
|
+
apiKey?: string;
|
|
582
|
+
headers?: Record<string, string>;
|
|
583
|
+
transport?: DoclingTransport;
|
|
584
|
+
fetch?: FetchLike;
|
|
585
|
+
httpRetries?: number;
|
|
586
|
+
httpTimeoutMs?: number;
|
|
587
|
+
httpBackoffBaseMs?: number;
|
|
588
|
+
options?: ConvertDocumentsOptions;
|
|
589
|
+
statusWatcher?: StatusWatcherKind;
|
|
590
|
+
webSocketFallbackToPoll?: boolean;
|
|
591
|
+
webSocketFactory?: WebSocketFactory;
|
|
592
|
+
connectTimeoutMs?: number;
|
|
593
|
+
pollServerWaitSeconds?: number;
|
|
594
|
+
pollClientIntervalMs?: number;
|
|
595
|
+
jobTimeoutMs?: number;
|
|
596
|
+
maxConcurrency?: number;
|
|
597
|
+
artifactDownloader?: ArtifactDownloader;
|
|
598
|
+
artifactDownload?: ArtifactDownloaderOptions;
|
|
599
|
+
}
|
|
600
|
+
interface SubmitCallOptions {
|
|
601
|
+
signal?: AbortSignal;
|
|
602
|
+
headers?: Record<string, string>;
|
|
603
|
+
}
|
|
604
|
+
interface BatchSubmitCallOptions extends SubmitCallOptions {
|
|
605
|
+
outputFormats?: ConvertDocumentsOptions['to_formats'];
|
|
606
|
+
}
|
|
607
|
+
interface SubmitSourceOptions<TTarget extends SubmitTarget = SubmitTarget> extends SubmitCallOptions {
|
|
608
|
+
options?: ConvertDocumentsOptions;
|
|
609
|
+
outputFormats?: ConvertDocumentsOptions['to_formats'];
|
|
610
|
+
target?: TTarget;
|
|
611
|
+
}
|
|
612
|
+
interface ConvertOptions extends WaitForTaskOptions {
|
|
613
|
+
options?: ConvertDocumentsOptions;
|
|
614
|
+
headers?: Record<string, string>;
|
|
615
|
+
maxNumPages?: number;
|
|
616
|
+
maxFileSize?: number;
|
|
617
|
+
pageRange?: [number, number];
|
|
618
|
+
raisesOnError?: boolean;
|
|
619
|
+
}
|
|
620
|
+
interface ConvertAllOptions extends Omit<ConvertOptions, 'raisesOnError'> {
|
|
621
|
+
maxConcurrency?: number;
|
|
622
|
+
}
|
|
623
|
+
interface ChunkCallOptions extends WaitForTaskOptions {
|
|
624
|
+
includeConvertedDoc?: boolean;
|
|
625
|
+
}
|
|
626
|
+
declare class DoclingClient<TDocument = DoclingDocument> {
|
|
627
|
+
#private;
|
|
628
|
+
constructor(options: DoclingClientOptions);
|
|
629
|
+
health(options?: {
|
|
630
|
+
signal?: AbortSignal;
|
|
631
|
+
}): Promise<HealthCheckResponse>;
|
|
632
|
+
version(options?: {
|
|
633
|
+
signal?: AbortSignal;
|
|
634
|
+
}): Promise<Record<string, unknown>>;
|
|
635
|
+
close(): Promise<void>;
|
|
636
|
+
submit<TTarget extends SubmitTarget>(request: ConvertSourcesRequest<TTarget> & {
|
|
637
|
+
target: TTarget;
|
|
638
|
+
}, options?: SubmitCallOptions): Promise<DoclingJob<SubmitResultForTarget<TTarget, TDocument>>>;
|
|
639
|
+
submit(request: ConvertSourcesRequest, options?: SubmitCallOptions): Promise<DoclingJob<AutoSubmitResult<TDocument>>>;
|
|
640
|
+
submitSource<TTarget extends SubmitTarget>(source: ConversionSourceInput, options: SubmitSourceOptions<TTarget> & {
|
|
641
|
+
target: TTarget;
|
|
642
|
+
}): Promise<DoclingJob<SubmitResultForTarget<TTarget, TDocument>>>;
|
|
643
|
+
submitSource(source: ConversionSourceInput, options?: SubmitSourceOptions): Promise<DoclingJob<AutoSubmitResult<TDocument>>>;
|
|
644
|
+
submitUrl<TTarget extends SubmitTarget>(url: string, options: ConvertDocumentsOptions, requestOptions: SubmitCallOptions & {
|
|
645
|
+
sourceHeaders?: Record<string, unknown>;
|
|
646
|
+
target: TTarget;
|
|
647
|
+
}): Promise<DoclingJob<SubmitResultForTarget<TTarget, TDocument>>>;
|
|
648
|
+
submitUrl(url: string, options?: ConvertDocumentsOptions, requestOptions?: SubmitCallOptions & {
|
|
649
|
+
sourceHeaders?: Record<string, unknown>;
|
|
650
|
+
target?: undefined;
|
|
651
|
+
}): Promise<DoclingJob<AutoSubmitResult<TDocument>>>;
|
|
652
|
+
submitFile<TTarget extends SubmitTarget>(base64: string, filename: string, options: ConvertDocumentsOptions, requestOptions: SubmitCallOptions & {
|
|
653
|
+
target: TTarget;
|
|
654
|
+
}): Promise<DoclingJob<SubmitResultForTarget<TTarget, TDocument>>>;
|
|
655
|
+
submitFile(base64: string, filename: string, options?: ConvertDocumentsOptions, requestOptions?: SubmitCallOptions & {
|
|
656
|
+
target?: undefined;
|
|
657
|
+
}): Promise<DoclingJob<AutoSubmitResult<TDocument>>>;
|
|
658
|
+
submitBinary<TTarget extends SubmitTarget>(source: BinaryFileSource, options: SubmitSourceOptions<TTarget> & {
|
|
659
|
+
target: TTarget;
|
|
660
|
+
}): Promise<DoclingJob<SubmitResultForTarget<TTarget, TDocument>>>;
|
|
661
|
+
submitBinary(source: BinaryFileSource, options?: SubmitSourceOptions & {
|
|
662
|
+
target?: undefined;
|
|
663
|
+
}): Promise<DoclingJob<AutoSubmitResult<TDocument>>>;
|
|
664
|
+
submitBatch<TTarget extends BatchTarget>(request: BatchConvertSourcesRequest<TTarget>, options?: BatchSubmitCallOptions): Promise<DoclingJob<BatchResultForTarget<TTarget>>>;
|
|
665
|
+
submitChunk(request: ChunkSourcesRequest, options?: SubmitCallOptions): Promise<DoclingJob<ChunkDocumentResponse<TDocument>>>;
|
|
666
|
+
submitChunkUrl(url: string, request: ChunkSourceOptions, requestOptions?: SubmitCallOptions & {
|
|
667
|
+
sourceHeaders?: Record<string, unknown>;
|
|
668
|
+
}): Promise<DoclingJob<ChunkDocumentResponse<TDocument>>>;
|
|
669
|
+
submitChunkFile(base64: string, filename: string, request: ChunkSourceOptions, requestOptions?: SubmitCallOptions): Promise<DoclingJob<ChunkDocumentResponse<TDocument>>>;
|
|
670
|
+
submitChunkBinary(source: BinaryFileSource, request: ChunkSourceOptions, requestOptions?: SubmitCallOptions): Promise<DoclingJob<ChunkDocumentResponse<TDocument>>>;
|
|
671
|
+
job<TResult = InBodyConversionResponse<TDocument>>(taskId: string, status?: TaskStatusResponse, resultLoader?: ResultLoader<TResult>): DoclingJob<TResult>;
|
|
672
|
+
poll(taskId: string, options?: {
|
|
673
|
+
waitSeconds?: number;
|
|
674
|
+
signal?: AbortSignal;
|
|
675
|
+
}): Promise<TaskStatusResponse>;
|
|
676
|
+
watch(taskId: string, options?: WaitForTaskOptions): AsyncGenerator<TaskStatusResponse>;
|
|
677
|
+
waitForCompletion(taskId: string, options?: WaitForTaskOptions): Promise<TaskStatusResponse>;
|
|
678
|
+
getResult(taskId: string, options?: {
|
|
679
|
+
signal?: AbortSignal;
|
|
680
|
+
lastStatus?: TaskStatusResponse;
|
|
681
|
+
}): Promise<InBodyConversionResponse<TDocument>>;
|
|
682
|
+
getBinaryResult(taskId: string, options?: {
|
|
683
|
+
signal?: AbortSignal;
|
|
684
|
+
lastStatus?: TaskStatusResponse;
|
|
685
|
+
}): Promise<RawServiceResult>;
|
|
686
|
+
getRawResult<TResult = unknown>(taskId: string, options?: {
|
|
687
|
+
signal?: AbortSignal;
|
|
688
|
+
lastStatus?: TaskStatusResponse;
|
|
689
|
+
}): Promise<TResult>;
|
|
690
|
+
convert(source: ConversionSourceInput, options?: ConvertOptions): Promise<ConversionResult<TDocument>>;
|
|
691
|
+
convertAll(sources: Iterable<ConversionSourceInput> | AsyncIterable<ConversionSourceInput>, options?: ConvertAllOptions): AsyncGenerator<ConversionResult<TDocument>>;
|
|
692
|
+
submitAndRetrieveEach<TMetadata = unknown>(items: Iterable<ConversionItem & {
|
|
693
|
+
metadata?: TMetadata;
|
|
694
|
+
}> | AsyncIterable<ConversionItem & {
|
|
695
|
+
metadata?: TMetadata;
|
|
696
|
+
}>, options?: Omit<SubmitAndRetrieveOptions<PresignedUrlTarget>, 'target'> & {
|
|
697
|
+
target?: undefined;
|
|
698
|
+
}): AsyncGenerator<[
|
|
699
|
+
ConversionItem & {
|
|
700
|
+
metadata?: TMetadata;
|
|
701
|
+
},
|
|
702
|
+
AutoSubmitResult<TDocument> | Error
|
|
703
|
+
]>;
|
|
704
|
+
submitAndRetrieveEach<TMetadata = unknown, TTarget extends SubmitTarget = SubmitTarget>(items: Iterable<ConversionItem & {
|
|
705
|
+
metadata?: TMetadata;
|
|
706
|
+
}> | AsyncIterable<ConversionItem & {
|
|
707
|
+
metadata?: TMetadata;
|
|
708
|
+
}>, options: SubmitAndRetrieveOptions<TTarget> & {
|
|
709
|
+
target: TTarget;
|
|
710
|
+
}): AsyncGenerator<[
|
|
711
|
+
ConversionItem & {
|
|
712
|
+
metadata?: TMetadata;
|
|
713
|
+
},
|
|
714
|
+
SubmitResultForTarget<TTarget, TDocument> | Error
|
|
715
|
+
]>;
|
|
716
|
+
/** @deprecated Use submitAndRetrieveEach instead. */
|
|
717
|
+
submitAndRetrieveMany<TMetadata = unknown>(items: Iterable<ConversionItem & {
|
|
718
|
+
metadata?: TMetadata;
|
|
719
|
+
}> | AsyncIterable<ConversionItem & {
|
|
720
|
+
metadata?: TMetadata;
|
|
721
|
+
}>, options?: Omit<SubmitAndRetrieveOptions<PresignedUrlTarget>, 'target'> & {
|
|
722
|
+
target?: undefined;
|
|
723
|
+
}): AsyncGenerator<[
|
|
724
|
+
ConversionItem & {
|
|
725
|
+
metadata?: TMetadata;
|
|
726
|
+
},
|
|
727
|
+
AutoSubmitResult<TDocument> | Error
|
|
728
|
+
]>;
|
|
729
|
+
submitAndRetrieveMany<TMetadata = unknown, TTarget extends SubmitTarget = SubmitTarget>(items: Iterable<ConversionItem & {
|
|
730
|
+
metadata?: TMetadata;
|
|
731
|
+
}> | AsyncIterable<ConversionItem & {
|
|
732
|
+
metadata?: TMetadata;
|
|
733
|
+
}>, options: SubmitAndRetrieveOptions<TTarget> & {
|
|
734
|
+
target: TTarget;
|
|
735
|
+
}): AsyncGenerator<[
|
|
736
|
+
ConversionItem & {
|
|
737
|
+
metadata?: TMetadata;
|
|
738
|
+
},
|
|
739
|
+
SubmitResultForTarget<TTarget, TDocument> | Error
|
|
740
|
+
]>;
|
|
741
|
+
chunk(request: ChunkSourcesRequest, waitOptions?: WaitForTaskOptions): Promise<ChunkDocumentResponse<TDocument>>;
|
|
742
|
+
chunk(source: ConversionSourceInput, request: ChunkSourceOptions, waitOptions?: WaitForTaskOptions): Promise<ChunkDocumentResponse<TDocument>>;
|
|
743
|
+
chunk(source: ConversionSourceInput, chunker: ChunkerKind, options?: ConvertDocumentsOptions, waitOptions?: ChunkCallOptions): Promise<ChunkDocumentResponse<TDocument>>;
|
|
744
|
+
}
|
|
745
|
+
type ResultLoader<TResult> = (taskId: string, lastStatus?: TaskStatusResponse, signal?: AbortSignal) => Promise<TResult>;
|
|
746
|
+
declare class DoclingJob<TResult> {
|
|
747
|
+
#private;
|
|
748
|
+
constructor(client: DoclingClient<unknown>, status: TaskStatusResponse, loadResult: ResultLoader<TResult>);
|
|
749
|
+
get taskId(): string;
|
|
750
|
+
get status(): TaskStatusResponse;
|
|
751
|
+
get submittedAt(): Date;
|
|
752
|
+
get queuePosition(): number | null;
|
|
753
|
+
get done(): boolean;
|
|
754
|
+
poll(options?: {
|
|
755
|
+
waitSeconds?: number;
|
|
756
|
+
signal?: AbortSignal;
|
|
757
|
+
}): Promise<TaskStatusResponse>;
|
|
758
|
+
watch(options?: WaitForTaskOptions): AsyncGenerator<TaskStatusResponse>;
|
|
759
|
+
wait(options?: WaitForTaskOptions): Promise<TaskStatusResponse>;
|
|
760
|
+
getResult(options?: {
|
|
761
|
+
signal?: AbortSignal;
|
|
762
|
+
}): Promise<TResult>;
|
|
763
|
+
result(options?: WaitForTaskOptions): Promise<TResult>;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
declare class DoclingError extends Error {
|
|
767
|
+
constructor(message: string, options?: ErrorOptions);
|
|
768
|
+
}
|
|
769
|
+
declare class DoclingServiceError extends DoclingError {
|
|
770
|
+
readonly status: number | null;
|
|
771
|
+
readonly detail: string | null;
|
|
772
|
+
constructor(message: string, options?: {
|
|
773
|
+
status?: number;
|
|
774
|
+
detail?: string;
|
|
775
|
+
cause?: unknown;
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
declare class DoclingHttpError extends DoclingServiceError {
|
|
779
|
+
readonly method: string;
|
|
780
|
+
readonly url: string;
|
|
781
|
+
readonly status: number;
|
|
782
|
+
readonly body: unknown;
|
|
783
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
784
|
+
constructor(options: {
|
|
785
|
+
method: string;
|
|
786
|
+
url: string;
|
|
787
|
+
status: number;
|
|
788
|
+
body: unknown;
|
|
789
|
+
headers?: Readonly<Record<string, string>>;
|
|
790
|
+
detail?: string;
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
declare class DoclingProtocolError extends DoclingError {
|
|
794
|
+
}
|
|
795
|
+
declare class DoclingResponseSchemaMismatchError extends DoclingServiceError {
|
|
796
|
+
}
|
|
797
|
+
declare class DoclingServiceUnavailableError extends DoclingServiceError {
|
|
798
|
+
}
|
|
799
|
+
declare class DoclingUsageLimitExceededError extends DoclingHttpError {
|
|
800
|
+
readonly currentUsage: number | null;
|
|
801
|
+
readonly limit: number | null;
|
|
802
|
+
constructor(options: {
|
|
803
|
+
method: string;
|
|
804
|
+
url: string;
|
|
805
|
+
status: number;
|
|
806
|
+
body: unknown;
|
|
807
|
+
headers?: Readonly<Record<string, string>>;
|
|
808
|
+
currentUsage?: number;
|
|
809
|
+
limit?: number;
|
|
810
|
+
detail?: string;
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
declare class DoclingTaskError extends DoclingError {
|
|
814
|
+
readonly task: TaskStatusResponse;
|
|
815
|
+
readonly failure?: PublicFailureInfo;
|
|
816
|
+
constructor(task: TaskStatusResponse);
|
|
817
|
+
}
|
|
818
|
+
declare class DoclingTimeoutError extends DoclingError {
|
|
819
|
+
readonly taskId: string;
|
|
820
|
+
readonly timeoutMs: number;
|
|
821
|
+
constructor(taskId: string, timeoutMs: number);
|
|
822
|
+
}
|
|
823
|
+
declare class DoclingTaskNotFoundError extends DoclingError {
|
|
824
|
+
readonly taskId: string;
|
|
825
|
+
constructor(taskId: string);
|
|
826
|
+
}
|
|
827
|
+
declare class DoclingResultNotReadyError extends DoclingError {
|
|
828
|
+
readonly taskId: string;
|
|
829
|
+
constructor(taskId: string);
|
|
830
|
+
}
|
|
831
|
+
declare class DoclingResultExpiredError extends DoclingError {
|
|
832
|
+
readonly taskId: string;
|
|
833
|
+
constructor(taskId: string);
|
|
834
|
+
}
|
|
835
|
+
declare class DoclingArtifactDownloadError extends DoclingError {
|
|
836
|
+
}
|
|
837
|
+
declare class DoclingConversionError extends DoclingError {
|
|
838
|
+
}
|
|
839
|
+
declare class DoclingBatchConversionError extends DoclingError {
|
|
840
|
+
readonly failures: Error[];
|
|
841
|
+
constructor(message: string, failures: Error[]);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
interface NormalizedJsonSource {
|
|
845
|
+
kind: 'json';
|
|
846
|
+
source: ConversionSource;
|
|
847
|
+
descriptor: ConversionInput;
|
|
848
|
+
}
|
|
849
|
+
interface NormalizedMultipartSource {
|
|
850
|
+
kind: 'multipart';
|
|
851
|
+
blob: Blob;
|
|
852
|
+
descriptor: ConversionInput;
|
|
853
|
+
}
|
|
854
|
+
type NormalizedSource = NormalizedJsonSource | NormalizedMultipartSource;
|
|
855
|
+
declare function normalizeSourceInput(input: ConversionSourceInput, signal?: AbortSignal): Promise<NormalizedSource>;
|
|
856
|
+
declare function resolveConvertOptions(defaults: ConvertDocumentsOptions, overrides: ConvertDocumentsOptions | undefined): ConvertDocumentsOptions;
|
|
857
|
+
declare function withJsonOutput(options: ConvertDocumentsOptions): ConvertDocumentsOptions;
|
|
858
|
+
declare function validateConvertOptions(options: ConvertDocumentsOptions): void;
|
|
859
|
+
declare function applyPageLimits(options: ConvertDocumentsOptions, pageRange?: [number, number], maxNumPages?: number): ConvertDocumentsOptions;
|
|
860
|
+
declare function validateMaxFileSize(value: number | undefined): void;
|
|
861
|
+
declare function preflightFileSize(source: NormalizedSource, maxFileSize: number | undefined): string | null;
|
|
862
|
+
declare function formValue(value: unknown): string;
|
|
863
|
+
declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
|
|
864
|
+
|
|
865
|
+
export { type ArtifactAddressResolver, ArtifactDownloader, type ArtifactDownloaderOptions, type ArtifactRef, type ArtifactType, type AutoSubmitResult, type AzureBlobCoordinates, type AzureBlobSource, type AzureBlobTarget, type BaseChunkingOptions, type BatchConvertSourcesRequest, type BatchResultForTarget, type BatchSource, type BatchSubmitCallOptions, type BatchTarget, type BinaryFileSource, type CallbackSpec, type ChunkCallOptions, type ChunkDocumentResponse, type ChunkSourceOptions, type ChunkSourcesRequest, type ChunkedDocumentResultItem, type ChunkerKind, type ConfidenceScores, type ConversionInput, type ConversionItem, type ConversionResult, type ConversionSource, type ConversionSourceInput, type ConversionStatus, type ConvertAllOptions, type ConvertDocumentResponse, type ConvertDocumentsOptions, type ConvertOptions, type ConvertSourcesRequest, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, type DoclingBinaryResponse, DoclingClient, type DoclingClientOptions, type DoclingComponentType, DoclingConversionError, type DoclingDocument, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, type DoclingRequestBodyType, DoclingResponseSchemaMismatchError, type DoclingResponseType, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, type DoclingTransport, type DoclingTransportRequest, DoclingUsageLimitExceededError, type DocumentArtifactItem, type DocumentLimits, type ErrorItem, type ExportDocumentResponse, type ExportResult, type FailureCategory, type FetchLike, FetchTransport, type FetchTransportOptions, type FileSource, type GenericSource, type GenericTarget, type GoogleCloudStorageCoordinates, type GoogleCloudStorageServiceAccountInfo, type GoogleCloudStorageSource, type GoogleCloudStorageTarget, type GoogleDriveCoordinates, type GoogleDriveCredentials, type GoogleDriveSource, type GoogleDriveTarget, type HealthCheckResponse, type HierarchicalChunkSourcesRequest, type HierarchicalChunkingOptions, type HttpSource, type HybridChunkSourcesRequest, type HybridChunkingOptions, type ImageExportMode, type InBodyConversionResponse, type InBodyTarget, type InputFormat, type LegacyVlmModelType, MAX_CONCURRENCY_LIMIT, type NormalizedJsonSource, type NormalizedMultipartSource, type NormalizedSource, type OutcomeCounts, type OutputFormat, type PdfBackend, type PictureClassificationLabel, type PictureDescriptionApi, type PictureDescriptionLocal, type PresignedUrlConvertDocumentResponse, type PresignedUrlConvertResponse, type PresignedUrlTarget, type ProcessingPipeline, type ProfilingItem, type ProfilingScope, type PublicFailureInfo, type PutTarget, type QualityGrade, type RawServiceResult, type RemoteTargetResponse, type S3Coordinates, type S3Source, type S3Target, type StatusWatcherKind, type StorageTarget, type SubmitAndRetrieveOptions, type SubmitCallOptions, type SubmitResultForTarget, type SubmitSourceOptions, type SubmitTarget, type TableMode, type TaskFailureResult, type TaskProcessingMeta, type TaskStatus, type TaskStatusResponse, type TaskType, type TransformersModelType, type VlmInferenceFramework, type VlmModelApi, type VlmModelLocal, type VlmResponseFormat, type WaitForTaskOptions, type WatchTaskOptions, type WebSocketFactory, type WebSocketFactoryOptions, type WebSocketLike, type ZipTarget, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, formValue, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|