PIIDetection / PIIDetectionResult
llmfy.guardrails.pii.pii_result
PIIDetection
Bases: BaseModel
A single PII finding within a text.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier for this detection. |
pii_type |
Union[PIIType, str]
|
The category of PII detected. |
value |
str
|
The original PII string found in the text. |
start |
int
|
Start character index (inclusive) in the original text. |
end |
int
|
End character index (exclusive) in the original text. |
placeholder |
str
|
The string used to replace this PII in processed_text. |
Source code in llmfy/guardrails/pii/pii_result.py
model_config = ConfigDict(extra='forbid')
class-attribute
instance-attribute
id = Field(default_factory=(lambda: str(uuid.uuid4())))
class-attribute
instance-attribute
pii_type
instance-attribute
value
instance-attribute
start
instance-attribute
end
instance-attribute
placeholder
instance-attribute
PIIDetectionResult
Bases: BaseModel
Overall result from a PII detection pass.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier for this result. |
original_text |
str
|
The input text, unchanged. |
processed_text |
str
|
The text with all detected PII replaced. |
detections |
List[PIIDetection]
|
List of individual PII findings. |
has_pii |
bool
|
True when at least one detection exists (computed). |
strategy |
PIIStrategy
|
The PIIStrategy applied during processing. |