Skip to content

Add support for a custom supplement_text function in the partitioner.#1332

Merged
karanataryn merged 2 commits into
mainfrom
ben/custom_supplement_text
Jun 5, 2025
Merged

Add support for a custom supplement_text function in the partitioner.#1332
karanataryn merged 2 commits into
mainfrom
ben/custom_supplement_text

Conversation

@bsowell
Copy link
Copy Markdown
Contributor

@bsowell bsowell commented Jun 4, 2025

This makes additional customization possible that is otherwise difficult.

This change should have no impact on current behavior.

This makes additional customization possible that is otherwise difficult.
@bsowell bsowell requested review from Copilot and karanataryn June 4, 2025 23:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for a custom supplement_text function in the partitioner, allowing users to override the default text-supplementation behavior.

  • Updated the type imports to include Callable.
  • Introduced a new parameter, supplement_text_fn, in the process_batch function signature.
  • Replaced the direct call to self._supplement_text with the new supplement_text_fn call, preserving existing behavior via a default.
Comments suppressed due to low confidence (1)

lib/sycamore/sycamore/transforms/detr_partitioner.py:449

  • Consider adding a docstring or inline comment for the supplement_text_fn parameter to clarify its purpose, expected inputs, and behavior.
supplement_text_fn: Callable[[list[Element], list[Element]], list[Element]] = _supplement_text,

@karanataryn karanataryn merged commit 6893434 into main Jun 5, 2025
12 of 15 checks passed
@karanataryn karanataryn deleted the ben/custom_supplement_text branch June 5, 2025 00:19
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.

3 participants