Skip to content

Jev Practices & Patterns

Visual Grounding with Box

How the box question type turns a crop into a decision: four fractional edges, a presence Noul for missing targets, the cut-off problem, and two patterns worth building.
Published
Category
Jev Practices & Patterns
Resources cited
5
Reading time
3 min
Tags#vision#box#patterns#crop

Box is Jev's first question type that answers where. That sounds like a small addition next to Choice and Noul, but it changes what a decision model can sit in front of: a crop becomes a decision, a presence check becomes a decision, and a visual review queue becomes something code can assemble without a generative model in the loop.

The shape of the answer

A Box answer is four edges — top, bottom, left, right — each a fraction from 0 to 1, measured from the top-left corner of the image, plus a confidence. Because the edges are fractions, the same answer is correct at any image size: multiply by the pixel width and height and crop.

edges = response["answers"]["mug"]["box"]
box = (
    round(edges["left"] * width),
    round(edges["top"] * height),
    round(edges["right"] * width),
    round(edges["bottom"] * height),
)
image.crop(box).save("mug.jpg")

That is the whole readout. No text to parse, no coordinates to rescale from a 0–1000 grid, no schema to validate beyond four numbers in range.

Box always answers

The failure mode is the important design fact: there is no not-found value. Ask for a signature that is not on the form and you still get four edges and a confidence. The documented pattern is to pair the Box with a Noul presence check on the same state — one request, two questions, one evaluated in parallel with the other — and let code drop boxes whose presence probability is low.

That pairing is also how you handle a second problem: a low-confidence box is not necessarily wrong, it is uncertain. TypeSafe does not publish a recommended threshold yet, so the docs tell you to tune one on your own images.

The cut-off problem

A box that is nearly right is still a bad crop. TypeSafe's own test on 36 painting crops, each cutting off part of the target, is a good map of the options:

StrategyCrops caught (of 36)
Four per-edge Noul questions30
One "is all of it inside" Noul26
Draw the box and ask about the outline20

Per-edge questions win because they localize the failure — you learn which side is cut. The docs offer a cheaper mitigation too: pad the box outward before cropping when a crop must not lose any part of the target, and re-ask on a higher-resolution crop when confidence is low.

Two patterns worth building

Crop and escalate. Use Box to find the region, crop it, and send the crop to a stronger model or a human queue. This is the classic confidence-gated routing shape applied to pixels, and it keeps the expensive model reading a small, well-framed image instead of a whole page.

Verify and highlight. In a review tool, Box turns "check that the signature is in the right place" into a comparison of fractions against a template region — code decides, the model only locates. Community work like jev-box-study explores the hallucination-detector version of this.

The limits to respect

  • Box needs jev-1.14.0 or jev-preview; on 1.13.0 it returns HTTP 400 before any model runs.
  • Every request with a Box question needs TypeSafe-Danger-Zone-Images: true.
  • Images are PNG or JPEG stills, 256–1568 pixels per side, 16 MiB per file, 32 MiB per request body.
  • The feature is dreamer-ready: format, limits, and accuracy can change between releases. Prototype, do not deploy.

Test on your own images

There is no recommended confidence threshold, and the accuracy numbers in the launch post are TypeSafe's own. Build a small labelled set — crops with known targets and known cut-offs — and measure two things separately: how often the presence Noul is right, and how often the box is good enough to crop. Those are different failures, and only one of them is fixed by padding.

From the Jev directory

The resources behind this article.

The box question type: one bounding box per question, returned as four edges that are fractions of the image, plus confidence, with no criteria field and no not-found value.
Jev Practices & PatternsDocs#official#docs#vision
Official
The Jev Day release post: Jev 1.14.0 under jev-preview plus three danger-zone features — composable images on both models, the box question type on 1.14 only, and opt-in 262k context.
Jev Guides & ArticlesArticle#official#release#vision
Official
The experimental image-input reference: PNG or JPEG files in a top-level assets map, referenced by string anywhere in state, instructions, or criteria, behind the TypeSafe-Danger-Zone-Images header.
Jev Practices & PatternsDocs#official#docs#vision
Official
0GitHub stars
0xRinne's MIT-licensed field report on using TypeSafe Jev 1.14's Box type and image input to spot AI-image hallucinations, across seven pipeline versions v1-v7b, with a live Vercel demo and raw score JSON.
Jev Tools & CLIs#community#research#hallucination-detection
MarkTechPost's write-up of the Jev 1.14 release: images, a box question type and 262k long context as experimental danger-zone features, unchanged $0.042 per million input token pricing, and TypeSafe's own note that none are production-ready.
Jev Media & TalksArticle#community#news#images
Community
Back to all articles

More Jev articles

How Pydantic AI, Mastra, TanStack AI, DSPy, Spring AI, and LiteLLM expose Jev: where the typed decision sits in the loop, what each integration returns, and which big frameworks are only adjacent.
Jev Integrations & Adapters#agents#frameworks#integrations
Read article
Tool menus can outgrow the context that reads them. The catalog's Jev-based routers and gates narrow the list: benchmarked tool search, per-tool scoring, fail-closed approvals, and WebMCP in the browser.
Jev Agents & MCP#mcp#tool-routing#agents
Read article

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai