Skip to content

Jev directory

Pytest Jev

A pytest plugin for semantic assertions: jev.expect sends many holds and lacks claims about one text to Jev in a single request and fails visibly when a probability is uncertain.
Stars
7
Language
Python
License
MIT
Reading time
3 min
Published by
Community
Author
allebee
Last verified
Sep 2026

About this project

Test what your LLM app's output means, not the exact words. Semantic assertions for pytest, judged by TypeSafe's Jev, a model that returns calibrated probabilities instead of text. Same verdicts as Claude Sonnet 5 on the example tests, 5× faster and 110× cheaper. Benchmark · real runs of jev-1.13 through OpenRouter. Quick start · Usage · Benchmark · Examples. All the claims about one text go to Jev in a single request. When a prompt change breaks the reply, the failure shows which claims broke and how sure Jev was:

Quoted from the project's README. Read the full README.

Highlights

  • All claims about one text go to Jev in one request; holds needs p >= 0.8 and lacks needs p <= 0.2, and unsure claims fail.
  • Answers cache in .pytest_cache, so rerunning unchanged tests makes no requests and gives identical verdicts.
  • On 12 example tests it matched Claude Sonnet 5's verdicts in 5.3 s versus 27.1 s, at $0.00017 versus $0.0192 per run.
  • The jev fixture exposes holds, lacks, expect, choice, and score methods; each sends one request and returns an assertable result.
  • Without a key, tests that use the jev fixture are skipped by default.

Quickstart

python
def test_refund_reply(jev):
    reply = support_bot("I was charged twice for order #1042.")
    jev.expect(
        reply,
        holds=["apologizes to the customer", "says the duplicate payment was refunded"],
        lacks=["blames the customer", "asks for a password or a full card number"],
    )

Watch out

MIT-licensed and not affiliated with TypeSafe; needs Python 3.10+ and pytest 7.4+, plus a TYPESAFE_API_KEY or OPENROUTER_API_KEY, and asserted text is sent to the provider.

Questions about this entry

Short answers drawn from the linked project or page.

Reactions & coverage

Posts, threads, and videos about this entry from around the web.

X: Agent Handoff Gate: agents verify what they hand off

X: Jev as an LLM guardrail inside Agentgateway

X: Vercel's fx safety reviewer, measured at 18× faster

Reddit: Early experiments wiring Jev into Pi as a safety layer and model router.

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai