Contents
Overview
TruthGuard is an enterprise-grade AI safety platform that validates AI responses in real-time, detects hallucinations, ensures compliance, and provides complete audit trails for regulatory requirements.
Hallucination Detection
Real-time fact verification against Wikipedia, DuckDuckGo, and NewsAPI
Compliance Checking
Automated regulatory and policy violation detection
Audit Trails
Complete logging for regulatory compliance and explainability
Key Benefits
- • Prevent false information from reaching customers
- • Maintain regulatory compliance automatically
- • Reduce legal exposure from AI-generated content
- • Provide auditors with complete interaction history
System Architecture
Frontend Stack
Backend Stack
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Customer │────▶│ TruthGuard │────▶│ External │
│ AI System │ │ Platform │ │ APIs │
└────────────────┘ └────────────────┘ └────────────────┘
│
▼
┌────────────────┐
│ Supabase │
│ PostgreSQL │
└────────────────┘Detection Pipeline
Every AI response goes through a 5-step validation pipeline:
Claim Extraction
Uses spaCy NLP to extract factual claims from AI responses. Identifies nouns, numbers, dates, and verifiable assertions.
Fact Verification
Queries Wikipedia API, DuckDuckGo, and NewsAPI to verify claims. Uses semantic similarity to match claims with sources.
Compliance Checking
Validates against predefined compliance rules (financial advice, medical claims, etc.) and company-specific policies.
Consistency Analysis
Compares response with historical data to detect contradictions and ensure message consistency.
Decision & Correction
Generates confidence score, flags violations, and optionally auto-corrects responses using AI.
Status Outcomes
API Reference
TruthGuard provides a RESTful API for integration with any AI system.
/api/v1/validateValidate an AI response
{
"query": "What is Python?",
"ai_response": "Python is a programming language...",
"organization_id": "your-org-id",
"ai_model": "gpt-4"
}/api/v1/audit/interactionsList all interactions
// Query parameters ?limit=20 &offset=0 &organization_id=your-org-id &status=approved|flagged|blocked
/api/v1/audit/violationsList violations
// Query parameters ?severity=critical|high|medium|low &violation_type=hallucination|compliance|policy
/api/v1/ai-test/generateGenerate AI response and validate
{
"company_id": "company-uuid",
"user_query": "Your question here",
"ai_model": "gemini-pro"
}Integration Guide
1. Basic Integration
// Send AI response for validation
const response = await fetch('https://api.truthguard.ai/api/v1/validate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query: userQuery,
ai_response: aiResponse,
organization_id: 'your-org-id',
ai_model: 'gpt-4'
})
});
const result = await response.json();
if (result.status === 'blocked') {
// Use corrected response or show warning
return result.validated_response || "Unable to provide response";
}
return result.ai_response;2. Python Example
import requests
def validate_ai_response(query: str, ai_response: str) -> dict:
response = requests.post(
"https://api.truthguard.ai/api/v1/validate",
json={
"query": query,
"ai_response": ai_response,
"organization_id": "your-org-id",
"ai_model": "gpt-4"
}
)
return response.json()
# Usage
result = validate_ai_response("What is Python?", ai_response)
if result["status"] == "approved":
print("Response is valid!")
else:
print(f"Issues found: {result['violations']}")