Skip to main content

Installation

Quick Start

Async Support

Configuration

Methods

client.sanitize(text, entities=None, mode=“sanitize”)

Sanitize text by replacing PII with placeholders. Returns SanitizeResponse with .sanitized, .session_id, .entities_found, .entities, .processing_ms, .redacted. Set mode="redact" to permanently remove PII. Redacted responses have session_id=None and cannot be rehydrated.

client.rehydrate(text, session_id)

Restore original PII to sanitized text. Returns RehydrateResponse with .text, .entities_restored, .processing_ms.

client.create_pattern(name, pattern, description="", examples=None)

Create a custom entity pattern. Returns PatternResponse with .pattern_id, .name, .status.

client.send_feedback(session_id, feedback_type, text_snippet, expected_type="")

Submit a single correction. Returns FeedbackResponse with .status.

client.get_insights()

Get pending insights and knowledge depth metrics. Returns InsightsResponse with .pending_conflicts, .proposed_improvements, .discovered_patterns, .knowledge_depth.

client.resolve_insight(insight_id, resolution, modifications=None, reason=None)

Resolve an insight. resolution is "approve", "refine", or "reject".

Batch Corrections

Chain corrections on a SanitizeResponse and submit them all at once:

Correction Methods on SanitizeResponse

Error Handling

Error Classes