String check

How to block text patterns with regular expressions

String Check allows users to write regular expressions that define text patterns that shouldn’t be allowed for discussion. It can be applied to either input or model output.


SUPERWISE guardrails: the String check rule form with apply to input or output and a regular expression field

Using the SDK

from superwise_api.models.agent.agent import AgentStringCheckGuard

restricted_topics_guard = AgentStringCheckGuard(
    name="Rule name",
    tags={"input", "output"}, # A Set containing "input", "output", or both
    regex_pattern={".*id-\d{9}.*"} # Set of regex patterns to search for prohibited content
)


Did this page help you?