Learn about defining rules for runtime protection
true
, then the rule has been broken and is triggered. You can then use this in your code to change the response from your application.
Rule
, setting the metric and operator. Set the target values as needed (for example, for the empty
and not_empty
operators, there is no need to set a target value).
The metric uses the GalileoScorers
enum, and the operator uses the RuleOperator
enum.
Value | Type | Description | Notes |
---|---|---|---|
RuleOperator.gt | Numerical | Greater than | |
RuleOperator.lt | Numerical | Less than | |
RuleOperator.gte | Numerical | Greater than or equal | |
RuleOperator.lte | Numerical | Less than or equal | |
RuleOperator.eq | Numerical or Categorical | Equals | |
RuleOperator.neq | Numerical or Categorical | Not equals | |
RuleOperator.contains | Categorical | Contains | Does the list of categories contain the single target values |
RuleOperator.all | Categorical | All | Does the list of categories contain all the target values |
RuleOperator.any | Categorical | Any | Does the list of categories contain any of the target values |
RuleOperator.empty | Categorical | Empty | Is the list of categories empty |
RuleOperator.not_empty | Categorical | Not empty | Is the list of categories not empty |
Setting | Value |
---|---|
Metric | GalileoScorers.action_advancement |
Required Payload Fields | Both input and output must be included |
Values | 0.0 - 1.0 |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |
Setting | Value |
---|---|
Metric | GalileoScorers.action_completion |
Required Payload Fields | Both input and output must be included |
Values | 0.0 - 1.0 |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |
Setting | Value |
---|---|
Metric | GalileoScorers.completeness |
Required Payload Fields | Both input and output must be included |
Values | 0.0 - 1.0 |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |
Setting | Value |
---|---|
Metric | GalileoScorers.context_adherence |
Required Payload Fields | Both input and output must be included |
Values | 0.0 - 1.0 |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |
0.1
is a good threshold below which the response is not adhering to the context. Creating a rule for less than 0.1 will trigger the rule when the response does not adhere to the provided context.
Setting | Value |
---|---|
Metric | GalileoScorers.input_pii (for detecting PII in the input)GalileoScorers.output_pii (for detecting PII in the output) |
Required Payload Fields | input for input PII, output for output PII |
Values | Depending on the operator, one or more of:account_info address credit_card_info date_of_birth email name network_info password phone_number ssn username |
Operators supported | Any (RuleOperator.any ) - A list of categoriesAll ( RuleOperator.all ) - A list of categoriesContains ( RuleOperator.contains ) - A single categoryEqual ( RuleOperator.eq ) - A single categoryNot equal ( RuleOperator.neq ) - A single categoryEmpty ( RuleOperator.empty )Not empty ( RuleOperator.not_empty ) |
Setting | Value |
---|---|
Metric | GalileoScorers.prompt_injection |
Required Payload Fields | input |
Values | Depending on the operator, one or more of:impersonation obfuscation simple_instruction few_shot new_context |
Operators supported | Any (RuleOperator.any ) - A list of categoriesAll ( RuleOperator.all ) - A list of categoriesContains ( RuleOperator.contains ) - A single categoryEqual ( RuleOperator.eq ) - A single categoryNot equal ( RuleOperator.neq ) - A single categoryEmpty ( RuleOperator.empty )Not empty ( RuleOperator.not_empty ) |
Setting | Value |
---|---|
Metric | GalileoScorers.input_sexism (for detecting sexism in the input)GalileoScorers.output_sexism (for detecting sexism in the output) |
Required Payload Fields | input for input sexism, output for output sexism |
Values | 0.0 - 1.0. Higher values indicate higher sexism. |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |
Setting | Value |
---|---|
Metric | GalileoScorers.input_tone (for detecting tone in the input)GalileoScorers.output_tone (for detecting tone in the output) |
Required Payload Fields | input for input tone, output for output tone |
Values | One of:anger annoyance confusion fear joy love sadness surprise neutral |
Operators supported | Equal (RuleOperator.eq ) - A single categoryNot equal ( RuleOperator.neq ) - A single category |
Setting | Value |
---|---|
Metric | GalileoScorers.tool_error_rate |
Required Payload Fields | Both input and output must be included |
Values | 0.0 - 1.0 |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |
Setting | Value |
---|---|
Metric | GalileoScorers.tool_selection_quality |
Required Payload Fields | Both input and output must be included |
Values | 0.0 - 1.0 |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |
Setting | Value |
---|---|
Metric | GalileoScorers.input_toxicity (for detecting toxicity in the input)GalileoScorers.output_toxicity (for detecting toxicity in the output) |
Required Payload Fields | input for input toxicity, output for output toxicity |
Values | 0.0 - 1.0. Higher values indicate higher toxicity. |
Operators supported | Greater than (RuleOperator.gt )Less than ( RuleOperator.lt )Greater than or equal ( RuleOperator.gte )Less than or equal ( RuleOperator.lte ) |