Skip to content

feat(api): map the remaining ConvertDocumentsOptions properties - #825

Merged
edeandrea merged 5 commits into
docling-project:mainfrom
edeandrea:feat/convert-options-stage-presets
Dec 1, 2026
Merged

edeandrea merged 5 commits into
docling-project:mainfrom
edeandrea:feat/convert-options-stage-presets

Conversation

@edeandrea

Copy link
Copy Markdown
Contributor

What

Maps the remaining ConvertDocumentsOptions properties that Docling Serve exposes but docling-java did not model — 19 in total.

Eight per-stage preset / custom-config pairs

Stage Preset Custom config
Layout layoutPreset layoutCustomConfig
OCR ocrPreset ocrCustomConfig
Table structure tableStructurePreset tableStructureCustomConfig
Picture description pictureDescriptionPreset pictureDescriptionCustomConfig
Picture classification pictureClassificationPreset pictureClassificationCustomConfig
Code & formula codeFormulaPreset codeFormulaCustomConfig
Chart extraction chartExtractionPreset chartExtractionCustomConfig
VLM pipeline vlmPipelinePreset vlmPipelineCustomConfig

Three standalone flags — doChartExtraction, includePageImages, mdCompactTables.

Design notes

Presets are String, not enums. The valid ids are registered by the deployment, not fixed by the library. Verified against a running v1.35.0: ocrPreset("tesseract") fails because Tesseract is not installed in that image, while auto and easyocr work. An enum would hand callers constants that compile and then fail at runtime on one image but not another.

Custom configs are Map<String, Object>. The server types them dict[str, Any], the kind discriminator selects from an open registry ({"kind": "custom_table_model", "model_path": "..."} is one of its own examples), and values are heterogeneous within a single map — String, List<String>, Boolean, Double, and nested objects. JsonNode is not an option here: this module supports Jackson 2 and 3 with both compileOnly, and the two JsonNode types are unrelated, so either one in the signature would break dual support.

Deprecations without forRemoval. The six options Docling Serve marks deprecated (ocrEngine, pictureDescriptionLocal, pictureDescriptionApi, vlmPipelineModel*) now carry @Deprecated(since = "0.7.3"), as do the four types reachable only through them (OcrEngine, VlmModelType, PictureDescriptionLocal, PictureDescriptionApi). Lombok copies the annotation onto both the getter and the builder setter, so the warning fires at the call site. They are deliberately not forRemoval: the options still work, and when they go is Docling Serve's call rather than this library's.

Note that upstream deprecates the fields, not the types — marking the four types is an inference from the fact that nothing else in the codebase can reach them.

Also fixed

HeadingHierarchyOptions#getUseStyle() claimed the style fallback "Requires generate_parsed_pages=True in the pipeline options". No such property exists in the schema and the fallback works without it, so the sentence is removed.

Testing

  • 7 new unit tests in ConvertDocumentOptionsTests (11 in the class)
  • 4 new integration tests in AbstractDoclingServeClientTests, against a real v1.35.0 container
  • New fixture 2408.09869-table.pdf — page 5 of the paper already excerpted in the repo, carrying the CPU benchmark table

Two things the integration tests caught that the schema alone would not have:

  1. layoutPreset("docling_layout_default") and tableStructurePreset("tableformer_v2") appear in the server's own OpenAPI examples and are rejected by v1.35.0 with Unknown ... preset. The javadoc and docs now steer callers to "default" and warn that examples are not guaranteed to be registered.
  2. 2408.09869.pdf is a two-page excerpt containing no tables, so mdCompactTables was unobservable against it — hence the new fixture. The assertion keys on the header separator row (|-----| vs | - |) rather than cell padding, because cell padding depends on column alignment.

Full build green: ./gradlew --no-daemon spotlessCheck build.

One known flake unrelated to this change: ChunkTests can time out under load when hybrid chunking downloads its tokenizer on first use. Seen in one full run, all 25 passing on re-run against an unchanged tree.

Out of scope

Deliberately split out, each with its own issue:

Closes #819

Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documentation recommends a preset known to fail on the current image and omits stage-specific custom configuration requirements, potentially leading callers to submit invalid requests.

2 open issues
What changed in this PR

This PR expands Docling Java’s conversion options with 19 properties exposed by Docling Serve, covering stage configuration, chart extraction, page images, and compact Markdown tables.

Changes:

  • Adds eight preset/custom-config pairs and three optional flags.
  • Deprecates six legacy options and four related types without marking them for removal.
  • Adds unit and integration coverage, documents the new options, and corrects heading-hierarchy Javadoc.
File Description
docs/​src/​doc/​docs/​whats-new.md Announces new options and deprecations.
docs/​src/​doc/​docs/​docling-serve/​serve-api.md Documents stage configuration and deployment-specific presets.
docling-serve/​docling-serve-client/​src/​test/​java/​ai/​docling/​serve/​client/​AbstractDoclingServeClientTests.java Tests presets, page images, and compact tables against Docling Serve.
docling-serve/​docling-serve-api/​src/​test/​java/​ai/​docling/​serve/​api/​convert/​request/​options/​ConvertDocumentOptionsTests.java Tests new fields, defaults, map immutability, and builder copying.
docling-serve/​docling-serve-api/​src/​main/​java/​ai/​docling/​serve/​api/​convert/​request/​options/​VlmModelType.java Deprecates the legacy VLM model enum.
docling-serve/​docling-serve-api/​src/​main/​java/​ai/​docling/​serve/​api/​convert/​request/​options/​PictureDescriptionLocal.java Deprecates legacy local picture-description configuration.
docling-serve/​docling-serve-api/​src/​main/​java/​ai/​docling/​serve/​api/​convert/​request/​options/​PictureDescriptionApi.java Deprecates legacy API picture-description configuration.
docling-serve/​docling-serve-api/​src/​main/​java/​ai/​docling/​serve/​api/​convert/​request/​options/​OcrEngine.java Deprecates the OCR enum in favor of deployment-defined presets.
docling-serve/​docling-serve-api/​src/​main/​java/​ai/​docling/​serve/​api/​convert/​request/​options/​HeadingHierarchyOptions.java Removes an incorrect prerequisite from Javadoc only.
docling-serve/​docling-serve-api/​src/​main/​java/​ai/​docling/​serve/​api/​convert/​request/​options/​ConvertDocumentOptions.java Maps 19 properties and marks six legacy options deprecated.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The configuration guidance incorrectly groups stages that also require model_spec and engine_options, leaving incomplete examples in both the API documentation and release notes.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Correct model_spec and engine_options guidance for extraction stages

docs/​src/​doc/​docs/​docling-serve/​serve-api.md:224

Picture description, code/formula and chart extraction also need model_spec and engine_options, so following the kind guidance for those stages produces incomplete configurations (see the upstream default-branch chart options and engine mixin). Restrict the kind group to layout, OCR, table structure and picture classification, and group the other four stages together. Apply the same correction in docs/src/doc/docs/whats-new.md:29.

2 resolved since last review

Review effort: Balanced

Add the eight per-stage preset / custom-config pairs (layout, OCR, table
structure, picture description, picture classification, code & formula,
chart extraction and the VLM pipeline) along with the doChartExtraction,
includePageImages and mdCompactTables flags, bringing ConvertDocumentOptions
up to the ConvertDocumentsOptions schema that Docling Serve exposes.

Presets are plain strings because the available ids are registered by the
deployment rather than fixed by this library, and custom configs are
Map<String, Object> because the server types them as dict[str, Any], the
kind registry is open, and the module has to stay neutral across Jackson 2
and 3.

Mark the six options Docling Serve deprecates, and the four types reachable
only through them, as deprecated without forRemoval: they still work, and
when they go is Docling Serve's decision rather than this library's.

Drop the "Requires generate_parsed_pages=True" sentence from
HeadingHierarchyOptions#getUseStyle(), which does not correspond to any
property of the schema and sent readers hunting for a setter that should
not exist.

Note that several preset ids from the server's own OpenAPI examples, such
as docling_layout_default and tableformer_v2, are not registered in every
Docling Serve build, so the javadoc and docs steer callers to "default".

Convert-side chunking, the missing OutputFormat values and the mistyped
vlmPipelineModelLocal/Api fields are tracked separately in docling-project#821, docling-project#822
and docling-project#823.

Closes docling-project#819

Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
Presets are registered per deployment, and default is not an exception:
code_formula_preset=default is rejected by the v1.35.0 image the
testcontainers module pins. Add it to the warning and stop presenting
default as universally safe.

Also correct the custom-config description, which said a custom config
overrides the preset while the paragraph above it said the two are
mutually exclusive, and generalized the `kind` selector to every stage
even though vlmPipelineCustomConfig takes model_spec and engine_options
instead.

Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
@edeandrea
edeandrea force-pushed the feat/convert-options-stage-presets branch from 193239c to 54cf30c Compare December 1, 2026 16:17
@edeandrea
edeandrea enabled auto-merge (squash) December 1, 2026 16:17
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

:java_duke: JaCoCo coverage report

Overall Project 52.91% 🟢

There is no coverage information present for the Files changed

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
TestsPassed ✅SkippedFailed
Gradle Test Results (all modules & JDKs)2432 ran2432 passed0 skipped0 failed
TestResult
No test annotations available

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documentation misstates which extraction stages require model_spec and engine_options, and the OCR example uses an invalid tesseract_cli implementation identifier.

2 open issues

Review effort: Balanced

@edeandrea
edeandrea disabled auto-merge December 1, 2026 16:31
…oups

The previous wording put seven of the eight stages in the kind group and
only the VLM pipeline outside it. The server schema splits them 4/4:
ocr/layout/table_structure/picture_classification take a dict with a kind
discriminator, while picture_description/code_formula/chart_extraction,
like the VLM pipeline, are typed to VLM engine option models that require
model_spec and engine_options and take no kind.

Add an example for the second group, taken from the server's own
chart_extraction_custom_config example.

Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:32
TesseractCliOcrOptions declares kind "tesseract", not "tesseract_cli".
The Javadoc example came from the server's own OpenAPI example, which is
wrong: the version-compatibility logs in this repo show every probed
image registering 'tesserocr' and 'tesseract' and no 'tesseract_cli'.

Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The conversion API expansion has no active review issues.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:35
@edeandrea
edeandrea enabled auto-merge (squash) December 1, 2026 16:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review identifies no active issues with the conversion API expansion and related deprecations.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@edeandrea
edeandrea merged commit 17bd67b into docling-project:main Dec 1, 2026
28 checks passed
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@edeandrea
edeandrea deleted the feat/convert-options-stage-presets branch December 1, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] Map the remaining ConvertDocumentsOptions properties (per-stage presets/custom configs, chart extraction, page images)

2 participants