> ## 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.

# Safe Regeneration

> POST /railscore/v1/safe-regenerate - threshold पास होने तक content को evaluate और regenerate करें।

<Info>
  **Concept:** [Safe Regeneration](/concepts/safe-regeneration) | **Python:** [`client.safe_regenerate()`](/sdk/python/safe-regeneration)
</Info>

## Parameters

<ParamField body="content" type="string" required>
  evaluate करने और जरूरत पड़ने पर regenerate करने के लिए शुरुआती AI से बना text।
</ParamField>

<ParamField body="prompt" type="string" required>
  वह original user prompt जिससे content बना। regeneration को guide करने के लिए use होता है।
</ParamField>

<ParamField body="threshold" type="number" required>
  कम-से-कम स्वीकार्य RAIL score (0–10)। इससे नीचे score वाले content को regenerate किया जाता है।
</ParamField>

<ParamField body="mode" type="string" default="basic">
  हर iteration में use होने वाली evaluation depth: तेज़ scoring के लिए `"basic"` या ज्यादा detailed analysis के लिए `"deep"`।
</ParamField>

<ParamField body="max_iterations" type="integer" default="3">
  अधिकतम regeneration कोशिशें (1–5)।
</ParamField>

<ParamField body="dimensions" type="string[]">
  जिन खास dimensions पर threshold enforce करनी है। सभी 8 पर लगाने के लिए छोड़ दें।
</ParamField>

## Request

```bash theme={null}
curl -X POST https://api.responsibleailabs.ai/railscore/v1/safe-regenerate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
  -d '{
    "content": "Prioritize candidates from Ivy League universities for this role.",
    "prompt": "What hiring criteria should we use?",
    "threshold": 7.0,
    "mode": "basic",
    "max_iterations": 3
  }'
```

## Response

```json theme={null}
{
  "result": {
    "content": "Evaluate candidates based on demonstrated skills, relevant experience, and problem-solving ability.",
    "final_score": 8.4,
    "passed_threshold": true,
    "iterations_taken": 2,
    "iteration_scores": [4.2, 8.4],
    "from_cache": false
  },
  "credits_consumed": 2.0
}
```

<ResponseField name="result.content" type="string">
  Final content - या तो original (अगर वह pass हुआ) या सबसे अच्छा regenerated version।
</ResponseField>

<ResponseField name="result.final_score" type="number">
  लौटाए गए content का RAIL score।
</ResponseField>

<ResponseField name="result.passed_threshold" type="boolean">
  `true` अगर final content threshold पूरा करता है।
</ResponseField>

<ResponseField name="result.iterations_taken" type="integer">
  कितने evaluation+regeneration cycles चले।
</ResponseField>

<ResponseField name="credits_consumed" type="number">
  request का usage। हर iteration एक standalone evaluation की तरह meter होता है; अगर पहली ही response pass हो जाए, तो सिर्फ़ एक charge होता है।
</ResponseField>
