Preserve content list aliases in multimodal chunks - #273
Merged
Conversation
- format_table_body now renders list-of-lists as a Markdown table so the LLM sees structured rows instead of a Python repr (the previous str(...) path produced "[['Method', 'Score']]" in prompts). - get_equation_text_and_format no longer concatenates the description into equation_text; the equation_chunk template already has a separate enhanced_caption slot. Field priority: text > latex > equation, with text_format defaulting to "latex" only when reading from the latex alias. - Updated unit tests to cover Markdown rendering and the simplified equation field selection.
LarFii
force-pushed
the
fix/content-list-alias-handling
branch
from
May 11, 2026 09:16
df89f30 to
48a56f9
Compare
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.
Summary
This PR makes direct
content_listmultimodal processing preserve common alias fields instead of silently dropping or misformatting them.Changes:
content_listindex after text items are separated, so context lookup still points at the original surrounding itemstable_body,table_data, ortexttext,latex, orequation, and inferLaTeXformat when onlylatexis providedWhy
The direct
content_listpath can receive pre-parsed multimodal items whose field names differ slightly by source. In that path, a table that only hastable_datacan produce an empty table body, an equation that only haslatexcan lose its formula text, and a string caption can be joined character-by-character.The same path also separates text and multimodal items before later context extraction. Without preserving the original item index, context lookup can point to the compacted multimodal list position instead of the original
content_listposition.Validation
From the repo root:
The targeted unittest covers:
content_listindex preservationtable_dataalias preservationlatexequation alias preservationScope / limits
This PR does not change parsers, model calls, retrieval behavior, or prompt templates. It only normalizes already-parsed multimodal item fields before building prompts/chunks.