Guardrails & review
Minimal grammY Telegram anti-spam bot powered by TypeSafe Jev
const TYPESAFE_URL = "https://api.typesafe.ai/v1/systemone";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.
from src/spam.ts:10
unsolicited_promotiontrue/falseIs `message` unsolicited promotional spam that a reasonable Telegram group moderator should delete?
profile_baittrue/falseIs `message` spam that tries to funnel readers to the sender's bio, profile, private messages, channel, or hidden link?
scam_or_phishingtrue/falseIs `message` a scam, phishing attempt, wallet-drainer lure, fake support message, impersonation, or fraudulent giveaway?
disruptive_spamtrue/falseIs `message` obvious disruptive Telegram spam that contributes no legitimate value to the group?
bot_promotiontrue/falseDoes `message` unsolicitedly advertise or invite group members to use another Telegram bot, game bot, channel, or mini app?
adult_dm_baittrue/falseDoes `message` solicit sexual content, dating contact, or private messages from group members?
gambling_promotiontrue/falseDoes `message` advertise or lure readers to a casino, betting, or gambling website?
easy_money_baittrue/falseDoes `message` use an unsolicited easy-money or implausible earnings claim as click bait?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
unsolicited_promotion: { type: 'boolean', instructions: 'Is `message` unsolicited promotional spam that a reasonable Telegram group moderator should delete?' },
profile_bait: { type: 'boolean', instructions: 'Is `message` spam that tries to funnel readers to the sender\'s bio, profile, private messages, channel, or hidden link?' },
scam_or_phishing: { type: 'boolean', instructions: 'Is `message` a scam, phishing attempt, wallet-drainer lure, fake support message, impersonation, or fraudulent giveaway?' },
disruptive_spam: { type: 'boolean', instructions: 'Is `message` obvious disruptive Telegram spam that contributes no legitimate value to the group?' },
bot_promotion: { type: 'boolean', instructions: 'Does `message` unsolicitedly advertise or invite group members to use another Telegram bot, game bot, channel, or mini app?' },
adult_dm_bait: { type: 'boolean', instructions: 'Does `message` solicit sexual content, dating contact, or private messages from group members?' },
gambling_promotion: { type: 'boolean', instructions: 'Does `message` advertise or lure readers to a casino, betting, or gambling website?' },
easy_money_bait: { type: 'boolean', instructions: 'Does `message` use an unsolicited easy-money or implausible earnings claim as click bait?' },
},
});