Applications
Open-source AI email triage for Gmail. Sorts your inbox into Needs reply, Updates, Promos, Sales and Spam with Jev, TypeSafe AI's decision model, via Vercel AI Gateway. Read-only, runs locally, 1,000 emails in about a minute for 3 cents.
import { experimental_evaluate as evaluate } from "ai";The link points at the commit we read, so the line number still holds.
These question sets are lifted from this project's source exactly as written.
categorychoiceWhich lane does this email belong in? Judge from the sender, subject, headers, and body together.
needs_reply — A real person expects a reply from the recipient: a colleague, customer, friend, or existing contact asking something or continuing a conversation.updates — Transactional or informational mail about the recipient's own accounts and activity: bank and card transaction alerts, OTPs and security notices, order, delivery, and booking status, receipts and invoices, bill reminders, service alarms, calendar or system notifications. Automated, addressed to the recipient, not trying to sell anything.promotional — Marketing: newsletters, campaigns, discounts, product announcements, event invitations, and content digests sent to a list. Usually has an unsubscribe link and is not about a specific transaction of the recipient.sales — Unsolicited cold outreach from a vendor, agency, or recruiter trying to start a conversation or book a call with the recipient.spam — Scams, phishing, fake invoices, or junk with no legitimate purpose.urgencyscoreHow urgently does this email need a reply from the recipient? Pick the level that best matches.
0 — No reply needed, or no time pressure at all1 — A reply within a week is fine2 — A reply within a few days is expected3 — A reply today is expected4 — A person is blocked, or a deadline falls within 24 hoursisPersonaltrue/falseWas this email written by a human specifically to this recipient, rather than sent to a list or generated by a system?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
category: { type: 'choice', instructions: 'Which lane does this email belong in? Judge from the sender, subject, headers, and body together.',
criteria: { needs_reply: 'A real person expects a reply from the recipient: a colleague, customer, friend, or existing contact asking something or continuing a conversation.', updates: 'Transactional or informational mail about the recipient\'s own accounts and activity: bank and card transaction alerts, OTPs and security notices, order, delivery, and booking status, receipts and invoices, bill reminders, service alarms, calendar or system notifications. Automated, addressed to the recipient, not trying to sell anything.', promotional: 'Marketing: newsletters, campaigns, discounts, product announcements, event invitations, and content digests sent to a list. Usually has an unsubscribe link and is not about a specific transaction of the recipient.', sales: 'Unsolicited cold outreach from a vendor, agency, or recruiter trying to start a conversation or book a call with the recipient.', spam: 'Scams, phishing, fake invoices, or junk with no legitimate purpose.' } },
urgency: { type: 'score', instructions: 'How urgently does this email need a reply from the recipient? Pick the level that best matches.',
criteria: ['No reply needed, or no time pressure at all', 'A reply within a week is fine', 'A reply within a few days is expected', 'A reply today is expected', 'A person is blocked, or a deadline falls within 24 hours'] },
isPersonal: { type: 'boolean', instructions: 'Was this email written by a human specifically to this recipient, rather than sent to a list or generated by a system?' },
},
});