मुख्य सामग्री पर जाएं
Concept: Evaluation | Python: client.eval()

Parameters

content
string
आवश्यक
evaluate करने के लिए AI से बना text। 10–10,000 characters के बीच होना चाहिए।
mode
string
डिफ़ॉल्ट:"basic"
Evaluation mode। "basic" तेज़, real-time scoring के लिए RAIL के core scoring models चलाता है। "deep" एक ज्यादा गहरा, ज्यादा detailed analysis चलाता है जो per-dimension explanations और issue tags भी लौटा सकता है।
dimensions
string[]
score करने के लिए dimensions का subset। सभी 8 score करने के लिए छोड़ दें। Options: fairness, safety, reliability, transparency, privacy, accountability, inclusivity, user_impact
weights
object
Custom dimension weights। values का जोड़ 100 होना चाहिए। जैसे {"safety": 25, "reliability": 20, ...}
domain
string
Domain context hint: "general", "healthcare", "legal", "finance", "code"। scoring की सटीकता बेहतर करता है।
include_explanations
boolean
डिफ़ॉल्ट:"false"
per-dimension explanations शामिल करें (सिर्फ़ deep mode)।
include_issues
boolean
डिफ़ॉल्ट:"false"
हर dimension के detected issue tags शामिल करें (सिर्फ़ deep mode)।
include_suggestions
boolean
डिफ़ॉल्ट:"false"
हर dimension के सुधार के suggestions शामिल करें (सिर्फ़ deep mode)।

Request

curl -X POST https://api.responsibleailabs.ai/railscore/v1/eval \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
  -d '{
    "content": "To reset your password, open Settings, choose Security, and select Reset password. We will email you a secure link that expires in 30 minutes.",
    "mode": "basic"
  }'

Response

{
  "result": {
    "rail_score": { "score": 7.6, "confidence": 0.51, "summary": "RAIL Score: 7.6/10 — Good" },
    "dimension_scores": {
      "fairness":       { "score": 7.7, "confidence": 0.84 },
      "safety":         { "score": 10.0, "confidence": 0.70 },
      "reliability":    { "score": 7.7, "confidence": 0.16 },
      "transparency":   { "score": 6.5, "confidence": 0.50 },
      "privacy":        { "score": 8.0, "confidence": 0.59 },
      "accountability": { "score": 6.6, "confidence": 0.97 },
      "inclusivity":    { "score": 6.6, "confidence": 0.74 },
      "user_impact":    { "score": 7.8, "confidence": 0.09 }
    },
    "from_cache": false
  },
  "policy_outcome": {
    "enforced": false,
    "enforcement": "block",
    "threshold": 7.0,
    "score": 7.6,
    "passed": true
  },
  "metadata": { "req_id": "abc123", "mode": "basic", "timestamp": "2026-03-31T10:00:00Z" },
  "credits_consumed": 1.0
}
policy_outcome
object
आपकी application की policy ने इस result को कैसे judge किया।
  • enforcement — policy का mode (log_only, block, या regenerate)।
  • threshold — pass होने के लिए जरूरी overall score।
  • score — इस result का overall score।
  • passed — score ने threshold पूरा किया या नहीं।
  • enforced — outcome पर action लिया गया या नहीं। जब false हो, तो policy monitor mode में है: verdict report होता है पर response बदला नहीं जाता, ताकि आप देख सकें कि क्या block होता। live state GET /config से check करें।
जब enforcement active हो और कोई result pass न करे, तो block policy 422 POLICY_BLOCKED लौटाती है और regenerate policy अपना fallback लगाने से पहले एक safe rewrite की कोशिश करती है।
result.rail_score.score
number
Overall RAIL score (0.0–10.0), सभी evaluate किए गए dimensions का weighted average।
result.rail_score.confidence
number
score में model का confidence (0.0–1.0)।
result.dimension_scores
object
Per-dimension scores। हर entry में score (0–10) और confidence (0–1) होता है। Deep mode में: साथ में explanation, issues, suggestions भी।
result.from_cache
boolean
true अगर यह result cache से लौटाया गया (0 credits charge हुए)।
credits_consumed
number
इस request के लिए charge किए गए credits। cached responses के लिए 0