Skip to content

Capture bottom Comments field in GeminiPageResult.comments_raw#32

Merged
jakebromberg merged 1 commit into
mainfrom
phase2-comments-field
May 10, 2026
Merged

Capture bottom Comments field in GeminiPageResult.comments_raw#32
jakebromberg merged 1 commit into
mainfrom
phase2-comments-field

Conversation

@jakebromberg
Copy link
Copy Markdown
Member

Summary

  • Add comments_raw: str | None = None field to GeminiPageResult (inherited by PageResult) so the bottom-of-page Comments band lands in a dedicated slot rather than being parked in page-level oddities.
  • Update PAGE_EXTRACTION_PROMPT to capture the band verbatim into comments_raw, with JSON null for 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.
  • Cover backward compatibility with the existing 34 corpus JSONs (no comments_raw key → defaults to None) plus prompt contract tests.

Closes #31

Test plan

  • ruff check . + ruff format --check . + mypy core cli.py clean
  • pytest green (331 passed, 1 deselected); 6 new schema tests, 3 new prompt-contract tests
  • Old PageResult extractions without comments_raw still validate (regression test included)
  • CI green on push

…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
@jakebromberg jakebromberg merged commit 2556c44 into main May 10, 2026
3 checks passed
@jakebromberg jakebromberg deleted the phase2-comments-field branch May 10, 2026 23:16
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
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.

Capture bottom-of-page Comments field into PageResult.comments_raw

1 participant