跳转到主要内容

Parameters

content
string
必填
The initial AI-generated text to evaluate and potentially regenerate.
prompt
string
必填
The original user prompt that produced the content. Used to guide regeneration.
threshold
number
必填
Minimum acceptable RAIL score (0–10). Content below this score is regenerated.
mode
string
默认值:"basic"
Evaluation mode per iteration: "basic" (1.0 credit each) or "deep" (3.0 credits each).
max_iterations
integer
默认值:"3"
Maximum regeneration attempts (1–5).
dimensions
string[]
Specific dimensions to enforce the threshold on. Omit to apply across all 8.

Request

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

{
  "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
}
result.content
string
The final content - either the original (if it passed) or the best regenerated version.
result.final_score
number
RAIL score of the returned content.
result.passed_threshold
boolean
true if the final content meets the threshold.
result.iterations_taken
integer
Number of evaluation+regeneration cycles performed.
credits_consumed
number
Total credits charged: eval_credit × iterations_taken.