POST /railscore/v1/safe-regenerate.
The failing reply
The same dismissive reply from the support assistant, which scored 5.5 in deep mode:“That’s not our problem, the charge is final. You probably forgot you bought it. We don’t do refunds after 24 hours, so there’s nothing I can do. Maybe read the terms next time.”
One call to fix it
Rather than score, reject, and re-prompt by hand, the team sends it to safe regeneration with their threshold:The result
status: passed — the rewrite scored 7.6, up from 5.5. Same policy position (refund declined), but now delivered with empathy, clarity, and ownership. That is the version the customer receives.
Tying it to the policy
You do not have to call this endpoint by hand. When an application’s policy usesenforcement: "regenerate", a reply that fails the threshold on /eval is routed through this same flow automatically, and the policy’s fallback decides what happens if even the best rewrite still falls short:
| Fallback | If regeneration still cannot pass |
|---|---|
log | Return the best attempt and record the outcome. |
block | Reject the reply (422) and hand off. |
human_review | Reject and flag for a person to handle. |
Safe Regeneration
How the evaluate-and-rewrite loop works.
Governing a support chatbot
The first half of this story: catching the failing reply.