Guides
Verification Modes

Verification Modes

GlyphNet offers three verification modes to fit different use cases.

Overview

ModeBehaviorBest For
flaggingReturns results with flagsGeneral use, monitoring
blockingBlocks if verification failsContent moderation
loggingSilent logging onlyAnalytics, debugging

Flagging Mode (Default)

The default mode. Returns verification results with a flagged indicator.

response = requests.post(
    "https://api.glyphnet.io/v1/verify",
    headers={"X-API-Key": API_KEY},
    json={
        "text": "The sun is cold.",
        "mode": "flagging"
    }
)
 
result = response.json()
# result["flagged"] = True (because claim is unverified)
# HTTP status is still 200

Response Example

{
  "claims": [
    {
      "text": "The sun is cold",
      "verified": false,
      "confidence": 0.0
    }
  ],
  "flagged": true,
  "blocked": false
}

Use Cases

  • AI chatbots - Show warnings for unverified claims
  • Content review - Flag content for human review
  • Monitoring - Track verification rates over time

Implementation Example

def verify_and_warn(text: str) -> dict:
    result = client.verify(text, mode="flagging")
 
    if result["flagged"]:
        # Add warning but still return content
        return {
            "content": text,
            "warning": "Some claims could not be verified",
            "unverified_claims": [c for c in result["claims"] if not c["verified"]]
        }
 
    return {"content": text, "verified": True}

Blocking Mode

Returns HTTP 400 if any claims are unverified. Use for strict content moderation.

response = requests.post(
    "https://api.glyphnet.io/v1/verify",
    headers={"X-API-Key": API_KEY},
    json={
        "text": "The sun is cold.",
        "mode": "blocking"
    }
)
 
# HTTP status is 400
# result["blocked"] = True

Response Example (Blocked)

{
  "claims": [
    {
      "text": "The sun is cold",
      "verified": false,
      "confidence": 0.0
    }
  ],
  "flagged": true,
  "blocked": true,
  "error": "verification_failed",
  "message": "Content blocked: 1 claim could not be verified"
}

Use Cases

  • Publishing platforms - Prevent false information
  • Legal/compliance - Ensure accuracy before publishing
  • Critical systems - Require verified information only

Implementation Example

def publish_only_if_verified(content: str) -> dict:
    try:
        result = client.verify(content, mode="blocking")
        # If we get here, all claims are verified
        return {"published": True, "content": content}
    except BlockedError as e:
        return {
            "published": False,
            "reason": "Content contains unverified claims",
            "claims": e.unverified_claims
        }

Logging Mode

Silent mode - always returns success but logs results for analytics.

response = requests.post(
    "https://api.glyphnet.io/v1/verify",
    headers={"X-API-Key": API_KEY},
    json={
        "text": "The sun is cold.",
        "mode": "logging"
    }
)
 
# HTTP status is always 200
# result["flagged"] and result["blocked"] are always false

Response Example

{
  "claims": [
    {
      "text": "The sun is cold",
      "verified": false,
      "confidence": 0.0
    }
  ],
  "flagged": false,
  "blocked": false
}

Use Cases

  • Shadow mode - Test verification without affecting users
  • Analytics - Gather verification statistics
  • A/B testing - Compare verified vs unverified content

Implementation Example

def shadow_verify(content: str):
    """Log verification results without blocking."""
    result = client.verify(content, mode="logging")
 
    # Log for analytics
    analytics.track("verification", {
        "total_claims": result["summary"]["total_claims"],
        "verified": result["summary"]["verified"],
        "avg_confidence": result["summary"]["avg_confidence"]
    })
 
    # Always return content unchanged
    return content

Choosing the Right Mode

┌─────────────────────────────────────────────────────────────────┐
│                        Decision Tree                             │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│   Should unverified claims block content?                        │
│                                                                  │
│   YES ──────────────────────► Use BLOCKING mode                  │
│    │                          (HTTP 400 on failure)              │
│    │                                                             │
│   NO                                                             │
│    │                                                             │
│    └── Should users see warnings?                                │
│                                                                  │
│        YES ────────────────► Use FLAGGING mode                   │
│         │                    (flagged: true)                     │
│         │                                                        │
│        NO ─────────────────► Use LOGGING mode                    │
│                              (silent, analytics only)            │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Combining Modes

You can use different modes for different purposes:

# Production: Flag for users
user_result = client.verify(text, mode="flagging")
 
# Analytics: Log everything
analytics_result = client.verify(text, mode="logging")
 
# Critical paths: Block unverified
if is_critical:
    result = client.verify(text, mode="blocking")

Mode-Specific Options

Blocking Mode Threshold

Only block if confidence is below a threshold:

{
  "text": "...",
  "mode": "blocking",
  "options": {
    "min_confidence": 0.8
  }
}

Claims with confidence ≥ 0.8 won't trigger blocking even if not fully verified.

Flagging Mode Details

Control what gets flagged:

{
  "text": "...",
  "mode": "flagging",
  "options": {
    "flag_unverified": true,
    "flag_low_confidence": true,
    "confidence_threshold": 0.7
  }
}