Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;

import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -66,8 +67,14 @@ public class ConvertDocumentOptions {

/**
* The OCR engine to use. String. Allowed values: auto, easyocr, ocrmac, rapidocr, tesserocr, tesseract. Optional, defaults to easyocr.
*
* <p>Docling Serve marks {@code ocr_engine} as deprecated and synchronizes it onto {@code ocr_preset} when
* {@code ocr_preset} is not set.
*
* @deprecated Docling Serve deprecated {@code ocr_engine}. Use {@link #getOcrPreset()} instead.
*/
@JsonProperty("ocr_engine")
@Deprecated(since = "0.7.3")
@Nullable
private OcrEngine ocrEngine;

Expand All @@ -79,6 +86,23 @@ public class ConvertDocumentOptions {
@lombok.Singular("ocrLang")
private List<String> ocrLang;

/**
* Preset id for the OCR engine, for example {@code auto}, {@code easyocr} or {@code tesseract}. Optional, defaults to {@code auto} on the server. Mutually exclusive with
* {@link #getOcrCustomConfig()}. The set of available presets is controlled by the Docling Serve deployment.
*/
@JsonProperty("ocr_preset")
@Nullable
private String ocrPreset;

/**
* Custom configuration for the OCR engine, used to specify engine-specific options beyond {@link #getOcrLang()}. The {@code kind} entry selects the engine implementation, for
* example {@code easyocr} or {@code tesseract}, and each engine kind has its own configuration schema. Mutually exclusive with {@link #getOcrPreset()}.
*/
@JsonProperty("ocr_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("ocrCustomConfigEntry")
private Map<String, Object> ocrCustomConfig;

/**
* The PDF backend to use. String. Allowed values: pypdfium2, dlparse_v1, dlparse_v2, dlparse_v4. Optional, defaults to dlparse_v4.
*/
Expand All @@ -101,6 +125,44 @@ public class ConvertDocumentOptions {
@Nullable
private Boolean tableCellMatching;

/**
* Preset id for table structure detection. {@code default} selects the deployment-controlled default; the server schema also lists {@code tableformer_v1_accurate},
* {@code tableformer_v1_fast} and {@code tableformer_v2} as examples, but those are not registered in every Docling Serve build. Mutually
* exclusive with {@link #getTableStructureCustomConfig()}. The set of available presets is controlled by the Docling Serve deployment.
*/
@JsonProperty("table_structure_preset")
@Nullable
private String tableStructurePreset;

/**
* Custom configuration for the table structure model. The {@code kind} entry selects the table structure implementation, for example {@code docling_tableformer}, and the
* remaining entries are that implementation's options. When unset, the default kind with its preset configuration is used. Mutually exclusive with
* {@link #getTableStructurePreset()}.
*/
@JsonProperty("table_structure_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("tableStructureCustomConfigEntry")
private Map<String, Object> tableStructureCustomConfig;

/**
* Preset id for layout detection. {@code default} selects the deployment-controlled default; the server schema also lists {@code docling_layout_default} as an example, but it
* is not registered in every Docling Serve build. Mutually exclusive with {@link #getLayoutCustomConfig()}. The set of available presets is controlled by the Docling Serve
* deployment.
*/
@JsonProperty("layout_preset")
@Nullable
private String layoutPreset;

/**
* Custom configuration for the layout model. The {@code kind} entry selects the layout implementation, for example {@code docling_layout_default} or
* {@code layout_object_detection}, and the remaining entries are that implementation's options. When unset, the default kind with its preset configuration is used. Mutually
* exclusive with {@link #getLayoutPreset()}.
*/
@JsonProperty("layout_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("layoutCustomConfigEntry")
private Map<String, Object> layoutCustomConfig;

/**
* Choose the pipeline to process PDF or image files.
*/
Expand Down Expand Up @@ -141,12 +203,20 @@ public class ConvertDocumentOptions {
private Boolean doTableStructure;

/**
* If enabled, images will be extracted from the document. Boolean. Optional, defaults to true.
* If enabled, picture element images are generated and included in the output. Boolean. Optional, defaults to true.
*/
@JsonProperty("include_images")
@Nullable
private Boolean includeImages;

/**
* If enabled, full-page images are generated and included in the output. This is independent of {@link #getIncludeImages()}, which covers picture elements only. Boolean.
* Optional, defaults to false.
*/
@JsonProperty("include_page_images")
@Nullable
private Boolean includePageImages;

/**
* Scale factor for images. Float. Optional, defaults to 2.0.
*/
Expand All @@ -161,6 +231,14 @@ public class ConvertDocumentOptions {
@Nullable
private String mdPageBreakPlaceholder;

/**
* Whether to use a compact table format without column padding in the markdown output. When false (the default), tables use padded columns for better visual formatting. When
* true, tables use minimal whitespace, which is better for large tables and downstream processing. Boolean. Optional, defaults to false.
*/
@JsonProperty("md_compact_tables")
@Nullable
private Boolean mdCompactTables;

/**
* If enabled, perform OCR code enrichment. Boolean. Optional, defaults to false.
*/
Expand All @@ -175,13 +253,71 @@ public class ConvertDocumentOptions {
@Nullable
private Boolean doFormulaEnrichment;

/**
* Preset id for code and formula extraction, for example {@code default}. Mutually exclusive with {@link #getCodeFormulaCustomConfig()}. The set of available presets is
* controlled by the Docling Serve deployment. Applies to {@link #getDoCodeEnrichment()} and {@link #getDoFormulaEnrichment()}.
*/
@JsonProperty("code_formula_preset")
@Nullable
private String codeFormulaPreset;

/**
* Custom code and formula extraction configuration, including the model spec and engine options. Mutually exclusive with {@link #getCodeFormulaPreset()}.
*/
@JsonProperty("code_formula_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("codeFormulaCustomConfigEntry")
private Map<String, Object> codeFormulaCustomConfig;

/**
* If enabled, classify pictures in documents. Boolean. Optional, defaults to false.
*/
@JsonProperty("do_picture_classification")
@Nullable
private Boolean doPictureClassification;

/**
* Preset id for picture classification, for example {@code default} or {@code document_figure_classifier_v2}. Mutually exclusive with
* {@link #getPictureClassificationCustomConfig()}. The set of available presets is controlled by the Docling Serve deployment.
*/
@JsonProperty("picture_classification_preset")
@Nullable
private String pictureClassificationPreset;

/**
* Custom configuration for picture classification. The {@code kind} entry selects the classifier implementation, for example {@code document_picture_classifier}. Mutually
* exclusive with {@link #getPictureClassificationPreset()}.
*/
@JsonProperty("picture_classification_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("pictureClassificationCustomConfigEntry")
private Map<String, Object> pictureClassificationCustomConfig;

/**
* If enabled, extract numeric data from charts. Boolean. Optional, defaults to false.
*/
@JsonProperty("do_chart_extraction")
@Nullable
private Boolean doChartExtraction;

/**
* Preset id for chart extraction. Use {@code default} for the deployment-controlled default, or a specific preset such as {@code granite_vision_v4} or {@code granite_vision}.
* Mutually exclusive with {@link #getChartExtractionCustomConfig()}.
*/
@JsonProperty("chart_extraction_preset")
@Nullable
private String chartExtractionPreset;

/**
* Custom chart extraction configuration, including the model spec and engine options. Entries are {@code model_spec}, {@code engine_options} and the optional output flags
* {@code chart2csv}, {@code chart2summary} and {@code chart2code}. Only available if the Docling Serve deployment allows custom configurations. Mutually exclusive with
* {@link #getChartExtractionPreset()}.
*/
@JsonProperty("chart_extraction_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("chartExtractionCustomConfigEntry")
private Map<String, Object> chartExtractionCustomConfig;

/**
* If enabled, describe pictures in documents. Boolean. Optional, defaults to false.
*/
Expand All @@ -199,41 +335,100 @@ public class ConvertDocumentOptions {
/**
* Options for running a local vision-language model in the picture description. The parameters refer to a model hosted on Hugging Face. This parameter is mutually exclusive with
* picture_description_api.
*
* <p>Docling Serve marks {@code picture_description_local} as deprecated. The replacements cannot be combined with this option.
*
* @deprecated Docling Serve deprecated {@code picture_description_local}. Use {@link #getPictureDescriptionPreset()} or {@link #getPictureDescriptionCustomConfig()} instead.
*/
@JsonProperty("picture_description_local")
@Deprecated(since = "0.7.3")
@Nullable
private PictureDescriptionLocal pictureDescriptionLocal;

/**
* API details for using a vision-language model in the picture description. This parameter is mutually exclusive with picture_description_local.
*
* <p>Docling Serve marks {@code picture_description_api} as deprecated. The replacements cannot be combined with this option.
*
* @deprecated Docling Serve deprecated {@code picture_description_api}. Use {@link #getPictureDescriptionPreset()} or {@link #getPictureDescriptionCustomConfig()} instead.
*/
@JsonProperty("picture_description_api")
@Deprecated(since = "0.7.3")
@Nullable
private PictureDescriptionApi pictureDescriptionApi;

/**
* Preset id for picture description, for example {@code default}, {@code smolvlm} or {@code granite_vision}. Mutually exclusive with
* {@link #getPictureDescriptionCustomConfig()}, and cannot be combined with the deprecated {@link #getPictureDescriptionLocal()} or {@link #getPictureDescriptionApi()}.
*/
@JsonProperty("picture_description_preset")
@Nullable
private String pictureDescriptionPreset;

/**
* Custom picture description configuration, including the model spec and engine options. Mutually exclusive with {@link #getPictureDescriptionPreset()}, and cannot be combined
* with the deprecated {@link #getPictureDescriptionLocal()} or {@link #getPictureDescriptionApi()}.
*/
@JsonProperty("picture_description_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("pictureDescriptionCustomConfigEntry")
private Map<String, Object> pictureDescriptionCustomConfig;

/**
* Preset of local and API models for the vlm pipeline. This parameter is mutually exclusive with vlm_pipeline_model_local and vlm_pipeline_model_api. Use the other options for
* more parameters.
*
* <p>Docling Serve marks {@code vlm_pipeline_model} as deprecated. The replacements cannot be combined with this option.
*
* @deprecated Docling Serve deprecated {@code vlm_pipeline_model}. Use {@link #getVlmPipelinePreset()} or {@link #getVlmPipelineCustomConfig()} instead.
*/
@JsonProperty("vlm_pipeline_model")
@Deprecated(since = "0.7.3")
@Nullable
private VlmModelType vlmPipelineModel;

/**
* Options for running a local vision-language model for the vlm pipeline. The parameters refer to a model hosted on Hugging Face. This parameter is mutually exclusive with
* vlm_pipeline_model_api and vlm_pipeline_model.
*
* <p>Docling Serve marks {@code vlm_pipeline_model_local} as deprecated. The replacements cannot be combined with this option.
*
* @deprecated Docling Serve deprecated {@code vlm_pipeline_model_local}. Use {@link #getVlmPipelinePreset()} or {@link #getVlmPipelineCustomConfig()} instead.
*/
@JsonProperty("vlm_pipeline_model_local")
@Deprecated(since = "0.7.3")
@Nullable
private String vlmPipelineModelLocal;

/**
* API details for using a vision-language model for the vlm pipeline. This parameter is mutually exclusive with vlm_pipeline_model_local and vlm_pipeline_model.
*
* <p>Docling Serve marks {@code vlm_pipeline_model_api} as deprecated. The replacements cannot be combined with this option.
*
* @deprecated Docling Serve deprecated {@code vlm_pipeline_model_api}. Use {@link #getVlmPipelinePreset()} or {@link #getVlmPipelineCustomConfig()} instead.
*/
@JsonProperty("vlm_pipeline_model_api")
@Deprecated(since = "0.7.3")
@Nullable
private String vlmPipelineModelApi;

/**
* Preset id for the VLM pipeline, for example {@code default} or {@code granite_docling}. Use {@code default} for the stable, deployment-controlled configuration. Mutually
* exclusive with {@link #getVlmPipelineCustomConfig()}, and cannot be combined with the deprecated {@code vlmPipelineModel*} options.
*/
@JsonProperty("vlm_pipeline_preset")
@Nullable
private String vlmPipelinePreset;

/**
* Custom VLM pipeline configuration. Must include the {@code model_spec} and {@code engine_options} entries. Only available if the Docling Serve deployment allows custom
* configurations. Mutually exclusive with {@link #getVlmPipelinePreset()}, and cannot be combined with the deprecated {@code vlmPipelineModel*} options.
*/
@JsonProperty("vlm_pipeline_custom_config")
@JsonSetter(nulls = Nulls.AS_EMPTY)
@lombok.Singular("vlmPipelineCustomConfigEntry")
private Map<String, Object> vlmPipelineCustomConfig;

/**
* Whether heading hierarchy inference is enabled. Derived from {@link #getHeadingHierarchyOptions()}
* — {@code true} when options are present, {@code false} otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public class HeadingHierarchyOptions {

/**
* Fall back to the heading's visual style (font size, weight, slant, letter case) when
* neither bookmarks nor numbering provide a level. Requires {@code generate_parsed_pages=True}
* in the pipeline options.
* neither bookmarks nor numbering provide a level.
*
* @param useStyle true to use visual style, or null for the default (true)
* @return the use-style flag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@

/**
* OCR engines supported by Docling.
*
* @deprecated Only used by the deprecated {@code ConvertDocumentOptions.ocrEngine} option. Select the OCR engine with
* {@code ConvertDocumentOptions.ocrPreset} instead, which takes a preset id registered by the Docling Serve deployment.
*/
@Deprecated(since = "0.7.3")
public enum OcrEngine {

@JsonProperty("auto") AUTO,
@JsonProperty("easyocr") EASYOCR,
@JsonProperty("ocrmac") OCRMAC,
@JsonProperty("rapidocr") RAPIDOCR,
@JsonProperty("tesserocr") TESSEROCR,
@JsonProperty("tesseract") TESSERACT
@JsonProperty("auto")
AUTO,
@JsonProperty("easyocr")
EASYOCR,
@JsonProperty("ocrmac")
OCRMAC,
@JsonProperty("rapidocr")
RAPIDOCR,
@JsonProperty("tesserocr")
TESSEROCR,
@JsonProperty("tesseract")
TESSERACT

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
* Configuration options for picture description API integration.
* This class encapsulates settings for making API calls to describe pictures,
* including URL, headers, parameters, timeout, concurrency, and custom prompts.
*
* @deprecated Only used by the deprecated {@code ConvertDocumentOptions.pictureDescriptionApi} option. Use
* {@code ConvertDocumentOptions.pictureDescriptionPreset} or {@code ConvertDocumentOptions.pictureDescriptionCustomConfig} instead.
*/
@Deprecated(since = "0.7.3")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@lombok.extern.jackson.Jacksonized
@lombok.Builder(toBuilder = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
/**
* Configuration for local picture description generation.
* This class contains settings for generating descriptions of pictures using a local model.
*
* @deprecated Only used by the deprecated {@code ConvertDocumentOptions.pictureDescriptionLocal} option. Use
* {@code ConvertDocumentOptions.pictureDescriptionPreset} or {@code ConvertDocumentOptions.pictureDescriptionCustomConfig} instead.
*/
@Deprecated(since = "0.7.3")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@lombok.extern.jackson.Jacksonized
@lombok.Builder(toBuilder = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@

/**
* Local and API models for the VLM pipeline.
*
* @deprecated Only used by the deprecated {@code ConvertDocumentOptions.vlmPipelineModel} option. Use
* {@code ConvertDocumentOptions.vlmPipelinePreset} or {@code ConvertDocumentOptions.vlmPipelineCustomConfig} instead.
*/
@Deprecated(since = "0.7.3")
public enum VlmModelType {

@JsonProperty("smoldocling") SMOLDOCLING,
@JsonProperty("smoldocling_vllm") SMOLDOCLING_VLLM,
@JsonProperty("granite_vision") GRANITE_VISION,
@JsonProperty("granite_vision_vllm") GRANITE_VISION_VLLM,
@JsonProperty("granite_vision_ollama") GRANITE_VISION_OLLAMA,
@JsonProperty("got_ocr_2") GOT_OCR_2
@JsonProperty("smoldocling")
SMOLDOCLING,
@JsonProperty("smoldocling_vllm")
SMOLDOCLING_VLLM,
@JsonProperty("granite_vision")
GRANITE_VISION,
@JsonProperty("granite_vision_vllm")
GRANITE_VISION_VLLM,
@JsonProperty("granite_vision_ollama")
GRANITE_VISION_OLLAMA,
@JsonProperty("got_ocr_2")
GOT_OCR_2

}
Loading