Class: Google::Apis::CesV1::GuardrailLlmPolicy
- Inherits:
-
Object
- Object
- Google::Apis::CesV1::GuardrailLlmPolicy
- Includes:
- Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
- Defined in:
- lib/google/apis/ces_v1/classes.rb,
lib/google/apis/ces_v1/representations.rb,
lib/google/apis/ces_v1/representations.rb
Overview
Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
Instance Attribute Summary collapse
-
#allow_short_utterance ⇒ Boolean
(also: #allow_short_utterance?)
Optional.
-
#fail_open ⇒ Boolean
(also: #fail_open?)
Optional.
-
#max_conversation_messages ⇒ Fixnum
Optional.
-
#model_settings ⇒ Google::Apis::CesV1::ModelSettings
Model settings contains various configurations for the LLM model.
-
#policy_scope ⇒ String
Required.
-
#prompt ⇒ String
Required.
Instance Method Summary collapse
-
#initialize(**args) ⇒ GuardrailLlmPolicy
constructor
A new instance of GuardrailLlmPolicy.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ GuardrailLlmPolicy
Returns a new instance of GuardrailLlmPolicy.
3688 3689 3690 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3688 def initialize(**args) update!(**args) end |
Instance Attribute Details
#allow_short_utterance ⇒ Boolean Also known as: allow_short_utterance?
Optional. By default, the LLM policy check is bypassed for short utterances.
Enabling this setting applies the policy check to all utterances, including
those that would normally be skipped.
Corresponds to the JSON property allowShortUtterance
3654 3655 3656 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3654 def allow_short_utterance @allow_short_utterance end |
#fail_open ⇒ Boolean Also known as: fail_open?
Optional. If an error occurs during the policy check, fail open and do not
trigger the guardrail.
Corresponds to the JSON property failOpen
3661 3662 3663 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3661 def fail_open @fail_open end |
#max_conversation_messages ⇒ Fixnum
Optional. When checking this policy, consider the last 'n' messages in the
conversation. When not set a default value of 10 will be used.
Corresponds to the JSON property maxConversationMessages
3668 3669 3670 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3668 def @max_conversation_messages end |
#model_settings ⇒ Google::Apis::CesV1::ModelSettings
Model settings contains various configurations for the LLM model.
Corresponds to the JSON property modelSettings
3673 3674 3675 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3673 def model_settings @model_settings end |
#policy_scope ⇒ String
Required. Defines when to apply the policy check during the conversation. If
set to POLICY_SCOPE_UNSPECIFIED, the policy will be applied to the user
input. When applying the policy to the agent response, additional latency will
be introduced before the agent can respond.
Corresponds to the JSON property policyScope
3681 3682 3683 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3681 def policy_scope @policy_scope end |
#prompt ⇒ String
Required. Policy prompt.
Corresponds to the JSON property prompt
3686 3687 3688 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3686 def prompt @prompt end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
3693 3694 3695 3696 3697 3698 3699 3700 |
# File 'lib/google/apis/ces_v1/classes.rb', line 3693 def update!(**args) @allow_short_utterance = args[:allow_short_utterance] if args.key?(:allow_short_utterance) @fail_open = args[:fail_open] if args.key?(:fail_open) @max_conversation_messages = args[:max_conversation_messages] if args.key?(:max_conversation_messages) @model_settings = args[:model_settings] if args.key?(:model_settings) @policy_scope = args[:policy_scope] if args.key?(:policy_scope) @prompt = args[:prompt] if args.key?(:prompt) end |