Every AI request on the Hasp platform flows through PHI Guard before it reaches an upstream model. PHI Guard is a mandatory compliance layer — it cannot be disabled — and it operates on the raw message content before any inference is performed.Documentation Index
Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt
Use this file to discover all available pages before exploring further.
What it does
PHI Guard scans outbound messages for Protected Health Information (PHI) using a combination of statistical NER and rule-based detectors (powered by Microsoft Presidio). On detection, it applies your org’s configuredphi_mode.
phi_mode values
| Mode | Behavior |
|---|---|
redact (default) | Detected PHI entities are replaced with placeholders (e.g., [PERSON], [US_SSN]) before the message is sent upstream. The response streams normally. The stored message row contains both the original encrypted content and the redaction metadata. |
block | Any message containing PHI returns 403 PHI_BLOCKED immediately — no inference is performed. The error response includes details.entity_types listing what was detected. |
phi_mode=off is not a valid state. Every organization operates under a compliance posture.
Configure phi_mode in Settings → AI Workspace → PHI Mode.
What counts as PHI
The scanner detects the 18 HIPAA identifier categories, including:- Names, geographic data, dates (other than year), phone numbers, fax numbers
- Email addresses, SSNs, medical record numbers, account numbers
- Certificate/license numbers, vehicle identifiers, device identifiers
- URLs, IP addresses, biometric identifiers, full-face photos
PHI_BLOCKED error (phi_mode=block)
Tool schema scanning
PHI Guard also scans tool definitions (function schemas) passed in the request. If a tool name, description, or parameter description contains PHI, the request is rejected with400 PHI_IN_TOOL_SCHEMA regardless of phi_mode. This rule cannot be relaxed — tool schemas are stored in plaintext in the model provider’s infrastructure and are not subject to the redaction pipeline.
PHI Guard on /v1/messages (Anthropic-compat)
PHI Guard applies identically on the Anthropic-compat endpoint. The error shape uses the Hasp envelope with Anthropic-compatibletype: "invalid_request_error" for PHI_IN_TOOL_SCHEMA; PHI_BLOCKED returns 403 using the standard Hasp error envelope (not Anthropic’s shape, since Anthropic has no equivalent concept).