Jev's four primitives explained: Choice, Score, Noul and Box

Everything you do with Jev comes down to four kinds of question. Pick one option. Place it on a scale. Is this true? Where is it in the image? Here is what each one asks, exactly what comes back, how to read the numbers, and the mistakes TypeSafe's own docs warn about.

Jev's four primitives as four cards. Choice asks which of these options, for example which team owns this ticket, and returns the option, a probability for each option and a confidence. Score asks which level, for example how frustrated is the writer on calm, annoyed, furious, and returns a score that can fall between levels, such as 1.43 on a 0 to 2 scale, plus a legend, probabilities and confidence. Noul asks is this true, for example the customer asks for a refund, and returns one probability of yes, such as 0.92. Box asks where is it in this image, for example where is the dent in this photo, and returns top, bottom, left and right as fractions of the image, plus a confidence. Box is still an early-access feature.
Fig. 1 — Four questions, four typed answers. Everything you build with Jev is made of these.

Most AI APIs give you one thing: a box to type a prompt into, and text back. Jev gives you four question types instead. TypeSafe calls them primitives: small, typed building blocks you put together in your code.

Each primitive comes as a pair. A question defines one judgment for Jev to make about your input (the state). An answer is the typed value that comes back. Learn these four pairs and you know the whole of Jev.

Primitive It asks You get back
Choice Which of these options? choice, probabilities, confidence
Score Which level? score, legend, probabilities, confidence
Noul Is this true? noul (a number from 0 to 1)
Box Where is it in this image? box (top, bottom, left, right), confidence

If you haven’t run Jev yet, start with Your first Jev program, then come back here. Everything below comes from TypeSafe’s documentation, linked at the end.

The golden rule: one snap judgment per question

Before the four types, the one idea that makes all of them work.

Jev is a System One model: built for fast, focused judgments, the kind a knowledgeable person makes in a second given the right context. TypeSafe’s own example: “Does this message convey urgency?” is a good question. “Analyse this message and determine the best course of action” is not, because that needs slow, step-by-step reasoning.

So when a judgment is big, split it into small questions and combine the answers in your code. A nice side effect: when you want to change how much each part matters, you change a weight in code, not a prompt.

The anatomy of a question

Every question, whatever its type, has the same parts:

  • An ID: the name you give it in the questions dictionary, like "team" or "refund". It’s for your code only. Jev never sees it; it’s how you find the answer afterwards.
  • type: choice, score, noul or box. (The Python SDK sets this for you through the class you use.)
  • instructions: the question itself, in plain English.
  • criteria: the possible answers. Required for Choice and Score, optional for Noul, not used for Box.

instructions and criteria can be a string, an object or an array. TypeSafe’s advice: start with strings, and only reach for structured versions when Jev keeps confusing two options.

Here are three types in one request, the way you’ll usually see them:

from typesafe_sdk import Choice, Noul, Score, TypeSafeClient

ticket = "I was charged twice this month. Please refund the extra payment today."

with TypeSafeClient(model="jev-latest") as client:
    result = client.system_one(
        state=ticket,
        questions={
            "refund": Noul(instructions="The customer asks for a refund"),
            "request_type": Choice(
                instructions="What kind of request is this",
                criteria={
                    "billing": "Charges, invoices, refunds or plan changes",
                    "technical": "Bugs, outages or integration problems",
                    "account": "Login, profile or access problems",
                    "other": "Anything that fits none of the above",
                },
            ),
            "frustration": Score(
                instructions="Level of frustration in the writer's tone",
                criteria=["Neutral, factual tone", "Annoyed but polite", "Furious, harsh wording"],
            ),
        },
    )

print(result.nouls["refund"].noul)
print(result.choices["request_type"].choice)
print(result.scores["frustration"].score)

Now let’s take each type in turn.

Choice: pick one option

Use it when the answer is one of several unordered categories: which team, which intent, which product, which language.

You send instructions and criteria, a dictionary of option name → description. Jev reads both the names and the descriptions, so the descriptions are where you separate similar options. If a name is obvious on its own ("calm", "angry"), the description can be None.

tone = Choice(
    instructions="What is the tone of the message",
    criteria={"calm": None, "angry": None},
)

You get back:

  • choice: the option with the highest probability.
  • probabilities: a probability for every option, adding up to 1.
  • confidence: one number from 0 to 1 for how concentrated those probabilities are.

In TypeSafe’s quick start, a department question about a broken checkout came back as technical, with probabilities technical 1.0, billing 0.0, sales 0.0, and confidence 1.0.

How confidence is worked out

For a Choice, only the top probability matters. With n options and a top probability p:

confidence = (p − 1/n) ÷ (1 − 1/n)

So an even split scores 0 and total certainty scores 1. With three options and a top probability of 0.6, confidence is (0.6 − 0.33) ÷ (1 − 0.33) = 0.4, however the remaining 0.4 is shared between the other two.

Choice tips from the docs

  • Up to 255 options in one Choice. For bigger or deeper taxonomies, ask level by level (division, then group), which TypeSafe shows in its hierarchical classification cookbook.
  • Give the full list, not a shortlist you guessed.
  • Add an other option so inputs that fit nothing have somewhere to go.
  • Don’t rely on “none of the above” as an option. TypeSafe says it often works poorly. Instead, ask a companion Noul in the same request, such as “The message names one of our products”, and ignore the Choice when it’s low.
  • Make confusable options explicit. If two options keep getting mixed up, use an object description that says what each covers and what belongs elsewhere.
  • Watch the order. TypeSafe’s list of known weak spots says Jev tends to favour the option listed first.

Score: place it on a scale

Use it when the answer is a position on a spectrum: severity, frustration, quality, risk, experience level.

You send instructions and criteria, an ordered list of level descriptions from low to high. You need at least 2 levels and at most 10. Levels are numbered by their position, starting at 0. Jev sees only the descriptions, never the numbers.

severity = Score(
    instructions="How much of the product is affected",
    criteria=[
        "A cosmetic problem; everything still works",          # level 0
        "One feature is broken; there is a workaround",        # level 1
        "Customers cannot complete a purchase",                # level 2
    ],
)

You get back:

  • score: a position on the scale, which can fall between levels.
  • probabilities: a probability for each level number, adding up to 1.
  • legend: maps each level number back to its description, so your code can show what the levels mean.
  • confidence: 0 to 1, how concentrated the probabilities are.

Why the score can be 1.43

The score is each level number multiplied by its probability, added up. TypeSafe’s example: 0.57 on level 1 and 0.43 on level 2 gives 1 × 0.57 + 2 × 0.43 = 1.43. It’s an average position, which is often more useful than a single level.

Score confidence is a little smarter than Choice confidence, because levels are ordered and distance matters. Probability split between two neighbouring levels lowers confidence less than probability split between the two ends. With three levels, a split between neighbours scores 0.25, but a split between the two ends scores 0.

Normalise before you combine

A score of 2 means “the top” on a 3-level scale but “the middle” on a 5-level one. To compare or combine scores, divide each by its top level number (number of levels − 1) to get a 0-to-1 value. The quick start’s frustration score of 0.67 on a 3-level scale normalises to 0.67 ÷ 2 ≈ 0.33.

Writing good levels

  • Describe things you can observe, not degrees like “moderately severe”. “Customers cannot complete a purchase” beats “very severe”.
  • Keep levels clearly different. Three is often enough.
  • Don’t write numbers or “worse than the last one” in descriptions: each level is judged on its own.
  • One dimension per Score. “Severe and urgent” is two questions.
  • Give rare extremes their own level if your code needs to treat them differently.
  • If Jev keeps splitting between neighbours, give each level an object with a description and a few examples, using the same field names on every level, and test on separate data.

Noul: is this true?

Use it when the answer is yes or no: asks for a refund, contains personal data, mentions a competitor, signals time pressure.

You send instructions (the statement or question), and optionally criteria describing what counts as true and what counts as false. Add those only when the line is subtle, and test with and without them. Over the raw API, that looks like:

{
  "type": "noul",
  "instructions": "The customer asks for a refund",
  "criteria": {
    "true": "Asks for money back, in any words",
    "false": "Only complains, or asks about a charge without asking for money back"
  }
}

You get back a single number, noul, from 0 to 1: the probability that the answer is yes. Near 1 is a strong yes, near 0 a strong no, and near 0.5 means Jev is split.

There’s no separate confidence for a Noul, because that one number already says everything about a two-way answer. If you want a confidence-style number to compare with Choices, TypeSafe gives the formula |2p − 1|: 0 at 0.5, 1 at 0 or 1.

TypeSafe’s docs don’t say where the name “Noul” comes from. Think of it simply as Jev’s yes-or-no question.

Reading a Noul in code

TypeSafe suggests starting with 0.7 for yes and 0.3 for no, and sending anything in between to a person:

p = result.nouls["refund"].noul
if p > 0.7:
    start_refund_flow()
elif p < 0.3:
    continue_normally()
else:
    ask_a_person()

Then set the bar by what a mistake costs: raise it when a false yes is expensive, lower it when a missed yes is expensive.

Noul pitfalls

  • Compound questions (“angry and asking for a refund”) blur the answer. Ask two Nouls and combine them in code.
  • Negative phrasing (“Is the message free of personal data?”) flips the meaning, which is easy to get wrong later. Phrase it so that high means yes. Double negatives also lower accuracy.
  • A Noul measures likelihood, not amount. “How experienced is the writer?” is a Score, not a Noul.
  • Don’t tune thresholds on a handful of examples.

Box: where is it in the image?

Use it when you need where something is in an image: a dent on a car, a signature on a form, a product on a shelf.

Box is newer than the other three, and TypeSafe labels it “Dreamer-ready”, meaning it isn’t production-ready yet: its request format, answers and limits may change between releases. To use it:

  • send the header TypeSafe-Danger-Zone-Images: true with any request that includes an image or a Box question;
  • use Jev 1.14 (images also work on 1.13, but Box questions need 1.14);
  • send PNG or JPEG stills, each side between 280 and 1,568 pixels. Images outside the limits are rejected, not resized, and are billed as input tokens.

You send instructions naming the target and the image, such as “Find the dent on the car door in photo”. Box takes no criteria.

You get back:

  • box: four edges, top, bottom, left and right, as fractions of the image from 0 to 1, measured from the top-left corner. left and right are fractions of the width; top and bottom of the height.
  • confidence: 0 to 1.

To turn the box into pixels, multiply each edge by the image’s width or height and round:

box = result.boxes["dent"].box
x1, x2 = round(box.left * width), round(box.right * width)
y1, y2 = round(box.top * height), round(box.bottom * height)

The big Box gotcha: there is no “not found”

TypeSafe puts it bluntly: a Box answer is always a box. If the thing isn’t in the image, you still get coordinates. So when presence is in doubt, ask a Noul in the same request (“The photo shows a dent”) and ignore the box when that’s low.

More Box tips from the docs:

  • One Box question per thing you want to find.
  • Several matches? Add a Choice with none, one and several. If it’s several, split the image into regions and ask again on each.
  • Small target in a big image? Find the region first, ask the Box question on that crop, then convert the edges back to full-image fractions.
  • Check the edges. On TypeSafe’s test set, asking one Noul per edge (“is the top of the target cut off?”) caught 30 of 36 cut-off boxes, better than a single “is all of it inside?” question (26) or an outline drawn on the full image (20).

Asking several questions at once

Every question in a request sees the same state and is evaluated independently and in parallel. That has three useful consequences:

  1. Batch everything that shares a state. Mixing types is fine. Extra questions add little time and only a small token cost. In one TypeSafe cookbook, 13 questions about a long article in one call were about 12 times cheaper and faster than 13 separate calls, with the same answers.
  2. Ask speculative questions. If your code might need an answer, ask for it anyway and ignore it when it’s irrelevant. That’s cheaper than a second round-trip.
  3. Answers can’t depend on each other inside a request. You only need a second request when your code must see the first answer before it can build the next question, for example to fetch more data or narrow the options.

There’s no fixed limit on the number of questions. The real limit is context length: Jev allows up to 64k tokens per request (state plus all questions) and 32k per question (state plus one question), and the state is usually what fills it.

Putting them together: composite scoring

The golden rule says to split big judgments. Here’s what that looks like for “how important is this ticket?”, using three Score questions, normalised and weighted in code:

questions = {
    "severity": Score(
        instructions="How much of the product is affected",
        criteria=["Cosmetic only", "One feature broken, with a workaround", "Customers cannot buy"],
    ),
    "frustration": Score(
        instructions="Level of frustration in the writer's tone",
        criteria=["Neutral, factual tone", "Annoyed but polite", "Furious, harsh wording"],
    ),
    "report_quality": Score(
        instructions="How easy the report is to act on",
        criteria=["Vague, no details", "Some details", "Clear steps to reproduce"],
    ),
}

result = client.system_one(state=ticket, questions=questions)

def normalised(answer):
    return answer.score / (len(answer.legend) - 1)   # 0..1 on any number of levels

weights = {"severity": 0.6, "frustration": 0.3, "report_quality": 0.1}
priority = sum(w * normalised(result.scores[q]) for q, w in weights.items())

All three questions run in parallel, so it costs barely more than one. If the support team later decides frustration matters more, you change 0.3, not a prompt.

Which primitive should I use?

How to pick a primitive. Start with the judgment you need. Where is something in an image, like a dent, a logo or a signature? Use Box, plus a Noul to check it's there. Is the answer yes or no, like asks for a refund or contains personal data? Use Noul. Is it a level on a scale, like severity, frustration or report quality? Use Score. Is it one of several categories, like team, intent, product or language? Use Choice, plus a companion Noul if nothing might fit.
Match the primitive to the shape of the answer your code needs.

TypeSafe’s rule of thumb: pick the type whose answer your code can act on most directly.

If your code needs… Use Watch out for
One of several labels Choice Add other; use a companion Noul instead of “none of the above”
A level, to sort or threshold Score Describe observable levels; normalise before combining
A yes or no Noul One idea per question; high should mean yes
A location in an image Box Always returns a box; check presence with a Noul

If your Score levels overlap a lot, or the “levels” are really separate categories, a Choice or a few Nouls is usually the better fit.

Common mistakes

  • Asking for reasoning. “Decide what to do with this ticket” isn’t a snap judgment. Split it.
  • Vague option descriptions. Jev confuses neighbouring options when their descriptions blur together.
  • Treating high confidence as “correct”. Confidence tells you how concentrated the probabilities are. A confident answer can still be wrong; test on your own data.
  • Looking only at score. Different probability spreads can give the same score. Check probabilities and confidence too.
  • Doing maths or date logic in a question. Jev isn’t a calculator and reads dates as text. Do those in code.
  • Stuffing the state. Irrelevant text distracts Jev. Send only what the questions need, and point to specific fields of a JSON state by their path in backticks, such as `ticket.message`.

Key takeaways

  • Jev has four primitives: Choice (pick one), Score (which level), Noul (is it true) and Box (where in the image).
  • Each question has an ID for your code, a type, instructions and, for Choice and Score, criteria.
  • Choice returns the option, probabilities for all options and a confidence. Up to 255 options.
  • Score returns a position that can fall between levels (2 to 10 levels), plus a legend, probabilities and confidence. Normalise by dividing by levels − 1.
  • Noul returns one probability of yes, with no separate confidence. Start with 0.7 / 0.3 thresholds.
  • Box is early access: fractions from the top-left corner, and it always returns a box, so pair it with a Noul.
  • Ask one snap judgment per question, batch them in one request, and combine the answers in your code.

Frequently asked questions

What is a Noul in Jev?

A Noul is Jev’s yes-or-no question. You give it a statement, and it returns one number from 0 to 1: the probability that the statement is true.

What is the difference between Choice and Score?

Choice picks one of several unordered categories, like teams. Score places the input on an ordered scale, like low to high severity, and its answer can fall between levels.

How many options can a Choice have?

Up to 255. For larger taxonomies, TypeSafe recommends asking level by level.

Why doesn’t a Noul have a confidence value?

Because a yes-or-no answer is fully described by one probability. A value near 0.5 already means Jev is unsure. If you need a matching number, use |2p − 1|.

Is Box ready for production?

Not yet. TypeSafe labels images and Box “Dreamer-ready”: you have to opt in with a header, and the format and accuracy may change between releases.

Sources

Comments

LEAVE A COMMENT
No sign-up. Comments appear after a quick review.