Skip to content

feat(describe): structured output for the skip decision (T-081, keystone)#145

Open
Ztein wants to merge 3 commits into
mainfrom
feat/t081-structured-describe
Open

feat(describe): structured output for the skip decision (T-081, keystone)#145
Ztein wants to merge 3 commits into
mainfrom
feat/t081-structured-describe

Conversation

@Ztein

@Ztein Ztein commented Jul 9, 2026

Copy link
Copy Markdown
Owner

T-081 keystone — the skip/keep decision now comes from a validated `FigureResult.is_figure` boolean via `response_format=json_schema`, not the fragile `[SKIP]` string a model can fail to emit (the junk-leak that blocked T-080).

  • `call_vision()`: structured-first, with a graceful fallback to the legacy text prompt on an endpoint that lacks json_schema support (air-gap-safe). Verified on Berget: gemma honours strict json_schema.
  • `describe_image` rewired through it; empty/truncation/cache/retry behaviour preserved. The `[SKIP]` instruction is dropped from the structured prompt (the schema carries it) and kept in the fallback.
  • `kind` field lands too — the building block for dropping the vector/raster prompt routing later.
  • Tests: 3 new (skip via is_figure, description, fallback); full offline suite green (375 passed).

Builds on Phase 0 (`api.temperature`) — this branch merges it, so the diff includes #143's changes until that merges.

Remaining in T-081: wire the diagram path (`diagrams.py`) through `call_vision` too, so over-captured vector regions also skip cleanly. Then T-080 (one-box-per-page extraction) is unblocked.

Core-path change — opened for review, not admin-merged.

🤖 Generated with Claude Code

Ztein and others added 3 commits July 9, 2026 13:09
…ll (Phase 0, T-082)

Adds api.temperature (default 0.0) and passes it to all five completion call sites
(describe, diagram, OCR, and both summarize calls). Reproducibility is the
prerequisite for the quality track: without it, the same document gives different
output each run, so "did this change help?" is unanswerable.

Also carries Joel's config.example.yaml prompt refinement (item 2: describe each
series' development, ideally with concrete numbers) — an unrelated one-liner that
was in the working tree; kept so it isn't lost.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…+ merge Phase 0

The significance decision now comes from a validated FigureResult.is_figure
boolean (response_format=json_schema), not a fragile "[SKIP]" string the model
must format exactly. Graceful fallback to the legacy text prompt on an endpoint
without json_schema support (air-gap-safe). describe_image preserves the empty/
truncation/cache/retry behaviour; the [SKIP] instruction is dropped from the
structured prompt (the schema carries it) and kept in the fallback prompt.

Merges Phase 0 (api.temperature) which this builds on — call_vision passes
temperature to every model call.

Tests: 3 new (skip via is_figure, description, fallback); full offline suite green.
Remaining: wire the diagram path (diagrams.py) through call_vision too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant