[Free Module] Use Groq AI to filter spam emails and form submissions!

In this example, we are using Groq AI (free), to parse content and determine whether it is spam.

Example Output

Screenshot_2024-08-07_200837

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

Click to Expand Module Export Code

JSON - Copy and Paste this directly in the scenario editor

{
  "subflows": [
    {
      "flow": [
        {
          "id": 1,
          "module": "groq:createJSONChatCompletion",
          "version": 1,
          "mapper": {
            "model": "llama-3.1-70b-versatile",
            "systemPrompt": "Classify the provided email as spam or not spam. Consider factors such as language, grammar, urgency, suspicious links, and requested actions. Provide a confidence score and a concise reason for the classification.\n\nThe JSON should look like this:\n\n{\n  \"is_spam\": true,\n  \"confidence_score\": 0.98,\n  \"reason\": \"The content contains a suspicious link and keywords not typically found in a form submission.\",\n  \"suspicious_keywords\": [ \"p0rn\", \"pu$y\", \"loli\", \"sex\", \"weight loss\", \"casino\", \"gamble\", \"seo\" ],\n  \"suspicious_links\": [ \"https://bit.ly/example\" ]\n}",
            "userMessage": "",
            "temperature": "0.15"
          },
          "metadata": {
            "designer": {
              "x": 0,
              "y": 0,
              "name": "AI Spam Filter"
            }
          }
        }
      ]
    }
  ],
  "metadata": {
    "version": 1
  }
}

Where to get a free Groq AI API key

  1. Go to https://console.groq.com/keys

  2. Register for a free account

  3. Click on “Create API Key”
    Screenshot_2024-08-08_190851

@samliew

4 Likes