async-dime/jevloop
0
1---2title: JevLoop3emoji: π4colorFrom: blue5colorTo: purple6sdk: gradio7sdk_version: 5.49.18app_file: app.py9license: apache-2.010short_description: Distribution-guided text optimization with Jev (TypeSafe AI)11---12 13# JevLoop β distribution-guided text optimization with Jev14 15**JevLoop** treats [Jev](https://typesafe.ai/blog/introducing-system-one-models-and-jev) β TypeSafe AI's16"System One" decision model that returns typed **Noul / Choice / Score** answers with calibrated17probabilities β not as an argmax classifier, but as a **continuous value function** inside a closed18optimization loop. Every documented and social use case so far (triage, routing, guardrails, bulk19labeling, rΓ©sumΓ© scoring) consumes only the top answer + confidence. JevLoop uses the **full20probability distributions**: per-axis probability mass selects *which rubric dimension to attack21next* (UCB1 bandit), a cross-entropy-method update steers which edit operator is tried next, and22the loop stops when the value plateaus **and** the critic's distribution entropy drops β i.e. when23Jev itself says it is sure there is nothing left to gain.24 25There is **no LLM in the loop**: the proposer is a set of deterministic edit operators. That is the26point β a System One critic plus ~200 lines of code can steer text improvement for ~$0.0004 per27critique at 70β500 ms per pass, with zero hallucinated output.28 29## Try it30 31The app below runs in **mock mode** by default: a deterministic heuristic critic with the same32interface simulates calibrated distributions so the whole loop works offline (no API key, and33clearly labelled as a simulation β it demonstrates the *control loop*, not Jev itself).34 35To run against the real model, pick `typesafe (real Jev API)` and provide a TypeSafe API key.36The direct API (`POST https://api.typesafe.ai/v1/systemone`, model `jev-latest`) is early-access /37waitlisted; Jev is also reachable via the **Vercel AI Gateway** (`typesafe-ai/jev`) and38**Cloudflare Workers AI** (`typesafe/jev`).39 40## CLI41 42```bash43pip install requests # mock mode needs nothing else44python -m jevloop.cli --preset resume_bullet \45 --text "I was responsible for working on the payments team..." --rounds 846python -m jevloop.cli --input pitch.txt --reference original.txt --mode typesafe --api-key $TYPESAFE_API_KEY47```48 49## Architecture (one call per pass, all questions answered in parallel by Jev)50 51```52state (current text) βββΊ Critic pass βββΊ per-axis Score distributions + Noul guards53 β² β β54 β β value = Ξ£ weightα΅’ Β· normα΅’55 β βΌ entropy = mean normalized entropy of Score dists56 best_text βββ accept if value improves βββ€57 β² β58 β UCB1 picks target axis (weak + uncertain)59 β Proposer: deterministic edit ops sampled from CEM distribution60 βββββββββ candidates (m per round) ββββ61guard violations (overclaim / fabrication / dismissive / meaning drift) β candidate vetoed62```63 64## Files65 66- `jevloop/rubric.py` β 4 presets (sales pitch, rΓ©sumΓ© bullet, support reply, doc clarity): Score axes + Noul guards in Jev's exact question schema67- `jevloop/client.py` β `JevClient` (real API) and `MockCritic` (offline simulation), identical interface68- `jevloop/proposer.py` β deterministic edit operators + CEM distribution over them69- `jevloop/optimizer.py` β the loop: UCB1 axis selection, candidate generation, guard vetoes, entropy stopping, cost accounting70- `jevloop/cli.py` β CLI71- `app.py` β this Space UI72 73## References74 75- TypeSafe AI launch post: <https://typesafe.ai/blog/introducing-system-one-models-and-jev>76- Question schema (Noul/Choice/Score, `criteria`, probabilities, legend): <https://developers.cloudflare.com/ai/models/typesafe/jev/>77- pydantic-ai `TypeSafeModel`: <https://pydantic.dev/docs/ai/models/typesafe/>78- Vercel AI Gateway model page: <https://vercel.com/ai-gateway/models/jev>