Skip to content

Conversation

@ElHachem02
Copy link
Member

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

…itial prompt

Signed-off-by: ElHachem02 <peterelhachem02@gmail.com>
@ElHachem02 ElHachem02 requested a review from Copilot December 4, 2025 12:28
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

DCO Check Passed

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

@dosubot
Copy link

dosubot bot commented Dec 4, 2025

Related Documentation

Checked 5 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@mergify
Copy link

mergify bot commented Dec 4, 2025

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

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

Copy link

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 introduces changes to the prompt building logic in the threaded layout VLM pipeline, modifying how layout information is incorporated into VLM prompts. However, the implementation appears to contain incomplete experimental code that needs refinement before merging.

Key changes:

  • Adds logic to filter prompts and only augment "Convert this page to docling." base prompts
  • Introduces random shuffling of layout elements and experimental table tag replacement
  • Changes prompt composition to use only layout information, discarding the base instruction text

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

)

if tag_name == DocumentToken.TABLE:
print("Found a table!")
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Debug print statement should be removed before merging to production. Consider using the existing _log.debug() instead if this logging is needed.

Suggested change
print("Found a table!")
_log.debug("Found a table!")

Copilot uses AI. Check for mistakes.
)

if tag_name == DocumentToken.TABLE:
print("Found a table!")
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The purpose of replacing table tags with "otsl" is unclear and lacks documentation. This appears to be experimental code that should either be explained with a comment or removed if not needed.

Suggested change
print("Found a table!")
print("Found a table!")
# Experimental: Replace 'table' tag with 'otsl' for downstream processing.
# TODO: Document the reason for this replacement or remove if not needed.

Copilot uses AI. Check for mistakes.
Comment on lines +136 to +137
# Shuffle elements
random.shuffle(layout_elements)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Randomly shuffling layout elements will produce non-deterministic results and makes the output unreproducible. This is problematic for testing, debugging, and consistent user experience. If shuffling is intentional for training/testing purposes, it should be: (1) documented with a clear explanation, (2) controlled by a configuration parameter, and (3) use a seeded random generator for reproducibility.

Copilot uses AI. Check for mistakes.
layout_injection = f"{layout_xml}"

augmented_prompt = base_prompt + layout_injection
augmented_prompt = layout_injection
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

This change completely discards the base_prompt and replaces it with only the layout information. The original implementation would concatenate them (base_prompt + layout_injection). This is a breaking change that removes the instruction text "Convert this page to docling." from the prompt. If intentional, this should be documented and the implications explained.

Suggested change
augmented_prompt = layout_injection
augmented_prompt = base_prompt + "\n" + layout_injection

Copilot uses AI. Check for mistakes.

augmented_prompt = base_prompt + layout_injection
augmented_prompt = layout_injection
print(f"final prompt is {augmented_prompt}")
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Debug print statement should be removed before merging to production. The existing _log.debug() at line 148-150 already logs this information appropriately.

Suggested change
print(f"final prompt is {augmented_prompt}")

Copilot uses AI. Check for mistakes.
if TYPE_CHECKING:
from docling_core.types.doc.page import SegmentedPage

import random
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The random module import should be placed with the other standard library imports at the top of the file (after line 12, before the third-party imports), following Python's PEP 8 style guide for import ordering.

Copilot uses AI. Check for mistakes.
Signed-off-by: ElHachem02 <peterelhachem02@gmail.com>
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...erimental/pipeline/threaded_layout_vlm_pipeline.py 0.00% 11 Missing ⚠️

📢 Thoughts on this report? Let us know!

@dolfim-ibm dolfim-ibm changed the title feat: update inference code to shuffle layout elements and discard in… fix: improvements (layout element shuffling and allow more strategies) in experimental two-stages pipeline Dec 8, 2025
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.

2 participants