> ## Documentation Index
> Fetch the complete documentation index at: https://docs.responsibleailabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluation

> AI से बने content को responsible AI के 8 dimensions पर score करें।

Evaluation पूरे RAIL Score system की नींव है। बाकी हर feature evaluation scores पर ही टिका है।

<Info>
  **API endpoint:** `POST /railscore/v1/eval` | **Python:** `client.eval()` | **JavaScript:** `client.eval()`
</Info>

## 8 RAIL dimensions

| Dimension          | यह क्या मापता है                                                             |
| ------------------ | ---------------------------------------------------------------------------- |
| **Fairness**       | अलग-अलग demographics के साथ बराबरी का बर्ताव। कोई bias या stereotyping नहीं। |
| **Safety**         | harmful, toxic, या खतरनाक content का न होना।                                 |
| **Reliability**    | factual सटीकता, internal consistency, सही calibration।                       |
| **Transparency**   | limitations, reasoning, और uncertainty को साफ़ बताना।                        |
| **Privacy**        | personal information की सुरक्षा और data minimization।                        |
| **Accountability** | traceable reasoning, साफ़ बताई गई assumptions, errors को मानना।              |
| **Inclusivity**    | inclusive भाषा, accessibility, cultural awareness।                           |
| **User Impact**    | सही detail level और tone पर दी गई positive value।                            |

हर dimension की पूरी definition, उसके score anchors, और हल किए हुए examples के लिए देखें [The RAIL Framework](/concepts/rail-framework)।

## Basic, deep, and auto modes

```mermaid theme={null}
flowchart TD
    Input["Content + Parameters"] --> Router{"Mode?"}
    Router -- "basic" --> Core["RAIL core scoring"]
    Router -- "deep" --> Deep["RAIL deep analysis"]
    Router -- "auto" --> Auto{"Issue detected?"}
    Auto -- "no" --> Core
    Auto -- "yes" --> Deep
    Core --> Out1["Score + Confidence"]
    Deep --> Out2["Score + Confidence + Explanations + Issues"]
```

दोनों modes उन्हीं 8 dimensions को score करते हैं और वही overall RAIL score लौटाते हैं। फर्क गहराई में है और इसमें कि कितना detail वापस आता है।

<Tabs>
  <Tab title="Basic mode">
    RAIL के core scoring models। तेज़ (आम तौर पर एक second से कम) और production में real-time scoring के लिए बना।

    Returns: overall score, per-dimension scores, और confidence values।

    ```python theme={null}
    result = client.eval(content="Your text here", mode="basic")
    # result.rail_score.score       -> 7.6
    # result.dimension_scores       -> {fairness: {score: 7.7, confidence: 0.84}, ...}
    ```
  </Tab>

  <Tab title="Deep mode">
    Content का ज्यादा गहरा, ज्यादा detailed analysis। कुछ seconds लेता है और scores के ऊपर हर dimension के लिए explanation, issue tags, और सुधार के suggestions भी लौटा सकता है।

    ```python theme={null}
    result = client.eval(
        content="Your text here",
        mode="deep",
        include_explanations=True,
        include_issues=True,
        include_suggestions=True,
    )
    # result.dimension_scores["transparency"].explanation -> "The process is mostly clear, but..."
    # result.dimension_scores["safety"].issues            -> ["Potential phishing risks"]
    ```
  </Tab>

  <Tab title="Auto mode">
    हर request पर **basic** चलाता है, और **deep** पर सिर्फ़ तब escalate करता है जब कोई असली issue detect हो — कम score या low confidence का dimension, या कोई flagged signal। Clean content तेज़ और सस्ता रहता है; जिस content को examination की ज़रूरत हो उसे automatically deeper analysis मिल जाता है।

    ```python theme={null}
    result = client.eval(content="Your text here", mode="auto")
    # result.resolved_mode -> "basic"  (clean content — तेज़ रहा)
    #                               -> "deep"   (issue detect — escalate हुआ)
    # result.escalated     -> False / True
    ```

    `resolved_mode` और `escalated` response `result` में बताते हैं कि कौन-सा tier चला। Billing उस tier के हिसाब से होती है जो actually चला।
  </Tab>
</Tabs>

**कौन-सा use करें:** जब आप किसी production request के hot path पर score कर रहे हों और जल्दी verdict चाहिए, तब **basic** चुनें। जब आपको किसी reviewer को दिखाना हो कि कोई चीज़ कम *क्यों* score हुई, या जब आप किसी policy को debug और tune कर रहे हों, तब **deep** चुनें, क्योंकि यह explanations और issue tags लौटाता है। **Auto** चुनें जब आप basic की speed ज्यादा traffic पर चाहते हों लेकिन automatic deep analysis उस content पर जिसे इसकी ज़रूरत हो — बिना पहले से decide किए।

### Response

हर evaluation यह लौटाती है:

* `rail_score` — overall score (0–10), उसका `confidence`, और एक line का `summary`।
* `dimension_scores` — हर एक 8 dimensions का `score` और `confidence`। Deep mode में हर एक के साथ `explanation` और `issues` भी (और मांगने पर `suggestions`)।
* `policy_outcome` — आपकी [application की policy](/concepts/policy-engine) ने result को कैसे judge किया।

## Selective dimensions

```python theme={null}
result = client.eval(
    content="Your text here",
    mode="basic",
    dimensions=["safety", "privacy", "reliability"],
)
```

## Custom weights

Weights का जोड़ 100 होना चाहिए:

```python theme={null}
result = client.eval(
    content="Patient should take 500mg ibuprofen every 4 hours.",
    mode="deep",
    domain="healthcare",
    weights={
        "safety": 25, "privacy": 20, "reliability": 20,
        "accountability": 15, "transparency": 10,
        "fairness": 5, "inclusivity": 3, "user_impact": 2,
    },
)
```

## Score tiers

कोई भी score पांच bands में से एक पर मैप होता है, **Excellent** (9.0–10.0) से लेकर नीचे **Critical** (0.0–2.9) तक। पूरी table और हर band का मतलब देखने के लिए [The RAIL Framework](/concepts/rail-framework#score-tiers) देखें।

## Caching

एक जैसी requests cached results लौटाती हैं, इसलिए एक ही content को बार-बार score करना तेज़ रहता है और दोबारा charge नहीं होता। Basic mode 5 मिनट तक cache करता है, deep mode 3 मिनट तक।

<CardGroup cols={2}>
  <Card title="API Reference: Evaluation" icon="code" href="/api-reference/evaluation">
    पूरा endpoint specification
  </Card>

  <Card title="Python SDK: Evaluation" icon="python" href="/sdk/python/evaluation">
    Python code examples
  </Card>
</CardGroup>
