Skip to content

fix(json): a docling-JSON input keeps its pictures' descriptions and classifications - #976

Merged
artiz merged 2 commits into
docling-project:masterfrom
artiz:claude/issue-975
Nov 2, 2026
Merged

artiz merged 2 commits into
docling-project:masterfrom
artiz:claude/issue-975

Conversation

@artiz

@artiz artiz commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

The docling-JSON backend built every picture with description: None and classification: None, so a document that had been through the picture-description pass (or the picture OCR, or docling's own enrichment) lost that text the moment it was fed back in: chunking such a document yielded nothing for its pictures, and a JSON→JSON round trip dropped meta.description (#975).

picture_item now reads docling's meta.description (text, created_by → PictureDescription) and meta.classification.predictions (→ PictureClass), else the deprecated description / classification annotations an older document carries alone; a picture with neither keeps None. The chunker then emits the description as the picture's chunk and the JSON export writes it back the way it came.

Not reproduced: the report's first observation, that docling-serve's to=json omits the descriptions it computed. Checked on this master with a mock vision endpoint against a PDF and a DOCX — the CLI, serve's native sync and async routes and the docling-serve-compatible sync and async routes all return meta.description + the annotation on every picture (crates/docling/tests/picture_description.rs covers the library path). The input-side loss above is the one defect found; if the server output itself still lacks them in some flow, that needs the request.

Closes #975

Claude-Session: https://claude.ai/code/session_01QNSzBK759SLC5oULeR3YeB

artiz and others added 2 commits November 2, 2026 10:22
…classifications

The docling-JSON backend built every picture with `description: None`
and `classification: None`, so a document that had been through the
picture-description pass (or the picture OCR, or docling's own
enrichment) lost that text the moment it was fed back in: chunking such
a document yielded nothing for its pictures, and a JSON→JSON round trip
dropped `meta.description` (docling-project#975).

`picture_item` now reads docling's `meta.description` (`text`,
`created_by` → `PictureDescription`) and `meta.classification.predictions`
(→ `PictureClass`), else the deprecated `description` / `classification`
annotations an older document carries alone; a picture with neither
keeps `None`. The chunker then emits the description as the picture's
chunk and the JSON export writes it back the way it came.

Not reproduced: the report's first observation, that docling-serve's
`to=json` omits the descriptions it computed. Checked on this master
with a mock vision endpoint against a PDF and a DOCX — the CLI, serve's
native sync and async routes and the docling-serve-compatible sync and
async routes all return `meta.description` + the annotation on every
picture (crates/docling/tests/picture_description.rs covers the library
path). The input-side loss above is the one defect found; if the server
output itself still lacks them in some flow, that needs the request.

Refs docling-project#975

Signed-off-by: Artem Kustikov <artem.kustikov@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNSzBK759SLC5oULeR3YeB
…ost descriptions on

The reporter's flow, clarified: docling-serve's `to=json` carries the
descriptions (confirmed), the client loads them into a `DoclingDocument`
and runs `docling_rs.chunking.HybridChunker`, which serializes the
document to docling-JSON and re-imports it natively — through the
backend the previous commit fixed. Reproduced with the pre-fix binary:
a described PDF document chunked with no chunk carrying a description;
with the fix, each picture's description is its chunk, after the caption.

Closes docling-project#975

Signed-off-by: Artem Kustikov <artem.kustikov@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNSzBK759SLC5oULeR3YeB
@artiz
artiz merged commit cb2a78c into docling-project:master Nov 2, 2026
12 checks passed
@artiz
artiz deleted the claude/issue-975 branch November 2, 2026 11:42
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.

json/serve: missing picture description in returned value

1 participant