Limits#
- class scikitplot.cleanprompt.Limits(max_input_chars=1000000, max_spans=100000, max_entries=50000, max_literal_terms=10000, max_literal_length=4096)[source]#
Hard bounds on one redaction pass.
- Parameters:
- max_input_charsint, default=1_000_000
Longest text accepted. Exceeding it raises
LimitExceededError.- max_spansint, default=100_000
Most detections accepted before overlap resolution.
- max_entriesint, default=50_000
Most distinct values newly detected in one text. Values carried in from earlier turns or pieces (a
seed) do not count.- max_literal_termsint, default=10_000
Most user-supplied literal terms accepted.
- max_literal_lengthint, default=4_096
Longest single literal term accepted.
- Raises:
- PolicyError
If any bound is not a positive integer.
- Parameters:
Notes
Developer notes. Bounds exist so that adversarial input fails loudly and early rather than consuming the process. They are policy, not constants, so a caller who genuinely needs a larger document can raise them explicitly and own that decision. Nothing in this submodule silently truncates: the
truncatedfield onRedactionResultis alwaysFalseand exists so a caller can assert that.The default
max_input_charsmatches the default document ceiling of the optional spaCy tier, so the base tier and the NER tier fail at the same size rather than at two different, surprising ones.
Gallery examples#
Cleanprompt from Python: Single Calls and Edge Cases