Class: Google::Cloud::DiscoveryEngine::V1beta::Assistant::CustomerPolicy

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/discoveryengine/v1beta/assistant.rb

Overview

Customer-defined policy for the assistant.

Defined Under Namespace

Classes: BannedPhrase, ModelArmorConfig

Instance Attribute Summary collapse

Instance Attribute Details

#banned_phrases::Array<::Google::Cloud::DiscoveryEngine::V1beta::Assistant::CustomerPolicy::BannedPhrase>

Returns Optional. List of banned phrases.

Returns:



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'proto_docs/google/cloud/discoveryengine/v1beta/assistant.rb', line 149

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

  # Definition of a customer-defined banned phrase. A banned phrase is not
  # allowed to appear in the user query or the LLM response, or else the
  # answer will be refused.
  # @!attribute [rw] phrase
  #   @return [::String]
  #     Required. The raw string content to be banned.
  # @!attribute [rw] match_type
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::Assistant::CustomerPolicy::BannedPhrase::BannedPhraseMatchType]
  #     Optional. Match type for the banned phrase.
  # @!attribute [rw] ignore_diacritics
  #   @return [::Boolean]
  #     Optional. If true, diacritical marks (e.g., accents, umlauts) are
  #     ignored when matching banned phrases. For example, "cafe" would match
  #     "café".
  class BannedPhrase
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The matching method for the banned phrase.
    module BannedPhraseMatchType
      # Defaults to SIMPLE_STRING_MATCH.
      BANNED_PHRASE_MATCH_TYPE_UNSPECIFIED = 0

      # The banned phrase matches if it is found anywhere in the text as an
      # exact substring.
      SIMPLE_STRING_MATCH = 1

      # Banned phrase only matches if the pattern found in the text is
      # surrounded by word delimiters. The phrase itself may still contain
      # word delimiters.
      WORD_BOUNDARY_STRING_MATCH = 2
    end
  end

  # Configuration for customer defined Model Armor templates to be used for
  # sanitizing user prompts and assistant responses.
  # @!attribute [rw] user_prompt_template
  #   @return [::String]
  #     Optional. The resource name of the Model Armor template for sanitizing
  #     user prompts. Format:
  #     `projects/{project}/locations/{location}/templates/{template_id}`
  #
  #     If not specified, no sanitization will be applied to the user prompt.
  # @!attribute [rw] response_template
  #   @return [::String]
  #     Optional. The resource name of the Model Armor template for sanitizing
  #     assistant responses. Format:
  #     `projects/{project}/locations/{location}/templates/{template_id}`
  #
  #     If not specified, no sanitization will be applied to the assistant
  #     response.
  # @!attribute [rw] failure_mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::Assistant::CustomerPolicy::ModelArmorConfig::FailureMode]
  #     Optional. Defines the failure mode for Model Armor sanitization.
  class ModelArmorConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Determines the behavior when Model Armor fails to process a request.
    module FailureMode
      # Unspecified failure mode, default behavior is `FAIL_CLOSED`.
      FAILURE_MODE_UNSPECIFIED = 0

      # In case of a Model Armor processing failure, the request is allowed
      # to proceed without any changes.
      FAIL_OPEN = 1

      # In case of a Model Armor processing failure, the request is rejected.
      FAIL_CLOSED = 2
    end
  end
end

#model_armor_config::Google::Cloud::DiscoveryEngine::V1beta::Assistant::CustomerPolicy::ModelArmorConfig

Returns Optional. Model Armor configuration to be used for sanitizing user prompts and assistant responses.

Returns:



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'proto_docs/google/cloud/discoveryengine/v1beta/assistant.rb', line 149

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

  # Definition of a customer-defined banned phrase. A banned phrase is not
  # allowed to appear in the user query or the LLM response, or else the
  # answer will be refused.
  # @!attribute [rw] phrase
  #   @return [::String]
  #     Required. The raw string content to be banned.
  # @!attribute [rw] match_type
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::Assistant::CustomerPolicy::BannedPhrase::BannedPhraseMatchType]
  #     Optional. Match type for the banned phrase.
  # @!attribute [rw] ignore_diacritics
  #   @return [::Boolean]
  #     Optional. If true, diacritical marks (e.g., accents, umlauts) are
  #     ignored when matching banned phrases. For example, "cafe" would match
  #     "café".
  class BannedPhrase
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The matching method for the banned phrase.
    module BannedPhraseMatchType
      # Defaults to SIMPLE_STRING_MATCH.
      BANNED_PHRASE_MATCH_TYPE_UNSPECIFIED = 0

      # The banned phrase matches if it is found anywhere in the text as an
      # exact substring.
      SIMPLE_STRING_MATCH = 1

      # Banned phrase only matches if the pattern found in the text is
      # surrounded by word delimiters. The phrase itself may still contain
      # word delimiters.
      WORD_BOUNDARY_STRING_MATCH = 2
    end
  end

  # Configuration for customer defined Model Armor templates to be used for
  # sanitizing user prompts and assistant responses.
  # @!attribute [rw] user_prompt_template
  #   @return [::String]
  #     Optional. The resource name of the Model Armor template for sanitizing
  #     user prompts. Format:
  #     `projects/{project}/locations/{location}/templates/{template_id}`
  #
  #     If not specified, no sanitization will be applied to the user prompt.
  # @!attribute [rw] response_template
  #   @return [::String]
  #     Optional. The resource name of the Model Armor template for sanitizing
  #     assistant responses. Format:
  #     `projects/{project}/locations/{location}/templates/{template_id}`
  #
  #     If not specified, no sanitization will be applied to the assistant
  #     response.
  # @!attribute [rw] failure_mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::Assistant::CustomerPolicy::ModelArmorConfig::FailureMode]
  #     Optional. Defines the failure mode for Model Armor sanitization.
  class ModelArmorConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Determines the behavior when Model Armor fails to process a request.
    module FailureMode
      # Unspecified failure mode, default behavior is `FAIL_CLOSED`.
      FAILURE_MODE_UNSPECIFIED = 0

      # In case of a Model Armor processing failure, the request is allowed
      # to proceed without any changes.
      FAIL_OPEN = 1

      # In case of a Model Armor processing failure, the request is rejected.
      FAIL_CLOSED = 2
    end
  end
end