Class: Google::Cloud::Ces::V1::Guardrail::LlmPolicy

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/ces/v1/guardrail.rb

Overview

Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.

Defined Under Namespace

Modules: PolicyScope

Instance Attribute Summary collapse

Instance Attribute Details

#allow_short_utterance::Boolean

Returns 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.

Returns:

  • (::Boolean)

    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.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'proto_docs/google/cloud/ces/v1/guardrail.rb', line 195

class LlmPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines when to apply the policy check during the conversation.
  module PolicyScope
    # Policy scope is not specified.
    POLICY_SCOPE_UNSPECIFIED = 0

    # Policy check is triggered on user input.
    USER_QUERY = 1

    # Policy check is triggered on agent response. Applying this policy
    # scope will introduce additional latency before the agent can respond.
    AGENT_RESPONSE = 2

    # Policy check is triggered on both user input and agent response.
    # Applying this policy scope will introduce additional latency before
    # the agent can respond.
    USER_QUERY_AND_AGENT_RESPONSE = 3
  end
end

#fail_open::Boolean

Returns Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.

Returns:

  • (::Boolean)

    Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'proto_docs/google/cloud/ces/v1/guardrail.rb', line 195

class LlmPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines when to apply the policy check during the conversation.
  module PolicyScope
    # Policy scope is not specified.
    POLICY_SCOPE_UNSPECIFIED = 0

    # Policy check is triggered on user input.
    USER_QUERY = 1

    # Policy check is triggered on agent response. Applying this policy
    # scope will introduce additional latency before the agent can respond.
    AGENT_RESPONSE = 2

    # Policy check is triggered on both user input and agent response.
    # Applying this policy scope will introduce additional latency before
    # the agent can respond.
    USER_QUERY_AND_AGENT_RESPONSE = 3
  end
end

#max_conversation_messages::Integer

Returns Optional. When checking this policy, consider the last 'n' messages in the conversation. When not set a default value of 10 will be used.

Returns:

  • (::Integer)

    Optional. When checking this policy, consider the last 'n' messages in the conversation. When not set a default value of 10 will be used.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'proto_docs/google/cloud/ces/v1/guardrail.rb', line 195

class LlmPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines when to apply the policy check during the conversation.
  module PolicyScope
    # Policy scope is not specified.
    POLICY_SCOPE_UNSPECIFIED = 0

    # Policy check is triggered on user input.
    USER_QUERY = 1

    # Policy check is triggered on agent response. Applying this policy
    # scope will introduce additional latency before the agent can respond.
    AGENT_RESPONSE = 2

    # Policy check is triggered on both user input and agent response.
    # Applying this policy scope will introduce additional latency before
    # the agent can respond.
    USER_QUERY_AND_AGENT_RESPONSE = 3
  end
end

#model_settings::Google::Cloud::Ces::V1::ModelSettings

Returns Optional. Model settings.

Returns:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'proto_docs/google/cloud/ces/v1/guardrail.rb', line 195

class LlmPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines when to apply the policy check during the conversation.
  module PolicyScope
    # Policy scope is not specified.
    POLICY_SCOPE_UNSPECIFIED = 0

    # Policy check is triggered on user input.
    USER_QUERY = 1

    # Policy check is triggered on agent response. Applying this policy
    # scope will introduce additional latency before the agent can respond.
    AGENT_RESPONSE = 2

    # Policy check is triggered on both user input and agent response.
    # Applying this policy scope will introduce additional latency before
    # the agent can respond.
    USER_QUERY_AND_AGENT_RESPONSE = 3
  end
end

#policy_scope::Google::Cloud::Ces::V1::Guardrail::LlmPolicy::PolicyScope

Returns 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.

Returns:

  • (::Google::Cloud::Ces::V1::Guardrail::LlmPolicy::PolicyScope)

    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.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'proto_docs/google/cloud/ces/v1/guardrail.rb', line 195

class LlmPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines when to apply the policy check during the conversation.
  module PolicyScope
    # Policy scope is not specified.
    POLICY_SCOPE_UNSPECIFIED = 0

    # Policy check is triggered on user input.
    USER_QUERY = 1

    # Policy check is triggered on agent response. Applying this policy
    # scope will introduce additional latency before the agent can respond.
    AGENT_RESPONSE = 2

    # Policy check is triggered on both user input and agent response.
    # Applying this policy scope will introduce additional latency before
    # the agent can respond.
    USER_QUERY_AND_AGENT_RESPONSE = 3
  end
end

#prompt::String

Returns Required. Policy prompt.

Returns:

  • (::String)

    Required. Policy prompt.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'proto_docs/google/cloud/ces/v1/guardrail.rb', line 195

class LlmPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines when to apply the policy check during the conversation.
  module PolicyScope
    # Policy scope is not specified.
    POLICY_SCOPE_UNSPECIFIED = 0

    # Policy check is triggered on user input.
    USER_QUERY = 1

    # Policy check is triggered on agent response. Applying this policy
    # scope will introduce additional latency before the agent can respond.
    AGENT_RESPONSE = 2

    # Policy check is triggered on both user input and agent response.
    # Applying this policy scope will introduce additional latency before
    # the agent can respond.
    USER_QUERY_AND_AGENT_RESPONSE = 3
  end
end