🤖 AI Summary
A developer ported a server-based spam-detection demo to run with Chrome AI’s on-device capabilities, using the Prompt API to classify whether text would be flagged as spam and return reasons. The idea is to provide real-time, in-browser guidance — for example, flagging email or CMS copy that might get routed to spam — without round trips to a server. The demo produced sensible results: aggressive, vague debt-collection copy was flagged as spam with specific reasons (threats, vague details, pressure tactics), while a polite conference follow-up was correctly labeled non-spam.
Technically, the proof-of-concept uses window.LanguageModel.create with a system prompt to steer behavior, monitors model download progress via downloadprogress events, and enforces structured output via a JSON schema (top-level boolean spam and an array reasons). Calls look like session.prompt(input, { responseConstraint: spamCheckResultSchema }). That structured-response pattern is important — it makes programmatic handling and UI integration straightforward. Note the Prompt API is currently behind a Chrome flag and available to extensions but not yet in the main browser. The demo shows on-device, privacy-friendly, low-latency spam signaling is feasible in web apps and could be integrated into editors and moderation pipelines once Chrome’s APIs are more widely available.
Loading comments...
login to comment
loading comments...
no comments yet