By Youssef Hosni

Published: 2026-10-12

URL: https://todatabeyond.substack.com/p/nine-ways-to-use-jev-in-ai-applications


AI applications contain many decisions that require a category, score, or action rather than a generated explanation. This blog explores nine ways to use Jev for those decisions, with runnable Python examples covering routing, guardrails, tool-call gating, inbox triage, reranking, evaluation, labeling, real-time control, and confidence gating.

Eight live comparisons against GPT-4.1 mini with structured outputs found 46.2–64.8% lower median request latency and 79.6–83.5% lower estimated token cost for Jev, using the recorded rates. Task-level agreement or ranking quality matched or exceeded the baseline on these small synthetic datasets. Replaying saved classifications also showed how confidence thresholds affect automatic coverage.

The examples demonstrate integration patterns and measured trade-offs; they do not establish production reliability or whole-application savings.

Get 50% off for 1 year

Table of Contents:

-

What Jev contributes to an application

-

Model routing: choosing which model receives a request

-

Guardrails: screening for prompt-injection attempts

-

Tool-call gating: check a proposed action before execution

-

Inbox triage: turn email content into a queue assignment

-

Reranking: choosing which retrieved passages reach the LLM

-

LLM evaluations: grade an answer against its reference

-

Bulk labeling: turn support tickets into a labeled dataset

-

Real-time control: choose an action from the current state

-

Confidence gating: decide when a classification needs review


Check out my latest book, Prompt Engineering 2.0 is out. Early bird: 19 instead of 29 until Sunday 18 October, 23:59 EEST with code 5otr3fv.

Prompt Engineering 2.0 Book

50% Discount on all my books, courses & bundles for To Data & Beyond paid subscribers.


1. Introduction: what Jev contributes to an application

Jev is a model from TypeSafe AI designed to answer bounded questions about text or application state. You provide the relevant context, describe the decision, and define the allowed answers.

Its System One interface returns typed decisions and probabilities that software can consume directly. This makes it relevant to steps such as deciding which model receives a request, whether a passage is relevant, or which queue should receive a support ticket.

Consider a support assistant handling a report that checkout has stopped working. The application may need to classify the problem, assess urgency, retrieve the right documentation, and decide whether a proposed action needs approval.

A generative model can still investigate the issue and write the reply. Jev can be evaluated for the narrower decisions between those steps, with each question receiving the context it needs.

The API exposes three question types. Choice selects from named options, such as billing, login, and technical support. Score evaluates content against ordered descriptions and returns a probability-weighted score. Noul answers a yes/no question with the probability of yes. These interfaces give the application different ways to express a decision without asking for a prose response.

A Choice response includes the selected option, the distribution across all options, and a confidence value. TypeSafe defines confidence as a statistic derived from the distribution’s shape: a concentrated distribution produces greater confidence than a flat one.

It should not be interpreted as an independently verified probability that the decision is correct. Before using it to automate an action, we need to check its behavior on representative examples.

A traditional LLM can also return a decision in a defined format through structured outputs. For example, its JSON schema can restrict a routing field to the same choices we give Jev.

This gives us a useful baseline: supply the same task and policy, record the decision, and measure the time and cost of obtaining it. The comparison should establish whether Jev is useful for a particular workflow rather than assume an advantage from its interface alone.

Throughout the examples, the application remains responsible for execution. It builds the input, validates the response, applies permission checks where needed, and sends uncertain or invalid cases to a fallback.

TypeSafe also documents limitations, including numerical precision, indirect instructions, irrelevant context, and sensitivity to option order. We will keep arithmetic and exact checks in code, make each question explicit, and map the result to a handler.Figure 1 — Jev evaluates a defined question; the application checks the returned answer and decides which handler runs.

A typed decision is useful when the application has a defined action for every allowed answer, including an explicit path for missing information or failed evaluation.


2. Model routing: choosing which model receives a request

Model routing places a decision before the model that performs the user’s task. A request to rewrite a sentence and a request to design a distributed system need different kinds of work. If an application has several available models, the router can assign a request to a suitable tier using descriptions of the tasks each tier should handle. This only becomes a useful optimization when those descriptions reflect measured capability on the application’s workload.

For this example, we define a policy with four outcomes. Small covers direct transformations of supplied text, such as extraction or short rewriting. Medium covers routine explanations, single-function code, and straightforward diagnosis of a supplied code snippet. Large covers distributed-system design, interacting failure modes, or trade-off analysis across multiple constraints. Review handles requests that lack enough detail or fall outside these categories. These are illustrative policy categories; they are not claims about particular models.

Under this policy, “Extract the invoice ID from: Invoice INV-2048 is due tomorrow” belongs to the small tier. Designing an event pipeline that must handle duplicate delivery, regional outages, and conflicting updates belongs to the large tier. A request containing only “Can you fix it?” belongs to review. The fourth option lets the application request clarification instead of sending every unclear request to the most expensive model.

AI Books Bundle at a 40% discountFigure 2. Application code maps Jev’s returned label to a model tier or review. Tier descriptions must reflect the application’s own evaluations of downstream models.

Get 50% off for 1 year