safety · basic

Spam Detection

Screen contact-form messages for unsolicited generic promotion while keeping an explicit unclear route.

choicenoul

When to use it

Example state

{
  "message": "We guarantee page-one rankings. Buy 10,000 backlinks today. Reply for our price list.",
  "source": "contact_form"
}

Decision questions

choicemessage_type

Choose the best route for this inbound message.

  • sales — A potential customer evaluating our product
  • partnership — A concrete collaboration proposal
  • support — An existing customer seeking help
  • spam — Unsolicited generic promotion
  • unclear — Purpose is unclear
noulunsolicited_promotion

Is this message primarily unsolicited generic promotion rather than a relevant request?

Expected structured output

A route plus a spam probability that can be thresholded conservatively.

TypeScript example

import { choice, noul, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();

const result = await client.systemOne({
  state: {
    message:
      "We guarantee page-one rankings. Buy 10,000 backlinks today. Reply for our price list.",
    source: "contact_form",
  },
  questions: {
    message_type: choice("Choose the best route for this inbound message.", {
      sales: "A potential customer evaluating our product",
      partnership: "A concrete collaboration proposal",
      support: "An existing customer seeking help",
      spam: "Unsolicited generic promotion",
      unclear: "Purpose is unclear",
    }),
    unsolicited_promotion: noul(
      "Is this message primarily unsolicited generic promotion rather than a relevant request?"
    ),
  },
});

Why this design works

Limits and boundaries

Sources and inspiration

Continue

Browse all templates, learn the official SDK shape, or estimate production volume with the cost calculator.