GuardrailLlmPolicy class
Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
Constructors
- GuardrailLlmPolicy({bool? allowShortUtterance, bool? failOpen, int? maxConversationMessages, ModelSettings? modelSettings, String? policyScope, String? prompt})
- GuardrailLlmPolicy.fromJson(Map json_)
Properties
- allowShortUtterance ↔ bool?
-
By default, the LLM policy check is bypassed for short utterances.
getter/setter pair
- failOpen ↔ bool?
-
If an error occurs during the policy check, fail open and do not trigger
the guardrail.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxConversationMessages ↔ int?
-
When checking this policy, consider the last 'n' messages in the
conversation.
getter/setter pair
- modelSettings ↔ ModelSettings?
-
Model settings.
getter/setter pair
- policyScope ↔ String?
-
Defines when to apply the policy check during the conversation.
getter/setter pair
- prompt ↔ String?
-
Policy prompt.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited