Skip to main content

analyze_suffix

Function analyze_suffix 

Source
pub fn analyze_suffix(
    text: &str,
    suffix_window_chars: usize,
    perplexity_threshold: f64,
    symbol_ratio_threshold: f64,
    min_prompt_chars: usize,
) -> PerplexityResult
Expand description

Analyze the suffix window of a prompt for adversarial content.

  • text: full prompt text
  • suffix_window_chars: number of trailing characters to analyze
  • perplexity_threshold: perplexity score above which to flag
  • symbol_ratio_threshold: symbol ratio above which to flag
  • min_prompt_chars: minimum prompt length to apply the filter