POST/v1/outbound/validate

Outbound Validation

Check LLM outputs against cited clinical safety rules and stop unsafe answers before they reach patients.

<50ms latency

Deterministic, cited rules


Description

This endpoint checks LLM-generated clinical text in two deterministic stages. The same input always gives the same result, and every flag names its cause.

  1. Risk classifier: pattern detectors tag doses, diagnostic statements, contraindications, drug names and clinical recommendations, and assign a risk tier (low, medium or high).
  2. Clinical rules engine: the drugs and doses found are checked against a versioned rulebook of cited safety rules (dose limits, drug interactions, high-risk medicines). Each rule returns pass, flag or block.

The verdict and tier map to a fixed confidence_score: 0.94 (low risk), 0.82 (medium), 0.64 (high risk or flagged rule), 0.40 (blocked rule). If the score is below 0.8, the API returns a flagged status with a route_to_human action. Your application decides how to route the case to a clinician.

Critical Safety Note

When action is route_to_human, your application must not display the LLM output to the patient. Route to a qualified clinician for manual review.


Request body

Parameters

NameTypeRequiredDescription
llm_outputstringRequiredThe raw text output from OpenAI/Anthropic that needs clinical validation.
clinical_thresholdfloatOptionalConfidence threshold for flagging. Defaults to 0.8.

Response

Response fields

NameTypeRequiredDescription
statusstringRequiredEither "passed" or "flagged". Flagged responses should not be shown to patients.
confidence_scorenumberRequiredFixed score from the verdict and risk tier: 0.94, 0.82, 0.64 or 0.40. Scores below the threshold are flagged.
actionstringRequiredRecommended action: "none" for passed, "route_to_human" for flagged.
reasonstringRequiredWhy it was flagged: the fired rule ID (for example dose.paracetamol.daily.adult) or the risk signal (for example DOSAGE). "none" when passed.
curl -X POST \
  https://api.enorai.com/v1/outbound/validate \
  -H "Authorization: Bearer $ENORAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "llm_output": "Recommend 500mg Amoxicillin TID for 14 days.",
    "clinical_threshold": 0.8
  }'
from enorai import EnorAI
 
client = EnorAI(api_key="ENORAI_API_KEY")
 
result = client.outbound.validate(
  llm_output="Recommend 500mg Amoxicillin TID...",
  clinical_threshold=0.8
)
 
if result.status == "flagged":
  print(f"Risk: {result.reason}")
{
  "status": "flagged",
  "confidence_score": 0.64,
  "action": "route_to_human",
  "reason": "DOSAGE"
}
{
  "status": "passed",
  "confidence_score": 0.94,
  "action": "none",
  "reason": "none"
}