Skip to content

fix(chunker): respect contextualized table token limits - #690

Open
pablopupo wants to merge 3 commits into
docling-project:mainfrom
pablopupo:fix/3428-contextualized-chunk-limit
Open

fix(chunker): respect contextualized table token limits#690
pablopupo wants to merge 3 commits into
docling-project:mainfrom
pablopupo:fix/3428-contextualized-chunk-limit

Conversation

@pablopupo

@pablopupo pablopupo commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
  • Apply the HybridChunker metadata-adjusted budget when splitting Markdown table rows.
  • Count each fully contextualized chunk and reduce the table budget by its measured overflow.
  • Preserve lossless, terminating line splits when token counts change after prefix concatenation.
  • Add regressions for contextualized overflow, non-additive token boundaries, Unicode prefixes, and table reconstruction.

Resolves docling-project/docling#3428

Verification

  • uv run --no-sync pytest --cov=docling_core --cov-report=xml test: 604 passed, 6 skipped
  • pre-commit run --all-files
  • .github/scripts/build-packages.sh
  • Supplied PDF: maximum contextualized chunk 8,189 / 8,192; both tables reconstructed byte-for-byte

@github-actions

Copy link
Copy Markdown
Contributor

DCO Check Passed

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

@mergify

mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

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)(?:\(.+\))?(!)?:

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pablopupo
pablopupo force-pushed the fix/3428-contextualized-chunk-limit branch from c95ce2f to e6284ac Compare August 4, 2026 18:43
@pablopupo
pablopupo marked this pull request as ready for review August 4, 2026 18:46
Signed-off-by: Pablo Pupo <pablofpupo23@gmail.com>
Signed-off-by: Pablo Pupo <pablofpupo23@gmail.com>
Signed-off-by: Pablo Pupo <pablofpupo23@gmail.com>
@pablopupo
pablopupo force-pushed the fix/3428-contextualized-chunk-limit branch from e6284ac to 31a23f1 Compare August 11, 2026 12:34
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.

[MarkdownTableSerializer] Chunk overflow with landscape tables in non-landscape mode

1 participant