Repository navigation
fix(json): a docling-JSON input keeps its pictures' descriptions and classifications - #976
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docling-JSON backend built every picture with
description: Noneandclassification: 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 droppedmeta.description(#975).picture_itemnow reads docling'smeta.description(text,created_by→PictureDescription) andmeta.classification.predictions(→PictureClass), else the deprecateddescription/classificationannotations an older document carries alone; a picture with neither keepsNone. 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=jsonomits 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 returnmeta.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