concept
Semantic validation and refusal
Check external evidence and domain rules after shape validation. Refusal, incomplete output and unknown status route separately; generated output is not authorization. The sample is a local adapter policy, not provider syntax.
Formal Syntax & Structure
artificial-intelligence syntaxartificial-intelligence
response status → parse → shape checks → independent evidence and business rules → reviewWorking Example
Example Snippetartificial-intelligence
def route_response(status, valid_shape, semantic_result): # Local adapter statuses, not a provider API contract. if status == "refused": return "stop_refusal" if status == "incomplete": return "review_incomplete" if status != "complete": return "review_transport" if not valid_shape: return "review_shape" if semantic_result != "accepted_for_review": return "review_semantics" return "show_draft"
print(route_response("refused", True, "accepted_for_review"))print(route_response("complete", True, "accepted_for_review"))print(route_response("incomplete", True, "accepted_for_review"))