Word Filtering

Filters specific words and phrases.

Options:

word_list: An array of words to filter
case_sensitive: Whether matching is case sensitive (default false) whole_words_only: Match whole words only (default true) replacement: Text to replace filtered words with (default "[FILTERED]")

Example Config

name: word-filter-guardrails
type: word-filter-guardrails-config
rules:
  - id: specific-word-filter
    when:
      models:
        - openai-main/gpt-3-5-turbo
    input_guardrails:
      - type: word_filter
        action: transform
        options:
          word_list:
            - "unwantedword"
            - "inappropriatephrase"
          case_sensitive: false
          whole_words_only: true
          replacement: "[REMOVED]"
    output_guardrails:
      - type: word_filter
        action: transform
        options:
          word_list:
            - "unwantedword"
            - "inappropriatephrase"
          case_sensitive: false
          whole_words_only: true
          replacement: "[REMOVED]"
guardrails_service_url: https://word-filter-service.company.com