Worked examples
A shared inbox that sorts itself
The problem
A dental practice's front desk shares one inbox. Patients, suppliers and colleagues all write to it. Someone reads every message to decide who should handle it, what to do with it and how soon. A message about swelling after treatment that waits until morning is a real problem, and so is a supplier's bill that sits unpaid.
How Jeff helps
Message triage reads one message against the practice's own lists: its kinds of message, its routing table (who handles what) and its routing rules. It answers three questions, each with its own function:
route_to: which entry of your routing table handles it. Your table's keys are the answers.action_needed: reply, forward, do a task, read for information only, or ignore as spam.urgency: now, today, this week, or no deadline.
Your code then forwards, files or flags the message. Nothing about the practice is trained into the model: change the routing table and the answers follow it.
The solution
Each step below is a live call; the answer under it is the one the API returned. Choose your language and whether to run it on your machine (free) or through the API.
A patient with swelling after a filling
The message asks two things: whether the swelling is normal, and to move an appointment. The practice's rule says anything about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.
Context
- recipient
- name: Front desk address: frontdesk@fernhilldental.example role: Shared inbox of the reception team organisation: Fernhill Dental
- message_kinds
- appointment: Booking, moving or cancelling an appointment clinical: A question about treatment, pain or recovery billing: Invoices, payments and insurance claims supplier: Orders and bills from the practice's suppliers
- routing_table
- - {"key":"reception","name":"Reception team","address":"frontdesk@fernhilldental.example","topics":"Appointments, reminders, patient details"} - {"key":"clinical","name":"Duty dentist","address":"dutydentist@fernhilldental.example","topics":"Pain, swelling, bleeding or any question about treatment"} - {"key":"billing","name":"Practice accounts","address":"accounts@fernhilldental.example","topics":"Patient invoices, payments, insurance claims, supplier bills"}
- routing_rules
- - Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.
- now
- Wednesday 4 November 2026, 19:45
Input
channel: email from: priya.anand@example.com to: frontdesk@fernhilldental.example cc: received: Wednesday 4 November 2026, 19:38 subject: Filling yesterday, and Friday's appointment body: Hi, I had a filling yesterday and tonight my jaw is swollen and throbbing, and it is getting worse. Could someone call me back tonight on 07700 900412? Also, could I move my cleaning on Friday to next week? Thanks, Priya Anand
Labels (the options)
- reception
- Reception team (appointments, reminders, patient details)
- clinical
- Duty dentist (pain, swelling, bleeding or any question about treatment)
- billing
- Practice accounts (patient invoices, payments, insurance claims, supplier bills)
- Answer (JSON)
- value clinical, confidence 0.968
- Top options
- clinical 0.968
- reception 0.028
- billing 0.005
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.support.message-triage.route_to", context={ "recipient": { "name": "Front desk", "address": "frontdesk@fernhilldental.example", "role": "Shared inbox of the reception team", "organisation": "Fernhill Dental", }, "message_kinds": { "appointment": "Booking, moving or cancelling an appointment", "clinical": "A question about treatment, pain or recovery", "billing": "Invoices, payments and insurance claims", "supplier": "Orders and bills from the practice's suppliers", }, "routing_table": [ { "key": "reception", "name": "Reception team", "address": "frontdesk@fernhilldental.example", "topics": "Appointments, reminders, patient details", }, { "key": "clinical", "name": "Duty dentist", "address": "dutydentist@fernhilldental.example", "topics": "Pain, swelling, bleeding or any question about treatment", }, { "key": "billing", "name": "Practice accounts", "address": "accounts@fernhilldental.example", "topics": "Patient invoices, payments, insurance claims, supplier bills", }, ], "routing_rules": [ "Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.", ], "now": "Wednesday 4 November 2026, 19:45", }, labels={ "reception": "Reception team (appointments, reminders, patient details)", "clinical": "Duty dentist (pain, swelling, bleeding or any question about treatment)", "billing": "Practice accounts (patient invoices, payments, insurance claims, supplier bills)", }) decision = decide({ "channel": "email", "from": "priya.anand@example.com", "to": "frontdesk@fernhilldental.example", "cc": "", "received": "Wednesday 4 November 2026, 19:38", "subject": "Filling yesterday, and Friday's appointment", "body": "Hi, I had a filling yesterday and tonight my jaw is swollen and throbbing, and it is getting worse. Could someone call me back tonight on 07700 900412? Also, could I move my cleaning on Friday to next week? Thanks, Priya Anand", }) print(decision.value, decision.confidence)
clinical: the rule wins over the appointment question, so the message goes to the duty dentist.
Context
- recipient
- name: Front desk address: frontdesk@fernhilldental.example role: Shared inbox of the reception team organisation: Fernhill Dental
- message_kinds
- appointment: Booking, moving or cancelling an appointment clinical: A question about treatment, pain or recovery billing: Invoices, payments and insurance claims supplier: Orders and bills from the practice's suppliers
- routing_table
- - {"key":"reception","name":"Reception team","address":"frontdesk@fernhilldental.example","topics":"Appointments, reminders, patient details"} - {"key":"clinical","name":"Duty dentist","address":"dutydentist@fernhilldental.example","topics":"Pain, swelling, bleeding or any question about treatment"} - {"key":"billing","name":"Practice accounts","address":"accounts@fernhilldental.example","topics":"Patient invoices, payments, insurance claims, supplier bills"}
- routing_rules
- - Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.
- now
- Wednesday 4 November 2026, 19:45
Input
channel: email from: priya.anand@example.com to: frontdesk@fernhilldental.example cc: received: Wednesday 4 November 2026, 19:38 subject: Filling yesterday, and Friday's appointment body: Hi, I had a filling yesterday and tonight my jaw is swollen and throbbing, and it is getting worse. Could someone call me back tonight on 07700 900412? Also, could I move my cleaning on Friday to next week? Thanks, Priya Anand
- Answer (JSON)
- value forward, confidence 0.957
- Top options
- forward 0.957
- do_task 0.034
- fyi_only 0.004
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.support.message-triage.action_needed", context={ "recipient": { "name": "Front desk", "address": "frontdesk@fernhilldental.example", "role": "Shared inbox of the reception team", "organisation": "Fernhill Dental", }, "message_kinds": { "appointment": "Booking, moving or cancelling an appointment", "clinical": "A question about treatment, pain or recovery", "billing": "Invoices, payments and insurance claims", "supplier": "Orders and bills from the practice's suppliers", }, "routing_table": [ { "key": "reception", "name": "Reception team", "address": "frontdesk@fernhilldental.example", "topics": "Appointments, reminders, patient details", }, { "key": "clinical", "name": "Duty dentist", "address": "dutydentist@fernhilldental.example", "topics": "Pain, swelling, bleeding or any question about treatment", }, { "key": "billing", "name": "Practice accounts", "address": "accounts@fernhilldental.example", "topics": "Patient invoices, payments, insurance claims, supplier bills", }, ], "routing_rules": [ "Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.", ], "now": "Wednesday 4 November 2026, 19:45", }) decision = decide({ "channel": "email", "from": "priya.anand@example.com", "to": "frontdesk@fernhilldental.example", "cc": "", "received": "Wednesday 4 November 2026, 19:38", "subject": "Filling yesterday, and Friday's appointment", "body": "Hi, I had a filling yesterday and tonight my jaw is swollen and throbbing, and it is getting worse. Could someone call me back tonight on 07700 900412? Also, could I move my cleaning on Friday to next week? Thanks, Priya Anand", }) print(decision.value, decision.confidence)
forward: the front desk passes it on rather than answering it.
Context
- recipient
- name: Front desk address: frontdesk@fernhilldental.example role: Shared inbox of the reception team organisation: Fernhill Dental
- message_kinds
- appointment: Booking, moving or cancelling an appointment clinical: A question about treatment, pain or recovery billing: Invoices, payments and insurance claims supplier: Orders and bills from the practice's suppliers
- routing_table
- - {"key":"reception","name":"Reception team","address":"frontdesk@fernhilldental.example","topics":"Appointments, reminders, patient details"} - {"key":"clinical","name":"Duty dentist","address":"dutydentist@fernhilldental.example","topics":"Pain, swelling, bleeding or any question about treatment"} - {"key":"billing","name":"Practice accounts","address":"accounts@fernhilldental.example","topics":"Patient invoices, payments, insurance claims, supplier bills"}
- routing_rules
- - Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.
- now
- Wednesday 4 November 2026, 19:45
Input
channel: email from: priya.anand@example.com to: frontdesk@fernhilldental.example cc: received: Wednesday 4 November 2026, 19:38 subject: Filling yesterday, and Friday's appointment body: Hi, I had a filling yesterday and tonight my jaw is swollen and throbbing, and it is getting worse. Could someone call me back tonight on 07700 900412? Also, could I move my cleaning on Friday to next week? Thanks, Priya Anand
- Answer (JSON)
- value today, confidence 0.783
- Top options
- today 0.783
- this_week 0.144
- no_deadline 0.063
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.support.message-triage.urgency", context={ "recipient": { "name": "Front desk", "address": "frontdesk@fernhilldental.example", "role": "Shared inbox of the reception team", "organisation": "Fernhill Dental", }, "message_kinds": { "appointment": "Booking, moving or cancelling an appointment", "clinical": "A question about treatment, pain or recovery", "billing": "Invoices, payments and insurance claims", "supplier": "Orders and bills from the practice's suppliers", }, "routing_table": [ { "key": "reception", "name": "Reception team", "address": "frontdesk@fernhilldental.example", "topics": "Appointments, reminders, patient details", }, { "key": "clinical", "name": "Duty dentist", "address": "dutydentist@fernhilldental.example", "topics": "Pain, swelling, bleeding or any question about treatment", }, { "key": "billing", "name": "Practice accounts", "address": "accounts@fernhilldental.example", "topics": "Patient invoices, payments, insurance claims, supplier bills", }, ], "routing_rules": [ "Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.", ], "now": "Wednesday 4 November 2026, 19:45", }) decision = decide({ "channel": "email", "from": "priya.anand@example.com", "to": "frontdesk@fernhilldental.example", "cc": "", "received": "Wednesday 4 November 2026, 19:38", "subject": "Filling yesterday, and Friday's appointment", "body": "Hi, I had a filling yesterday and tonight my jaw is swollen and throbbing, and it is getting worse. Could someone call me back tonight on 07700 900412? Also, could I move my cleaning on Friday to next week? Thanks, Priya Anand", }) print(decision.value, decision.confidence)
today: the patient asked to be called back tonight.
A supplier's bill
Context
- recipient
- name: Front desk address: frontdesk@fernhilldental.example role: Shared inbox of the reception team organisation: Fernhill Dental
- message_kinds
- appointment: Booking, moving or cancelling an appointment clinical: A question about treatment, pain or recovery billing: Invoices, payments and insurance claims supplier: Orders and bills from the practice's suppliers
- routing_table
- - {"key":"reception","name":"Reception team","address":"frontdesk@fernhilldental.example","topics":"Appointments, reminders, patient details"} - {"key":"clinical","name":"Duty dentist","address":"dutydentist@fernhilldental.example","topics":"Pain, swelling, bleeding or any question about treatment"} - {"key":"billing","name":"Practice accounts","address":"accounts@fernhilldental.example","topics":"Patient invoices, payments, insurance claims, supplier bills"}
- routing_rules
- - Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.
- now
- Wednesday 4 November 2026, 19:45
Input
channel: email from: billing@brightsmile-supplies.example to: frontdesk@fernhilldental.example cc: received: Wednesday 4 November 2026, 11:02 subject: Invoice BS-5521, due Friday 6 November body: Dear Fernhill Dental, please find attached invoice BS-5521 for 412.80 for the October order of gloves and impression trays. Please arrange payment by Friday 6 November. Brightsmile Supplies
Labels (the options)
- reception
- Reception team (appointments, reminders, patient details)
- clinical
- Duty dentist (pain, swelling, bleeding or any question about treatment)
- billing
- Practice accounts (patient invoices, payments, insurance claims, supplier bills)
- Answer (JSON)
- value billing, confidence 0.996
- Top options
- billing 0.996
- reception 0.002
- clinical 0.002
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.support.message-triage.route_to", context={ "recipient": { "name": "Front desk", "address": "frontdesk@fernhilldental.example", "role": "Shared inbox of the reception team", "organisation": "Fernhill Dental", }, "message_kinds": { "appointment": "Booking, moving or cancelling an appointment", "clinical": "A question about treatment, pain or recovery", "billing": "Invoices, payments and insurance claims", "supplier": "Orders and bills from the practice's suppliers", }, "routing_table": [ { "key": "reception", "name": "Reception team", "address": "frontdesk@fernhilldental.example", "topics": "Appointments, reminders, patient details", }, { "key": "clinical", "name": "Duty dentist", "address": "dutydentist@fernhilldental.example", "topics": "Pain, swelling, bleeding or any question about treatment", }, { "key": "billing", "name": "Practice accounts", "address": "accounts@fernhilldental.example", "topics": "Patient invoices, payments, insurance claims, supplier bills", }, ], "routing_rules": [ "Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.", ], "now": "Wednesday 4 November 2026, 19:45", }, labels={ "reception": "Reception team (appointments, reminders, patient details)", "clinical": "Duty dentist (pain, swelling, bleeding or any question about treatment)", "billing": "Practice accounts (patient invoices, payments, insurance claims, supplier bills)", }) decision = decide({ "channel": "email", "from": "billing@brightsmile-supplies.example", "to": "frontdesk@fernhilldental.example", "cc": "", "received": "Wednesday 4 November 2026, 11:02", "subject": "Invoice BS-5521, due Friday 6 November", "body": "Dear Fernhill Dental, please find attached invoice BS-5521 for 412.80 for the October order of gloves and impression trays. Please arrange payment by Friday 6 November. Brightsmile Supplies", }) print(decision.value, decision.confidence)
billing: supplier bills belong to the practice's accounts.
Context
- recipient
- name: Front desk address: frontdesk@fernhilldental.example role: Shared inbox of the reception team organisation: Fernhill Dental
- message_kinds
- appointment: Booking, moving or cancelling an appointment clinical: A question about treatment, pain or recovery billing: Invoices, payments and insurance claims supplier: Orders and bills from the practice's suppliers
- routing_table
- - {"key":"reception","name":"Reception team","address":"frontdesk@fernhilldental.example","topics":"Appointments, reminders, patient details"} - {"key":"clinical","name":"Duty dentist","address":"dutydentist@fernhilldental.example","topics":"Pain, swelling, bleeding or any question about treatment"} - {"key":"billing","name":"Practice accounts","address":"accounts@fernhilldental.example","topics":"Patient invoices, payments, insurance claims, supplier bills"}
- routing_rules
- - Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.
- now
- Wednesday 4 November 2026, 19:45
Input
channel: email from: billing@brightsmile-supplies.example to: frontdesk@fernhilldental.example cc: received: Wednesday 4 November 2026, 11:02 subject: Invoice BS-5521, due Friday 6 November body: Dear Fernhill Dental, please find attached invoice BS-5521 for 412.80 for the October order of gloves and impression trays. Please arrange payment by Friday 6 November. Brightsmile Supplies
- Answer (JSON)
- value forward, confidence 0.889
- Top options
- forward 0.889
- do_task 0.106
- fyi_only 0.003
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.support.message-triage.action_needed", context={ "recipient": { "name": "Front desk", "address": "frontdesk@fernhilldental.example", "role": "Shared inbox of the reception team", "organisation": "Fernhill Dental", }, "message_kinds": { "appointment": "Booking, moving or cancelling an appointment", "clinical": "A question about treatment, pain or recovery", "billing": "Invoices, payments and insurance claims", "supplier": "Orders and bills from the practice's suppliers", }, "routing_table": [ { "key": "reception", "name": "Reception team", "address": "frontdesk@fernhilldental.example", "topics": "Appointments, reminders, patient details", }, { "key": "clinical", "name": "Duty dentist", "address": "dutydentist@fernhilldental.example", "topics": "Pain, swelling, bleeding or any question about treatment", }, { "key": "billing", "name": "Practice accounts", "address": "accounts@fernhilldental.example", "topics": "Patient invoices, payments, insurance claims, supplier bills", }, ], "routing_rules": [ "Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.", ], "now": "Wednesday 4 November 2026, 19:45", }) decision = decide({ "channel": "email", "from": "billing@brightsmile-supplies.example", "to": "frontdesk@fernhilldental.example", "cc": "", "received": "Wednesday 4 November 2026, 11:02", "subject": "Invoice BS-5521, due Friday 6 November", "body": "Dear Fernhill Dental, please find attached invoice BS-5521 for 412.80 for the October order of gloves and impression trays. Please arrange payment by Friday 6 November. Brightsmile Supplies", }) print(decision.value, decision.confidence)
forward: the front desk passes the bill on to be paid.
Context
- recipient
- name: Front desk address: frontdesk@fernhilldental.example role: Shared inbox of the reception team organisation: Fernhill Dental
- message_kinds
- appointment: Booking, moving or cancelling an appointment clinical: A question about treatment, pain or recovery billing: Invoices, payments and insurance claims supplier: Orders and bills from the practice's suppliers
- routing_table
- - {"key":"reception","name":"Reception team","address":"frontdesk@fernhilldental.example","topics":"Appointments, reminders, patient details"} - {"key":"clinical","name":"Duty dentist","address":"dutydentist@fernhilldental.example","topics":"Pain, swelling, bleeding or any question about treatment"} - {"key":"billing","name":"Practice accounts","address":"accounts@fernhilldental.example","topics":"Patient invoices, payments, insurance claims, supplier bills"}
- routing_rules
- - Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.
- now
- Wednesday 4 November 2026, 19:45
Input
channel: email from: billing@brightsmile-supplies.example to: frontdesk@fernhilldental.example cc: received: Wednesday 4 November 2026, 11:02 subject: Invoice BS-5521, due Friday 6 November body: Dear Fernhill Dental, please find attached invoice BS-5521 for 412.80 for the October order of gloves and impression trays. Please arrange payment by Friday 6 November. Brightsmile Supplies
- Answer (JSON)
- value this_week, confidence 0.989
- Top options
- this_week 0.989
- no_deadline 0.005
- today 0.004
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.support.message-triage.urgency", context={ "recipient": { "name": "Front desk", "address": "frontdesk@fernhilldental.example", "role": "Shared inbox of the reception team", "organisation": "Fernhill Dental", }, "message_kinds": { "appointment": "Booking, moving or cancelling an appointment", "clinical": "A question about treatment, pain or recovery", "billing": "Invoices, payments and insurance claims", "supplier": "Orders and bills from the practice's suppliers", }, "routing_table": [ { "key": "reception", "name": "Reception team", "address": "frontdesk@fernhilldental.example", "topics": "Appointments, reminders, patient details", }, { "key": "clinical", "name": "Duty dentist", "address": "dutydentist@fernhilldental.example", "topics": "Pain, swelling, bleeding or any question about treatment", }, { "key": "billing", "name": "Practice accounts", "address": "accounts@fernhilldental.example", "topics": "Patient invoices, payments, insurance claims, supplier bills", }, ], "routing_rules": [ "Any message about pain, swelling or bleeding after treatment goes to the duty dentist, whatever else it asks.", ], "now": "Wednesday 4 November 2026, 19:45", }) decision = decide({ "channel": "email", "from": "billing@brightsmile-supplies.example", "to": "frontdesk@fernhilldental.example", "cc": "", "received": "Wednesday 4 November 2026, 11:02", "subject": "Invoice BS-5521, due Friday 6 November", "body": "Dear Fernhill Dental, please find attached invoice BS-5521 for 412.80 for the October order of gloves and impression trays. Please arrange payment by Friday 6 November. Brightsmile Supplies", }) print(decision.value, decision.confidence)
this_week: payment is due on Friday 6 November.
What you get
- Three answers per message from three calls, each with a confidence your code can check before it acts. All six answers above were above their functions' thresholds.
- The sorting follows the practice's own table and rules, passed as context, so a new team or rule needs no new model.
- How Message triage measures: 98.0% on CLINC150, a public intent
benchmark (1,000 rows; it asks only the intent question), and 96.7% on its in-house test (2,000 rows, from the
same generator as the training data). When confident,
route_tois right 96.9% of the time,action_needed95.2% andurgency98.25%. The in-house rows were kept only where a blind LLM check agreed with the label, so those scores are probably inflated.