# Jev Python Tutorial: Typed AI Decisions in Python

> Published 2026-11-24T14:51:27.994Z on https://youblog.app/p/jev-python-tutorial-typed-ai-decisions-in-python/
> Source video: https://www.youtube.com/watch?v=Jwos3ibkEeM

Text generation is a poor fit when you need the same judgement thousands of times and only need a label, a flag or a rating. This Jev Python tutorial covers the three question types, the request shape, and a confidence threshold that keeps uncertain cases with a human.

## Jev Python tutorial: what the model actually returns

This Jev Python tutorial starts with one distinction: Jev, a decision model from TypeSafe, returns typed answers about a state you send it rather than generated text. Each request carries a state and a list of named questions, and each question declares a type, instructions and criteria.

Jev is distributed through providers, and OpenRouter documents it as the model identifier typesafe/jev-1.13 available with an OpenRouter API key, per the [Jev tutorial on OpenRouter](https://openrouter.ai/docs/guides/community/jev-tutorial). The model identifier and price belong to the provider listing, so check the model page before budgeting.

The response gives you a probability distribution over your own labels. Your Python code then compares a number against a threshold and takes an action, which is where routing, escalation and flagging happen.

Three question types cover most labelling work, and the [Jev documentation hub](https://openrouter.ai/docs/guides/community/jev-tutorial) is the place to confirm the current request schema before you build around it.

| Question type | What it asks | What comes back |
| --- | --- | --- |
| Choice | Pick one option from a set you define | Probability per option |
| Noul | Answer yes or no | Probability of yes |
| Score | Place the input on an ordered scale | Weighted position on the scale |

## How to make your first Jev call from Python

A first Jev call from Python needs an API key, a state string, and at least one question with a type and criteria. The transcript's version uses Python's requests library to post JSON to OpenRouter and reads the answer dict from the parsed response.

Here is that shape with placeholders, since keys and endpoint paths change with provider:

```python import json, os, requests

state = "Hi, I was charged twice for my order last week. Can I get one of those payments back?" questions = [{ "name": "refund", "type": "noul", "instructions": "Is the customer asking for a refund based on this state?", "criteria": {"true": "they want the money back", "false": "they want something else"}, }]

response = requests.post( "https://openrouter.ai/api/v1/decisions", headers={"Authorization": f"Bearer {os.environ['OPENROUTER_API_KEY']}"}, json={"model": "typesafe/jev-1.13", "state": state, "questions": questions}, ) data = response.json() print(data["answers"]["refund"]["noul"]) ```

The transcript reports that this request returned a yes probability of 0.98 and a cost below a thousandth of a cent, measured on 31 October 2026 through OpenRouter. Those figures belong to that provider, model version and payload, so treating them as a general price would be wrong.

Wrap the call in an ask function once it works. A helper that takes a state and a list of questions and returns parsed answers keeps provider details out of your routing code and makes threshold changes a one-line edit.

## Choice questions pick one label from your own list

Choice questions ask Jev to select one option from a set you define and return a probability for each option. You supply the option labels with short descriptions, and the confidence lands on whichever label the model favours.

The transcript classifies four customer messages into shipping, tech, billing and sales. A package marked delivered but missing routes to shipping, a login failure to tech, a wrong charge to billing, and a stock question to sales, each handled in the same loop.

Probabilities across options sum to one. When the model is confident, one label can take nearly all of the mass; when it is not, the mass spreads and no option dominates. Code that reads only the top label will hide that spread.

Keep the descriptions specific. Four labels with one line each give the model less room to confuse shipping with billing than bare words do, and the label descriptions are the part of a Choice question most worth editing when results look off.

## Noul answers yes or no with a probability

Noul questions answer yes or no and return the probability that the answer is yes. The transcript spells the type as noul in code and describes it as the null or yes-or-no question, so verify the exact string against the current schema before you ship.

The criteria carry the meaning. In the refund example, true means the customer wants money back and false means they want something else. Writing those two clauses well does more for accuracy than rewording the instructions.

A probability of 0.98 supports an automatic route to a refund queue. A probability of 0.55 does not, and no threshold can rescue a question whose criteria overlap.

The Python community package [vibecheck-py](https://pypi.org/project/vibecheck-py/), an independent wrapper around decision models, exposes check, filter and group helpers with a probability threshold, which shows the same pattern packaged for batch work. That package is a separate implementation, and its behaviour is its own.

## Score questions rate input on an ordered scale

Score questions place an input on an ordered scale you define and return a position derived from probabilities across the scale levels. The transcript's urgency example uses three labels mapped to 0, 1 and 2, and reports a separate confidence alongside the score.

A score of 0.96 means roughly 95 percent of the probability sits on level 1 and 5 percent on level 0, so the weighted position lands just under normal urgency. Read the distribution, not only the score, when the decision matters.

The scale length is set by your labels, and the transcript describes accepting between 2 and 10. Fewer levels give coarser buckets and larger jumps between them.

Scores are not calibrated to wall-clock urgency. A 1.63 ticket is meant as between normal and urgent within your own definitions, and only your team's handling rules can convert that into a service-level target.

## Batch questions and confidence gating in one inbox

One Jev request can answer several questions about the same state, and a confidence threshold decides which answers an automated system acts on. The transcript's inbox example asks team, refund and urgency together, then routes only the confident answers.

The reported output shows the pattern clearly. A double charge went to billing with refund true and urgency 0.94. A team-plan question came back with 44 percent confidence and went to a human. A company-wide login failure scored full urgency and paged the team.

Gating on confidence is the part worth copying. Set the threshold from your own error tolerance, log every gated decision with its probabilities, and review the low-confidence pile weekly to find questions whose criteria need rewriting.

The transcript describes classifying the whole batch for a fraction of a cent, which is plausible for short states and a handful of questions but should be measured on your own payloads and the provider's current price.

## Where Jev fits and where it struggles

Jev suits repeated, well specified classification where you need a label, a flag or a rating and would rather not pay a chat model for prose. It struggles when the question itself is ambiguous, and the transcript is direct about that limit.

The speaker reports that Jev handles relatively simple work well and finds super complex classification harder. That is first-hand experience from a tutorial, not a published benchmark, and it should shape your expectations rather than your marketing copy.

A reasonable division of labour puts Jev on triage, tagging, moderation queues and lead scoring, and keeps a general model for drafting replies and explanations. Keep the decision layer typed so you can test it against labelled examples.

Cost comparisons deserve the same test. Pricing and throughput vary by provider and can change, and the [MLJAR walkthrough of Jev in Python](https://mljar.com/blog/jev-python/) is one developer's account of working with the model rather than an independent price study.

Decision models of this type are increasingly used as a lightweight layer inside larger AI workflows, though the public evidence so far comes mostly from tutorials and vendor documentation rather than broad adoption data.

## A production checklist before you ship

Before shipping a Jev integration, pin the model identifier and provider, test the decision layer against labelled examples, and keep a human review path for low confidence. Each step is small and each one prevents a predictable failure.

| Step | What to do | Why it matters |
| --- | --- | --- |
| 1 | Pin model and provider version | Behaviour and price can change |
| 2 | Build a labelled test set | Measure accuracy on your own data |
| 3 | Set a confidence threshold | Uncertain answers reach a human |
| 4 | Log state, answers and cost | Auditing and prompt tuning |
| 5 | Review low-confidence cases | Rewrite criteria that keep failing |

Security and data handling belong to your application. Sending customer text to a hosted provider is a data processing decision, and the model's accuracy says nothing about compliance, retention or tenant isolation.

Teams building AI tools around typed decisions can find broader material on automation and tooling at [crazystack.com.br](https://crazystack.com.br), and Portuguese-speaking developers often hear this kind of workflow discussed by Dev Doido do canal do youtube.

## Frequently asked questions about Jev in Python

- **What is Jev in Python?** Jev is a decision model from TypeSafe that answers typed questions about a state you send, such as a yes or no probability, one option from a list, or a position on a scale. You call it from Python through a provider API and read the answers as JSON.

- **Does Jev generate text?** No. Jev returns labels, probabilities and scale positions rather than prose, which is why it suits high-volume classification and routing. A general language model is still the tool for drafting replies or explanations.

- **How many questions can one Jev request answer?** A single request can carry several named questions about the same state, and the transcript demonstrates three at once for a support ticket. Confirm any documented limits in the current API reference before batching large numbers.

- **What does a Score question return?** A Score question returns a weighted position on a scale you define plus a confidence value, along with the probability for each level. Read the distribution when a decision depends on how close two levels are.

- **What should I do with low-confidence answers?** Send them to a human and log the state with the full probability spread. Recurring low confidence usually points to overlapping criteria in the question, which a rewrite can fix.

- **Is Jev cheaper than a chat model?** The transcript reports a cost below a thousandth of a cent for one short request, but price depends on the provider and model version. Measure cost on your own payloads rather than trusting a figure from a tutorial.

- **Can Jev replace a human review step?** Jev can automate clear cases when confidence is high. Keeping a human path for uncertain answers is the safer design, especially where a wrong label has a real operational cost.

- **Do I need OpenRouter to use Jev?** The tutorial uses OpenRouter because it issues a key quickly, and other providers or the official API can be used. The request body stays similar, while headers, endpoint and model identifier depend on the provider.

- **What kinds of questions work badly with Jev?** Vague or compound questions produce low confidence because the criteria are hard to separate. Splitting a fuzzy question into two specific ones usually improves clarity more than adding instructions.

## Start building the decision layer

The transcript's inbox example shows the shape of a working decision layer: a state string, three typed questions, a confidence gate and a routing rule. Copying that structure gives you a testable system before you touch a larger model.

Keep the first version small. One state, one question, a threshold you can defend, and a log you can read. Widen it only after the labelled examples agree with the outcomes you expected.

[Source video](https://www.youtube.com/watch?v=Jwos3ibkEeM)
