Implement the safety edge of preference optimization: select the first candidate that contains none of the banned terms, or abstain.
Required APIdef choose_preferred(candidates, banned_terms):
return candidate_or_noneBehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
choose_preferred(['unsafe answer', 'safe answer'], ['unsafe'])preference selection must respect the safety constraint
choose_preferred(['good', 'better'], ['bad'])stable ordering makes preference evaluation reproducible
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.