@docling/docling-client 0.3.0 → 2.131.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
@@ -67,6 +67,22 @@ interface VlmModelApi {
67
67
  response_format: VlmResponseFormat;
68
68
  temperature?: number;
69
69
  }
70
+ /**
71
+ * Fine-tuning options for PDF heading-hierarchy inference, applied when
72
+ * `do_pdf_heading_hierarchy` is enabled.
73
+ *
74
+ * Mirrors Python's `HeadingHierarchyOptions`.
75
+ */
76
+ interface HeadingHierarchyOptions {
77
+ /** Use PDF bookmarks/table-of-contents for heading levels. Default: true. */
78
+ use_bookmarks?: boolean;
79
+ /** Use outline numbering (e.g. "1.2.3 Title") for heading levels. Default: true. */
80
+ use_outline_levels?: boolean;
81
+ /** Use font-style differences for heading levels. Default: true. */
82
+ use_style?: boolean;
83
+ /** Maximum inferred heading depth. Default: 6. */
84
+ max_level?: number;
85
+ }
70
86
  /**
71
87
  * Common Docling Serve conversion controls.
72
88
  *
@@ -90,6 +106,14 @@ interface ConvertDocumentsOptions {
90
106
  table_mode?: TableMode;
91
107
  table_cell_matching?: boolean;
92
108
  do_table_structure?: boolean;
109
+ /**
110
+ * If enabled, section-header levels are inferred for PDF and image inputs
111
+ * processed by the standard pipeline. When disabled every heading stays at
112
+ * level 1 (flat hierarchy). Default: false.
113
+ */
114
+ do_pdf_heading_hierarchy?: boolean;
115
+ /** Fine-tuning of the heading-level inference. Applied when do_pdf_heading_hierarchy is enabled. */
116
+ pdf_heading_hierarchy_options?: HeadingHierarchyOptions;
93
117
  image_export_mode?: ImageExportMode;
94
118
  images_scale?: number;
95
119
  include_images?: boolean;
@@ -100,6 +124,16 @@ interface ConvertDocumentsOptions {
100
124
  do_picture_classification?: boolean;
101
125
  do_picture_description?: boolean;
102
126
  do_chart_extraction?: boolean;
127
+ /**
128
+ * Preset ID for chart extraction (e.g. "default", "granite_vision_v4", "granite_vision").
129
+ * Mutually exclusive with chart_extraction_custom_config.
130
+ */
131
+ chart_extraction_preset?: string | null;
132
+ /**
133
+ * Custom chart extraction configuration. Accepts a ChartExtractionVlmEngineOptions-equivalent
134
+ * dict. Only available when the admin allows it. Mutually exclusive with chart_extraction_preset.
135
+ */
136
+ chart_extraction_custom_config?: Record<string, unknown> | null;
103
137
  picture_description_area_threshold?: number;
104
138
  /** @deprecated Prefer picture_description_preset or picture_description_custom_config. */
105
139
  picture_description_local?: PictureDescriptionLocal | null;
@@ -123,8 +157,24 @@ interface ConvertDocumentsOptions {
123
157
  layout_custom_config?: Record<string, unknown> | string | null;
124
158
  picture_classification_preset?: string | null;
125
159
  picture_classification_custom_config?: Record<string, unknown> | string | null;
160
+ /** Use compact table format without column padding in markdown output. */
161
+ md_compact_tables?: boolean;
126
162
  abort_on_error?: boolean;
127
163
  document_timeout?: number | null;
164
+ /**
165
+ * Inline chunker configuration. Mutually exclusive with chunking_preset.
166
+ * Discriminated by a `chunker` field: "hybrid" | "hierarchical".
167
+ */
168
+ chunking_options?: (HybridChunkingOptions & {
169
+ chunker: 'hybrid';
170
+ }) | (HierarchicalChunkingOptions & {
171
+ chunker: 'hierarchical';
172
+ }) | null;
173
+ /**
174
+ * Preset ID for chunking (e.g. "granite_embedding_278m", "minilm_l6", "hierarchical").
175
+ * Mutually exclusive with chunking_options.
176
+ */
177
+ chunking_preset?: string | null;
128
178
  }
129
179
  interface HttpSource {
130
180
  kind: 'http';
@@ -153,8 +203,10 @@ interface PutTarget {
153
203
  interface S3Coordinates {
154
204
  endpoint: string;
155
205
  verify_ssl?: boolean;
156
- access_key: string;
157
- secret_key: string;
206
+ /** AWS region of the S3 bucket, e.g. 'us-east-2'. Required for correctly signed presigned URLs against real AWS S3 buckets. */
207
+ region?: string | null;
208
+ access_key?: string | null;
209
+ secret_key?: string | null;
158
210
  bucket: string;
159
211
  key_prefix?: string;
160
212
  max_num_elements?: number | null;
@@ -534,7 +586,7 @@ interface FetchTransportOptions {
534
586
  }
535
587
  declare class FetchTransport implements DoclingTransport {
536
588
  #private;
537
- constructor(optionsOrFetch?: FetchTransportOptions | FetchLike | undefined);
589
+ constructor(optionsOrFetch?: FetchTransportOptions | FetchLike);
538
590
  request<T>(request: DoclingTransportRequest): Promise<T>;
539
591
  }
540
592
 
@@ -862,4 +914,4 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
862
914
  declare function appendFormValue(form: FormData, key: string, value: unknown): void;
863
915
  declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
864
916
 
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, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
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 };
package/dist/index.d.ts CHANGED
@@ -67,6 +67,22 @@ interface VlmModelApi {
67
67
  response_format: VlmResponseFormat;
68
68
  temperature?: number;
69
69
  }
70
+ /**
71
+ * Fine-tuning options for PDF heading-hierarchy inference, applied when
72
+ * `do_pdf_heading_hierarchy` is enabled.
73
+ *
74
+ * Mirrors Python's `HeadingHierarchyOptions`.
75
+ */
76
+ interface HeadingHierarchyOptions {
77
+ /** Use PDF bookmarks/table-of-contents for heading levels. Default: true. */
78
+ use_bookmarks?: boolean;
79
+ /** Use outline numbering (e.g. "1.2.3 Title") for heading levels. Default: true. */
80
+ use_outline_levels?: boolean;
81
+ /** Use font-style differences for heading levels. Default: true. */
82
+ use_style?: boolean;
83
+ /** Maximum inferred heading depth. Default: 6. */
84
+ max_level?: number;
85
+ }
70
86
  /**
71
87
  * Common Docling Serve conversion controls.
72
88
  *
@@ -90,6 +106,14 @@ interface ConvertDocumentsOptions {
90
106
  table_mode?: TableMode;
91
107
  table_cell_matching?: boolean;
92
108
  do_table_structure?: boolean;
109
+ /**
110
+ * If enabled, section-header levels are inferred for PDF and image inputs
111
+ * processed by the standard pipeline. When disabled every heading stays at
112
+ * level 1 (flat hierarchy). Default: false.
113
+ */
114
+ do_pdf_heading_hierarchy?: boolean;
115
+ /** Fine-tuning of the heading-level inference. Applied when do_pdf_heading_hierarchy is enabled. */
116
+ pdf_heading_hierarchy_options?: HeadingHierarchyOptions;
93
117
  image_export_mode?: ImageExportMode;
94
118
  images_scale?: number;
95
119
  include_images?: boolean;
@@ -100,6 +124,16 @@ interface ConvertDocumentsOptions {
100
124
  do_picture_classification?: boolean;
101
125
  do_picture_description?: boolean;
102
126
  do_chart_extraction?: boolean;
127
+ /**
128
+ * Preset ID for chart extraction (e.g. "default", "granite_vision_v4", "granite_vision").
129
+ * Mutually exclusive with chart_extraction_custom_config.
130
+ */
131
+ chart_extraction_preset?: string | null;
132
+ /**
133
+ * Custom chart extraction configuration. Accepts a ChartExtractionVlmEngineOptions-equivalent
134
+ * dict. Only available when the admin allows it. Mutually exclusive with chart_extraction_preset.
135
+ */
136
+ chart_extraction_custom_config?: Record<string, unknown> | null;
103
137
  picture_description_area_threshold?: number;
104
138
  /** @deprecated Prefer picture_description_preset or picture_description_custom_config. */
105
139
  picture_description_local?: PictureDescriptionLocal | null;
@@ -123,8 +157,24 @@ interface ConvertDocumentsOptions {
123
157
  layout_custom_config?: Record<string, unknown> | string | null;
124
158
  picture_classification_preset?: string | null;
125
159
  picture_classification_custom_config?: Record<string, unknown> | string | null;
160
+ /** Use compact table format without column padding in markdown output. */
161
+ md_compact_tables?: boolean;
126
162
  abort_on_error?: boolean;
127
163
  document_timeout?: number | null;
164
+ /**
165
+ * Inline chunker configuration. Mutually exclusive with chunking_preset.
166
+ * Discriminated by a `chunker` field: "hybrid" | "hierarchical".
167
+ */
168
+ chunking_options?: (HybridChunkingOptions & {
169
+ chunker: 'hybrid';
170
+ }) | (HierarchicalChunkingOptions & {
171
+ chunker: 'hierarchical';
172
+ }) | null;
173
+ /**
174
+ * Preset ID for chunking (e.g. "granite_embedding_278m", "minilm_l6", "hierarchical").
175
+ * Mutually exclusive with chunking_options.
176
+ */
177
+ chunking_preset?: string | null;
128
178
  }
129
179
  interface HttpSource {
130
180
  kind: 'http';
@@ -153,8 +203,10 @@ interface PutTarget {
153
203
  interface S3Coordinates {
154
204
  endpoint: string;
155
205
  verify_ssl?: boolean;
156
- access_key: string;
157
- secret_key: string;
206
+ /** AWS region of the S3 bucket, e.g. 'us-east-2'. Required for correctly signed presigned URLs against real AWS S3 buckets. */
207
+ region?: string | null;
208
+ access_key?: string | null;
209
+ secret_key?: string | null;
158
210
  bucket: string;
159
211
  key_prefix?: string;
160
212
  max_num_elements?: number | null;
@@ -534,7 +586,7 @@ interface FetchTransportOptions {
534
586
  }
535
587
  declare class FetchTransport implements DoclingTransport {
536
588
  #private;
537
- constructor(optionsOrFetch?: FetchTransportOptions | FetchLike | undefined);
589
+ constructor(optionsOrFetch?: FetchTransportOptions | FetchLike);
538
590
  request<T>(request: DoclingTransportRequest): Promise<T>;
539
591
  }
540
592
 
@@ -862,4 +914,4 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
862
914
  declare function appendFormValue(form: FormData, key: string, value: unknown): void;
863
915
  declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
864
916
 
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, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
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 };
package/dist/index.js CHANGED
@@ -131,7 +131,7 @@ var ArtifactDownloader = class {
131
131
  "No fetch implementation is available for artifact downloads"
132
132
  );
133
133
  }
134
- this.#fetch = options.fetch ?? globalThis.fetch;
134
+ this.#fetch = options.fetch ?? globalThis.fetch?.bind(globalThis);
135
135
  this.#resolver = options.resolver ?? resolveAllAddresses;
136
136
  this.#allowPrivateUrls = options.allowPrivateUrls ?? false;
137
137
  this.#timeoutMs = options.timeoutMs ?? 6e4;
@@ -1065,6 +1065,11 @@ function validateOptionExclusivity(options) {
1065
1065
  }
1066
1066
  for (const [name, preset, custom] of [
1067
1067
  ["code_formula", options.code_formula_preset, options.code_formula_custom_config],
1068
+ [
1069
+ "chart_extraction",
1070
+ options.chart_extraction_preset,
1071
+ options.chart_extraction_custom_config
1072
+ ],
1068
1073
  ["layout", options.layout_preset, options.layout_custom_config],
1069
1074
  [
1070
1075
  "picture_classification",
@@ -1083,6 +1088,11 @@ function validateOptionExclusivity(options) {
1083
1088
  "ocr_preset and ocr_custom_config are mutually exclusive"
1084
1089
  );
1085
1090
  }
1091
+ if (options.chunking_preset !== void 0 && options.chunking_preset !== null && options.chunking_options !== void 0 && options.chunking_options !== null) {
1092
+ throw new DoclingProtocolError(
1093
+ "chunking_preset and chunking_options are mutually exclusive"
1094
+ );
1095
+ }
1086
1096
  }
1087
1097
  function applyPageLimits(options, pageRange, maxNumPages) {
1088
1098
  let effectiveRange = pageRange ?? options.page_range;
@@ -1382,6 +1392,7 @@ var BOOLEAN_OPTIONS = [
1382
1392
  "force_ocr",
1383
1393
  "table_cell_matching",
1384
1394
  "do_table_structure",
1395
+ "do_pdf_heading_hierarchy",
1385
1396
  "include_images",
1386
1397
  "include_page_images",
1387
1398
  "do_code_enrichment",
@@ -1389,7 +1400,8 @@ var BOOLEAN_OPTIONS = [
1389
1400
  "do_picture_classification",
1390
1401
  "do_chart_extraction",
1391
1402
  "do_picture_description",
1392
- "abort_on_error"
1403
+ "abort_on_error",
1404
+ "md_compact_tables"
1393
1405
  ];
1394
1406
  var NUMBER_OPTIONS = [
1395
1407
  "document_timeout",
@@ -1403,15 +1415,18 @@ var STRING_OPTIONS = [
1403
1415
  "vlm_pipeline_preset",
1404
1416
  "picture_description_preset",
1405
1417
  "code_formula_preset",
1418
+ "chart_extraction_preset",
1406
1419
  "table_structure_preset",
1407
1420
  "layout_preset",
1408
- "picture_classification_preset"
1421
+ "picture_classification_preset",
1422
+ "chunking_preset"
1409
1423
  ];
1410
1424
  var RECORD_OPTIONS = [
1411
1425
  "ocr_custom_config",
1412
1426
  "vlm_pipeline_custom_config",
1413
1427
  "picture_description_custom_config",
1414
1428
  "code_formula_custom_config",
1429
+ "chart_extraction_custom_config",
1415
1430
  "table_structure_custom_config",
1416
1431
  "layout_custom_config",
1417
1432
  "picture_classification_custom_config",
@@ -1567,15 +1582,16 @@ var FetchTransport = class {
1567
1582
  #timeoutMs;
1568
1583
  #backoffBaseMs;
1569
1584
  #sleep;
1570
- constructor(optionsOrFetch = globalThis.fetch) {
1585
+ constructor(optionsOrFetch) {
1571
1586
  const options = typeof optionsOrFetch === "function" ? { fetch: optionsOrFetch } : optionsOrFetch;
1572
- const fetchImplementation = options?.fetch ?? globalThis.fetch;
1587
+ const userFetch = options?.fetch;
1588
+ const fetchImplementation = userFetch ?? globalThis.fetch;
1573
1589
  if (fetchImplementation === void 0) {
1574
1590
  throw new DoclingProtocolError(
1575
1591
  "No fetch implementation is available; provide a DoclingTransport"
1576
1592
  );
1577
1593
  }
1578
- this.#fetch = fetchImplementation;
1594
+ this.#fetch = userFetch ? fetchImplementation : fetchImplementation.bind(globalThis);
1579
1595
  this.#retries = validateNonNegativeInteger(options?.retries ?? 3, "retries");
1580
1596
  this.#timeoutMs = validatePositiveNumber(options?.timeoutMs ?? 6e4, "timeoutMs");
1581
1597
  this.#backoffBaseMs = validatePositiveNumber(
@@ -3767,13 +3783,11 @@ function validateKnownConnector(value, role) {
3767
3783
  return;
3768
3784
  }
3769
3785
  if (value.kind === "s3") {
3770
- requireStringFields(
3771
- fields,
3772
- ["endpoint", "access_key", "secret_key", "bucket", "key_prefix"],
3773
- role,
3774
- true
3775
- );
3786
+ requireStringFields(fields, ["endpoint", "bucket", "key_prefix"], role, true);
3776
3787
  validateOptionalBoolean(fields.verify_ssl, `${role} verify_ssl`);
3788
+ validateOptionalString2(fields.region, `${role} region`);
3789
+ validateOptionalString2(fields.access_key, `${role} access_key`);
3790
+ validateOptionalString2(fields.secret_key, `${role} secret_key`);
3777
3791
  validatePositiveMaxElements(fields.max_num_elements, role);
3778
3792
  return;
3779
3793
  }