@docling/docling-client 2.151.1 → 2.153.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
@@ -97,6 +97,16 @@ interface HeadingHierarchyOptions {
97
97
  style_size_tolerance?: number;
98
98
  /** Optional override of numbering-scheme precedence (highest level first). Default: null. */
99
99
  numbering_schemes?: string[] | null;
100
+ /**
101
+ * Extra keyword markers for the numbering signal, as a mapping from a scheme
102
+ * family to its words, for documents that are not in English. Empty by default.
103
+ */
104
+ numbering_keywords?: Record<string, string[]> | null;
105
+ /**
106
+ * Extra number words that count as the enumerator after a keyword marker, in
107
+ * addition to the English ones ('one', 'first', ...). Empty by default.
108
+ */
109
+ numbering_number_words?: string[] | null;
100
110
  /** Maximum inferred heading depth. Default: 6. */
101
111
  max_level?: number;
102
112
  /** Minimum normalized title-similarity (0..1) for bookmark matches. Default: 0.8. */
@@ -112,7 +122,12 @@ interface ConvertDocumentsOptions {
112
122
  [key: string]: unknown;
113
123
  from_formats?: InputFormat[];
114
124
  to_formats?: OutputFormat[];
115
- pipeline?: ProcessingPipeline;
125
+ /**
126
+ * Choose the pipeline to process PDF or image files.
127
+ * If not set (or null), the server uses its default pipeline
128
+ * (`standard` unless the administrator configured another one).
129
+ */
130
+ pipeline?: ProcessingPipeline | null;
116
131
  /**
117
132
  * Only convert a range of pages (1-based, inclusive). The service default
118
133
  * is the whole document, which the client never sends explicitly.
@@ -841,10 +856,19 @@ declare function watchTask(options: WatchTaskOptions): AsyncGenerator<TaskStatus
841
856
 
842
857
  declare const DEFAULT_MAX_CONCURRENCY = 8;
843
858
  declare const MAX_CONCURRENCY_LIMIT = 512;
859
+ declare const ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER = "Accept-Docling-Document-Version";
844
860
  interface DoclingClientOptions {
845
861
  baseUrl: string;
846
862
  apiKey?: string;
847
863
  headers?: Record<string, string>;
864
+ /**
865
+ * Newest DoclingDocument schema version this application can read, for
866
+ * example `CURRENT_VERSION` from `@docling/docling-core`. When set, it is sent
867
+ * on every HTTP request as `Accept-Docling-Document-Version` so the service
868
+ * can down-project newer documents. Python always sends its installed
869
+ * docling-core version; this client stays schema-neutral, so it is opt-in.
870
+ */
871
+ acceptDocumentVersion?: string;
848
872
  transport?: DoclingTransport;
849
873
  fetch?: FetchLike;
850
874
  httpRetries?: number;
@@ -1132,5 +1156,5 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
1132
1156
  declare function appendFormValue(form: FormData, key: string, value: unknown): void;
1133
1157
  declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
1134
1158
 
1135
- export { ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
1159
+ export { ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER, ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
1136
1160
  export type { AnyHttpSourceRequest, ArtifactAddressResolver, ArtifactDownloaderOptions, ArtifactRef, ArtifactType, AutoSubmitResult, AzureBlobCoordinates, AzureBlobSource, AzureBlobSourceRequest, AzureBlobTarget, BaseChunkDocumentsRequest, BaseChunkerOptions, BaseChunkingOptions, BaseProgress, BatchConvertSourcesRequest, BatchResultForTarget, BatchSource, BatchSourceRequestInput, BatchSourceRequestItem, BatchSubmitCallOptions, BatchTarget, BatchTargetRequest, BatchTargetRequestInput, BinaryFileSource, CallbackSpec, ChunkCallOptions, ChunkDocumentResponse, ChunkSourceOptions, ChunkSourcesRequest, ChunkedDocumentResult, ChunkedDocumentResultItem, ChunkingExportOptions, ChunkingOptionType, ClearResponse, ConfidenceScores, ConversionInput, ConversionItem, ConversionResult, ConversionSource, ConversionSourceInput, ConversionStatus, ConvertAllOptions, ConvertDocumentErrorResponse, ConvertDocumentResponse, ConvertDocumentResult, ConvertDocumentsOptions, ConvertDocumentsRequest, ConvertOptions, ConvertSourcesRequest, ConvertedOutcomeCountsMixin, DoclingBinaryResponse, DoclingClientOptions, DoclingComponentType, DoclingDocument, DoclingRequestBodyType, DoclingResponseType, DoclingTaskResult, DoclingTransport, DoclingTransportRequest, DocumentArtifactItem, DocumentCompletedItem, DocumentLimits, DocumentResultItem, ErrorItem, ExportDocumentResponse, ExportResult, FailureCategory, FailurePhase, FetchLike, FetchTransportOptions, FileSource, FileSourceRequest, GenericChunkDocumentsRequest, GenericSource, GenericSourceRequest, GenericTarget, GenericTargetRequest, GoogleCloudStorageCoordinates, GoogleCloudStorageServiceAccountInfo, GoogleCloudStorageSource, GoogleCloudStorageSourceRequest, GoogleCloudStorageTarget, GoogleDriveCoordinates, GoogleDriveCredentials, GoogleDriveSource, GoogleDriveSourceRequest, GoogleDriveTarget, HeadingHierarchyOptions, HealthCheckResponse, HierarchicalChunkSourcesRequest, HierarchicalChunkerOptions, HierarchicalChunkingOptions, HttpSource, HttpSourceRequest, HybridChunkSourcesRequest, HybridChunkerOptions, HybridChunkingOptions, ImageExportMode, ImageRefMode, InBodyConversionResponse, InBodyTarget, InferenceFramework, InputFormat, KnownBatchSourceRequestItem, KnownBatchTargetRequest, LegacyVlmModelType, MessageKind, NormalizedJsonSource, NormalizedMultipartSource, NormalizedSource, OutcomeCounts, OutputFormat, ParsedOrigin, PdfBackend, PictureClassificationLabel, PictureDescriptionApi, PictureDescriptionLocal, PresignedArtifactResult, PresignedUrlConvertDocumentResponse, PresignedUrlConvertResponse, PresignedUrlTarget, ProcessedDocsItem, ProcessingPipeline, ProfilingItem, ProfilingScope, ProgressCallbackRequest, ProgressCallbackResponse, ProgressDocumentCompleted, ProgressKind, ProgressSetNumDocs, ProgressTaskCompleted, ProgressUpdateProcessed, PublicFailureInfo, PutTarget, QualityGrade, RawServiceResult, ReadinessResponse, RemoteTargetResponse, RemoteTargetResult, ResponseFormat, ResultType, S3Coordinates, S3Source, S3SourceRequest, S3Target, SourceRequestItem, StorageTarget, SubmitAndRetrieveOptions, SubmitCallOptions, SubmitResultForTarget, SubmitSourceOptions, SubmitTarget, TableFormerMode, TableMode, Target, TargetRequest, TaskFailureResult, TaskProcessingMeta, TaskStatus, TaskStatusResponse, TaskType, TransformersModelType, UsageLimitExceededDetails, UsageLimitExceededResponse, VlmInferenceFramework, VlmModelApi, VlmModelLocal, VlmModelType, VlmResponseFormat, WaitForTaskOptions, WatchTaskOptions, WebSocketFactory, WebSocketFactoryOptions, WebSocketLike, WebsocketMessage, ZipArchiveResult, ZipTarget };
package/dist/index.d.ts CHANGED
@@ -97,6 +97,16 @@ interface HeadingHierarchyOptions {
97
97
  style_size_tolerance?: number;
98
98
  /** Optional override of numbering-scheme precedence (highest level first). Default: null. */
99
99
  numbering_schemes?: string[] | null;
100
+ /**
101
+ * Extra keyword markers for the numbering signal, as a mapping from a scheme
102
+ * family to its words, for documents that are not in English. Empty by default.
103
+ */
104
+ numbering_keywords?: Record<string, string[]> | null;
105
+ /**
106
+ * Extra number words that count as the enumerator after a keyword marker, in
107
+ * addition to the English ones ('one', 'first', ...). Empty by default.
108
+ */
109
+ numbering_number_words?: string[] | null;
100
110
  /** Maximum inferred heading depth. Default: 6. */
101
111
  max_level?: number;
102
112
  /** Minimum normalized title-similarity (0..1) for bookmark matches. Default: 0.8. */
@@ -112,7 +122,12 @@ interface ConvertDocumentsOptions {
112
122
  [key: string]: unknown;
113
123
  from_formats?: InputFormat[];
114
124
  to_formats?: OutputFormat[];
115
- pipeline?: ProcessingPipeline;
125
+ /**
126
+ * Choose the pipeline to process PDF or image files.
127
+ * If not set (or null), the server uses its default pipeline
128
+ * (`standard` unless the administrator configured another one).
129
+ */
130
+ pipeline?: ProcessingPipeline | null;
116
131
  /**
117
132
  * Only convert a range of pages (1-based, inclusive). The service default
118
133
  * is the whole document, which the client never sends explicitly.
@@ -841,10 +856,19 @@ declare function watchTask(options: WatchTaskOptions): AsyncGenerator<TaskStatus
841
856
 
842
857
  declare const DEFAULT_MAX_CONCURRENCY = 8;
843
858
  declare const MAX_CONCURRENCY_LIMIT = 512;
859
+ declare const ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER = "Accept-Docling-Document-Version";
844
860
  interface DoclingClientOptions {
845
861
  baseUrl: string;
846
862
  apiKey?: string;
847
863
  headers?: Record<string, string>;
864
+ /**
865
+ * Newest DoclingDocument schema version this application can read, for
866
+ * example `CURRENT_VERSION` from `@docling/docling-core`. When set, it is sent
867
+ * on every HTTP request as `Accept-Docling-Document-Version` so the service
868
+ * can down-project newer documents. Python always sends its installed
869
+ * docling-core version; this client stays schema-neutral, so it is opt-in.
870
+ */
871
+ acceptDocumentVersion?: string;
848
872
  transport?: DoclingTransport;
849
873
  fetch?: FetchLike;
850
874
  httpRetries?: number;
@@ -1132,5 +1156,5 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
1132
1156
  declare function appendFormValue(form: FormData, key: string, value: unknown): void;
1133
1157
  declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
1134
1158
 
1135
- export { ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
1159
+ export { ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER, ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
1136
1160
  export type { AnyHttpSourceRequest, ArtifactAddressResolver, ArtifactDownloaderOptions, ArtifactRef, ArtifactType, AutoSubmitResult, AzureBlobCoordinates, AzureBlobSource, AzureBlobSourceRequest, AzureBlobTarget, BaseChunkDocumentsRequest, BaseChunkerOptions, BaseChunkingOptions, BaseProgress, BatchConvertSourcesRequest, BatchResultForTarget, BatchSource, BatchSourceRequestInput, BatchSourceRequestItem, BatchSubmitCallOptions, BatchTarget, BatchTargetRequest, BatchTargetRequestInput, BinaryFileSource, CallbackSpec, ChunkCallOptions, ChunkDocumentResponse, ChunkSourceOptions, ChunkSourcesRequest, ChunkedDocumentResult, ChunkedDocumentResultItem, ChunkingExportOptions, ChunkingOptionType, ClearResponse, ConfidenceScores, ConversionInput, ConversionItem, ConversionResult, ConversionSource, ConversionSourceInput, ConversionStatus, ConvertAllOptions, ConvertDocumentErrorResponse, ConvertDocumentResponse, ConvertDocumentResult, ConvertDocumentsOptions, ConvertDocumentsRequest, ConvertOptions, ConvertSourcesRequest, ConvertedOutcomeCountsMixin, DoclingBinaryResponse, DoclingClientOptions, DoclingComponentType, DoclingDocument, DoclingRequestBodyType, DoclingResponseType, DoclingTaskResult, DoclingTransport, DoclingTransportRequest, DocumentArtifactItem, DocumentCompletedItem, DocumentLimits, DocumentResultItem, ErrorItem, ExportDocumentResponse, ExportResult, FailureCategory, FailurePhase, FetchLike, FetchTransportOptions, FileSource, FileSourceRequest, GenericChunkDocumentsRequest, GenericSource, GenericSourceRequest, GenericTarget, GenericTargetRequest, GoogleCloudStorageCoordinates, GoogleCloudStorageServiceAccountInfo, GoogleCloudStorageSource, GoogleCloudStorageSourceRequest, GoogleCloudStorageTarget, GoogleDriveCoordinates, GoogleDriveCredentials, GoogleDriveSource, GoogleDriveSourceRequest, GoogleDriveTarget, HeadingHierarchyOptions, HealthCheckResponse, HierarchicalChunkSourcesRequest, HierarchicalChunkerOptions, HierarchicalChunkingOptions, HttpSource, HttpSourceRequest, HybridChunkSourcesRequest, HybridChunkerOptions, HybridChunkingOptions, ImageExportMode, ImageRefMode, InBodyConversionResponse, InBodyTarget, InferenceFramework, InputFormat, KnownBatchSourceRequestItem, KnownBatchTargetRequest, LegacyVlmModelType, MessageKind, NormalizedJsonSource, NormalizedMultipartSource, NormalizedSource, OutcomeCounts, OutputFormat, ParsedOrigin, PdfBackend, PictureClassificationLabel, PictureDescriptionApi, PictureDescriptionLocal, PresignedArtifactResult, PresignedUrlConvertDocumentResponse, PresignedUrlConvertResponse, PresignedUrlTarget, ProcessedDocsItem, ProcessingPipeline, ProfilingItem, ProfilingScope, ProgressCallbackRequest, ProgressCallbackResponse, ProgressDocumentCompleted, ProgressKind, ProgressSetNumDocs, ProgressTaskCompleted, ProgressUpdateProcessed, PublicFailureInfo, PutTarget, QualityGrade, RawServiceResult, ReadinessResponse, RemoteTargetResponse, RemoteTargetResult, ResponseFormat, ResultType, S3Coordinates, S3Source, S3SourceRequest, S3Target, SourceRequestItem, StorageTarget, SubmitAndRetrieveOptions, SubmitCallOptions, SubmitResultForTarget, SubmitSourceOptions, SubmitTarget, TableFormerMode, TableMode, Target, TargetRequest, TaskFailureResult, TaskProcessingMeta, TaskStatus, TaskStatusResponse, TaskType, TransformersModelType, UsageLimitExceededDetails, UsageLimitExceededResponse, VlmInferenceFramework, VlmModelApi, VlmModelLocal, VlmModelType, VlmResponseFormat, WaitForTaskOptions, WatchTaskOptions, WebSocketFactory, WebSocketFactoryOptions, WebSocketLike, WebsocketMessage, ZipArchiveResult, ZipTarget };
package/dist/index.js CHANGED
@@ -2106,7 +2106,7 @@ var JSON_STRING_CONFIG_OPTIONS = [
2106
2106
  "chart_extraction_custom_config"
2107
2107
  ];
2108
2108
  function validateStringEnum(value, allowed, name) {
2109
- if (value !== void 0 && !allowed.has(value)) {
2109
+ if (value !== void 0 && value !== null && !allowed.has(value)) {
2110
2110
  throw new DoclingProtocolError(`${name} contains an unsupported value`);
2111
2111
  }
2112
2112
  }
@@ -2920,6 +2920,7 @@ function isRecord3(value) {
2920
2920
  var DEFAULT_JOB_TIMEOUT_MS = 3e5;
2921
2921
  var DEFAULT_MAX_CONCURRENCY = 8;
2922
2922
  var MAX_CONCURRENCY_LIMIT = 512;
2923
+ var ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER = "Accept-Docling-Document-Version";
2923
2924
  var DoclingClient = class {
2924
2925
  #baseUrl;
2925
2926
  #apiKey;
@@ -2942,6 +2943,9 @@ var DoclingClient = class {
2942
2943
  this.#headers = {
2943
2944
  accept: "application/json",
2944
2945
  ...normalizeHeaders(options.headers),
2946
+ ...options.acceptDocumentVersion === void 0 ? {} : {
2947
+ [ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER.toLowerCase()]: validateDocumentVersion(options.acceptDocumentVersion)
2948
+ },
2945
2949
  ...this.#apiKey === "" ? {} : { "x-api-key": this.#apiKey }
2946
2950
  };
2947
2951
  if (options.transport !== void 0 && (options.fetch !== void 0 || options.httpRetries !== void 0 || options.httpTimeoutMs !== void 0 || options.httpBackoffBaseMs !== void 0)) {
@@ -4763,6 +4767,14 @@ function normalizeHeaders(headers) {
4763
4767
  Object.entries(headers ?? {}).map(([name, value]) => [name.toLowerCase(), value])
4764
4768
  );
4765
4769
  }
4770
+ function validateDocumentVersion(value) {
4771
+ if (typeof value !== "string" || !/^[!-~]+$/.test(value)) {
4772
+ throw new DoclingProtocolError(
4773
+ "acceptDocumentVersion must be a non-empty visible ASCII string"
4774
+ );
4775
+ }
4776
+ return value;
4777
+ }
4766
4778
  function positiveNumber(value, name) {
4767
4779
  if (!Number.isFinite(value) || value <= 0) {
4768
4780
  throw new DoclingProtocolError(`${name} must be a positive number`);
@@ -4828,6 +4840,7 @@ function isRecord4(value) {
4828
4840
  return value !== null && typeof value === "object" && !Array.isArray(value);
4829
4841
  }
4830
4842
  export {
4843
+ ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER,
4831
4844
  ArtifactDownloader,
4832
4845
  ChunkerKind,
4833
4846
  ChunkerType,