Skip to content

feat: add JEV-based PDF form-filling example - #49

Open
bendersej wants to merge 1 commit into
mainfrom
example-typesafe-jev
Open

bendersej wants to merge 1 commit into
mainfrom
example-typesafe-jev

Conversation

@bendersej

Copy link
Copy Markdown
Member

Background

A public example showing Typesafe's JEV ("System One") model driving SimplePDF form-filling. It demonstrates the tenet code owns control flow, JEV answers narrow structured questions: the app orchestrates the editor via @simplepdf/react-embed-pdf actions, while JEV maps a CSV record onto fields, ticks checkboxes / picks constrained-field options, and judges plausibility. No agent, no hallucination.

Changes

  • Next.js + Tailwind example under examples/with-typesafe, two forms (IRS W-9, Medication Prior Auth)
  • JEV mapping (CSV column -> field) gated on calibrated confidence: auto-fill, confirm, or manual
  • Constrained-field support: checkboxes and options driven off the field's own get_fields options
  • JEV plausibility pass flags fictional / implausible values (e.g. a fake TIN)
  • Human-in-the-loop: confirm low-confidence fills, a "Fill manually" path for red errors, live editor mirroring, and download
  • Same-origin JEV proxy (/api/jev): path allowlist, redirect: "error", request timeout; BYOK key held in-memory only
  • Benchmark harness (npm run bench): times JEV vs any OpenAI-compatible model on the same payload and reports output agreement, not just latency

Notes

The benchmark/ harness (and its vitest devDependency) is opt-in and self-contained. It needs NEXT_PUBLIC_TYPESAFE_API_KEY plus BENCHMARK_MODEL_BASE_URL / BENCHMARK_MODEL_ID / BENCHMARK_MODEL_API_KEY in .env.local to run the second model; delete the benchmark/ dir to ship the example JEV-only.

A Next.js example driving SimplePDF form-filling with Typesafe's JEV (System One): JEV maps a CSV record onto fields, ticks checkboxes and picks constrained-field options, gates every write on a calibrated confidence, and a JEV plausibility pass flags implausible values. A human confirms low-confidence fills, fixes red errors, and downloads. Includes a self-contained benchmark harness (npm run bench) comparing JEV vs any OpenAI-compatible model on the same payload, reporting both latency and output agreement.
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