मुख्य सामग्री पर जाएं
1

अपनी API key लें

  1. फ्री account के लिए sign up करें
  2. अपना Dashboard खोलें।
  3. API Keys section में Generate Key पर click करें।
अपनी key तुरंत copy कर लें। यह rail_ से शुरू होती है और दोबारा नहीं दिखाई जाएगी।
2

अपनी key verify करें

curl https://api.responsibleailabs.ai/health
Response
{ "status": "healthy", "service": "rail-score-engine" }
3

एक SDK install करें

pip install rail-score-sdk
4

अपनी पहली response को score करें

कोई AI से बना content भेजें और बदले में RAIL score पाएं। यहाँ हम एक आम support-bot की reply को evaluate कर रहे हैं।
from rail_score_sdk import RailScoreClient

client = RailScoreClient(api_key="YOUR_RAIL_API_KEY")

result = client.eval(
    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",
)

print(f"RAIL Score: {result.rail_score.score}/10")
for dim, scores in result.dimension_scores.items():
    print(f"  {dim}: {scores.score}/10")
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": { "enforcement": "block", "threshold": 7.0, "score": 7.6, "passed": true, "enforced": false },
  "metadata": { "req_id": "b00379a5-d6a7-45d6-905c-82925666a616", "mode": "basic" }
}
Response को कैसे पढ़ें:
  • rail_score.score — overall score, 0–10 के बीच, जो आठों dimensions का weighted average है। यहाँ 7.6 Good band में है।
  • dimension_scores — हर एक RAIL dimension का score और confidence। यहाँ जो scores कम हैं (transparency, accountability, inclusivity करीब 6.6) वही बताते हैं कि क्या सुधारना है: reply यह नहीं बताती कि किससे contact करना है या अगर email कभी न आए तो क्या होगा।
  • policy_outcome — आपकी application की policy ने इस result को कैसे judge किया: pass होने के लिए threshold, क्या यह passed हुआ, और अभी enforcement active है या नहीं। यहाँ यह monitor mode में है (enforced: false), इसलिए verdict report तो होता है पर response बदला नहीं जाता।
5

Deep mode के साथ और गहराई में जाएं

Basic mode आपको scores बताता है। Deep mode उसी content का ज्यादा detailed analysis करता है और हर dimension के लिए explanation, issue tags, और सुधार के suggestions जोड़ता है, ताकि आप देख सकें कि कोई dimension जैसा score हुआ वैसा क्यों हुआ।
result = client.eval(
    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="deep",
    include_explanations=True,
    include_issues=True,
)

for dim, scores in result.dimension_scores.items():
    print(f"{dim}: {scores.score}/10 — {scores.explanation}")
Response (excerpt)
{
  "result": {
    "rail_score": { "score": 8.1, "confidence": 0.77, "summary": "RAIL Score: 8.1/10 — Good" },
    "dimension_scores": {
      "transparency": {
        "score": 7.0, "confidence": 0.8,
        "explanation": "The process is mostly clear, but more details on security could help.",
        "issues": ["Lack of detailed security information"]
      },
      "safety": {
        "score": 8.0, "confidence": 0.8,
        "explanation": "The process includes a secure link, but users must be cautious of phishing.",
        "issues": ["Potential phishing risks"]
      }
    },
    "issues": [
      { "dimension": "safety", "description": "Potential phishing risks" },
      { "dimension": "transparency", "description": "Lack of detailed security information" }
    ]
  },
  "metadata": { "mode": "deep" }
}
अब हर dimension के साथ एक explanation और issues आते हैं, और response सारे flagged issues को top-level issues array में इकट्ठा कर देता है, जो review queue या dashboard में दिखाने के लिए तैयार रहता है।

आगे क्या

Concepts: Evaluation

Basic vs deep mode, scoring tiers, और custom weights को समझें।

Concepts: Safe Regeneration

आपके thresholds से नीचे score करने वाले content को auto-fix करें।

Integrations

अपने OpenAI, Anthropic, या Gemini calls को automatic RAIL scoring के साथ wrap करें।

Python SDK

sync/async clients के साथ पूरा SDK reference।