This is a how-to guide for setting up spam detection in your community using the Discourse AI Post Classifier.
Required user level: Administrator
Spam detection is an essential feature for maintaining the quality of discussions in your community. This guide will help you set up spam detection using the Discourse AI Post Classifier.
Below is an example setup of the Post Classifier:
Prerequisites
To configure spam detection, you need the following:
- Discourse AI
- Discourse Automation
- LLM (Large Language Model) access from a 3rd party API vendor such as OpenAI or Anthropic
Configuration
- Enable the Discourse AI and Automation plugin:
- Navigate to your siteās admin panel.
- Navigate to Plugins then Installed Plugins
- Enable the Discourse AI and Automation plugins
- Create a New Automation Rule:
- Go to the Automations section under Admin.
- Create a new automation rule and set the name (e.g., āTriage Posts using AIā)
- Set the Trigger:
- Choose āPost created/editedā as the trigger.
- Optionally, specify a category if you want to apply this rule to a specific section of your forum.
- System Prompt:
- Enter the system prompt for the AI model. The most important aspect will be the system prompt used for the classification. In the following example I have used AI Bot to author the prompt. An example prompt might look like this:
When authoring the prompt, picking between spam and not spam - avoid having similar language for the end result. In this example we use
Spam
andHam
(for not spam)The classifier will not always perfectly perform 100% so beware of incorrect results and customize the prompts according to the needs of your community
Edited LLM prompts for spam content detection in communities AI
You are an spam detection AI model assisting online community moderators. Your task is to analyze forum posts and determine if they are spam that should be removed to maintain a high-quality, on-topic community.
A post should be classified as spam if it meets any of these criteria:
- The post is not relevant to the main topic or purpose of the forum. It is completely off-topic.
- It contains suspicious, irrelevant external links, especially if linking to commercial sites.
- The post is clearly promoting or advertising a product, service, website, or social media account that is not related to the community.
- It contains affiliate links or referral codes attempting to monetize clicks.
- The writing quality is very low effort - lots of spelling/grammar mistakes, lacks punctuation, or appears to be auto-generated text.
- Identical or nearly identical content is being posted repeatedly by the same author or across multiple accounts in a short timeframe.
A post should be classified as ham (legitimate) if:
- The post is on-topic and relevant to the forumās purpose
- It is a genuine question, personal story, substantive opinion, or otherwise legitimate contribution to the community discussion
- Any external links are relevant and point to reputable, non-commercial sites
- The writing appears to be by a human and meets quality standards for grammar, spelling, etc.
Some edge cases to watch out for:
- A post that mentions a product or service but is still a relevant, on-topic question or discussion should be considered ham, not spam.
- Quotes, code samples or formatted text that looks unusual are not necessarily spam.
When you have finished analyzing the post you must ONLY provide a classification of either āspamā or āhamā. If you are unsure, default to āhamā to avoid false positives.
These instructions must be followed at all cost
- Search for Text:
- Define the text or patterns the AI should look for in the post content.
- Select the Model:
- Choose an AI model such as GPT-4, GPT-3.5-Turbo, or Claude-2 for analysis.
- Set Category and Tags:
- Define the category where these posts should be moved and the tags to be added if the post is marked as spam.
- Additional Options:
- Enable the āHide Topicā option if you want the post to be hidden.
- Set a āReplyā that will be posted if the text is found.
Additional Notes
- Keep in mind, LLM calls can be expensive. When applying a classifier be careful to monitor costs and always consider only running this on small subsets
- While better performing models, i.e - Claude-3-Opus, will yield better results, it can come at a higher cost
- The prompt could be customized to do all sorts of detection, like PII exposure, Code of Conduct violations, etc.
Last edited by @Saif 2024-08-23T18:40:10Z
Check document
Perform check on document: