API Reference4 min read•Updated July 2026
Configuration & Custom Tiers
Customizing priority tier thresholds, regex rules, and retention parameters.
Configuring ContextCompressor
Instantiate `ContextCompressor` with tailored rules:
config.py
from llmslim import ContextCompressor
compressor = ContextCompressor(
target_ratio=0.4,
preserve_code=True,
preserve_entities=True,
custom_protected_keywords=["CONFIDENTIAL", "API_KEY", "MUST_NOT"]
)
result = compressor.compress(prompt)Frequently Asked Questions
Can I define custom regex rules for Priority 4 protection?
Yes. Pass custom_patterns to ContextCompressor or configure them globally in your environment.