safetykit 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb740cd06fd2147d66523afd833977860625eba2fa2b3b85dba5933a46f68a74
4
- data.tar.gz: 49974de3af4a1b8188a16cd72999a6eb822338e4f2cb5b5ee80739885f550aad
3
+ metadata.gz: e99118dc813839214ef54180d8c8b7fd0528ddeb49f48d2eecde4ec540bbaa41
4
+ data.tar.gz: '08c93665f10cc3be1ce9a44781e2c60b6ede81d25fbec916f6bd29be2ba62558'
5
5
  SHA512:
6
- metadata.gz: bd4c8bf187f42c1ddbff83a393afd6c3e177414a1c37f62b6d1847c8457cc2de4d570d5941c6a81f13701006cd77c80f62b7919bcc26459418b6f9ca5b572fe8
7
- data.tar.gz: 9bd4562815b061c8d5995cf75aa02752726f66e55cb2d8ecd5bd8893f434bd0470e403cef886e004214f20c04b35565096d731b539b27285444364e36d042989
6
+ metadata.gz: 7db211c300da39bc4e7c0dd74ca7220bfc38aa23df5c597a054ab72cd4156859aa583025ff7292c02121c78c7743d27912b72374a7a70ae0f16ab21bef5953ae
7
+ data.tar.gz: 2569223e2d2779daab8a6a364fcde41473e1dfc7af8cb345b790eb590f74e02b47b79f03e46ee42f63468fe6718693292962f8f2611aede4d82ea86024151c84
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.53.0 (2026-08-06)
4
+
5
+ Full Changelog: [v0.52.0...v0.53.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.52.0...v0.53.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([4c74263](https://github.com/GetSafetyKit/safetykit-ruby/commit/4c74263a51e3176b1ff3660c1b5ac14d0dcd3559))
10
+
3
11
  ## 0.52.0 (2026-08-05)
4
12
 
5
13
  Full Changelog: [v0.51.0...v0.52.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.51.0...v0.52.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "safetykit", "~> 0.52.0"
20
+ gem "safetykit", "~> 0.53.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -7,12 +7,11 @@ module SafetyKit
7
7
  extend SafetyKit::Internal::Type::RequestParameters::Converter
8
8
  include SafetyKit::Internal::Type::RequestParameters
9
9
 
10
- # @!attribute entity_id
11
- # Your stable identifier for the entity this content belongs to, such as a user,
12
- # listing, or message thread.
10
+ # @!attribute user_id
11
+ # Your stable identifier for the user this content belongs to.
13
12
  #
14
13
  # @return [String]
15
- required :entity_id, String
14
+ required :user_id, String
16
15
 
17
16
  # @!attribute content_id
18
17
  # Your identifier for this content, matching the content_id sent on /v1/events.
@@ -23,7 +22,7 @@ module SafetyKit
23
22
 
24
23
  # @!attribute images
25
24
  # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
26
- # most 4 images, 5MB each.
25
+ # most 20 images, 5MB each.
27
26
  #
28
27
  # @return [Array<String>, nil]
29
28
  optional :images, SafetyKit::Internal::Type::ArrayOf[String]
@@ -35,17 +34,16 @@ module SafetyKit
35
34
  optional :metadata, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
36
35
 
37
36
  # @!attribute text
38
- # User-authored text to classify. At most 20000 characters. Classification is
39
- # based on the first 16,000 characters.
37
+ # User-authored text to classify. At most 16000 characters.
40
38
  #
41
39
  # @return [String, nil]
42
40
  optional :text, String
43
41
 
44
- # @!method initialize(entity_id:, content_id: nil, images: nil, metadata: nil, text: nil, request_options: {})
42
+ # @!method initialize(user_id:, content_id: nil, images: nil, metadata: nil, text: nil, request_options: {})
45
43
  # Some parameter documentations has been truncated, see
46
44
  # {SafetyKit::Models::ContentCreateParams} for more details.
47
45
  #
48
- # @param entity_id [String] Your stable identifier for the entity this content belongs to, such as a user, l
46
+ # @param user_id [String] Your stable identifier for the user this content belongs to.
49
47
  #
50
48
  # @param content_id [String] Your identifier for this content, matching the content_id sent on /v1/events. Pr
51
49
  #
@@ -53,7 +51,7 @@ module SafetyKit
53
51
  #
54
52
  # @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content. At most 8KB when serialized.
55
53
  #
56
- # @param text [String] User-authored text to classify. At most 20000 characters. Classification is base
54
+ # @param text [String] User-authored text to classify. At most 16000 characters.
57
55
  #
58
56
  # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}]
59
57
  end
@@ -11,30 +11,18 @@ module SafetyKit
11
11
  required :content_id, String
12
12
 
13
13
  # @!attribute decision
14
- # SafetyKit's decision for the submitted content: approve (no violation found),
15
- # reject (violating), or review (needs human review).
14
+ # Overall decision: match if any policy matched, review if any policy needs
15
+ # review, not_match otherwise.
16
16
  #
17
17
  # @return [Symbol, SafetyKit::Models::ContentCreateResponse::Decision]
18
18
  required :decision, enum: -> { SafetyKit::Models::ContentCreateResponse::Decision }
19
19
 
20
- # @!attribute entity_id
21
- # The entity_id from the request.
20
+ # @!attribute policies
21
+ # Per-policy results for the submitted content.
22
22
  #
23
- # @return [String]
24
- required :entity_id, String
25
-
26
- # @!attribute escalation
27
- # Escalation outcome: none (no escalation ran), completed (verdict reflected in
28
- # decision), or timed_out (decision is a provisional review).
29
- #
30
- # @return [Symbol, SafetyKit::Models::ContentCreateResponse::Escalation]
31
- required :escalation, enum: -> { SafetyKit::Models::ContentCreateResponse::Escalation }
32
-
33
- # @!attribute mirrored
34
- # Whether SafetyKit mirrored the submitted content for later review.
35
- #
36
- # @return [Boolean]
37
- required :mirrored, SafetyKit::Internal::Type::Boolean
23
+ # @return [Array<SafetyKit::Models::ContentCreateResponse::Policy>]
24
+ required :policies,
25
+ -> { SafetyKit::Internal::Type::ArrayOf[SafetyKit::Models::ContentCreateResponse::Policy] }
38
26
 
39
27
  # @!attribute reference_set_matches
40
28
  # Reference set matches found for the submitted content.
@@ -43,14 +31,13 @@ module SafetyKit
43
31
  required :reference_set_matches,
44
32
  -> { SafetyKit::Internal::Type::ArrayOf[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch] }
45
33
 
46
- # @!attribute scores
47
- # Classifier scores produced for the submitted content.
34
+ # @!attribute user_id
35
+ # The user_id from the request.
48
36
  #
49
- # @return [Array<SafetyKit::Models::ContentCreateResponse::Score>]
50
- required :scores,
51
- -> { SafetyKit::Internal::Type::ArrayOf[SafetyKit::Models::ContentCreateResponse::Score] }
37
+ # @return [String]
38
+ required :user_id, String
52
39
 
53
- # @!method initialize(content_id:, decision:, entity_id:, escalation:, mirrored:, reference_set_matches:, scores:)
40
+ # @!method initialize(content_id:, decision:, policies:, reference_set_matches:, user_id:)
54
41
  # Some parameter documentations has been truncated, see
55
42
  # {SafetyKit::Models::ContentCreateResponse} for more details.
56
43
  #
@@ -58,46 +45,107 @@ module SafetyKit
58
45
  #
59
46
  # @param content_id [String] SafetyKit identifier for the classified content.
60
47
  #
61
- # @param decision [Symbol, SafetyKit::Models::ContentCreateResponse::Decision] SafetyKit's decision for the submitted content: approve (no violation found), re
62
- #
63
- # @param entity_id [String] The entity_id from the request.
64
- #
65
- # @param escalation [Symbol, SafetyKit::Models::ContentCreateResponse::Escalation] Escalation outcome: none (no escalation ran), completed (verdict reflected in de
48
+ # @param decision [Symbol, SafetyKit::Models::ContentCreateResponse::Decision] Overall decision: match if any policy matched, review if any policy needs review
66
49
  #
67
- # @param mirrored [Boolean] Whether SafetyKit mirrored the submitted content for later review.
50
+ # @param policies [Array<SafetyKit::Models::ContentCreateResponse::Policy>] Per-policy results for the submitted content.
68
51
  #
69
52
  # @param reference_set_matches [Array<SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch>] Reference set matches found for the submitted content.
70
53
  #
71
- # @param scores [Array<SafetyKit::Models::ContentCreateResponse::Score>] Classifier scores produced for the submitted content.
54
+ # @param user_id [String] The user_id from the request.
72
55
 
73
- # SafetyKit's decision for the submitted content: approve (no violation found),
74
- # reject (violating), or review (needs human review).
56
+ # Overall decision: match if any policy matched, review if any policy needs
57
+ # review, not_match otherwise.
75
58
  #
76
59
  # @see SafetyKit::Models::ContentCreateResponse#decision
77
60
  module Decision
78
61
  extend SafetyKit::Internal::Type::Enum
79
62
 
80
- APPROVE = :approve
81
- REJECT = :reject
63
+ MATCH = :match
64
+ NOT_MATCH = :not_match
82
65
  REVIEW = :review
83
66
 
84
67
  # @!method self.values
85
68
  # @return [Array<Symbol>]
86
69
  end
87
70
 
88
- # Escalation outcome: none (no escalation ran), completed (verdict reflected in
89
- # decision), or timed_out (decision is a provisional review).
90
- #
91
- # @see SafetyKit::Models::ContentCreateResponse#escalation
92
- module Escalation
93
- extend SafetyKit::Internal::Type::Enum
71
+ class Policy < SafetyKit::Internal::Type::BaseModel
72
+ # @!attribute decision
73
+ # Decision for the submitted content: match (violates the policy), not_match (does
74
+ # not violate), or review (needs human review).
75
+ #
76
+ # @return [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Decision]
77
+ required :decision, enum: -> { SafetyKit::Models::ContentCreateResponse::Policy::Decision }
94
78
 
95
- NONE = :none
96
- COMPLETED = :completed
97
- TIMED_OUT = :timed_out
79
+ # @!attribute escalation
80
+ # Escalation outcome: none (no escalation ran), completed (verdict reflected in
81
+ # decision), or timed_out (decision is a provisional review).
82
+ #
83
+ # @return [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Escalation]
84
+ required :escalation, enum: -> { SafetyKit::Models::ContentCreateResponse::Policy::Escalation }
98
85
 
99
- # @!method self.values
100
- # @return [Array<Symbol>]
86
+ # @!attribute policy_id
87
+ # Identifier of the policy.
88
+ #
89
+ # @return [String]
90
+ required :policy_id, String
91
+
92
+ # @!attribute score
93
+ # Policy score between 0 and 1. Higher means more likely violating.
94
+ #
95
+ # @return [Float]
96
+ required :score, Float
97
+
98
+ # @!attribute version
99
+ # Version of the policy.
100
+ #
101
+ # @return [String]
102
+ required :version, String
103
+
104
+ # @!method initialize(decision:, escalation:, policy_id:, score:, version:)
105
+ # Some parameter documentations has been truncated, see
106
+ # {SafetyKit::Models::ContentCreateResponse::Policy} for more details.
107
+ #
108
+ # Result for one policy evaluated against the submitted content.
109
+ #
110
+ # @param decision [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Decision] Decision for the submitted content: match (violates the policy), not_match (does
111
+ #
112
+ # @param escalation [Symbol, SafetyKit::Models::ContentCreateResponse::Policy::Escalation] Escalation outcome: none (no escalation ran), completed (verdict reflected in de
113
+ #
114
+ # @param policy_id [String] Identifier of the policy.
115
+ #
116
+ # @param score [Float] Policy score between 0 and 1. Higher means more likely violating.
117
+ #
118
+ # @param version [String] Version of the policy.
119
+
120
+ # Decision for the submitted content: match (violates the policy), not_match (does
121
+ # not violate), or review (needs human review).
122
+ #
123
+ # @see SafetyKit::Models::ContentCreateResponse::Policy#decision
124
+ module Decision
125
+ extend SafetyKit::Internal::Type::Enum
126
+
127
+ MATCH = :match
128
+ NOT_MATCH = :not_match
129
+ REVIEW = :review
130
+
131
+ # @!method self.values
132
+ # @return [Array<Symbol>]
133
+ end
134
+
135
+ # Escalation outcome: none (no escalation ran), completed (verdict reflected in
136
+ # decision), or timed_out (decision is a provisional review).
137
+ #
138
+ # @see SafetyKit::Models::ContentCreateResponse::Policy#escalation
139
+ module Escalation
140
+ extend SafetyKit::Internal::Type::Enum
141
+
142
+ NONE = :none
143
+ COMPLETED = :completed
144
+ TIMED_OUT = :timed_out
145
+
146
+ # @!method self.values
147
+ # @return [Array<Symbol>]
148
+ end
101
149
  end
102
150
 
103
151
  class ReferenceSetMatch < SafetyKit::Internal::Type::BaseModel
@@ -120,35 +168,6 @@ module SafetyKit
120
168
  #
121
169
  # @param similarity [Float] Similarity between the submitted content and the matched reference set entry.
122
170
  end
123
-
124
- class Score < SafetyKit::Internal::Type::BaseModel
125
- # @!attribute classifier_id
126
- # Identifier of the classifier that produced this score.
127
- #
128
- # @return [String]
129
- required :classifier_id, String
130
-
131
- # @!attribute score
132
- # Classifier score between 0 and 1. Higher means more likely violating.
133
- #
134
- # @return [Float]
135
- required :score, Float
136
-
137
- # @!attribute version
138
- # Version of the classifier that produced this score.
139
- #
140
- # @return [String]
141
- required :version, String
142
-
143
- # @!method initialize(classifier_id:, score:, version:)
144
- # Score produced by one classifier for the submitted content.
145
- #
146
- # @param classifier_id [String] Identifier of the classifier that produced this score.
147
- #
148
- # @param score [Float] Classifier score between 0 and 1. Higher means more likely violating.
149
- #
150
- # @param version [String] Version of the classifier that produced this score.
151
- end
152
171
  end
153
172
  end
154
173
  end
@@ -9,12 +9,12 @@ module SafetyKit
9
9
  # {SafetyKit::Models::ContentCreateParams} for more details.
10
10
  #
11
11
  # Classify a piece of content synchronously. Send user-authored text, images, or
12
- # both, and receive a decision (approve, reject, or review) with classifier scores
13
- # and reference set matches in the response. Requests have a maximum size of 6MB.
12
+ # both, and receive per-policy results with an overall decision (match, not_match,
13
+ # or review) in the response. Requests have a maximum size of 6MB.
14
14
  #
15
- # @overload create(entity_id:, content_id: nil, images: nil, metadata: nil, text: nil, request_options: {})
15
+ # @overload create(user_id:, content_id: nil, images: nil, metadata: nil, text: nil, request_options: {})
16
16
  #
17
- # @param entity_id [String] Your stable identifier for the entity this content belongs to, such as a user, l
17
+ # @param user_id [String] Your stable identifier for the user this content belongs to.
18
18
  #
19
19
  # @param content_id [String] Your identifier for this content, matching the content_id sent on /v1/events. Pr
20
20
  #
@@ -22,7 +22,7 @@ module SafetyKit
22
22
  #
23
23
  # @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content. At most 8KB when serialized.
24
24
  #
25
- # @param text [String] User-authored text to classify. At most 20000 characters. Classification is base
25
+ # @param text [String] User-authored text to classify. At most 16000 characters.
26
26
  #
27
27
  # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}, nil]
28
28
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SafetyKit
4
- VERSION = "0.52.0"
4
+ VERSION = "0.53.0"
5
5
  end
@@ -11,10 +11,9 @@ module SafetyKit
11
11
  T.any(SafetyKit::ContentCreateParams, SafetyKit::Internal::AnyHash)
12
12
  end
13
13
 
14
- # Your stable identifier for the entity this content belongs to, such as a user,
15
- # listing, or message thread.
14
+ # Your stable identifier for the user this content belongs to.
16
15
  sig { returns(String) }
17
- attr_accessor :entity_id
16
+ attr_accessor :user_id
18
17
 
19
18
  # Your identifier for this content, matching the content_id sent on /v1/events.
20
19
  # Prevents double-counting content submitted to both endpoints.
@@ -25,7 +24,7 @@ module SafetyKit
25
24
  attr_writer :content_id
26
25
 
27
26
  # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
28
- # most 4 images, 5MB each.
27
+ # most 20 images, 5MB each.
29
28
  sig { returns(T.nilable(T::Array[String])) }
30
29
  attr_reader :images
31
30
 
@@ -39,8 +38,7 @@ module SafetyKit
39
38
  sig { params(metadata: T::Hash[Symbol, T.nilable(T.anything)]).void }
40
39
  attr_writer :metadata
41
40
 
42
- # User-authored text to classify. At most 20000 characters. Classification is
43
- # based on the first 16,000 characters.
41
+ # User-authored text to classify. At most 16000 characters.
44
42
  sig { returns(T.nilable(String)) }
45
43
  attr_reader :text
46
44
 
@@ -49,7 +47,7 @@ module SafetyKit
49
47
 
50
48
  sig do
51
49
  params(
52
- entity_id: String,
50
+ user_id: String,
53
51
  content_id: String,
54
52
  images: T::Array[String],
55
53
  metadata: T::Hash[Symbol, T.nilable(T.anything)],
@@ -58,19 +56,17 @@ module SafetyKit
58
56
  ).returns(T.attached_class)
59
57
  end
60
58
  def self.new(
61
- # Your stable identifier for the entity this content belongs to, such as a user,
62
- # listing, or message thread.
63
- entity_id:,
59
+ # Your stable identifier for the user this content belongs to.
60
+ user_id:,
64
61
  # Your identifier for this content, matching the content_id sent on /v1/events.
65
62
  # Prevents double-counting content submitted to both endpoints.
66
63
  content_id: nil,
67
64
  # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
68
- # most 4 images, 5MB each.
65
+ # most 20 images, 5MB each.
69
66
  images: nil,
70
67
  # Additional product context for this content. At most 8KB when serialized.
71
68
  metadata: nil,
72
- # User-authored text to classify. At most 20000 characters. Classification is
73
- # based on the first 16,000 characters.
69
+ # User-authored text to classify. At most 16000 characters.
74
70
  text: nil,
75
71
  request_options: {}
76
72
  )
@@ -79,7 +75,7 @@ module SafetyKit
79
75
  sig do
80
76
  override.returns(
81
77
  {
82
- entity_id: String,
78
+ user_id: String,
83
79
  content_id: String,
84
80
  images: T::Array[String],
85
81
  metadata: T::Hash[Symbol, T.nilable(T.anything)],
@@ -15,8 +15,8 @@ module SafetyKit
15
15
  sig { returns(String) }
16
16
  attr_accessor :content_id
17
17
 
18
- # SafetyKit's decision for the submitted content: approve (no violation found),
19
- # reject (violating), or review (needs human review).
18
+ # Overall decision: match if any policy matched, review if any policy needs
19
+ # review, not_match otherwise.
20
20
  sig do
21
21
  returns(
22
22
  SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
@@ -24,22 +24,11 @@ module SafetyKit
24
24
  end
25
25
  attr_accessor :decision
26
26
 
27
- # The entity_id from the request.
28
- sig { returns(String) }
29
- attr_accessor :entity_id
30
-
31
- # Escalation outcome: none (no escalation ran), completed (verdict reflected in
32
- # decision), or timed_out (decision is a provisional review).
27
+ # Per-policy results for the submitted content.
33
28
  sig do
34
- returns(
35
- SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
36
- )
29
+ returns(T::Array[SafetyKit::Models::ContentCreateResponse::Policy])
37
30
  end
38
- attr_accessor :escalation
39
-
40
- # Whether SafetyKit mirrored the submitted content for later review.
41
- sig { returns(T::Boolean) }
42
- attr_accessor :mirrored
31
+ attr_accessor :policies
43
32
 
44
33
  # Reference set matches found for the submitted content.
45
34
  sig do
@@ -49,9 +38,9 @@ module SafetyKit
49
38
  end
50
39
  attr_accessor :reference_set_matches
51
40
 
52
- # Classifier scores produced for the submitted content.
53
- sig { returns(T::Array[SafetyKit::Models::ContentCreateResponse::Score]) }
54
- attr_accessor :scores
41
+ # The user_id from the request.
42
+ sig { returns(String) }
43
+ attr_accessor :user_id
55
44
 
56
45
  # Synchronous classification result for the submitted content.
57
46
  sig do
@@ -59,35 +48,27 @@ module SafetyKit
59
48
  content_id: String,
60
49
  decision:
61
50
  SafetyKit::Models::ContentCreateResponse::Decision::OrSymbol,
62
- entity_id: String,
63
- escalation:
64
- SafetyKit::Models::ContentCreateResponse::Escalation::OrSymbol,
65
- mirrored: T::Boolean,
51
+ policies:
52
+ T::Array[SafetyKit::Models::ContentCreateResponse::Policy::OrHash],
66
53
  reference_set_matches:
67
54
  T::Array[
68
55
  SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch::OrHash
69
56
  ],
70
- scores:
71
- T::Array[SafetyKit::Models::ContentCreateResponse::Score::OrHash]
57
+ user_id: String
72
58
  ).returns(T.attached_class)
73
59
  end
74
60
  def self.new(
75
61
  # SafetyKit identifier for the classified content.
76
62
  content_id:,
77
- # SafetyKit's decision for the submitted content: approve (no violation found),
78
- # reject (violating), or review (needs human review).
63
+ # Overall decision: match if any policy matched, review if any policy needs
64
+ # review, not_match otherwise.
79
65
  decision:,
80
- # The entity_id from the request.
81
- entity_id:,
82
- # Escalation outcome: none (no escalation ran), completed (verdict reflected in
83
- # decision), or timed_out (decision is a provisional review).
84
- escalation:,
85
- # Whether SafetyKit mirrored the submitted content for later review.
86
- mirrored:,
66
+ # Per-policy results for the submitted content.
67
+ policies:,
87
68
  # Reference set matches found for the submitted content.
88
69
  reference_set_matches:,
89
- # Classifier scores produced for the submitted content.
90
- scores:
70
+ # The user_id from the request.
71
+ user_id:
91
72
  )
92
73
  end
93
74
 
@@ -97,23 +78,21 @@ module SafetyKit
97
78
  content_id: String,
98
79
  decision:
99
80
  SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol,
100
- entity_id: String,
101
- escalation:
102
- SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol,
103
- mirrored: T::Boolean,
81
+ policies:
82
+ T::Array[SafetyKit::Models::ContentCreateResponse::Policy],
104
83
  reference_set_matches:
105
84
  T::Array[
106
85
  SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch
107
86
  ],
108
- scores: T::Array[SafetyKit::Models::ContentCreateResponse::Score]
87
+ user_id: String
109
88
  }
110
89
  )
111
90
  end
112
91
  def to_hash
113
92
  end
114
93
 
115
- # SafetyKit's decision for the submitted content: approve (no violation found),
116
- # reject (violating), or review (needs human review).
94
+ # Overall decision: match if any policy matched, review if any policy needs
95
+ # review, not_match otherwise.
117
96
  module Decision
118
97
  extend SafetyKit::Internal::Type::Enum
119
98
 
@@ -123,14 +102,14 @@ module SafetyKit
123
102
  end
124
103
  OrSymbol = T.type_alias { T.any(Symbol, String) }
125
104
 
126
- APPROVE =
105
+ MATCH =
127
106
  T.let(
128
- :approve,
107
+ :match,
129
108
  SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
130
109
  )
131
- REJECT =
110
+ NOT_MATCH =
132
111
  T.let(
133
- :reject,
112
+ :not_match,
134
113
  SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
135
114
  )
136
115
  REVIEW =
@@ -150,41 +129,169 @@ module SafetyKit
150
129
  end
151
130
  end
152
131
 
153
- # Escalation outcome: none (no escalation ran), completed (verdict reflected in
154
- # decision), or timed_out (decision is a provisional review).
155
- module Escalation
156
- extend SafetyKit::Internal::Type::Enum
157
-
158
- TaggedSymbol =
132
+ class Policy < SafetyKit::Internal::Type::BaseModel
133
+ OrHash =
159
134
  T.type_alias do
160
- T.all(Symbol, SafetyKit::Models::ContentCreateResponse::Escalation)
135
+ T.any(
136
+ SafetyKit::Models::ContentCreateResponse::Policy,
137
+ SafetyKit::Internal::AnyHash
138
+ )
161
139
  end
162
- OrSymbol = T.type_alias { T.any(Symbol, String) }
163
140
 
164
- NONE =
165
- T.let(
166
- :none,
167
- SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
168
- )
169
- COMPLETED =
170
- T.let(
171
- :completed,
172
- SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
141
+ # Decision for the submitted content: match (violates the policy), not_match (does
142
+ # not violate), or review (needs human review).
143
+ sig do
144
+ returns(
145
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision::TaggedSymbol
173
146
  )
174
- TIMED_OUT =
175
- T.let(
176
- :timed_out,
177
- SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
147
+ end
148
+ attr_accessor :decision
149
+
150
+ # Escalation outcome: none (no escalation ran), completed (verdict reflected in
151
+ # decision), or timed_out (decision is a provisional review).
152
+ sig do
153
+ returns(
154
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation::TaggedSymbol
178
155
  )
156
+ end
157
+ attr_accessor :escalation
158
+
159
+ # Identifier of the policy.
160
+ sig { returns(String) }
161
+ attr_accessor :policy_id
162
+
163
+ # Policy score between 0 and 1. Higher means more likely violating.
164
+ sig { returns(Float) }
165
+ attr_accessor :score
166
+
167
+ # Version of the policy.
168
+ sig { returns(String) }
169
+ attr_accessor :version
170
+
171
+ # Result for one policy evaluated against the submitted content.
172
+ sig do
173
+ params(
174
+ decision:
175
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision::OrSymbol,
176
+ escalation:
177
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation::OrSymbol,
178
+ policy_id: String,
179
+ score: Float,
180
+ version: String
181
+ ).returns(T.attached_class)
182
+ end
183
+ def self.new(
184
+ # Decision for the submitted content: match (violates the policy), not_match (does
185
+ # not violate), or review (needs human review).
186
+ decision:,
187
+ # Escalation outcome: none (no escalation ran), completed (verdict reflected in
188
+ # decision), or timed_out (decision is a provisional review).
189
+ escalation:,
190
+ # Identifier of the policy.
191
+ policy_id:,
192
+ # Policy score between 0 and 1. Higher means more likely violating.
193
+ score:,
194
+ # Version of the policy.
195
+ version:
196
+ )
197
+ end
179
198
 
180
199
  sig do
181
200
  override.returns(
182
- T::Array[
183
- SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
184
- ]
201
+ {
202
+ decision:
203
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision::TaggedSymbol,
204
+ escalation:
205
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation::TaggedSymbol,
206
+ policy_id: String,
207
+ score: Float,
208
+ version: String
209
+ }
185
210
  )
186
211
  end
187
- def self.values
212
+ def to_hash
213
+ end
214
+
215
+ # Decision for the submitted content: match (violates the policy), not_match (does
216
+ # not violate), or review (needs human review).
217
+ module Decision
218
+ extend SafetyKit::Internal::Type::Enum
219
+
220
+ TaggedSymbol =
221
+ T.type_alias do
222
+ T.all(
223
+ Symbol,
224
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision
225
+ )
226
+ end
227
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
228
+
229
+ MATCH =
230
+ T.let(
231
+ :match,
232
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision::TaggedSymbol
233
+ )
234
+ NOT_MATCH =
235
+ T.let(
236
+ :not_match,
237
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision::TaggedSymbol
238
+ )
239
+ REVIEW =
240
+ T.let(
241
+ :review,
242
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision::TaggedSymbol
243
+ )
244
+
245
+ sig do
246
+ override.returns(
247
+ T::Array[
248
+ SafetyKit::Models::ContentCreateResponse::Policy::Decision::TaggedSymbol
249
+ ]
250
+ )
251
+ end
252
+ def self.values
253
+ end
254
+ end
255
+
256
+ # Escalation outcome: none (no escalation ran), completed (verdict reflected in
257
+ # decision), or timed_out (decision is a provisional review).
258
+ module Escalation
259
+ extend SafetyKit::Internal::Type::Enum
260
+
261
+ TaggedSymbol =
262
+ T.type_alias do
263
+ T.all(
264
+ Symbol,
265
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation
266
+ )
267
+ end
268
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
269
+
270
+ NONE =
271
+ T.let(
272
+ :none,
273
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation::TaggedSymbol
274
+ )
275
+ COMPLETED =
276
+ T.let(
277
+ :completed,
278
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation::TaggedSymbol
279
+ )
280
+ TIMED_OUT =
281
+ T.let(
282
+ :timed_out,
283
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation::TaggedSymbol
284
+ )
285
+
286
+ sig do
287
+ override.returns(
288
+ T::Array[
289
+ SafetyKit::Models::ContentCreateResponse::Policy::Escalation::TaggedSymbol
290
+ ]
291
+ )
292
+ end
293
+ def self.values
294
+ end
188
295
  end
189
296
  end
190
297
 
@@ -221,52 +328,6 @@ module SafetyKit
221
328
  def to_hash
222
329
  end
223
330
  end
224
-
225
- class Score < SafetyKit::Internal::Type::BaseModel
226
- OrHash =
227
- T.type_alias do
228
- T.any(
229
- SafetyKit::Models::ContentCreateResponse::Score,
230
- SafetyKit::Internal::AnyHash
231
- )
232
- end
233
-
234
- # Identifier of the classifier that produced this score.
235
- sig { returns(String) }
236
- attr_accessor :classifier_id
237
-
238
- # Classifier score between 0 and 1. Higher means more likely violating.
239
- sig { returns(Float) }
240
- attr_accessor :score
241
-
242
- # Version of the classifier that produced this score.
243
- sig { returns(String) }
244
- attr_accessor :version
245
-
246
- # Score produced by one classifier for the submitted content.
247
- sig do
248
- params(classifier_id: String, score: Float, version: String).returns(
249
- T.attached_class
250
- )
251
- end
252
- def self.new(
253
- # Identifier of the classifier that produced this score.
254
- classifier_id:,
255
- # Classifier score between 0 and 1. Higher means more likely violating.
256
- score:,
257
- # Version of the classifier that produced this score.
258
- version:
259
- )
260
- end
261
-
262
- sig do
263
- override.returns(
264
- { classifier_id: String, score: Float, version: String }
265
- )
266
- end
267
- def to_hash
268
- end
269
- end
270
331
  end
271
332
  end
272
333
  end
@@ -6,11 +6,11 @@ module SafetyKit
6
6
  # the response.
7
7
  class Content
8
8
  # Classify a piece of content synchronously. Send user-authored text, images, or
9
- # both, and receive a decision (approve, reject, or review) with classifier scores
10
- # and reference set matches in the response. Requests have a maximum size of 6MB.
9
+ # both, and receive per-policy results with an overall decision (match, not_match,
10
+ # or review) in the response. Requests have a maximum size of 6MB.
11
11
  sig do
12
12
  params(
13
- entity_id: String,
13
+ user_id: String,
14
14
  content_id: String,
15
15
  images: T::Array[String],
16
16
  metadata: T::Hash[Symbol, T.nilable(T.anything)],
@@ -19,19 +19,17 @@ module SafetyKit
19
19
  ).returns(SafetyKit::Models::ContentCreateResponse)
20
20
  end
21
21
  def create(
22
- # Your stable identifier for the entity this content belongs to, such as a user,
23
- # listing, or message thread.
24
- entity_id:,
22
+ # Your stable identifier for the user this content belongs to.
23
+ user_id:,
25
24
  # Your identifier for this content, matching the content_id sent on /v1/events.
26
25
  # Prevents double-counting content submitted to both endpoints.
27
26
  content_id: nil,
28
27
  # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
29
- # most 4 images, 5MB each.
28
+ # most 20 images, 5MB each.
30
29
  images: nil,
31
30
  # Additional product context for this content. At most 8KB when serialized.
32
31
  metadata: nil,
33
- # User-authored text to classify. At most 20000 characters. Classification is
34
- # based on the first 16,000 characters.
32
+ # User-authored text to classify. At most 16000 characters.
35
33
  text: nil,
36
34
  request_options: {}
37
35
  )
@@ -2,7 +2,7 @@ module SafetyKit
2
2
  module Models
3
3
  type content_create_params =
4
4
  {
5
- entity_id: String,
5
+ user_id: String,
6
6
  content_id: String,
7
7
  images: ::Array[String],
8
8
  metadata: ::Hash[Symbol, top?],
@@ -14,7 +14,7 @@ module SafetyKit
14
14
  extend SafetyKit::Internal::Type::RequestParameters::Converter
15
15
  include SafetyKit::Internal::Type::RequestParameters
16
16
 
17
- attr_accessor entity_id: String
17
+ attr_accessor user_id: String
18
18
 
19
19
  attr_reader content_id: String?
20
20
 
@@ -33,7 +33,7 @@ module SafetyKit
33
33
  def text=: (String) -> String
34
34
 
35
35
  def initialize: (
36
- entity_id: String,
36
+ user_id: String,
37
37
  ?content_id: String,
38
38
  ?images: ::Array[String],
39
39
  ?metadata: ::Hash[Symbol, top?],
@@ -42,7 +42,7 @@ module SafetyKit
42
42
  ) -> void
43
43
 
44
44
  def to_hash: -> {
45
- entity_id: String,
45
+ user_id: String,
46
46
  content_id: String,
47
47
  images: ::Array[String],
48
48
  metadata: ::Hash[Symbol, top?],
@@ -4,11 +4,9 @@ module SafetyKit
4
4
  {
5
5
  content_id: String,
6
6
  decision: SafetyKit::Models::ContentCreateResponse::decision,
7
- entity_id: String,
8
- escalation: SafetyKit::Models::ContentCreateResponse::escalation,
9
- mirrored: bool,
7
+ policies: ::Array[SafetyKit::Models::ContentCreateResponse::Policy],
10
8
  reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch],
11
- scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
9
+ user_id: String
12
10
  }
13
11
 
14
12
  class ContentCreateResponse < SafetyKit::Internal::Type::BaseModel
@@ -16,58 +14,99 @@ module SafetyKit
16
14
 
17
15
  attr_accessor decision: SafetyKit::Models::ContentCreateResponse::decision
18
16
 
19
- attr_accessor entity_id: String
20
-
21
- attr_accessor escalation: SafetyKit::Models::ContentCreateResponse::escalation
22
-
23
- attr_accessor mirrored: bool
17
+ attr_accessor policies: ::Array[SafetyKit::Models::ContentCreateResponse::Policy]
24
18
 
25
19
  attr_accessor reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch]
26
20
 
27
- attr_accessor scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
21
+ attr_accessor user_id: String
28
22
 
29
23
  def initialize: (
30
24
  content_id: String,
31
25
  decision: SafetyKit::Models::ContentCreateResponse::decision,
32
- entity_id: String,
33
- escalation: SafetyKit::Models::ContentCreateResponse::escalation,
34
- mirrored: bool,
26
+ policies: ::Array[SafetyKit::Models::ContentCreateResponse::Policy],
35
27
  reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch],
36
- scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
28
+ user_id: String
37
29
  ) -> void
38
30
 
39
31
  def to_hash: -> {
40
32
  content_id: String,
41
33
  decision: SafetyKit::Models::ContentCreateResponse::decision,
42
- entity_id: String,
43
- escalation: SafetyKit::Models::ContentCreateResponse::escalation,
44
- mirrored: bool,
34
+ policies: ::Array[SafetyKit::Models::ContentCreateResponse::Policy],
45
35
  reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch],
46
- scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
36
+ user_id: String
47
37
  }
48
38
 
49
- type decision = :approve | :reject | :review
39
+ type decision = :match | :not_match | :review
50
40
 
51
41
  module Decision
52
42
  extend SafetyKit::Internal::Type::Enum
53
43
 
54
- APPROVE: :approve
55
- REJECT: :reject
44
+ MATCH: :match
45
+ NOT_MATCH: :not_match
56
46
  REVIEW: :review
57
47
 
58
48
  def self?.values: -> ::Array[SafetyKit::Models::ContentCreateResponse::decision]
59
49
  end
60
50
 
61
- type escalation = :none | :completed | :timed_out
51
+ type policy =
52
+ {
53
+ decision: SafetyKit::Models::ContentCreateResponse::Policy::decision,
54
+ escalation: SafetyKit::Models::ContentCreateResponse::Policy::escalation,
55
+ policy_id: String,
56
+ score: Float,
57
+ version: String
58
+ }
62
59
 
63
- module Escalation
64
- extend SafetyKit::Internal::Type::Enum
60
+ class Policy < SafetyKit::Internal::Type::BaseModel
61
+ attr_accessor decision: SafetyKit::Models::ContentCreateResponse::Policy::decision
62
+
63
+ attr_accessor escalation: SafetyKit::Models::ContentCreateResponse::Policy::escalation
64
+
65
+ attr_accessor policy_id: String
66
+
67
+ attr_accessor score: Float
68
+
69
+ attr_accessor version: String
70
+
71
+ def initialize: (
72
+ decision: SafetyKit::Models::ContentCreateResponse::Policy::decision,
73
+ escalation: SafetyKit::Models::ContentCreateResponse::Policy::escalation,
74
+ policy_id: String,
75
+ score: Float,
76
+ version: String
77
+ ) -> void
78
+
79
+ def to_hash: -> {
80
+ decision: SafetyKit::Models::ContentCreateResponse::Policy::decision,
81
+ escalation: SafetyKit::Models::ContentCreateResponse::Policy::escalation,
82
+ policy_id: String,
83
+ score: Float,
84
+ version: String
85
+ }
65
86
 
66
- NONE: :none
67
- COMPLETED: :completed
68
- TIMED_OUT: :timed_out
87
+ type decision = :match | :not_match | :review
69
88
 
70
- def self?.values: -> ::Array[SafetyKit::Models::ContentCreateResponse::escalation]
89
+ module Decision
90
+ extend SafetyKit::Internal::Type::Enum
91
+
92
+ MATCH: :match
93
+ NOT_MATCH: :not_match
94
+ REVIEW: :review
95
+
96
+ def self?.values: -> ::Array[SafetyKit::Models::ContentCreateResponse::Policy::decision]
97
+ end
98
+
99
+ type escalation = :none | :completed | :timed_out
100
+
101
+ module Escalation
102
+ extend SafetyKit::Internal::Type::Enum
103
+
104
+ NONE: :none
105
+ COMPLETED: :completed
106
+ TIMED_OUT: :timed_out
107
+
108
+ def self?.values: -> ::Array[SafetyKit::Models::ContentCreateResponse::Policy::escalation]
109
+ end
71
110
  end
72
111
 
73
112
  type reference_set_match = { set_id: String, similarity: Float }
@@ -81,24 +120,6 @@ module SafetyKit
81
120
 
82
121
  def to_hash: -> { set_id: String, similarity: Float }
83
122
  end
84
-
85
- type score = { classifier_id: String, score: Float, version: String }
86
-
87
- class Score < SafetyKit::Internal::Type::BaseModel
88
- attr_accessor classifier_id: String
89
-
90
- attr_accessor score: Float
91
-
92
- attr_accessor version: String
93
-
94
- def initialize: (
95
- classifier_id: String,
96
- score: Float,
97
- version: String
98
- ) -> void
99
-
100
- def to_hash: -> { classifier_id: String, score: Float, version: String }
101
- end
102
123
  end
103
124
  end
104
125
  end
@@ -2,7 +2,7 @@ module SafetyKit
2
2
  module Resources
3
3
  class Content
4
4
  def create: (
5
- entity_id: String,
5
+ user_id: String,
6
6
  ?content_id: String,
7
7
  ?images: ::Array[String],
8
8
  ?metadata: ::Hash[Symbol, top?],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safetykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.0
4
+ version: 0.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Safetykit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-05 00:00:00.000000000 Z
11
+ date: 2026-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi