Skip to content

feat: add include_provenance option to chunk endpoints#647

Open
pablopupo wants to merge 1 commit into
docling-project:mainfrom
pablopupo:feat/613-chunk-provenance
Open

feat: add include_provenance option to chunk endpoints#647
pablopupo wants to merge 1 commit into
docling-project:mainfrom
pablopupo:feat/613-chunk-provenance

Conversation

@pablopupo

Copy link
Copy Markdown

The chunk endpoints return doc_items as bare JSON pointer refs, so bounding boxes and page numbers are not available without re-running the conversion and resolving the refs client side. This adds an opt-in include_provenance chunking option (chunking_include_provenance as form field) to the synchronous chunk endpoints. When set, each doc_items entry is returned as an object with self_ref, label and the resolved prov array (page_no, bbox, charspan). The flag is off by default and the existing response shape is unchanged.

The endpoints ask the worker for the converted document, resolve the refs against it when building the response, and drop the document again unless the client requested it with include_converted_doc. Long term this could live in docling-jobkit's chunker serialization instead (happy to follow up there if you prefer that route).

Tests cover both hybrid endpoints with the flag on and off.

Issue resolved by this Pull Request:
Resolves #613

The synchronous chunk endpoints can now return each doc_items entry as an
object with self_ref, label and the resolved prov array (page_no, bbox,
charspan) instead of a bare JSON pointer reference. The flag is opt-in and
off by default, so the existing response shape is unchanged.

Signed-off-by: pablopupo <145598901+pablopupo@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @pablopupo, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

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.

Include provenance (bbox + page_no) inline in chunk endpoint response

1 participant