Capture bottom Comments field in GeminiPageResult.comments_raw#32
Merged
Conversation
…nts_raw The Comments band at the bottom of each flowsheet page is a free-text DJ commentary slot the model previously parked into page-level `oddities`. That double-tasked oddities (which exists to surface *unmodeled* phenomena) and buried the contents in an untyped list. Add a dedicated `comments_raw: str | None` field on `GeminiPageResult` with verbatim capture and `null` for blank/unreadable bands; remove the obsolete "Comments field at the bottom contains…" example from the page-level oddities list and tell the model explicitly not to duplicate the contents. Backward compatible with the existing 34 corpus JSONs (no `comments_raw` key → defaults to None; covered by a regression test). The per-quadrant adapter (`modal-qwen-vl-quad`) has no footer call yet, so it'll emit `comments_raw=None` until a follow-up adds one — acceptable interim state. Closes #31
This was referenced May 10, 2026
jakebromberg
added a commit
that referenced
this pull request
May 11, 2026
The per-quadrant adapter assembled a PageResult from a header call plus four quadrant calls; none of those crops sees the bottom Comments band because `_crop_quadrants` stops at `layout.body_bottom_y` so the printed `Comments:` line does not bleed into the bottom-quadrant transcriptions. With `PageResult.comments_raw` landed in #32 the adapter therefore emitted `comments_raw=None` on every page even when the band had real content. Adds a sixth `transcribe_qwen_vl.remote()` call against `image[body_bottom_y:, :]` inside the existing `with app.run():` block, mirroring the header call's fault-tolerance shape so a footer parse failure leaves `comments_raw=None` without failing the page. Introduces `_crop_footer_strip(image, layout)`, `FOOTER_WIRE_SCHEMA` (analogous to `HEADER_WIRE_SCHEMA` — small, inline, no Pydantic indirection), and `FOOTER_EXTRACTION_PROMPT` (mirrors `HEADER_EXTRACTION_PROMPT`'s scoping discipline: capture verbatim, JSON null for blank, never invent, do not transcribe row content from above the Comments line). The Modal container is warm for calls 2-6, so the cost delta is one warm forward pass per page. Closes #33
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
comments_raw: str | None = Nonefield toGeminiPageResult(inherited byPageResult) so the bottom-of-page Comments band lands in a dedicated slot rather than being parked in page-leveloddities.PAGE_EXTRACTION_PROMPTto capture the band verbatim intocomments_raw, with JSONnullfor blank; remove the obsolete"Comments field at the bottom contains: …"example from the page-level oddities list and tell the model explicitly not to duplicate.comments_rawkey → defaults toNone) plus prompt contract tests.Closes #31
Test plan
ruff check .+ruff format --check .+mypy core cli.pycleanpytestgreen (331 passed, 1 deselected); 6 new schema tests, 3 new prompt-contract testsPageResultextractions withoutcomments_rawstill validate (regression test included)