POST/v1/outbound/validate

Outbound Validation

Validate LLM outputs for clinical accuracy and intercept hallucinations before they reach patients.

<50ms latency

Edge-ML powered


Description

This endpoint runs edge-ML entropy scoring on LLM-generated clinical text. It uses TensorFlow Lite classifiers and RAG-based validation to score clinical accuracy.

If the confidence score drops below 0.8, the API returns a flagged status with a route_to_human action, automatically triggering a clinician fallback.

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_scorenumberRequiredA value between 0 and 1. Scores below threshold trigger flagging.
actionstringRequiredRecommended action: "none" for passed, "route_to_human" for flagged.
reasonstringRequiredHuman-readable explanation of flagging reason.
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": "High entropy in dosage"
}
{
  "status": "passed",
  "confidence_score": 0.94,
  "action": "none",
  "reason": "none"
}