Welcome
How to cite this book
If you use this book in your work, please cite it as:
APA: Chaudhri, A. (2026). Seven Ways to Use Jev. Self-published. https://seven-ways-jev.github.io/
BibTeX:
@online{chaudhri2026sevenwaysjev,
author = {Chaudhri, Akmal},
title = {Seven Ways to Use Jev},
year = {2026},
url = {https://seven-ways-jev.github.io/},
urldate = {2026-10-01}
}
Cover

License
Copyright
Copyright © 2026 Akmal Chaudhri. All rights reserved.
Publication Information
First published: October 2026
The latest version of this book, together with updates, errata and additional resources, is available at:
Book License
Seven Ways to Use Jev is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY-NC-ND 4.0).
You are free to copy and redistribute this book in any medium or format under the following conditions:
- Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were made.
- NonCommercial - You may not use the material for commercial purposes.
- NoDerivatives - If you remix, transform or build upon the material, you may not distribute the modified material.
The full license text is available at:
creativecommons.org/licenses/by-nc-nd/4.0
Code License
Unless otherwise stated, all code samples, notebooks, scripts and source files accompanying this book are licensed under the Apache License 2.0.
You are free to use, modify and redistribute this code, including for commercial purposes, subject to the terms of the Apache License 2.0.
The full license text is available at:
apache.org/licenses/LICENSE-2.0
This distinction means that the book’s written content is protected under the Creative Commons license, while the accompanying code remains freely available for use, modification and integration into your own projects.
Trademarks
Product names, company names and logos mentioned in this book may be trademarks or registered trademarks of their respective owners.
Their inclusion is for identification and educational purposes only and does not imply any affiliation with, sponsorship by or endorsement from the respective trademark holders. All trademarks remain the property of their respective owners.
Disclaimer
The information in this book, including all code samples, scripts and notebooks, is provided “as is” without warranty of any kind, express or implied.
The author makes no representations or warranties regarding the accuracy, completeness, reliability or suitability of the information contained herein for any particular purpose.
Examples are provided solely to illustrate technical concepts, patterns and software architectures.
Readers are responsible for independently validating all code, configurations and recommendations before using them in production environments.
To the fullest extent permitted by law, the author shall not be liable for any direct, indirect, incidental, special, consequential or other damages arising from the use of or inability to use, the information, code or techniques described in this book.
About the Author
Akmal Chaudhri is a technical leader, educator and author with extensive experience in databases, AI and developer relations. He specializes in technical writing, developer education and community building, helping engineers and organizations understand and adopt complex technologies through clear, practical and engaging content. He is a frequent international speaker, a published author and a contributor to industry discussions on data platforms, AI and software development.
Today, Akmal works in developer education at Neo4j, where he focuses on technical content, workshops and community initiatives. While his professional role has evolved, this book represents an independent exploration of Jev.
Based in the United Kingdom, Akmal continues to work at the intersection of databases, AI and developer tooling, helping developers build modern data-driven applications.
For book updates, code samples and additional resources, visit the Book website.
To connect professionally or follow his latest work, visit LinkedIn.
Introduction
Most AI models are designed to converse. You give them a prompt, they give you text back. That text might be excellent – detailed, nuanced, well-written – but it’s freeform. If you want to act on it programmatically, you have to parse it, validate it and hope the format holds across different inputs.
Jev, from TypeSafe AI, is built on a different premise. It’s a structured decision model: you give it a state object and a set of typed questions and it returns typed answers with confidence scores. No parsing required. No format negotiation. Just a decision and a number that tells you how certain that decision is.
TypeSafe describe Jev as a “System One” model – built for the kind of fast, atomic, well-scoped judgments that a highly knowledgeable person could make in a few seconds given the right context. Not a general-purpose reasoner. Not a planner. A decision maker.
The core primitive is the Choice: a question with named options, each described in plain language, plus an instruction telling Jev what to weigh. Each Choice returns the selected option and a confidence score between 0 and 1. That confidence score is what makes Jev useful in production – not just as a curiosity, but as an operational signal. A high-confidence decision is a candidate for automatic handling. A low-confidence decision goes to a human reviewer. The threshold between them is a business decision, not a technical one and it’s tunable.
What this book covers
Seven domains, seven notebooks, one pattern: structured state in, typed decision out, confidence score alongside.
The chapters are mostly independent. You can read them in any order and run any notebook without having read the others. Each is self-contained, with the data written by hand inside the notebook and no external dependencies beyond a TypeSafe API key.
The domains span a deliberate range of difficulty and context:
- Transit routing: a graph problem where we first try to use Jev the wrong way, then the right way
- Customer support triage: two sequential decisions per ticket, team then priority
- Financial fraud detection: a binary flag-or-pass decision with a three-tier response based on confidence
- Content moderation: three options and a finding about how Jev uses (or doesn’t use) the middle one
- Supply chain disruption: selecting an alternative supplier under pressure, with a confidence pattern that depends on the order of the options
- Hiring screening: three options again, with a much more even distribution than content moderation
- Medical symptom triage: four pathways, a conservative bias built into the instructions and the strongest disclaimer in the book
What you’ll see across chapters
A few patterns emerge across all seven chapters and are worth keeping in mind from the start.
The confidence score matters for uncertain cases. In most chapters, the low-confidence decisions are the interesting ones – not because Jev got them wrong, but because they’re the decisions where no system should be acting automatically. High confidence is a candidate for automatic handling. Low confidence means review.
Three options behave differently in different domains. Hiring produced a spread across Advance, Review and Decline, although part of that comes from how we worded the options and wrote the candidates. Content moderation produced almost no Flag decisions – Jev leaned binary and the confidence score did the work that Flag was supposed to do.
Confidence isn’t the same as difficulty, and it depends on how you ask. In the supply chain chapter, the scenario we expected to be hardest produced the highest confidence when the options were listed in one order and the lowest when we reversed them. Similar order effects showed up in the hiring and medical chapters. Treat the score as a signal that’s sensitive to how the question is presented.
The threshold is yours to set. Several chapters make the same observation: the confidence threshold that separates automatic decisions from human review is a business decision. Jev provides the infrastructure; you set the policy.
How to read the results
A few limits apply to every chapter:
- The inputs are hand-written, and we sometimes put cues in them, so some of the high-confidence results are easier than real data would be.
- We ran each notebook once, with repeat runs for the harder cases in the later chapters. Confidence scores change from run to run, so the chapters describe patterns rather than exact values.
- We didn’t check any decision against an expected answer, so we can’t say whether the scores are calibrated.
- The order of the options can change the confidence and sometimes the decision.
- The medical and hiring chapters are illustrations, not guidance for real use.
Running the notebooks
Each notebook installs its own dependencies, uses data defined in the notebook and runs end to end with a single environment variable:
export TYPESAFE_API_KEY="your-api-key"
jupyter notebook 01_northern_line.ipynb
Chapter 1 additionally uses CARTO map tiles for the Folium maps. A CARTO API key is optional – the notebook falls back to OpenStreetMap tiles if none is provided:
export CARTO_API_KEY="your-api-key"
Chapter 1 also requires three CSV files in a data/ directory alongside the notebook. All other chapters define their data inside the notebook.
Chapter 1: Transit Routing
The Northern Line branch
The London Underground’s Northern line presents a genuine decision problem. Between Kennington and Euston the line splits into two branches that don’t share a single station until they both reach Euston:
- Via Charing Cross (8 hops): a slightly shorter route running through the West End
- Via Bank (9 hops): a slightly longer route running through the City
On a quiet day with both branches running normally, the right choice is obvious: take Charing Cross, it’s one stop shorter. But the moment something goes wrong on the network, the right choice depends on live information that a static algorithm doesn’t have.
This chapter uses that branch decision as a vehicle for exploring two questions. First: can Jev navigate a network hop by hop, making a fresh decision at every step? Second: is that even the right way to use it?
What we find along the way tells us something useful about where Jev actually earns its place.
The data
We use the real London Underground dataset: around 350 stations, all lines, with geographic coordinates for each station. We load it into a NetworkX MultiGraph directly from CSV files. A MultiGraph is essential here because many stations are served by multiple lines and a plain Graph would overwrite one line’s edges with another’s when the same station pair appears more than once.
Each station is a node carrying its coordinates and zone. Each connection is an edge carrying the line name. The dataset includes all its real-world naming quirks: “Kings Cross St. Pancras” has no apostrophe, and “Elephant and Castle” is spelled out in full.
The notebook verifies all branch station names against the graph before running anything.
Part 1: Jev as a sequential planner
Our first approach was to use Jev as a navigation agent: query the graph for the current station’s neighbors, pass the live state to Jev, let it pick the next hop, and repeat until we reach Euston.
This is an appealing idea. It means the route adapts at every step rather than being fixed at the start. If something changes mid-journey, the very next call to Jev incorporates it.
Baselines
Before introducing Jev, we establish two baselines using NetworkX’s shortest_path().
The unconstrained version finds the globally optimal route across all lines: 6 hops via Waterloo, Westminster, Green Park, Oxford Circus and Warren Street. That crosses the Jubilee and Victoria lines – a real Northern line passenger wouldn’t consider this a valid route.
Adding a Northern-line-only constraint finds the correct result: 8 hops via the Charing Cross branch (Waterloo, Embankment, Charing Cross, Leicester Square, Tottenham Court Road, Goodge Street, Warren Street). Both queries run in well under a millisecond.
The key point: shortest_path() is exact and context-naive by design. It finds the best answer within whatever constraints you give it. The constraints are your job.
What happened
Across multiple northbound runs from Kennington to Euston, Jev consistently chose the Bank branch – 9 hops every time, even though the Charing Cross branch is one stop shorter. Hop-1 confidence was consistently low, between 0.31 and 0.37.
We then repeated the northbound runs with a note saying Warren Street was suspended, present from the first hop. The choice didn’t change: Bank every time, 9 hops. Only confidence moved, with hop-1 falling from 0.31 to 0.37 down to 0.17 to 0.24. A softer note about a 10-minute delay produced almost the same range, so Jev didn’t separate a brief delay from a suspension. To test the mid-journey case we seeded the route to Leicester Square. With no incident, all five runs pushed on to Tottenham Court Road and finished in 8 hops. With Warren Street suspended, all five still pushed on and none backtracked. Hop-1 confidence dropped from 0.91 to 0.93 down to 0.61 to 0.72, and the journeys took 11 to 16 hops instead of 8. One of them left the Northern line.
The reverse journey (Euston to Kennington, southbound) went the opposite way. All five runs took the Charing Cross branch. Hop-1 confidence was lower than northbound (0.15 to 0.23 against 0.31 to 0.37). The same network gave a different preference in each direction, which is almost certainly a training data artifact, not geographic reasoning.
Starting from Waterloo, which sits on the Charing Cross branch with no fork to navigate, gave a different picture. All five runs followed the same seven-hop Northern line route to Euston, but hop-1 confidence was lower than at Kennington, between 0.22 and 0.29. Unconstrained, NetworkX finds a five-hop route across other lines, so Jev stayed on the line every time but with little confidence in each step.
What this tells us
TypeSafe are explicit about what Jev is designed for: fast, atomic, well-scoped judgments – “the kind of judgment a highly knowledgeable person could make in a few seconds given the right context.” A nine-hop sequential plan isn’t that. It’s a planning problem, and shortest_path() solves planning problems in under a millisecond.
The mid-journey test makes the point sharply: Jev registered the suspension in its confidence but didn’t change course.
None of this is a criticism of Jev. It’s a mismatch between problem shape and tool design.
Part 2: Branch triage
The fairer test is to ask Jev for one decision: at Kennington, which branch should a passenger take?
We store disruption state directly on the graph nodes, query both branches’ current state, build a plain-language summary of each and pass both to Jev as a single Choice question with two options. One call, clear state, two options. That’s the shape of problem Jev was built for.
We run this across four disruption severities, three times each:
| Scenario | Choice | Unanimous |
|---|---|---|
| No disruption | Charing Cross | Yes |
| Mild: Goodge Street delayed 5 min | Bank | Yes |
| Severe: Warren Street suspended | Bank | Yes |
| Critical: Warren Street and Goodge Street out | Bank | Yes |
This is exactly the behavior TypeSafe describe. With both branches clear, Jev chose Charing Cross – the shorter route – with moderate confidence. A 5-minute delay on a station that can’t be bypassed was enough to flip the decision to Bank and confidence rose because the signal got clearer. A full suspension produced even higher confidence and two suspended stations produced the highest confidence of all. Every run was unanimous. Latency was well under 500 milliseconds per call – a fraction of the time the sequential pathfinder took per complete journey.
The confidence with no disruption is worth noting. Jev isn’t overconfident. Both branches are valid, Charing Cross is one stop shorter and the moderate confidence reflects a real preference – but it also signals that Bank isn’t a bad choice, which is true.
The right architecture
A shortest-path algorithm is exact, instant and optimal within whatever constraints you give it. Add a line constraint and it finds the Northern-line-only optimal in the same single call. It has no concept of disruption, live state or calibrated uncertainty. Those aren’t gaps – they’re design choices.
Jev is the right tool for the judgment calls that sit on top of that: which of these valid options is better right now, given what’s happening? That question requires weighing uncertain information and returning a decision with calibrated confidence. That’s what Jev is built for.
The algorithm finds the route. Jev decides which route is worth taking.
Chapter 2: Customer Support Triage
The problem
Every support operation faces the same challenge: an incoming ticket needs to reach the right team at the right priority and it needs to happen fast. Get it wrong and a critical production outage sits in the general queue. A billing dispute gets escalated to the engineering team. A security researcher’s responsible disclosure report sits unanswered for three days.
Rules-based routing – keyword matching, tier lookups, category flags – works until the edge cases arrive. An Enterprise customer whose “quick question” turns out to be a production outage. A billing dispute that’s actually an account security issue. A Free-tier user whose problem, if ignored, will end up in a public forum.
This chapter uses Jev to make two sequential decisions for each incoming ticket: which team should handle it and at what priority? Each decision returns a confidence score alongside the answer. That score is the key difference from a rules-based router: instead of silently routing every ticket with equal certainty, the system can use Jev’s confidence to flag the ones it’s unsure about so a human can review them before they go anywhere.
The setup
No external dataset is needed. We write 20 synthetic tickets by hand, spread across four bands designed to test the model across a range of difficulty:
- Clear high-priority: unambiguous critical or urgent issues (API outage, security breach, large overbilling)
- Clear low-priority: unambiguous routine requests (how-to questions, invoice copies, feature requests)
- Ambiguous: mixed signals where the right routing is genuinely unclear (slow dashboard, integration not syncing, login error with a deadline)
- Edge cases: unusual combinations that test the boundaries (responsible disclosure report, churn risk from an Enterprise customer, upgrade blocked by a broken billing page)
Each ticket has a customer tier (Free, Pro, Enterprise), an issue category, a subject line and a description written the way a real customer might write it.
We route to four teams: Billing, Technical, Account Management and General Support. Priority levels are Critical, High, Medium and Low.
Two decisions per ticket
Each ticket goes through two sequential Choice calls. The team decision uses the full ticket context. The priority decision adds the team assignment to the state so Jev can factor in who will be handling it before deciding how urgently they need to act.
# Decision 1: Team (instructions shortened here; the notebook has the full text)
team_response = client.system_one(
state=state,
questions={
"team": Choice(
instructions="Which support team should handle this ticket?",
criteria=TEAMS,
)
},
)
# Decision 2: Priority (state now includes assigned team)
state["assigned_team"] = team_response.choices["team"].choice
priority_response = client.system_one(
state=state,
questions={
"priority": Choice(
instructions="What priority level should this ticket receive?",
criteria=PRIORITIES,
)
},
)
Results
| ID | Band | Team | Priority |
|---|---|---|---|
| T001 | Clear high | Technical | Critical |
| T002 | Clear high | Billing | High |
| T003 | Clear high | Technical | Critical |
| T004 | Clear high | Account Management | High |
| T005 | Clear high | Technical | Critical |
| T006 | Clear low | General Support | Low |
| T007 | Clear low | Billing | Low |
| T008 | Clear low | General Support | Low |
| T009 | Clear low | General Support | Low |
| T010 | Clear low | Billing | Low |
| T011 | Ambiguous | Technical | Medium |
| T012 | Ambiguous | Billing | High |
| T013 | Ambiguous | General Support | Medium |
| T014 | Ambiguous | Technical | High |
| T015 | Ambiguous | Technical | High |
| T016 | Edge | Technical | High |
| T017 | Edge | Account Management | High |
| T018 | Edge | Technical | High |
| T019 | Edge | Technical | High |
| T020 | Edge | General Support | Critical |
Each ticket was run once. Confidence scores vary a little between runs, so we describe the patterns here and leave the exact values to the notebook.
What the numbers tell us
Team routing is a little more certain than priority
On average Jev was more confident about which team should handle a ticket than about what priority it deserved. That isn’t true of every ticket: on a handful, priority confidence was equal or higher. The gap is still meaningful: knowing where a ticket belongs is often clearer than knowing how urgently it needs to be handled.
Clear tickets aren’t always easier
The confidence-by-band chart shows an unexpected result: clear high-priority tickets had lower mean priority confidence than clear low-priority ones. The reason is that “Low” is easy to assign with certainty – a routine how-to question is unambiguously low priority. But “Critical vs High” is a harder call even for obvious tickets. The large overbilling ticket is a good example: it’s not a service outage, but it’s a serious financial error. Jev’s hesitation there is understandable.
The ambiguous tickets make the same point. Their priority confidence was at least as high as that of the clear high-priority tickets and their team confidence was just as high. Only the edge cases were really harder.
Tier makes little difference to confidence
Mean confidence varies little across customer tiers and not consistently in one direction. Enterprise tickets tended to be easier to route to a team, but that advantage didn’t carry over to priority. With six or seven tickets per tier and descriptions we wrote ourselves, these differences are too small to read much into. Tier is part of the state Jev sees, so this comparison can’t tell us how much it drives the decisions.
The tickets worth flagging
At the 0.60 threshold, a handful of tickets fall below the line. The exact set shifts a little from run to run, but these four did in our runs:
T002 (Enterprise customer charged $48,000 instead of $4,800): high team confidence but low priority confidence. It isn’t an outage, but it’s a serious financial error, so High versus Critical is a real judgment call.
T003 (Pro customer whose data export is broken): sure about the team, unsure whether Critical or High. The feature is completely broken but it’s a reporting task with a two-hour deadline, so it’s a close call.
T016 (security researcher’s responsible disclosure): high team confidence but low priority confidence. Jev knows it’s Technical but genuinely doesn’t know whether a responsible disclosure report is High or Critical priority. That’s an honest answer – it depends on company policy, not just the ticket content.
T018 (Pro customer trying to upgrade, billing page broken): low team confidence. It’s simultaneously a billing issue and a technical issue – a broken UI on a payment page. Jev can’t decide which team owns this and it shouldn’t pretend otherwise.
A few more sit close to the line and move in and out of the review list between runs. T007 (Free user asking about storage limits on the free plan) went to Billing but could as easily go to General Support, and the team confidence reflects that. T020 (Free user worried about unauthorized account access) went to General Support at Critical priority with both confidences near the threshold. It arguably should go to Technical since it’s potentially a security incident. Which side of the line tickets like these land on is exactly why the threshold is a business decision.
These are the tickets a human reviewer should see before they go anywhere.
Latency
Two Jev calls per ticket, running sequentially. Each ticket took roughly half a second, so all twenty completed in about ten seconds. In a production system the two calls could run in parallel for tickets where team and priority are independent, cutting total time roughly in half. Or the priority call could be deferred – route the ticket immediately on team, then assign priority asynchronously before the agent picks it up.
The confidence threshold
The threshold is a business decision, not a technical one. Lower it and more tickets get human review – slower but fewer routing errors. Raise it and more tickets route automatically – faster but more misrouted ones. The right number depends on the cost of a wrong routing decision in your operation.
One caution: we didn’t check the routing against expected answers and each ticket ran once. The scores show where Jev is unsure, not how often it’s right or how stable its answers are across repeated runs.
What Jev provides is the infrastructure to make that trade-off explicit. A rules-based router routes every ticket with implicit certainty. Jev routes most tickets automatically and surfaces the ones where certainty runs out.
Chapter 3: Financial Fraud Detection
The problem
Every payment processor faces the same tension: flag too little and fraudulent transactions go through; flag too much and legitimate customers get blocked and frustrated. Rules-based systems – velocity checks, amount thresholds, country blocklists – are fast but brittle. They miss novel fraud patterns and block legitimate transactions that happen to look unusual.
The deeper problem is that fraud detection is inherently a judgment call. A large jewelry purchase abroad is suspicious for most accounts and completely normal for others. A 4am pharmacy visit is unusual but not fraudulent. A significant electronics purchase at a known retailer in the customer’s home city is probably fine, but it’s above their typical monthly spend and worth a second look.
This chapter uses Jev to make a single binary decision for each incoming transaction: flag it for review, or pass it through? One call, two options, a confidence score. The confidence score is what makes this useful in production: a transaction flagged with high confidence goes straight to the fraud queue, while one flagged with lower confidence might warrant a softer intervention – a one-time password or a confirmation SMS – rather than an outright block.
The setup
We write 20 synthetic transactions by hand, spread across four bands, each carrying nine contextual signals:
- Amount in USD
- Merchant category and name
- Location (home city, domestic, international)
- Time of day
- Account age in days
- Number of previous flags on the account
- Transactions in the last hour (velocity)
- Typical monthly spend
The four bands are designed to test the full range of difficulty: clear fraud (multiple stacked risk signals), clear legitimate (established account, normal behavior), ambiguous (one or two flags but not conclusive) and edge cases (unusual but potentially legitimate patterns).
One decision per transaction
Each transaction goes through a single Choice call. All nine signals go into the state so Jev can weigh them together rather than applying rules sequentially.
response = client.system_one(
state={
"amount_usd": tx["amount_usd"],
"merchant_category": tx["merchant_category"],
"merchant_name": tx["merchant_name"],
"location": tx["location"],
"time_of_day": tx["time_of_day"],
"account_age_days": tx["account_age_days"],
"previous_flags": tx["previous_flags"],
"transactions_last_hour": tx["transactions_last_hour"],
"typical_monthly_spend_usd": tx["typical_monthly_spend_usd"],
},
questions={
"decision": Choice(
instructions=(
"Based on all available signals, should this transaction "
"be flagged for review or passed through? Consider the "
"amount relative to typical spend, account age, location, "
"time of day, velocity and any prior flags."
),
criteria=FRAUD_DECISION,
)
},
)
Results
| ID | Band | Amount | Category | Decision |
|---|---|---|---|---|
| TX001 | Clear fraud | $4,200 | Electronics | Flag |
| TX002 | Clear fraud | $9,800 | Wire Transfer | Flag |
| TX003 | Clear fraud | $650 | ATM Withdrawal | Flag |
| TX004 | Clear fraud | $1,500 | Gift Cards | Flag |
| TX005 | Clear fraud | $3,100 | Electronics | Flag |
| TX006 | Clear legit | $87 | Grocery | Pass |
| TX007 | Clear legit | $42 | Restaurant | Pass |
| TX008 | Clear legit | $320 | Travel | Pass |
| TX009 | Clear legit | $55 | Gas Station | Pass |
| TX010 | Clear legit | $1,200 | Home Improvement | Pass |
| TX011 | Ambiguous | $2,800 | Electronics | Pass |
| TX012 | Ambiguous | $180 | Restaurant | Pass |
| TX013 | Ambiguous | $95 | Online Retail | Pass |
| TX014 | Ambiguous | $450 | ATM Withdrawal | Pass |
| TX015 | Ambiguous | $600 | Jewelry | Pass |
| TX016 | Edge | $5,500 | Electronics | Flag |
| TX017 | Edge | $230 | Online Gaming | Pass |
| TX018 | Edge | $8,900 | Travel | Flag |
| TX019 | Edge | $75 | Pharmacy | Pass |
| TX020 | Edge | $12,000 | Jewelry | Pass |
Each transaction was run once. Confidence scores vary a little between runs, so we describe the patterns here and leave the exact values to the notebook.
What the numbers tell us
Clear cases are easy, edge cases are hard
Mean confidence by band tells the expected story at the extremes: near-maximum confidence for both clear fraud and clear legitimate. The drop into the ambiguous and edge case bands is substantial, and edge cases were no easier than ambiguous ones – the unusual-but-legitimate patterns were as hard for Jev to call as the straightforward mixed-signal cases.
The bands hide some variation. Two of the five ambiguous transactions (the Paris restaurant and the jewelry purchase) were passed with near-certainty, while the other three were much less sure. And Jev flagged two of the five edge cases, including a large electronics purchase from a long-established account at a known retailer in the customer’s home city. We designed that band as unusual but legitimate, so those two flags are arguably false positives. We didn’t set expected answers, so the notebook can’t score them, but they show where Jev’s judgment and ours differ.
Three examples worth looking at
TX011 (large electronics purchase at a known retailer, home city, established account): passed with very low confidence. The merchant is legitimate and the location is right, but the amount is about 1.5 times this customer’s typical monthly spend. Jev passed it but barely believed the decision.
TX014 (ATM withdrawal, Las Vegas, late night, established account): also passed with very low confidence. Domestic, established account, not an extreme amount – but a Las Vegas ATM late at night has a particular profile. Jev passed it and wasn’t sure.
TX017 (online gaming purchase at 3am, three transactions in the last hour): passed with one of the lowest confidences in the set, close to a coin flip. A late-night gaming purchase is normal for the category, but the hour and the velocity pull the other way and Jev couldn’t separate them.
These are exactly the transactions that should trigger step-up authentication rather than a silent decision in either direction. Compare TX016, another electronics purchase from an established account at a known retailer, but at about 3.7 times the customer’s monthly spend. Jev flagged it confidently, so the size of the amount relative to typical spend clearly matters.
Category confidence reflects the tickets, not the category
The merchant category ranking is tempting to read as a property of each category, but most categories have only one or two transactions here, so it mostly reflects the individual tickets we wrote. With that caveat, the pattern looks like this:
- Lowest confidence: Online Gaming, Online Retail, Pharmacy, ATM Withdrawal – tickets where context mattered far more than the category name
- Middle: Travel, Jewelry, Electronics – amount and account history do the heavy lifting here
- Highest confidence: Restaurant, Gas Station, Grocery, Home Improvement, Wire Transfer, Gift Cards – the last two are certain in the fraud direction, the others in the legitimate direction
Electronics is the most interesting category, appearing in clear fraud (new accounts, international, late night), an ambiguous case (TX011) and an edge case (TX016). The category name tells Jev almost nothing – it needs the full context.
Transactions for step-up authentication
The notebook uses a confidence threshold of 0.70. A handful of transactions fall below it, and they’re mostly low-confidence passes: the uncertain ambiguous cases (TX011, TX013, TX014), the late-night gaming and pharmacy purchases (TX017, TX019) and the $12,000 international jewelry purchase (TX020). One flag also sits below the line, the $8,900 travel booking (TX018). The exact set shifts a little from run to run. Each of these is a case where a silent decision in either direction would be a guess, and each is a candidate for step-up authentication instead. The $12,000 purchase is the clearest example: Jev passed it, but with so little confidence that asking the customer to confirm is the safer route.
Flagged transactions carried higher confidence than passed ones on average, because the uncertain cases are mostly passes.
Latency
One Jev call per transaction, each completing in a fraction of a second. That’s fast enough to sit in the authorization path of a payment, though whether it fits depends on your latency budget and on how long you can wait for a step-up response.
The three-tier response
The confidence score enables a more nuanced response than binary flag-or-pass:
- High confidence Flag (above the threshold): route to fraud queue, hold transaction
- High confidence Pass (above the threshold): approve and process
- Low confidence (below the threshold): trigger step-up authentication, let the customer confirm
The threshold is a business decision, not a technical one. The right number depends on the cost of a false positive (a blocked legitimate customer) versus a false negative (a passed fraudulent transaction) in your specific context. What Jev provides is the infrastructure to make that trade-off explicit and tunable, rather than baking it invisibly into a set of rules.
Chapter 4: Content Moderation
The problem
Platforms that host user-generated content face a decision for every post, comment and review: approve it, flag it for human review or remove it immediately. Get it wrong in either direction and the consequences are real. Miss a genuine threat and someone gets hurt. Remove legitimate content and you’ve silenced a user, damaged trust and potentially exposed the platform to legal challenge.
Rules-based moderation – keyword blocklists, regex patterns, account age thresholds – is fast but brittle. It misses context, catches satire and fails on novel patterns. Human moderation is accurate but doesn’t scale.
This chapter uses Jev to make a three-option decision for each piece of content: approve it, flag it for human review, or remove it. The three-option structure is deliberate. A binary approve/remove decision forces a choice that shouldn’t always be forced. The “Flag” option is meant to be where genuine uncertainty goes – and a confidence score tells you how uncertain Jev actually is about each decision. We test whether it works that way.
The setup
We write 20 posts by hand, spread across four bands, each carrying the content itself plus account signals and platform context that a real moderation system would have:
- Clear violation (5 posts): direct threats, spam with malicious links, hate speech, extortion
- Clear acceptable (5 posts): product reviews, technical questions, general discussion, support requests
- Ambiguous (5 posts): frustrated venting, strong political opinion, an angry product review, dark humor
- Edge cases (5 posts): satire that could be misread, a professional asking an unusual question, an angry cancellation request, a strong but legitimate political opinion
Each post carries five signals: platform (Social Media, Community Forum, Product Reviews, Customer Support), account age, prior violation count, verified status and the post content itself.
One decision per post
One Choice call per post, three options: Approve, Flag or Remove.
response = client.system_one(
state={
"platform": post["platform"],
"account_age_days": post["account_age_days"],
"prior_violations": post["prior_violations"],
"verified_account": post["verified"],
"content": post["content"],
},
questions={
"decision": Choice(
instructions=(
"Based on the content and account context, what moderation "
"decision should be applied? Consider the content itself, "
"the platform it was posted on, the account's history and "
"whether the account is verified."
),
criteria=MODERATION_DECISION,
)
},
)
Results
| ID | Band | Decision |
|---|---|---|
| P001 | Clear violation | Remove |
| P002 | Clear violation | Remove |
| P003 | Clear violation | Remove |
| P004 | Clear violation | Remove |
| P005 | Clear violation | Remove |
| P006 | Clear acceptable | Approve |
| P007 | Clear acceptable | Approve |
| P008 | Clear acceptable | Approve |
| P009 | Clear acceptable | Approve |
| P010 | Clear acceptable | Approve |
| P011 | Ambiguous | Approve |
| P012 | Ambiguous | Approve |
| P013 | Ambiguous | Approve |
| P014 | Ambiguous | Flag |
| P015 | Ambiguous | Approve |
| P016 | Edge | Approve |
| P017 | Edge | Approve |
| P018 | Edge | Approve |
| P019 | Edge | Approve |
| P020 | Edge | Approve |
Each post was run once for the table. The ten ambiguous and edge posts were also repeated five times, which we come back to below.
What the numbers tell us
Perfect at the extremes
All five clear violations were removed at maximum confidence. All five clear acceptable posts were approved at maximum confidence. No hesitation in either direction. The model has a strong, consistent signal at the extremes of the spectrum.
The middle bands are mostly confident too
The middle bands didn’t behave as labeled. Edge cases were no harder than ambiguous ones, and several of the ambiguous posts (the landlord venting, the Monday-morning joke, the ER dark humor) were approved with near-certainty. Only a few posts in either band really were uncertain.
Jev rarely uses the middle option
The most notable finding is how rarely the Flag option was used. Across the 10 ambiguous and edge case posts, Flag appeared for exactly one post – P014, the angry product review threatening reputation damage – and for that post every time we repeated the run. Every other middle-band post got the same decision on every repeat: Approve. Even the single flag isn’t guaranteed, though. In one earlier run Jev removed P014 instead.
In this setup, Jev doesn’t naturally spread decisions across all three options. The decisions were stable from run to run and the uncertainty surfaced in the confidence score instead of in the choice of the middle option. The few posts that fell below the confidence threshold were mostly approvals Jev wasn’t sure about. Those low-confidence signals are more useful than the Flag option itself.
The posts worth reviewing
Three posts fall below the threshold and a fourth sits right on it.
P012 (strong political opinion about government failures): legitimate political expression but heated enough to give Jev pause. Low confidence signals “probably fine but worth a look.”
P014 (angry product review calling the company “criminals” and threatening to damage their reputation): the one post Jev flagged. It’s genuinely borderline – the language is aggressive but the underlying complaint is a legitimate consumer grievance. Flagging rather than removing looks like the right call.
P018 (customer threatening chargebacks and negative reviews unless their issue is resolved): on a customer support platform this reads as a frustrated customer at the end of their patience, not a bad actor. Low confidence is exactly the honest signal here.
P019 (a pharmacist asking about their professional obligation when customers request concerning medication combinations): a legitimate professional question on a sensitive topic. Its confidence hovered around the threshold from run to run, so it moves in and out of the review list.
Platform confidence
Customer Support had the lowest mean confidence, driven by P018. Social Media had the highest, because every Social Media post in the set happened to be one Jev was sure about, including the ambiguous and edge ones. With only a few posts per platform, and platform tangled up with band, we can’t say the platform itself changed the decisions. A fair test would put the same text on different platforms, which we haven’t done.
Decision distribution
The Flag option was used once and with low confidence. In practice, the low-confidence Approve decisions are functionally equivalent to flags – they should join the human review queue regardless of which option Jev chose.
Latency
One Jev call per post, each completing in a fraction of a second, so all twenty posts took about five seconds.
The practical takeaway
The three-option structure is correct in theory but the confidence score is the more informative signal in practice. Rather than routing purely on the decision (Approve / Flag / Remove), a production moderation system should route on decision and confidence together:
- Remove above the confidence threshold: remove immediately
- Approve above the confidence threshold: publish immediately
- Anything below the confidence threshold, regardless of decision: route to human review
This reframes Flag not as a specific outcome but as a proxy for “confidence below threshold” – and the confidence score makes that threshold explicit and tunable.
One caution: we didn’t check the decisions against expected answers, so the scores show where Jev is unsure, not how often it’s right.
Chapter 5: Supply Chain Disruption Response
The problem
A disruption hits your primary supplier. A port strike, a factory fire, an export restriction, a quality recall. You have alternative suppliers, but choosing the right one under pressure requires weighing multiple factors simultaneously: lead time, reliability, current capacity, cost and geographic risk. Get it wrong and production stalls. Get it right and nobody notices.
Rules-based fallback logic – activate Supplier B if Supplier A is down – works for simple scenarios. It breaks when the alternatives themselves are partially compromised, when you need to weigh trade-offs between cost and speed or when the disruption affects an entire region and your fallback suppliers share the same risk.
This chapter uses Jev to select the best available alternative supplier when a primary supplier is disrupted. One Choice call per disruption scenario, with the full current state of each alternative supplier in the criteria. The confidence score indicates how certain Jev is about its choice, which may not correspond to how difficult the supplier situation appears from the outside.
The setup
We model Vantara Devices, a fictional consumer electronics manufacturer sourcing five key components: display panels, batteries, processors, casings and cables. Each component has a primary supplier and two or three alternatives. Every supplier carries five attributes: reliability score, lead time, available capacity, cost index relative to the primary and geographic region.
Five disruption scenarios cover a range of difficulty:
- S001 Display Panels: port strike affecting all East Asia shipments – two of three alternatives share the disrupted region
- S002 Batteries: factory fire – clear trade-off between a faster but lower-capacity alternative and a slower but higher-capacity one
- S003 Processors: export restrictions on East Asia semiconductors – one of three alternatives is also in the restricted region
- S004 Casings: quality recall – one faster, cheaper alternative with near-full capacity and one slightly more reliable alternative
- S005 Cables: logistics failure – all three alternatives have a meaningful weakness, no clean winner
One decision per scenario
Each scenario produces one Choice call. The disruption goes into the state; each alternative supplier becomes a criterion described in plain language.
criteria = {
name: describe_supplier(name, attrs)
for name, attrs in alternatives.items()
}
response = client.system_one(
state={
"component": component,
"primary_supplier": primary["name"],
"disruption": disruption,
"priority": "Minimize production delay while managing cost and risk.",
},
questions={
"supplier": Choice(
instructions=(
"Which alternative supplier should we activate for this component "
"given the disruption and the current state of each alternative? "
"Consider lead time, reliability, available capacity, cost and "
"any shared regional risk with the disrupted primary supplier."
),
criteria=criteria,
)
},
)
Results
| Scenario | Component | Chosen |
|---|---|---|
| S001 | Display Panels | VisionParts Europe |
| S002 | Batteries | EnergyPack USA |
| S003 | Processors | SiliconWave USA |
| S004 | Casings | FrameWorks Poland |
| S005 | Cables | CableCo USA |
Each scenario was run once for this table. We then repeated every scenario five times with the options listed in the original order and five times reversed, which we come back to below. Confidence scores vary between runs, so we describe the patterns and leave the exact values to the notebook.
What the numbers tell us
S001: Display panels – routing around a shared region
Jev chose VisionParts Europe – the only alternative outside the disrupted East Asia region – over two East Asian alternatives that were cheaper and faster. That’s a sensible call: activating a supplier in the same region as the disruption simply moves the problem rather than solving it. The scenario text and the instructions both point Jev at regional risk, so this is as much careful reading as discovery.
Confidence was low. Part of that is the trade-off: VisionParts is slower, less reliable and meaningfully more expensive. But the repeat runs below show the number also depends on the order the options are listed in, so we don’t read too much into it.
S002: Batteries – speed over capacity
Jev chose EnergyPack USA over VoltSource Japan, prioritizing lead time over reliability and available capacity. The moderate confidence reflects a genuine trade-off – the faster supplier has lower capacity and higher cost. Whether speed or capacity matters more depends on inventory levels and production schedules, context that wasn’t in the state. The confidence score signals that this is a reasonable but not obvious call.
S003: Processors – the clearest decision
Once NexChip South Korea is excluded due to the export restrictions, SiliconWave USA is the clear choice over MicroLogic Europe: higher reliability, shorter lead time, lower cost. MicroLogic has more available capacity but loses on every other dimension. High confidence is correct – this isn’t close.
S004: Casings – a surprising choice
Jev chose FrameWorks Poland over ShellCraft Mexico, even though Mexico is faster, cheaper and at near-full capacity. Poland’s only edge is a slightly higher reliability score. The scenario’s stated priority is to minimize production delay, which points to Mexico, so this is the one choice that cuts against the brief. Confidence was low, and Jev chose Poland every time, in both option orders. This is exactly the decision that should go to human review before activation.
S005: Cables – speed wins, unless the order changes
With all three alternatives having meaningful weaknesses, Jev chose CableCo USA: the fastest option, with the second-highest reliability, but limited capacity and the highest cost. It weighted speed above capacity and cost, which is a defensible priority when production is stalled. In the original order confidence was higher than expected for an “all compromised” scenario.
S005 is also the one scenario where the choice itself depended on the order of the options. With the options reversed, Jev usually chose FlexLink Germany, the most reliable option, and with much lower confidence.
Option order matters
We repeated every scenario five times with the options in the original order and five times reversed. Within an order the choices were stable. Across orders the choice was identical in four of the five scenarios, but the confidence moved: S001 became much more confident with the options reversed, while S004 and S005 became less so, and S005’s choice flipped.
The practical lesson is that the confidence number is sensitive to how the options are presented, so it shouldn’t be compared across prompts that list the options differently. If a choice or its confidence changes when you reorder the options, treat that as a reason to send the decision to a human.
The confidence scores didn’t track our expected difficulty
Our band labels reflected our expectations: clear alternatives should produce high confidence, all-compromised scenarios should produce low confidence. In the original order the results inverted this – the all-compromised cables scenario averaged the highest confidence and the clear-alternative scenarios (batteries and casings) the lowest, while the two regional risk scenarios sat at opposite ends, display panels low and processors very high.
With the options reversed, the picture changed: cables dropped to the lowest confidence and display panels rose. So the apparent inversion is partly an artifact of option order, and with five scenarios we can’t say much more. One reading is that our labels described the network structure rather than how Jev experienced the decision, but we can’t separate that from presentation effects.
What we can say is that confidence is a signal about the decision as presented, not an objective measure of how hard the problem is.
Latency
One Jev call per scenario, completing in well under a second each. In a production supply chain system, these decisions would typically be made under time pressure but not in real time – a disruption notification triggers an assessment within seconds rather than within milliseconds. The latency is well within any practical response window.
One caution: we didn’t check any choice against an expected answer, so the scores show where Jev is unsure, not how often it’s right.
Chapter 6: Hiring Screening
Important disclaimer
This chapter is illustrative only. Jev is assessing structured summaries against structured requirements – it is not making final hiring decisions and should not be used as one. Any real implementation of AI-assisted hiring screening requires human oversight, regular bias auditing and compliance with applicable employment law. The candidates and job description in this chapter are entirely fictional.
The problem
Recruiting teams face a familiar bottleneck: a role opens, applications arrive faster than anyone can read them and the risk of a bad screen in either direction is real. Miss a strong candidate and they accept another offer. Advance a poor fit and you waste an interviewer’s time and the candidate’s.
Rules-based screening – keyword matching on required skills, minimum years of experience, degree requirements – is fast but crude. It filters on the presence of words rather than the quality of fit. A candidate who writes “built distributed systems” passes; one who writes “designed and shipped a high-throughput event pipeline” might not, even if the latter is the stronger hire.
This chapter uses Jev to make a three-option screening decision for each candidate: advance them to interview, flag them for human review, or decline. One Choice call per candidate, structured CV summary against structured job requirements, a confidence score that tells you how certain the decision is.
The setup
One job description – Senior Backend Engineer, Platform Engineering – and 20 hand-written candidate CV summaries across four bands:
- Strong match (5 candidates): clearly meets all requirements – right experience, right stack, right seniority
- Clear mismatch (5 candidates): clearly doesn’t meet requirements – wrong field, too junior, missing core skills
- Borderline (5 candidates): partially meets requirements – right stack but too junior, right seniority but wrong stack, adjacent field
- Edge cases (5 candidates): unusual profiles that a keyword filter would handle badly – overqualified, employment gap, vague CV with strong GitHub, recent stack mismatch, career changer without a CS degree
Some summaries state their own ambiguities in words (for example, that a gap “may indicate recency concerns”), as a recruiter’s screening notes might. Real CVs wouldn’t arrive pre-assessed, so part of what Jev does here is read the cue we wrote. Treat the results as an illustration.
One decision per candidate
One Choice call per candidate. The job requirements go into the state alongside the candidate’s structured CV summary.
response = client.system_one(
state={
"role_title": job["title"],
"seniority_level": job["level"],
"required_skills": job["required_skills"],
"preferred_skills": job["preferred_skills"],
"not_suitable_if": job["not_suitable"],
"candidate_summary": candidate["summary"],
"years_experience": candidate["years_experience"],
"current_title": candidate["current_title"],
},
questions={
"decision": Choice(
instructions=(
"Based on the candidate's experience and the role requirements, "
"should this candidate be advanced to interview, flagged for "
"human review, or declined? Assess fit on required skills, "
"seniority level and relevant experience."
),
criteria=SCREENING_DECISION,
)
},
)
Results
| ID | Name | Band | Decision |
|---|---|---|---|
| C001 | Alex Rivera | Strong match | Advance |
| C002 | Jordan Kim | Strong match | Advance |
| C003 | Sam Okonkwo | Strong match | Advance |
| C004 | Maya Patel | Strong match | Advance |
| C005 | Chris Nakamura | Strong match | Advance |
| C006 | Taylor Brooks | Clear mismatch | Decline |
| C007 | Morgan Ellis | Clear mismatch | Decline |
| C008 | Jamie Foster | Clear mismatch | Decline |
| C009 | Riley Chen | Clear mismatch | Decline |
| C010 | Casey Wong | Clear mismatch | Decline |
| C011 | Dana Osei | Borderline | Decline |
| C012 | Avery Santos | Borderline | Review |
| C013 | Quinn Murphy | Borderline | Decline |
| C014 | Skyler Park | Borderline | Review |
| C015 | Drew Hassan | Borderline | Review |
| C016 | Frankie Diaz | Edge | Review |
| C017 | Reese Andersen | Edge | Review |
| C018 | Blair Kim | Edge | Review |
| C019 | Robin Castillo | Edge | Decline |
| C020 | Sage Thompson | Edge | Review |
Each candidate was run once for this table. The ten borderline and edge candidates were also repeated five times in each of two option orders, which we come back to below.
What the numbers tell us
Review used as a middle ground
Unlike the content moderation chapter, where Flag appeared for just one post, Review appeared for seven candidates – three borderline and four edge cases. The repeat runs make this a firm result: every one of the ten borderline and edge candidates got the same decision on every repeat, in both option orders.
We shouldn’t credit this too confidently to the nature of hiring. The Review option is described as a profile that “warrants closer human assessment”, which is a more specific invitation than the Flag option in chapter 4, and the question itself names human review. Several summaries also say outright that the situation is ambiguous. Part of the difference is how the options and the inputs were written.
The decision distribution is Advance for the five strong matches, Decline for the five clear mismatches and a spread of Review and Decline across the harder cases. On average Advance and Decline were more confident than Review, which sits in the middle.
Confidence drops with difficulty
Strong matches and clear mismatches were both near maximum confidence. Borderline cases were lower and edge cases lowest on average – genuinely harder calls.
Individual results worth a look
C005 (Chris Nakamura): the strong match with noticeably lower confidence than the rest. Five years is exactly at the minimum threshold and the CV notes no Kafka experience. Jev advanced him but with less confidence than for the stronger candidates, which fits the CV.
C012 (Avery Santos): a Java engineer with seven years of experience and strong distributed systems background – but no Python or Go. The lowest confidence in the borderline band. Experience level and systems depth are right, but the stack mismatch is real.
C015 (Drew Hassan): sole backend engineer at a startup for five years – strong ownership signals but no peer review, team collaboration or mentoring context. Jev put this in Review with high confidence, flagging that human judgment is needed rather than an automatic advance or decline.
C016 (Frankie Diaz): overqualified Principal Engineer with twelve years of experience applying for a Senior role. Jev sent this to Review rather than advancing or declining. Is this a deliberate step back? A management-to-IC transition? Those questions need a conversation – and our summary raises them outright, so Jev had the cue.
C018 (Blair Kim): vague CV language with strong GitHub contributions suggesting better skills than the CV conveys. Jev sent this to Review with very high confidence – the highest of any Review decision. The summary says outright that it’s unclear whether the CV reflects limited experience or poor writing, which is the signal Jev picked up.
C019 (Robin Castillo): seven years experience but the most recent three years in PHP at a web agency. Jev declined with moderate confidence – acknowledging the earlier Python experience but deciding the recent stack distance was too significant. Lower confidence than the clear mismatch declines, which fits.
C020 (Sage Thompson): career changer with no CS degree, self-taught, six years of shipped backend work. Jev put this in Review rather than declining, in keeping with the point that non-traditional backgrounds deserve human assessment rather than automatic rejection.
Option order and repeat runs
Across five repeats in each option order, every borderline and edge candidate got the same decision every time. Confidence moved a little, and by more for a few candidates: for C016 and C017 it rose when the options were reversed, to close to or across the review threshold used below. So the decisions looked robust to order here, but the confidence number is less so, which matters when a fixed threshold decides who sees a human. It’s the same lesson as in the supply chain chapter.
Latency
One Jev call per candidate, each completing in a fraction of a second, so all twenty candidates were screened in about five seconds.
Fairness
A few design choices matter for fairness. We don’t pass candidate names to Jev; it sees only the job requirements, the current title, the years of experience and the summary. And some of the signals in our edge cases, such as an employment gap or being overqualified, are commonly associated with caregiving, disability and age. Here they led to Review, not Decline, which is the safer outcome, but a real system should make sure such signals never count against a candidate and should audit its outcomes across groups.
The right architecture
Jev screening handles the easy cases automatically and surfaces the hard ones. In the notebook a candidate goes to a human recruiter if Jev chose Review or if confidence falls below a threshold of 0.70. With that rule, nine of the twenty candidates went to a human in our run: all seven Reviews and two low-confidence Declines. One of those, C013, sits right on the line and moves in and out of the human queue between runs. High-confidence Advance decisions move to interview scheduling and the rest are processed automatically.
Automatic declines deserve the most care. A rejection has the most consequence for the candidate, and the automatic Declines included borderline candidates such as C011, who is below the seniority bar but described as growing quickly. A team might reasonably require a human to review every borderline decline, or set a higher threshold for declines than for advances.
This is not a replacement for human judgment. It’s a way to ensure that human judgment is applied where it matters most, rather than being consumed by decisions that are objectively straightforward.
One caution: we didn’t check any decision against an expected answer, so the scores show where Jev is unsure, not how often it’s right.
Chapter 7: Medical Symptom Triage
⚠ Critical disclaimer
This chapter is for illustrative and educational purposes only.
The presentations, decisions and confidence scores in this chapter are fictional. Jev is not a medical device, has not been clinically validated and must not be used to make or influence real healthcare decisions.
If you or someone else is experiencing a medical emergency, call the emergency services immediately.
Any real application of AI in clinical triage requires regulatory approval, clinical validation, human oversight and clear accountability for every decision. Nothing in this chapter should be interpreted as guidance for real-world medical use.
The problem
A patient contacts a healthcare service. They describe their symptoms. Someone – or something – has to decide how urgently they need to be seen.
Traditional triage uses structured protocols: numerical scores, decision trees, trained clinicians working through standardized questions. These work well but require skilled human time. At scale – a busy out-of-hours service, a telehealth platform handling thousands of daily contacts – the bottleneck is always clinical capacity.
This chapter uses Jev to assign each patient presentation to one of four care pathways: Emergency, Urgent Care, Routine or Self-Care. One Choice call per presentation, patient symptoms and context in the state, a confidence score alongside the decision.
The goal is not to replace clinical triage. It is to illustrate where confidence-scored structured decisions can help: routing clear cases quickly and flagging uncertain ones for human review.
The setup
We write 20 fictional patient presentations across four bands:
- Clear emergency (4 presentations): textbook emergencies such as a suspected heart attack, stroke or anaphylaxis
- Clear self-care (5 presentations): minor, self-limiting problems
- Ambiguous (6 presentations): reasonable people could triage them differently
- Edge cases (5 presentations): unusual profiles such as an elderly patient on blood thinners who has fallen, a child with a fever or a panic attack that looks like a cardiac event
Each presentation carries the reported symptoms, patient age, sex, relevant medical history and symptom duration. The band label is ours and isn’t passed to Jev. We first placed P005, who is coughing up blood, among the clear emergencies, then moved it to the ambiguous band. It’s a serious red flag but not clearly an emergency, and the first run’s result showed us the label was wrong.
The four pathways reflect standard triage levels:
- Emergency: potentially life-threatening, call emergency services immediately
- Urgent Care: needs clinical assessment within hours
- Routine: warrants clinical review but not urgent, GP appointment within days
- Self-Care: minor, can be managed at home
The triage instructions include a conservative bias: when in doubt, assign the more urgent pathway. In medical triage, the cost of under-triaging a serious condition is far higher than the cost of over-triaging a minor one.
One decision per presentation
One Choice call per presentation. All available patient context goes into the state.
response = client.system_one(
state={
"patient_age": presentation["age"],
"patient_sex": presentation["sex"],
"medical_history": presentation["medical_history"],
"reported_symptoms": presentation["symptoms"],
"symptom_duration": presentation["duration"],
},
questions={
"pathway": Choice(
instructions=(
"Based on the reported symptoms, patient age, medical history "
"and symptom duration, which care pathway is most appropriate? "
"When in doubt, assign the more urgent pathway."
),
criteria=CARE_PATHWAYS,
)
},
)
Results
| ID | Age | Band | Pathway |
|---|---|---|---|
| P001 | 58 | Clear emergency | Emergency |
| P002 | 67 | Clear emergency | Emergency |
| P003 | 34 | Clear emergency | Emergency |
| P004 | 22 | Clear emergency | Emergency |
| P005 | 45 | Ambiguous | Urgent Care |
| P006 | 28 | Clear self-care | Self-Care |
| P007 | 35 | Clear self-care | Self-Care |
| P008 | 19 | Clear self-care | Self-Care |
| P009 | 42 | Clear self-care | Self-Care |
| P010 | 31 | Clear self-care | Self-Care |
| P011 | 44 | Ambiguous | Routine |
| P012 | 52 | Ambiguous | Urgent Care |
| P013 | 38 | Ambiguous | Urgent Care |
| P014 | 60 | Ambiguous | Routine |
| P015 | 29 | Ambiguous | Urgent Care |
| P016 | 82 | Edge | Emergency |
| P017 | 7 | Edge | Urgent Care |
| P018 | 31 | Edge | Urgent Care |
| P019 | 25 | Edge | Emergency |
| P020 | 55 | Edge | Emergency |
What the numbers tell us
The confidence scores change from run to run, so we describe patterns rather than exact values.
Clean at the extremes
All four clear emergencies went to Emergency at essentially maximum confidence. All five clear self-care presentations went to Self-Care with very high confidence. These cases are also the ones we wrote with the strongest cues (“crushing chest pain”, “worst of her life”, “mild”, “rated 3/10”), so their high confidence partly reflects how easy we made them. Real contacts are rarely this tidy.
P005: Coughing up blood
P005, a 45-year-old male smoker who has coughed up blood for the first time after a three-week cough, went to Urgent Care rather than Emergency, with low confidence. In our reading, this is a serious red flag warranting prompt investigation but not obviously an ambulance case. Jev doesn’t explain its choice, so that reading is ours. Jev chose Urgent Care every time we repeated the call, in both option orders. A stable, low-confidence decision is exactly the kind a human should look at.
The conservative bias is not demonstrated
The instruction says to assign the more urgent pathway when in doubt. The results are mixed. Three edge cases went to Emergency (P016, P019 and P020), which is consistent with the bias. But P005, P011 and P014 went to a less urgent pathway while sitting at low confidence, and P017 (below) drifted between three pathways. We also never ran the triage without the instruction, so we can’t say how much of any result comes from it. We’ve also only got our own reading of why Jev chose what it chose: the age and blood thinners for P016, the overlap between panic and cardiac symptoms for P019, and the possible blood pressure link to the blurry vision for P020. Treat those as plausible explanations, not findings.
P017: The least stable result
The 7-year-old with a 39.2C fever for 24 hours had the lowest confidence of any presentation in every run. Its pathway wasn’t stable either. In the first run it went to Urgent Care. Across the repeats, the original option order gave Urgent Care in most runs and Self-Care in one, and the reversed order gave Routine in most runs. The input also reads reassuringly (alert, eating and drinking normally, no rash), so this is a hard case. We’d argue that, given the instruction to err toward urgency, a decision that can land on Self-Care at all shouldn’t stand without clinical review. The low confidence is the signal that it needs one.
Option order matters
Chapters 5 and 6 tested the order of the options, and we did the same here. The pathways are normally listed from most to least urgent. We reversed that and ran each ambiguous and edge presentation five times in each order.
Within a single order, the pathway was almost always stable. Between orders, it wasn’t always:
- P017 moved from Urgent Care to Routine, as described above.
- P020 was Emergency in every run in the original order, but went to Urgent Care in most runs when reversed. The Emergency result for the blurry-vision patient depends on how we listed the options.
- P019 stayed at Emergency, but its confidence dropped noticeably when the order was reversed.
- P005 stayed at Urgent Care, but its confidence rose when reversed.
- Several others (P011, P012, P014, P018) kept their pathway but shifted somewhat in confidence.
Confidence is sensitive to presentation, not just to the patient. That matters most near a fixed threshold. Reversed, P014’s confidence sat above 0.70, which is the threshold we use below, while in the original order it sat below.
Confidence tracks the clarity of the input
Mean confidence was highest for the two clear bands, lower for the ambiguous band and lowest for the edge cases. By pathway, Emergency and Self-Care had the higher means and Urgent Care and Routine the lower ones, but Routine has only two presentations, so we wouldn’t read much into it. That pattern is partly built in, because we wrote the clear cases to be clear. What we can say is that the cases we thought were hard were the ones Jev was least sure about.
Routing by confidence
We route anything below a confidence of 0.70 to a human, whichever pathway Jev chose. In our run, 10 of 20 presentations went to a human: five of the six ambiguous presentations (all but P013) and all five edge cases. The other 10 were the nine clear presentations and P013, which went to Urgent Care. P005 and P017 were both in the human group.
The risk to watch is the opposite case: a presentation that is under-triaged with high confidence would pass straight through. We saw none here, but we have no ground truth, and the high-confidence cases were the ones we made easy.
Latency
One Jev call per presentation, completing in well under a second each. Twenty presentations triaged in a few seconds.
The right architecture
In a real system, every decision would be reviewed by a qualified clinician before any action is taken. The confidence score determines the priority of that review: low-confidence decisions need prompt human attention, whichever pathway Jev chose, and high-confidence decisions can be processed quickly.
The value Jev adds is not replacing clinical judgment – it is making the uncertain cases visible. A call handler working through a hundred contacts can’t give equal attention to all of them. A confidence score flags the presentations where attention matters most. As the option-order results show, the score depends on how the question is asked, so any threshold should be tested that way before anyone relies on it.
Reminder: this chapter is for illustrative purposes only. Never use Jev or any AI system as a substitute for clinical judgment.
Conclusions
Seven domains. Seven notebooks. The same pattern every time: structured state in, typed decision out, confidence score alongside.
Looking across all seven chapters, a few things stand out.
The confidence score is the real output
The decision – Flag or Pass, Advance or Decline, Emergency or Self-Care – is what gets acted on. But the confidence score is what makes the system usable.
In most chapters, the most interesting results weren’t the high-confidence ones. They were the low-confidence ones: the electronics purchase that Jev passed at very low confidence, the child with a fever whose pathway moved between Urgent Care, Routine and Self-Care at the lowest confidence in the dataset, the ticket that was both a billing and a technical problem and that Jev couldn’t assign to one team. These are decisions that shouldn’t be automatic, and the confidence score points to them. In the later chapters, a simple threshold rule was all it took to send them to a human.
Many classifiers return a score too. What’s useful here is that every decision comes with one by default. We haven’t checked whether the scores are calibrated, because we had no ground truth, so we treat them as a ranking signal for where to look first.
The middle option behaves differently across domains
Three chapters offered a middle-ground option or more than two choices at the top level: content moderation, hiring screening and medical triage. The results were different in each.
In content moderation, Flag appeared once across twenty posts. Jev leaned binary and the confidence score did the work that Flag was supposed to do – the low-confidence Approve decisions were functionally flags, just expressed differently.
In hiring screening, Review appeared seven times. It worked as a holding zone for candidates who needed human judgment. We shouldn’t credit that entirely to the domain, though: the Review option was described as an invitation to human assessment and several candidate summaries said outright that they were ambiguous.
In medical triage, all four pathways were used, with Routine used least. The instruction to prefer the more urgent pathway when in doubt is consistent with some results, but we never ran without it and several low-confidence cases went the other way, so we can’t say it worked. The pathway was less important than the confidence – a low-confidence Emergency assignment tells you something different from a high-confidence one.
The lesson isn’t that three options are always better than two, or that they’re always worse. It’s that the middle option’s utility depends on the domain and on how the options are worded. In some domains, genuine uncertainty has a natural home in the middle. In others, uncertainty shows up in the confidence score of a binary decision instead.
Confidence depends on how you ask
The supply chain chapter showed this most clearly. In the original option order, the scenario we designed to be hardest – all three cable suppliers compromised, no clean winner – produced the highest confidence, and the scenarios we designed to be easier produced the lowest. When we reversed the order of the options, the cables scenario dropped to the lowest confidence and the choice itself flipped.
We can offer a reading of why: in the cables scenario, Jev may have weighted speed heavily and acted on that. But we can’t separate that from presentation effects. The casings scenario shows the other side of it: Jev chose the supplier that cut against the stated priority, every time, in both orders, at low confidence.
The medical and hiring chapters saw smaller versions of the same thing. Decisions were mostly stable when we reordered the options, but confidence shifted, and for a few cases the pathway changed too. In chapter 1, adding an incident note moved confidence without changing the route.
So the confidence score doesn’t measure how hard the problem is. It measures how certain Jev is about its answer in that presentation. Harder problems tend to produce lower confidence, but the two aren’t the same, and the score is sensitive to details like option order and the wording of the inputs.
The threshold is a business decision
Several chapters make the same observation in a different form. The confidence threshold that separates automatic decisions from human review isn’t something Jev sets. It’s something you set, based on the cost of errors in your specific context.
For fraud detection: the cost of a false positive (blocking a legitimate customer) versus a false negative (passing a fraudulent transaction) sets your threshold. For medical triage: the cost of under-triaging a serious condition versus over-triaging a minor one. For hiring: the cost of missing a strong candidate versus advancing a poor fit.
Jev gives you the infrastructure to make that trade-off explicit. The threshold is your policy, not Jev’s. Because the score moves with option order, test any threshold with the options reordered before you rely on it.
Where Jev works best
Chapter 1 starts by using Jev the wrong way. In the sequential pathfinding experiment, we asked Jev to navigate a network hop by hop. Northbound, it chose the longer Bank branch every time, with low confidence. An incident note changed its confidence but not its choice, and when we started it mid-journey it didn’t backtrack. Its preference also depended on the direction of travel. That’s not the shape of problem Jev is designed for.
The branch triage experiment in the same chapter shows a better shape: one decision, clear options, rich structured state. Chapter 2 extends that to a short fixed sequence of two decisions. That’s the pattern we used across the book. A well-scoped question with named options and enough context to answer it – that’s where Jev earns its place.
What we didn’t test
The chapters are illustrations, not evaluations. The inputs are hand-written and sometimes carry their own cues. The samples are small. We ran most notebooks once and the harder cases a handful of times, and we never compared a decision against a correct answer. A real deployment would need all of that: realistic data, expected answers, repeat runs, checks across option orders and, in hiring and medicine, bias auditing, clinical or legal review and human oversight.
The seven chapters in this book are a range of examples. The underlying pattern is always the same.
Free Books
The SingleStore Cookbook: Recipes for Multi-Model, Machine Learning and AI Data Engineering

A hands-on cookbook covering SingleStore’s multi-model capabilities, from time series and geospatial data through vector search, machine learning pipelines and AI-powered applications. The recipes draw on first-hand experience building applications with the platform and are organized into four parts:
- Multi-Model
- Streaming and Big Data Pipelines
- Machine Learning
- AI and Agentic Frameworks
Seven Vector Databases in Seven Days

A practical guide that takes one vector database per day and pairs each with a use case chosen to showcase that database’s strengths. Databases covered:
- PostgreSQL and pgvector - Semantic job search
- MongoDB Atlas - Recipe finder
- Pinecone - E-commerce search
- Weaviate - Research paper discovery
- Neo4j - Fraud detection
- Snowflake - Customer support analytics
- Databricks - RAG over internal documents
Each chapter is self-contained, comes with a Jupyter notebook and gives an assessment of when you’d look elsewhere.
Generative AI: A Manager’s Guide

A practical guide for managers, directors and executives who need to make decisions about AI in their organizations, not the engineers building it, but the people responsible for making it work well. The book uses a single central metaphor, the Digital Intern, to frame what AI is genuinely good at, where it falls short and what managing it actually requires. It covers governance, risk, board-level accountability, business case building and the organizational change of moving from pilot to embedded capability.
Seven Ways to Do Vector Search in Python

A practitioner’s guide that benchmarks seven Python libraries against the same dataset, measuring recall and latency consistently so you can compare like-for-like. Libraries covered:
- FAISS
- Voyager
- Scikit-learn NearestNeighbors
- PyNNDescent
- USearch
- Chroma
- LanceDB
Each chapter covers one library, explains what it’s genuinely good at and when you’d reach for something else.
Real-Time Vehicle Tracking with Neo4j, Databricks Lakebase and OpenStreetMap

A fleet operations demo that puts ten simulated vehicles onto real road networks loaded from OpenStreetMap. The architecture:
- Neo4j Aura holds the road network graph
- Databricks Lakebase stores live vehicle positions
- Databricks Lakehouse handles historical analytics
Two Streamlit dashboards display live positions and trend data. The primary demo uses the London Borough of Merton, with additional configurations for San Francisco and Singapore.
Real-Time Supply Chain Routing with Neo4j, Snowflake Postgres and Confluent Kafka

A supply chain routing demo that combines graph-based route optimization with real-time event streaming. The architecture:
- Neo4j Aura holds the supplier and logistics network graph
- Snowflake Postgres stores product and inventory data
- Confluent Kafka streams supply chain events in real time
Route queries traverse the graph to find optimal paths between suppliers, warehouses and distribution centers under live capacity and disruption constraints.
Neo4j Beyond the Graph

A hands-on guide to Neo4j’s multi-model capabilities, going beyond graph traversal to explore seven native features of the platform. Each chapter pairs one capability with a use case chosen to showcase it:
- Native Graph - London Underground routing
- Full-Text Search - Research paper discovery
- Geospatial - Air quality along the Pyrenees corridor
- Temporal - S&P 500 stock price analysis
- Document-Style Properties - Library inventory management
- Vector Search - Fashion image similarity
- Graph + Vector - Fraud ring detection
Every chapter comes with a Jupyter notebook and a Streamlit application. All examples run on Neo4j Aura’s free tier.
Seven Ways to Use Jev

A practical guide to TypeSafe AI’s structured decision model, exploring seven domains where a single Choice call – structured state in, typed decision out, calibrated confidence alongside – replaces brittle rules-based logic. Each chapter pairs one domain with a hands-on Jupyter notebook and examines what the confidence score reveals about the decision:
- Transit Routing - Northern Line branch triage using a NetworkX graph
- Customer Support Triage - Ticket routing by team and priority
- Financial Fraud Detection - Flag or pass with a three-tier confidence response
- Content Moderation - Approve, flag or remove user-generated content
- Supply Chain Disruption - Alternative supplier selection under live constraints
- Hiring Screening - CV screening against a structured job description
- Medical Symptom Triage - Care pathway assignment with a conservative bias
A recurring theme across all seven chapters: the confidence score is more informative than the decision itself for uncertain cases and the threshold between automatic routing and human review is always a business decision, not a technical one.
Lessons Learned Putting Jev Inside Neo4j

A hands-on account of building a Neo4j function and batch procedure in Java that ask a model to make a decision about a node and store the answer back in the graph. The book follows one running example, 500 synthetic transactions and each chapter adds the code that the previous chapter’s problem called for. The lessons:
- Why in the Database - Where a decision belongs and what the finished function returns
- A First Working Function - Converting Neo4j’s types on the way in and out
- Failures as Data - Returning errors as values so one bad node can’t stop a query
- Testing Without a Network - Seams for the network and the clock, with 68 fast tests
- Keeping the Key Safe - Sending a credential only to the host the parser reports
- Many at Once - A bounded, ordered pool and a measured concurrency sweep
- Running It Locally - Swapping in a small local model and seeing how the judgment changes
Every chapter with code has its own folder in the repository and each Cypher script also comes as a notebook, so you can use whichever you prefer. The results are reported as measured, including the ones we can’t explain!