as_dict#
- scikitplot.cleanprompt.as_dict(obj)[source]#
Return a JSON-safe, secret-free dictionary for a result object.
- Parameters:
- objRedactionResult or RestorationResult or Stats
The value to describe.
- Returns:
- dict
A plain dictionary. Secrets are never included:
Entryis rendered without itsoriginalfield.
- Raises:
- TypeError
If
objis not one of the supported result types.
- Parameters:
obj (Any)
- Return type:
Notes
Developer notes. This is the only sanctioned serializer for results.
dataclasses.asdictwould walk intoEntry.originaland emit the secrets, which is exactly the mistake that made the upstream web tier ship personal data to the browser.
Gallery examples#
Cleanprompt from Python: Single Calls and Edge Cases
Cleanprompt from Python: Single Calls and Edge Cases