Class: SafetyKit::Models::ContentCreateResponse::Policy

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/safety_kit/models/content_create_response.rb,
sig/safety_kit/models/content_create_response.rbs

Defined Under Namespace

Modules: Decision, Escalation

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(decision:, escalation:, policy_id:, score:, version:) ⇒ Object

Result for one policy evaluated against the submitted content.

Parameters:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/safety_kit/models/content_create_response.rb', line 44

class Policy < SafetyKit::Internal::Type::BaseModel
  # @!attribute decision
  #   Whether the submitted content violates the policy.
  #
  #   @return [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Decision]
  required :decision, enum: -> { SafetyKit::Models::ContentCreateResponse::Policy::Decision }

  # @!attribute escalation
  #   Escalation outcome for this policy.
  #
  #   @return [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Escalation]
  required :escalation, enum: -> { SafetyKit::Models::ContentCreateResponse::Policy::Escalation }

  # @!attribute policy_id
  #   Identifier of the policy.
  #
  #   @return [String]
  required :policy_id, String

  # @!attribute score
  #   Policy score between 0 and 1. Higher means more likely violating.
  #
  #   @return [Float]
  required :score, Float

  # @!attribute version
  #   Version of the policy.
  #
  #   @return [String]
  required :version, String

  # @!method initialize(decision:, escalation:, policy_id:, score:, version:)
  #   Result for one policy evaluated against the submitted content.
  #
  #   @param decision [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Decision] Whether the submitted content violates the policy.
  #
  #   @param escalation [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Escalation] Escalation outcome for this policy.
  #
  #   @param policy_id [String] Identifier of the policy.
  #
  #   @param score [Float] Policy score between 0 and 1. Higher means more likely violating.
  #
  #   @param version [String] Version of the policy.

  # Whether the submitted content violates the policy.
  #
  # @see SafetyKit::Models::ContentCreateResponse::Policy#decision
  module Decision
    extend SafetyKit::Internal::Type::Enum

    MATCH = :match
    NOT_MATCH = :not_match
    REVIEW = :review

    # @!method self.values
    #   @return [Array<Symbol>]
  end

  # Escalation outcome for this policy.
  #
  # @see SafetyKit::Models::ContentCreateResponse::Policy#escalation
  module Escalation
    extend SafetyKit::Internal::Type::Enum

    NONE = :none
    COMPLETED = :completed
    ERROR = :error

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

Instance Attribute Details

#decisionSymbol, SafetyKit::Models::ContentCreateResponse::Policy::Decision

Whether the submitted content violates the policy.

Parameters:

  • value (SafetyKit::Models::ContentCreateResponse::Policy::decision)

Returns:



49
# File 'lib/safety_kit/models/content_create_response.rb', line 49

required :decision, enum: -> { SafetyKit::Models::ContentCreateResponse::Policy::Decision }

#escalationSymbol, SafetyKit::Models::ContentCreateResponse::Policy::Escalation

Escalation outcome for this policy.

Parameters:

  • value (SafetyKit::Models::ContentCreateResponse::Policy::escalation)

Returns:



55
# File 'lib/safety_kit/models/content_create_response.rb', line 55

required :escalation, enum: -> { SafetyKit::Models::ContentCreateResponse::Policy::Escalation }

#policy_idString

Identifier of the policy.

Parameters:

  • value (String)

Returns:

  • (String)


61
# File 'lib/safety_kit/models/content_create_response.rb', line 61

required :policy_id, String

#scoreFloat

Policy score between 0 and 1. Higher means more likely violating.

Parameters:

  • value (Float)

Returns:

  • (Float)


67
# File 'lib/safety_kit/models/content_create_response.rb', line 67

required :score, Float

#versionString

Version of the policy.

Parameters:

  • value (String)

Returns:

  • (String)


73
# File 'lib/safety_kit/models/content_create_response.rb', line 73

required :version, String

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/safety_kit/models/content_create_response.rb', line 98

Instance Method Details

#to_hash{

Returns:

  • ({)


62
# File 'sig/safety_kit/models/content_create_response.rbs', line 62

def to_hash: -> {