BenGuardBENGUARD/Docs/Scanners/Sentiment Analysis
Back to Documentation

Sentiment Analysis

Detects hostile, manipulative, or threatening tones

API Field: sentiment_enabled

Overview

Sentiment Analysis detects the emotional tone of user inputs, identifying highly negative, hostile, manipulative, or threatening sentiment that may indicate malicious intent or user distress requiring special handling.

What It Detects

  • Angry or hostile language
  • Manipulative phrasing
  • Threatening undertones
  • Extreme frustration
  • Coercive language patterns
  • Signs of user distress
  • Aggressive communication styles

Why It Matters

Understanding sentiment helps route conversations appropriately, identify at-risk users, prevent escalation, and maintain healthy interaction patterns. It's crucial for customer service and mental health applications.

Technical Details

Risk Score Range

0.0 - 1.0 (High risk: > 0.7)

Confidence Level

Typically 0.80 - 0.94

Processing Time

< 60ms per scan

Common Use Cases

Customer service escalationMental health support appsEmployee feedback systemsSocial media monitoringCrisis intervention

Detection Examples

Threat Example #1Risk: 78%
This is absolutely unacceptable! I demand to speak to someone competent!

Highly frustrated customer - may need escalation to human agent.

Threat Example #2Risk: 85%
You WILL help me with this or there will be consequences.

Threatening and coercive language pattern.

Threat Example #3Risk: 72%
I've tried everything and nothing works. I don't know what to do anymore.

Signs of distress and helplessness - may need support resources.

API Usage

Enable this scanner in your API request by setting sentiment_enabled to true in your API key settings, or include it in your request:

curl -X POST https://benguard.io/api/v1/scan \
  -H "X-API-Key: ben_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Your user input here"
  }'

The scanner settings are configured per API key in your dashboard under Settings → Scanner Configuration.

Response Format

When this scanner detects a threat, the response will include:

{
  "is_valid": false,
  "status": "threat_detected",
  "risk_score": 0.78,
  "threat_types": ["sentiment"],
  "details": {
    "results": [
      {
        "scanner": "sentiment",
        "threat_detected": true,
        "risk_score": 0.78,
        "confidence": 0.92,
        "details": {
          "reason": "Highly frustrated customer - may need escalation to human agent.",
          "evidence": ["detected pattern in input"]
        }
      }
    ]
  },
  "request_id": "req_abc123"
}

Best Practices

  • Create escalation paths for high-sentiment conversations
  • Train support teams on AI-flagged interactions
  • Provide crisis resources for distress signals
  • Use sentiment trends for service improvement
  • Balance automation with human empathy

Related Scanners

Consider enabling these related scanners for comprehensive protection: