@docling/docling-client 2.132.0 → 2.134.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/dist/index.d.cts CHANGED
@@ -12,7 +12,7 @@ interface DoclingDocument {
12
12
  name: string;
13
13
  [key: string]: unknown;
14
14
  }
15
- type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'ebcdic' | 'afp';
15
+ type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'iwork_numbers' | 'ebcdic' | 'afp';
16
16
  type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks' | 'latex';
17
17
  type ProcessingPipeline = 'legacy' | 'standard' | 'native' | 'vlm' | 'asr';
18
18
  type TableMode = 'fast' | 'accurate';
@@ -293,6 +293,57 @@ interface CallbackSpec {
293
293
  ca_cert?: string;
294
294
  [key: string]: unknown;
295
295
  }
296
+ type ProgressKind = 'set_num_docs' | 'update_processed' | 'document_completed' | 'task_completed';
297
+ interface BaseProgress {
298
+ kind: ProgressKind;
299
+ }
300
+ interface ProgressSetNumDocs extends BaseProgress {
301
+ kind: 'set_num_docs';
302
+ num_docs: number;
303
+ }
304
+ interface ProcessedDocsItem {
305
+ source: string;
306
+ status: ConversionStatus;
307
+ error?: string | null;
308
+ }
309
+ interface ProgressUpdateProcessed extends BaseProgress {
310
+ kind: 'update_processed';
311
+ num_processed: number;
312
+ num_succeeded: number;
313
+ num_partially_succeeded: number;
314
+ num_failed: number;
315
+ docs: ProcessedDocsItem[];
316
+ }
317
+ interface DocumentCompletedItem {
318
+ source: string;
319
+ status: ConversionStatus;
320
+ document_type?: InputFormat | null;
321
+ num_pages?: number | null;
322
+ num_characters?: number | null;
323
+ num_tables?: number | null;
324
+ num_pictures?: number | null;
325
+ processing_time?: number | null;
326
+ doc_hash?: string | null;
327
+ error?: string | null;
328
+ }
329
+ interface ProgressDocumentCompleted extends BaseProgress {
330
+ kind: 'document_completed';
331
+ document: DocumentCompletedItem;
332
+ total_processed: number;
333
+ total_docs?: number | null;
334
+ }
335
+ interface ProgressTaskCompleted extends BaseProgress {
336
+ kind: 'task_completed';
337
+ task_status: 'success' | 'failure';
338
+ failure?: PublicFailureInfo | null;
339
+ }
340
+ interface ProgressCallbackRequest {
341
+ task_id: string;
342
+ progress: ProgressSetNumDocs | ProgressUpdateProcessed | ProgressDocumentCompleted | ProgressTaskCompleted;
343
+ }
344
+ interface ProgressCallbackResponse {
345
+ status: 'ack';
346
+ }
296
347
  interface ConvertSourcesRequest<TTarget extends SubmitTarget = SubmitTarget> {
297
348
  options?: ConvertDocumentsOptions;
298
349
  sources: ConversionSource[];
@@ -307,18 +358,64 @@ interface BatchConvertSourcesRequest<TTarget extends BatchTarget = BatchTarget>
307
358
  callbacks?: CallbackSpec[];
308
359
  }
309
360
  type ChunkerKind = 'hybrid' | 'hierarchical';
361
+ type ChunkerType = ChunkerKind;
362
+ interface ChunkingExportOptions {
363
+ include_converted_doc?: boolean;
364
+ }
310
365
  interface BaseChunkingOptions {
311
366
  use_markdown_tables?: boolean;
312
367
  use_markdown_images?: boolean;
313
368
  image_placeholder?: string;
314
369
  include_raw_text?: boolean;
315
370
  }
371
+ type BaseChunkerOptions = BaseChunkingOptions;
316
372
  interface HybridChunkingOptions extends BaseChunkingOptions {
317
373
  max_tokens?: number | null;
318
374
  tokenizer?: string;
319
375
  merge_peers?: boolean;
320
376
  }
377
+ type HybridChunkerOptions = HybridChunkingOptions;
321
378
  type HierarchicalChunkingOptions = BaseChunkingOptions;
379
+ type HierarchicalChunkerOptions = HierarchicalChunkingOptions;
380
+ type ChunkingOptionType = (HybridChunkingOptions & {
381
+ chunker: 'hybrid';
382
+ }) | (HierarchicalChunkingOptions & {
383
+ chunker: 'hierarchical';
384
+ });
385
+ type FileSourceRequest = FileSource;
386
+ type AnyHttpSourceRequest = HttpSource;
387
+ type HttpSourceRequest = HttpSource;
388
+ type S3SourceRequest = S3Source;
389
+ type AzureBlobSourceRequest = AzureBlobSource;
390
+ type GoogleCloudStorageSourceRequest = GoogleCloudStorageSource;
391
+ type GoogleDriveSourceRequest = GoogleDriveSource;
392
+ declare const TargetName: {
393
+ readonly INBODY: "inbody";
394
+ readonly PRESIGNED_URL: "presigned_url";
395
+ readonly ZIP: "zip";
396
+ };
397
+ type TargetName = (typeof TargetName)[keyof typeof TargetName];
398
+ type KnownBatchSourceRequestItem = AnyHttpSourceRequest | S3SourceRequest | AzureBlobSourceRequest | GoogleCloudStorageSourceRequest | GoogleDriveSourceRequest;
399
+ type GenericSourceRequest = GenericSource;
400
+ type BatchSourceRequestItem = KnownBatchSourceRequestItem | GenericSourceRequest;
401
+ type BatchSourceRequestInput = BatchSourceRequestItem | Record<string, unknown>;
402
+ type SourceRequestItem = FileSourceRequest | HttpSourceRequest;
403
+ type TargetRequest = SubmitTarget;
404
+ type KnownBatchTargetRequest = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget | PresignedUrlTarget;
405
+ type GenericTargetRequest = GenericTarget;
406
+ type BatchTargetRequest = KnownBatchTargetRequest | GenericTargetRequest;
407
+ type BatchTargetRequestInput = BatchTargetRequest | Record<string, unknown>;
408
+ /** @deprecated Alias for ConvertSourcesRequest */
409
+ type ConvertDocumentsRequest<TTarget extends SubmitTarget = SubmitTarget> = ConvertSourcesRequest<TTarget>;
410
+ interface BaseChunkDocumentsRequest {
411
+ convert_options?: ConvertDocumentsOptions;
412
+ sources: SourceRequestItem[];
413
+ include_converted_doc?: boolean;
414
+ target?: TargetRequest;
415
+ callbacks?: CallbackSpec[];
416
+ }
417
+ type GenericChunkDocumentsRequest = ChunkSourcesRequest;
418
+ type Target = SubmitTarget;
322
419
  interface BaseChunkSourcesRequest {
323
420
  convert_options?: ConvertDocumentsOptions;
324
421
  sources: ConversionSource[];
@@ -349,11 +446,12 @@ interface TaskProcessingMeta {
349
446
  num_partially_succeeded: number;
350
447
  num_failed: number;
351
448
  }
449
+ type FailurePhase = 'admission' | 'source_enumeration' | 'execution' | 'orchestration';
352
450
  interface PublicFailureInfo {
353
451
  category: FailureCategory;
354
452
  message: string;
355
453
  retryable: boolean;
356
- phase: 'admission' | 'source_enumeration' | 'execution' | 'orchestration';
454
+ phase: FailurePhase;
357
455
  details: Record<string, string>;
358
456
  }
359
457
  interface TaskStatusResponse {
@@ -404,12 +502,58 @@ interface ExportDocumentResponse<TDocument = DoclingDocument> {
404
502
  }
405
503
  interface ExportResult<TDocument = DoclingDocument> {
406
504
  kind: 'ExportResult';
505
+ document: ExportDocumentResponse<TDocument>;
506
+ /** @deprecated Use `document` instead. */
407
507
  content: ExportDocumentResponse<TDocument>;
408
508
  status: ConversionStatus;
409
509
  errors: ErrorItem[];
410
510
  timings: Record<string, ProfilingItem>;
411
511
  confidence?: ConfidenceScores | null;
412
512
  }
513
+ type DocumentResultItem<TDocument = DoclingDocument> = ExportResult<TDocument>;
514
+ interface ZipArchiveResult {
515
+ kind: 'ZipArchiveResult';
516
+ content: Uint8Array | unknown;
517
+ }
518
+ interface RemoteTargetResult {
519
+ kind: 'RemoteTargetResult';
520
+ }
521
+ interface PresignedArtifactResult {
522
+ kind: 'PresignedArtifactResult';
523
+ documents: DocumentArtifactItem[];
524
+ }
525
+ type ConvertedOutcomeCountsMixin = OutcomeCounts;
526
+ type ResultType<TDocument = DoclingDocument> = ExportResult<TDocument> | ZipArchiveResult | RemoteTargetResult | ChunkedDocumentResult<TDocument> | PresignedArtifactResult;
527
+ interface DoclingTaskResult<TDocument = DoclingDocument> extends OutcomeCounts {
528
+ result: ResultType<TDocument>;
529
+ processing_time: number;
530
+ }
531
+ /** @deprecated Use DoclingTaskResult instead. */
532
+ type ConvertDocumentResult<TDocument = DoclingDocument> = DoclingTaskResult<TDocument>;
533
+ interface ReadinessResponse {
534
+ status: string;
535
+ }
536
+ interface ClearResponse {
537
+ status: string;
538
+ }
539
+ interface ConvertDocumentErrorResponse {
540
+ status: ConversionStatus;
541
+ }
542
+ interface UsageLimitExceededDetails {
543
+ currentUsage: number;
544
+ limit: number;
545
+ }
546
+ interface UsageLimitExceededResponse {
547
+ error: 'usage_limit_exceeded';
548
+ message: string;
549
+ details: UsageLimitExceededDetails;
550
+ }
551
+ type MessageKind = 'connection' | 'update' | 'error';
552
+ interface WebsocketMessage {
553
+ message: MessageKind;
554
+ task?: TaskStatusResponse | null;
555
+ error?: string | null;
556
+ }
413
557
  type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
414
558
  interface ArtifactRef {
415
559
  artifact_type: ArtifactType;
@@ -456,6 +600,12 @@ interface ChunkedDocumentResultItem {
456
600
  page_numbers?: number[] | null;
457
601
  metadata?: Record<string, unknown> | null;
458
602
  }
603
+ interface ChunkedDocumentResult<TDocument = DoclingDocument> {
604
+ kind: 'ChunkedDocumentResponse';
605
+ chunks: ChunkedDocumentResultItem[];
606
+ documents: ExportResult<TDocument>[];
607
+ chunking_info?: Record<string, unknown> | null;
608
+ }
459
609
  interface ChunkDocumentResponse<TDocument = DoclingDocument> {
460
610
  chunks: ChunkedDocumentResultItem[];
461
611
  documents: ExportResult<TDocument>[];
@@ -914,4 +1064,4 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
914
1064
  declare function appendFormValue(form: FormData, key: string, value: unknown): void;
915
1065
  declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
916
1066
 
917
- 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 HeadingHierarchyOptions, 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, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
1067
+ export { type AnyHttpSourceRequest, type ArtifactAddressResolver, ArtifactDownloader, type ArtifactDownloaderOptions, type ArtifactRef, type ArtifactType, type AutoSubmitResult, type AzureBlobCoordinates, type AzureBlobSource, type AzureBlobSourceRequest, type AzureBlobTarget, type BaseChunkDocumentsRequest, type BaseChunkerOptions, type BaseChunkingOptions, type BaseProgress, type BatchConvertSourcesRequest, type BatchResultForTarget, type BatchSource, type BatchSourceRequestInput, type BatchSourceRequestItem, type BatchSubmitCallOptions, type BatchTarget, type BatchTargetRequest, type BatchTargetRequestInput, type BinaryFileSource, type CallbackSpec, type ChunkCallOptions, type ChunkDocumentResponse, type ChunkSourceOptions, type ChunkSourcesRequest, type ChunkedDocumentResult, type ChunkedDocumentResultItem, type ChunkerKind, type ChunkerType, type ChunkingExportOptions, type ChunkingOptionType, type ClearResponse, type ConfidenceScores, type ConversionInput, type ConversionItem, type ConversionResult, type ConversionSource, type ConversionSourceInput, type ConversionStatus, type ConvertAllOptions, type ConvertDocumentErrorResponse, type ConvertDocumentResponse, type ConvertDocumentResult, type ConvertDocumentsOptions, type ConvertDocumentsRequest, type ConvertOptions, type ConvertSourcesRequest, type ConvertedOutcomeCountsMixin, 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, type DoclingTaskResult, DoclingTimeoutError, type DoclingTransport, type DoclingTransportRequest, DoclingUsageLimitExceededError, type DocumentArtifactItem, type DocumentCompletedItem, type DocumentLimits, type DocumentResultItem, type ErrorItem, type ExportDocumentResponse, type ExportResult, type FailureCategory, type FailurePhase, type FetchLike, FetchTransport, type FetchTransportOptions, type FileSource, type FileSourceRequest, type GenericChunkDocumentsRequest, type GenericSource, type GenericSourceRequest, type GenericTarget, type GenericTargetRequest, type GoogleCloudStorageCoordinates, type GoogleCloudStorageServiceAccountInfo, type GoogleCloudStorageSource, type GoogleCloudStorageSourceRequest, type GoogleCloudStorageTarget, type GoogleDriveCoordinates, type GoogleDriveCredentials, type GoogleDriveSource, type GoogleDriveSourceRequest, type GoogleDriveTarget, type HeadingHierarchyOptions, type HealthCheckResponse, type HierarchicalChunkSourcesRequest, type HierarchicalChunkerOptions, type HierarchicalChunkingOptions, type HttpSource, type HttpSourceRequest, type HybridChunkSourcesRequest, type HybridChunkerOptions, type HybridChunkingOptions, type ImageExportMode, type InBodyConversionResponse, type InBodyTarget, type InputFormat, type KnownBatchSourceRequestItem, type KnownBatchTargetRequest, type LegacyVlmModelType, MAX_CONCURRENCY_LIMIT, type MessageKind, type NormalizedJsonSource, type NormalizedMultipartSource, type NormalizedSource, type OutcomeCounts, type OutputFormat, type PdfBackend, type PictureClassificationLabel, type PictureDescriptionApi, type PictureDescriptionLocal, type PresignedArtifactResult, type PresignedUrlConvertDocumentResponse, type PresignedUrlConvertResponse, type PresignedUrlTarget, type ProcessedDocsItem, type ProcessingPipeline, type ProfilingItem, type ProfilingScope, type ProgressCallbackRequest, type ProgressCallbackResponse, type ProgressDocumentCompleted, type ProgressKind, type ProgressSetNumDocs, type ProgressTaskCompleted, type ProgressUpdateProcessed, type PublicFailureInfo, type PutTarget, type QualityGrade, type RawServiceResult, type ReadinessResponse, type RemoteTargetResponse, type RemoteTargetResult, type ResultType, type S3Coordinates, type S3Source, type S3SourceRequest, type S3Target, type SourceRequestItem, type StatusWatcherKind, type StorageTarget, type SubmitAndRetrieveOptions, type SubmitCallOptions, type SubmitResultForTarget, type SubmitSourceOptions, type SubmitTarget, type TableMode, type Target, TargetName, type TargetRequest, type TaskFailureResult, type TaskProcessingMeta, type TaskStatus, type TaskStatusResponse, type TaskType, type TransformersModelType, type UsageLimitExceededDetails, type UsageLimitExceededResponse, type VlmInferenceFramework, type VlmModelApi, type VlmModelLocal, type VlmResponseFormat, type WaitForTaskOptions, type WatchTaskOptions, type WebSocketFactory, type WebSocketFactoryOptions, type WebSocketLike, type WebsocketMessage, type ZipArchiveResult, type ZipTarget, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ interface DoclingDocument {
12
12
  name: string;
13
13
  [key: string]: unknown;
14
14
  }
15
- type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'ebcdic' | 'afp';
15
+ type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'iwork_numbers' | 'ebcdic' | 'afp';
16
16
  type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks' | 'latex';
17
17
  type ProcessingPipeline = 'legacy' | 'standard' | 'native' | 'vlm' | 'asr';
18
18
  type TableMode = 'fast' | 'accurate';
@@ -293,6 +293,57 @@ interface CallbackSpec {
293
293
  ca_cert?: string;
294
294
  [key: string]: unknown;
295
295
  }
296
+ type ProgressKind = 'set_num_docs' | 'update_processed' | 'document_completed' | 'task_completed';
297
+ interface BaseProgress {
298
+ kind: ProgressKind;
299
+ }
300
+ interface ProgressSetNumDocs extends BaseProgress {
301
+ kind: 'set_num_docs';
302
+ num_docs: number;
303
+ }
304
+ interface ProcessedDocsItem {
305
+ source: string;
306
+ status: ConversionStatus;
307
+ error?: string | null;
308
+ }
309
+ interface ProgressUpdateProcessed extends BaseProgress {
310
+ kind: 'update_processed';
311
+ num_processed: number;
312
+ num_succeeded: number;
313
+ num_partially_succeeded: number;
314
+ num_failed: number;
315
+ docs: ProcessedDocsItem[];
316
+ }
317
+ interface DocumentCompletedItem {
318
+ source: string;
319
+ status: ConversionStatus;
320
+ document_type?: InputFormat | null;
321
+ num_pages?: number | null;
322
+ num_characters?: number | null;
323
+ num_tables?: number | null;
324
+ num_pictures?: number | null;
325
+ processing_time?: number | null;
326
+ doc_hash?: string | null;
327
+ error?: string | null;
328
+ }
329
+ interface ProgressDocumentCompleted extends BaseProgress {
330
+ kind: 'document_completed';
331
+ document: DocumentCompletedItem;
332
+ total_processed: number;
333
+ total_docs?: number | null;
334
+ }
335
+ interface ProgressTaskCompleted extends BaseProgress {
336
+ kind: 'task_completed';
337
+ task_status: 'success' | 'failure';
338
+ failure?: PublicFailureInfo | null;
339
+ }
340
+ interface ProgressCallbackRequest {
341
+ task_id: string;
342
+ progress: ProgressSetNumDocs | ProgressUpdateProcessed | ProgressDocumentCompleted | ProgressTaskCompleted;
343
+ }
344
+ interface ProgressCallbackResponse {
345
+ status: 'ack';
346
+ }
296
347
  interface ConvertSourcesRequest<TTarget extends SubmitTarget = SubmitTarget> {
297
348
  options?: ConvertDocumentsOptions;
298
349
  sources: ConversionSource[];
@@ -307,18 +358,64 @@ interface BatchConvertSourcesRequest<TTarget extends BatchTarget = BatchTarget>
307
358
  callbacks?: CallbackSpec[];
308
359
  }
309
360
  type ChunkerKind = 'hybrid' | 'hierarchical';
361
+ type ChunkerType = ChunkerKind;
362
+ interface ChunkingExportOptions {
363
+ include_converted_doc?: boolean;
364
+ }
310
365
  interface BaseChunkingOptions {
311
366
  use_markdown_tables?: boolean;
312
367
  use_markdown_images?: boolean;
313
368
  image_placeholder?: string;
314
369
  include_raw_text?: boolean;
315
370
  }
371
+ type BaseChunkerOptions = BaseChunkingOptions;
316
372
  interface HybridChunkingOptions extends BaseChunkingOptions {
317
373
  max_tokens?: number | null;
318
374
  tokenizer?: string;
319
375
  merge_peers?: boolean;
320
376
  }
377
+ type HybridChunkerOptions = HybridChunkingOptions;
321
378
  type HierarchicalChunkingOptions = BaseChunkingOptions;
379
+ type HierarchicalChunkerOptions = HierarchicalChunkingOptions;
380
+ type ChunkingOptionType = (HybridChunkingOptions & {
381
+ chunker: 'hybrid';
382
+ }) | (HierarchicalChunkingOptions & {
383
+ chunker: 'hierarchical';
384
+ });
385
+ type FileSourceRequest = FileSource;
386
+ type AnyHttpSourceRequest = HttpSource;
387
+ type HttpSourceRequest = HttpSource;
388
+ type S3SourceRequest = S3Source;
389
+ type AzureBlobSourceRequest = AzureBlobSource;
390
+ type GoogleCloudStorageSourceRequest = GoogleCloudStorageSource;
391
+ type GoogleDriveSourceRequest = GoogleDriveSource;
392
+ declare const TargetName: {
393
+ readonly INBODY: "inbody";
394
+ readonly PRESIGNED_URL: "presigned_url";
395
+ readonly ZIP: "zip";
396
+ };
397
+ type TargetName = (typeof TargetName)[keyof typeof TargetName];
398
+ type KnownBatchSourceRequestItem = AnyHttpSourceRequest | S3SourceRequest | AzureBlobSourceRequest | GoogleCloudStorageSourceRequest | GoogleDriveSourceRequest;
399
+ type GenericSourceRequest = GenericSource;
400
+ type BatchSourceRequestItem = KnownBatchSourceRequestItem | GenericSourceRequest;
401
+ type BatchSourceRequestInput = BatchSourceRequestItem | Record<string, unknown>;
402
+ type SourceRequestItem = FileSourceRequest | HttpSourceRequest;
403
+ type TargetRequest = SubmitTarget;
404
+ type KnownBatchTargetRequest = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget | PresignedUrlTarget;
405
+ type GenericTargetRequest = GenericTarget;
406
+ type BatchTargetRequest = KnownBatchTargetRequest | GenericTargetRequest;
407
+ type BatchTargetRequestInput = BatchTargetRequest | Record<string, unknown>;
408
+ /** @deprecated Alias for ConvertSourcesRequest */
409
+ type ConvertDocumentsRequest<TTarget extends SubmitTarget = SubmitTarget> = ConvertSourcesRequest<TTarget>;
410
+ interface BaseChunkDocumentsRequest {
411
+ convert_options?: ConvertDocumentsOptions;
412
+ sources: SourceRequestItem[];
413
+ include_converted_doc?: boolean;
414
+ target?: TargetRequest;
415
+ callbacks?: CallbackSpec[];
416
+ }
417
+ type GenericChunkDocumentsRequest = ChunkSourcesRequest;
418
+ type Target = SubmitTarget;
322
419
  interface BaseChunkSourcesRequest {
323
420
  convert_options?: ConvertDocumentsOptions;
324
421
  sources: ConversionSource[];
@@ -349,11 +446,12 @@ interface TaskProcessingMeta {
349
446
  num_partially_succeeded: number;
350
447
  num_failed: number;
351
448
  }
449
+ type FailurePhase = 'admission' | 'source_enumeration' | 'execution' | 'orchestration';
352
450
  interface PublicFailureInfo {
353
451
  category: FailureCategory;
354
452
  message: string;
355
453
  retryable: boolean;
356
- phase: 'admission' | 'source_enumeration' | 'execution' | 'orchestration';
454
+ phase: FailurePhase;
357
455
  details: Record<string, string>;
358
456
  }
359
457
  interface TaskStatusResponse {
@@ -404,12 +502,58 @@ interface ExportDocumentResponse<TDocument = DoclingDocument> {
404
502
  }
405
503
  interface ExportResult<TDocument = DoclingDocument> {
406
504
  kind: 'ExportResult';
505
+ document: ExportDocumentResponse<TDocument>;
506
+ /** @deprecated Use `document` instead. */
407
507
  content: ExportDocumentResponse<TDocument>;
408
508
  status: ConversionStatus;
409
509
  errors: ErrorItem[];
410
510
  timings: Record<string, ProfilingItem>;
411
511
  confidence?: ConfidenceScores | null;
412
512
  }
513
+ type DocumentResultItem<TDocument = DoclingDocument> = ExportResult<TDocument>;
514
+ interface ZipArchiveResult {
515
+ kind: 'ZipArchiveResult';
516
+ content: Uint8Array | unknown;
517
+ }
518
+ interface RemoteTargetResult {
519
+ kind: 'RemoteTargetResult';
520
+ }
521
+ interface PresignedArtifactResult {
522
+ kind: 'PresignedArtifactResult';
523
+ documents: DocumentArtifactItem[];
524
+ }
525
+ type ConvertedOutcomeCountsMixin = OutcomeCounts;
526
+ type ResultType<TDocument = DoclingDocument> = ExportResult<TDocument> | ZipArchiveResult | RemoteTargetResult | ChunkedDocumentResult<TDocument> | PresignedArtifactResult;
527
+ interface DoclingTaskResult<TDocument = DoclingDocument> extends OutcomeCounts {
528
+ result: ResultType<TDocument>;
529
+ processing_time: number;
530
+ }
531
+ /** @deprecated Use DoclingTaskResult instead. */
532
+ type ConvertDocumentResult<TDocument = DoclingDocument> = DoclingTaskResult<TDocument>;
533
+ interface ReadinessResponse {
534
+ status: string;
535
+ }
536
+ interface ClearResponse {
537
+ status: string;
538
+ }
539
+ interface ConvertDocumentErrorResponse {
540
+ status: ConversionStatus;
541
+ }
542
+ interface UsageLimitExceededDetails {
543
+ currentUsage: number;
544
+ limit: number;
545
+ }
546
+ interface UsageLimitExceededResponse {
547
+ error: 'usage_limit_exceeded';
548
+ message: string;
549
+ details: UsageLimitExceededDetails;
550
+ }
551
+ type MessageKind = 'connection' | 'update' | 'error';
552
+ interface WebsocketMessage {
553
+ message: MessageKind;
554
+ task?: TaskStatusResponse | null;
555
+ error?: string | null;
556
+ }
413
557
  type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
414
558
  interface ArtifactRef {
415
559
  artifact_type: ArtifactType;
@@ -456,6 +600,12 @@ interface ChunkedDocumentResultItem {
456
600
  page_numbers?: number[] | null;
457
601
  metadata?: Record<string, unknown> | null;
458
602
  }
603
+ interface ChunkedDocumentResult<TDocument = DoclingDocument> {
604
+ kind: 'ChunkedDocumentResponse';
605
+ chunks: ChunkedDocumentResultItem[];
606
+ documents: ExportResult<TDocument>[];
607
+ chunking_info?: Record<string, unknown> | null;
608
+ }
459
609
  interface ChunkDocumentResponse<TDocument = DoclingDocument> {
460
610
  chunks: ChunkedDocumentResultItem[];
461
611
  documents: ExportResult<TDocument>[];
@@ -914,4 +1064,4 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
914
1064
  declare function appendFormValue(form: FormData, key: string, value: unknown): void;
915
1065
  declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
916
1066
 
917
- 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 HeadingHierarchyOptions, 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, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
1067
+ export { type AnyHttpSourceRequest, type ArtifactAddressResolver, ArtifactDownloader, type ArtifactDownloaderOptions, type ArtifactRef, type ArtifactType, type AutoSubmitResult, type AzureBlobCoordinates, type AzureBlobSource, type AzureBlobSourceRequest, type AzureBlobTarget, type BaseChunkDocumentsRequest, type BaseChunkerOptions, type BaseChunkingOptions, type BaseProgress, type BatchConvertSourcesRequest, type BatchResultForTarget, type BatchSource, type BatchSourceRequestInput, type BatchSourceRequestItem, type BatchSubmitCallOptions, type BatchTarget, type BatchTargetRequest, type BatchTargetRequestInput, type BinaryFileSource, type CallbackSpec, type ChunkCallOptions, type ChunkDocumentResponse, type ChunkSourceOptions, type ChunkSourcesRequest, type ChunkedDocumentResult, type ChunkedDocumentResultItem, type ChunkerKind, type ChunkerType, type ChunkingExportOptions, type ChunkingOptionType, type ClearResponse, type ConfidenceScores, type ConversionInput, type ConversionItem, type ConversionResult, type ConversionSource, type ConversionSourceInput, type ConversionStatus, type ConvertAllOptions, type ConvertDocumentErrorResponse, type ConvertDocumentResponse, type ConvertDocumentResult, type ConvertDocumentsOptions, type ConvertDocumentsRequest, type ConvertOptions, type ConvertSourcesRequest, type ConvertedOutcomeCountsMixin, 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, type DoclingTaskResult, DoclingTimeoutError, type DoclingTransport, type DoclingTransportRequest, DoclingUsageLimitExceededError, type DocumentArtifactItem, type DocumentCompletedItem, type DocumentLimits, type DocumentResultItem, type ErrorItem, type ExportDocumentResponse, type ExportResult, type FailureCategory, type FailurePhase, type FetchLike, FetchTransport, type FetchTransportOptions, type FileSource, type FileSourceRequest, type GenericChunkDocumentsRequest, type GenericSource, type GenericSourceRequest, type GenericTarget, type GenericTargetRequest, type GoogleCloudStorageCoordinates, type GoogleCloudStorageServiceAccountInfo, type GoogleCloudStorageSource, type GoogleCloudStorageSourceRequest, type GoogleCloudStorageTarget, type GoogleDriveCoordinates, type GoogleDriveCredentials, type GoogleDriveSource, type GoogleDriveSourceRequest, type GoogleDriveTarget, type HeadingHierarchyOptions, type HealthCheckResponse, type HierarchicalChunkSourcesRequest, type HierarchicalChunkerOptions, type HierarchicalChunkingOptions, type HttpSource, type HttpSourceRequest, type HybridChunkSourcesRequest, type HybridChunkerOptions, type HybridChunkingOptions, type ImageExportMode, type InBodyConversionResponse, type InBodyTarget, type InputFormat, type KnownBatchSourceRequestItem, type KnownBatchTargetRequest, type LegacyVlmModelType, MAX_CONCURRENCY_LIMIT, type MessageKind, type NormalizedJsonSource, type NormalizedMultipartSource, type NormalizedSource, type OutcomeCounts, type OutputFormat, type PdfBackend, type PictureClassificationLabel, type PictureDescriptionApi, type PictureDescriptionLocal, type PresignedArtifactResult, type PresignedUrlConvertDocumentResponse, type PresignedUrlConvertResponse, type PresignedUrlTarget, type ProcessedDocsItem, type ProcessingPipeline, type ProfilingItem, type ProfilingScope, type ProgressCallbackRequest, type ProgressCallbackResponse, type ProgressDocumentCompleted, type ProgressKind, type ProgressSetNumDocs, type ProgressTaskCompleted, type ProgressUpdateProcessed, type PublicFailureInfo, type PutTarget, type QualityGrade, type RawServiceResult, type ReadinessResponse, type RemoteTargetResponse, type RemoteTargetResult, type ResultType, type S3Coordinates, type S3Source, type S3SourceRequest, type S3Target, type SourceRequestItem, type StatusWatcherKind, type StorageTarget, type SubmitAndRetrieveOptions, type SubmitCallOptions, type SubmitResultForTarget, type SubmitSourceOptions, type SubmitTarget, type TableMode, type Target, TargetName, type TargetRequest, type TaskFailureResult, type TaskProcessingMeta, type TaskStatus, type TaskStatusResponse, type TaskType, type TransformersModelType, type UsageLimitExceededDetails, type UsageLimitExceededResponse, type VlmInferenceFramework, type VlmModelApi, type VlmModelLocal, type VlmResponseFormat, type WaitForTaskOptions, type WatchTaskOptions, type WebSocketFactory, type WebSocketFactoryOptions, type WebSocketLike, type WebsocketMessage, type ZipArchiveResult, type ZipTarget, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
package/dist/index.js CHANGED
@@ -795,6 +795,7 @@ var EXTENSION_FORMATS = {
795
795
  boxnote: "boxnote",
796
796
  pages: "iwork_pages",
797
797
  key: "iwork_keynote",
798
+ numbers: "iwork_numbers",
798
799
  ebc: "ebcdic",
799
800
  ebcdic: "ebcdic",
800
801
  afp: "afp"
@@ -1308,6 +1309,7 @@ var INPUT_FORMATS = /* @__PURE__ */ new Set([
1308
1309
  "boxnote",
1309
1310
  "iwork_pages",
1310
1311
  "iwork_keynote",
1312
+ "iwork_numbers",
1311
1313
  "ebcdic",
1312
1314
  "afp"
1313
1315
  ]);
@@ -3322,6 +3324,7 @@ function parseExportResult(value, path) {
3322
3324
  });
3323
3325
  return {
3324
3326
  kind: "ExportResult",
3327
+ document: parsed.document,
3325
3328
  content: parsed.document,
3326
3329
  status: parsed.status,
3327
3330
  errors: parsed.errors,
@@ -4118,6 +4121,13 @@ async function* mapSourcesToItems(sources, options, headers) {
4118
4121
  function isRecord4(value) {
4119
4122
  return value !== null && typeof value === "object" && !Array.isArray(value);
4120
4123
  }
4124
+
4125
+ // src/types.ts
4126
+ var TargetName = {
4127
+ INBODY: "inbody",
4128
+ PRESIGNED_URL: "presigned_url",
4129
+ ZIP: "zip"
4130
+ };
4121
4131
  export {
4122
4132
  ArtifactDownloader,
4123
4133
  DEFAULT_MAX_CONCURRENCY,
@@ -4140,6 +4150,7 @@ export {
4140
4150
  DoclingUsageLimitExceededError,
4141
4151
  FetchTransport,
4142
4152
  MAX_CONCURRENCY_LIMIT,
4153
+ TargetName,
4143
4154
  appendFormValue,
4144
4155
  applyPageLimits,
4145
4156
  documentFromBundle,