Jev vs structured outputs: when to use each

By

Updated

Tagged: AI

Compare Jev, JSON mode, and schema-constrained LLM outputs. Learn when a typed answer is enough and when decision probabilities justify another model.

A regular LLM can return a category in JSON, and Jev can return a category too. So why would you bother with a separate decision model?

It comes down to what your app needs back. If an LLM is already reading a support ticket to draft a reply, adding a category field to that response is usually enough. If your app keeps making small routing decisions and you want real probabilities across every option, Jev is worth a look.

You also have to weigh the overhead around each call. Adding a second model means another API integration to wire up and maintain, while asking a general chat model to handle every tiny routing decision adds its own friction.

To compare both approaches, let’s walk through a support inbox that routes incoming tickets. (If you’re on OpenAI, the Decisions API is another way to route tickets without asking a chat model for JSON.) I also ran the exact same routing prompt across five small chat models to see how they behave in practice.

JSON mode and structured outputs solve different problems

Take a look at this response:

{"department":"billing"}

It’s valid JSON, so your parser can read it. Still, valid JSON alone won’t tell you if department is a field your app expects or if billing is an allowed value. A model in plain JSON mode could just as easily hand you {"team":"accounts"}, leaving your code with nothing to match against.

That’s the split between JSON mode and schema-constrained structured outputs. JSON mode tells the model to emit valid JSON, while structured outputs lock the response to a specific schema you define (using whichever JSON Schema features your provider supports). OpenAI’s structured output guide lays out that distinction well, and you can also check my structured outputs glossary entry for the short version along with the exact flag or API field in Claude Code, Codex, Cursor, and Grok.

For ticket routing, your schema might look like this:

{
  "type": "object",
  "properties": {
    "department": {
      "type": "string",
      "enum": ["billing", "technical", "other"]
    }
  },
  "required": ["department"],
  "additionalProperties": false
}

The schema locks down the allowed values, though your prompt still has to explain where each category begins and ends. Asking to swap a credit card belongs to billing, while hitting a bug on the payment settings page belongs to technical support. Field names won’t draw that line for you.

You still have to handle failed requests, refusals, and incomplete responses around the call. Here’s what handling those response states looks like:

JSON validity and routing correctness are separateA support answer can be valid JSON, match the department schema, and still choose a department that conflicts with the support policy.YesNoYesNoModel answerValid JSON?Matches schema?Bad JSONCheck policyBad shapeMay be wrong

A correct shape can contain a wrong decision

Say a customer sends this message:

I was charged twice, and now I can’t sign in to download either receipt.

Both billing and technical pass schema validation here. Which one is right depends completely on your support team’s rules.

Maybe billing owns duplicate charges and coordinates getting the customer back into their account. Or maybe your inbox picks one initial owner and attaches extra tags. Spell that rule out before you benchmark models, otherwise you’re measuring how ambiguous your prompt is instead of how well a model follows it.

What five models did with it

I sent that exact message to five small models through OpenRouter with the schema above, ten runs each. I tested three system prompts: no routing policy, a rule giving billing ownership, and a rule giving technical support every ticket with a sign-in problem.

ModelNo policyBilling owns itTechnical owns it
GPT-6 Luna10 billing10 billing10 technical
Claude Haiku 5.510 billing10 billing10 technical
Muse Ember10 billing10 billing10 technical
Qwen3 14B10 billing10 billing10 technical
DeepSeek V4 Flash10 billing10 billing7 technical, 3 billing

All 150 responses matched the schema without a single malformed payload.

With no policy in the prompt, every model picked billing every time. That tells you where the default bias sits: if your team wants technical to take sign-in issues first, you have to state it in the prompt.

Once I added that rule, four of the five models followed it 10 out of 10 times. DeepSeek V4 Flash still picked billing 3 times out of 10. All three of those responses are valid JSON and satisfy the schema, yet they route the ticket to the wrong queue.

Schema validation will never catch that kind of mistake, so you need a set of labeled examples to test against. Write down how your team handles mixed tickets, messages without a clear question, and out-of-scope requests, then turn those rules into test cases you run on every prompt or model change.

What Jev adds to the contract

Jev’s Choice primitive takes a list of options with their descriptions and gives you back the winning option, a probability for every option in the list, and a confidence score calculated from that distribution.

Here’s the request body for the same support inbox using the TypeSafe evaluation endpoint:

{
  "model": "jev-latest",
  "state": {
    "message": "I was charged twice, and now I can't sign in to download either receipt."
  },
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Choose the initial owner. Billing owns payment disputes even when the customer also reports an access problem.",
      "criteria": {
        "billing": "Payments, duplicate charges, invoices, and refunds",
        "technical": "Application failures without a payment dispute",
        "other": "Requests outside these categories or without enough information"
      }
    }
  }
}

Save that payload as routing.json, set your API key from the Jev API setup guide in your terminal environment, and send the request like this:

curl --fail-with-body https://api.typesafe.ai/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @routing.json

Keep that key on your server, never in browser JavaScript or source control.

Getting the full probability breakdown gives your code much more to work with than a single label. When a ticket comes back narrowly split between billing and technical, you can handle it differently from a clear-cut billing match (though the model still has to get the call right in the first place).

Jev supports other typed question primitives too, which I cover in the main tutorial, and for this routing task Choice is all we need.

Fig 1 · 1/3A typed answer still needs a policy
Both approaches start with an explicit set of allowed departments.

A generated confidence field is a separate design choice

You can always add a numeric confidence field to a regular LLM schema. That forces the model to output a number, though it tells you very little about how often the model is right.

In Jev, Choice confidence comes straight from the probability math. As the confidence documentation explains, it measures how far the top option sits above an even split, adjusted for the number of choices.

Those two numbers measure different things, so don’t compare confidence: 0.9 from a chat prompt with confidence: 0.9 from Jev as if they were on the same scale.

Even with real probability scores, check them against labeled tickets from your real inbox. A missing category or a fuzzy prompt can make any model confidently pick the wrong queue. If high-confidence billing tickets keep needing manual fixes, raising the cutoff won’t solve it. Tighten the categories or the prompt instead.

Adding an other option helps catch out-of-scope messages cleanly. Uncertainty and category membership are separate questions, and a model can be completely sure a message falls outside every supported department.

Put the action policy in ordinary code

Let the model suggest a department, and let plain application code decide whether to auto-assign it.

Say you only auto-route a ticket when the winning option hits at least 0.9 probability, sending everything else to a human review queue (you’ll want to tune that cutoff on your own tickets). Here’s a small policy function for that:

export const route = answer => {
  const allowed = ['billing', 'technical', 'other']
  if (!allowed.includes(answer.choice)) return 'review'
  const probability = answer.probabilities?.[answer.choice]
  if (!Number.isFinite(probability)) return 'review'
  if (probability < 0.9 || probability > 1) return 'review'
  return answer.choice === 'other' ? 'review' : answer.choice
}

You call it with one question’s answer: route(response.answers.department).

Run this after you’ve already validated the full API response and checked that the probabilities are well formed. Because the function only looks at the parsed result, you can feed it output from any classifier whose probabilities you trust, and you can unit-test your routing rules without hitting a live model.

Treat API timeouts and network errors as their own path. Send timed-out tickets to review or leave them queued instead of silently dumping them into a default department, and log those failures separately from valid, low-confidence answers so you can debug both cleanly.

Also keep the stakes of the action in mind. Dropping a ticket into a support queue is easy to fix if the model gets it wrong, whereas issuing a refund requires its own explicit permission check regardless of how confident the billing label looks.

When I would keep the existing LLM

If your inbox already sends every message to an LLM to write a summary and draft a reply, test adding the department enum to that existing structured response first. You keep one integration, and the model already has the full message context in front of it.

Adding a second classification call makes little sense when a person reviews every draft anyway. Worse, it gives you another network request that can time out or fail, stalling a workflow for a label that was only meant as a hint.

Stick with a general LLM when you also need free-form text out of the message, like pulling out a reference the customer pasted in alongside drafting a reply. Jev supports extraction patterns too, yet there’s no point wiring up a second model just to rebuild an extraction flow that already works well unless you see a real gain from switching.

And if you’re building a small internal tool where people can fix an occasional misrouted ticket, a plain structured enum is often all you need.

When I would evaluate a decision model

If most incoming messages don’t need a drafted reply at all, the tradeoff shifts. When your app only needs to route tickets, flag uncertain ones for a person, and pick the next processing step, a narrow decision model fits the job much better. Run it side by side against your current setup using the exact same messages and label descriptions.

It also pays off when your workflow can act on the full probability distribution instead of tossing it away. For example, you can send borderline tickets to a shared triage queue while clear matches go straight to a specialist, putting uncertainty to real use rather than sticking a confidence badge in the UI.

Add Jev when the numbers justify it in your workflow: lower cost, faster responses, or fewer bad auto-assignments. Measure those directly on your own traffic instead of assuming a specialized model wins by default, and split out the edge cases where the system should abstain so tricky tickets go to a person instead of the wrong team.

Compare coverage as well as accuracy

Start by putting together a test set that looks like a real inbox: short messages, mixed complaints, unfamiliar product names, and requests your team doesn’t handle. Don’t send private customer data to a new provider without permission. Sanitized or synthetic cases are plenty for an initial run.

Label every example against your written policy. When reviewers disagree on a message, fix the policy or mark the ambiguity instead of forcing a neat expected answer.

Then track two numbers for each setup: how many cases it handles on its own (automatic coverage) and how many of those routes are right. Accuracy alone can mislead you if a system only handles a handful of easy messages and punts the rest to a human.

Compare both approaches at the same acceptable error rate to see how much human review each one needs, or fix the coverage and compare errors instead. Either view tells you far more than raw confidence scores.

Keep a separate batch of examples untouched for your final check after you’ve picked prompts and thresholds. If you keep testing on the same set you used to tune the system, the numbers will look better than they really are.

Time the whole request end to end as well, including validation and retries. A fast first call hides the real response time when your pipeline often needs a fallback call.

Migration can start in the background

If you already have a structured-output setup that works, run the candidate decision model in the background without letting it assign tickets. Log every disagreement and inspect them.

Keep the current route visible to your team. Alongside it, save the candidate answer and enough detail to reconstruct the question, including the model identifier returned by the API, without hanging onto message content longer than your workflow needs it.

When the two systems disagree, check the original message against your written policy before picking a side. Either setup could be the one that made the mistake.

Once the results hold up, turn on automatic routing for one narrow category with a clear fallback path. Expand from there only when the review workload and error rate justify it.

For an inbox like this, keep the general model writing replies and decide separately whether Jev improves routing.

Want me to talk about your product? You can sponsor this site.

Related posts about ai: