safetykit 0.50.0 → 0.52.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: 3be0223c948a999f249d8f68585345ec7d96040de4b4b18256a29d7af8b1b662
4
- data.tar.gz: 9863631b6583962919497f97a27ddbde318e13b18d66ed3ccc724d1cd0f924c7
3
+ metadata.gz: fb740cd06fd2147d66523afd833977860625eba2fa2b3b85dba5933a46f68a74
4
+ data.tar.gz: 49974de3af4a1b8188a16cd72999a6eb822338e4f2cb5b5ee80739885f550aad
5
5
  SHA512:
6
- metadata.gz: c1e231c7fafe07d840d93848166f1bedeef1ded22f991ab97e5c22aeb9d88a255d6de0065da5cb91c414178c327c4f65ec9e2dba62f3b38154b191ec470b9a90
7
- data.tar.gz: a3369ab0dfb03b3579926ca0e8edd36bce0a927d8350f4d25bce7c8aa8da527a4868206cb7b28445dc9367e08fb4ded3d13fb5deccda8ebd39f552c08e8ea520
6
+ metadata.gz: bd4c8bf187f42c1ddbff83a393afd6c3e177414a1c37f62b6d1847c8457cc2de4d570d5941c6a81f13701006cd77c80f62b7919bcc26459418b6f9ca5b572fe8
7
+ data.tar.gz: 9bd4562815b061c8d5995cf75aa02752726f66e55cb2d8ecd5bd8893f434bd0470e403cef886e004214f20c04b35565096d731b539b27285444364e36d042989
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.52.0 (2026-08-05)
4
+
5
+ Full Changelog: [v0.51.0...v0.52.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.51.0...v0.52.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([9d34342](https://github.com/GetSafetyKit/safetykit-ruby/commit/9d343420a3716e47e99f484881f25944a3468e43))
10
+
11
+ ## 0.51.0 (2026-08-05)
12
+
13
+ Full Changelog: [v0.50.0...v0.51.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.50.0...v0.51.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([3a57f4e](https://github.com/GetSafetyKit/safetykit-ruby/commit/3a57f4e95d35ddb799c71c06db72ccedbd171560))
18
+
3
19
  ## 0.50.0 (2026-08-01)
4
20
 
5
21
  Full Changelog: [v0.49.0...v0.50.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.49.0...v0.50.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.50.0"
20
+ gem "safetykit", "~> 0.52.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -42,6 +42,11 @@ module SafetyKit
42
42
  # @return [SafetyKit::Resources::Async]
43
43
  attr_reader :async
44
44
 
45
+ # Classify user-authored text and images synchronously and receive a decision in
46
+ # the response.
47
+ # @return [SafetyKit::Resources::Content]
48
+ attr_reader :content
49
+
45
50
  # Submit end-user deletion requests. Accepted requests are processed
46
51
  # asynchronously.
47
52
  # @return [SafetyKit::Resources::DeletionRequests]
@@ -128,6 +133,7 @@ module SafetyKit
128
133
  @agent_decisions = SafetyKit::Resources::AgentDecisions.new(client: self)
129
134
  @access_tokens = SafetyKit::Resources::AccessTokens.new(client: self)
130
135
  @async = SafetyKit::Resources::Async.new(client: self)
136
+ @content = SafetyKit::Resources::Content.new(client: self)
131
137
  @deletion_requests = SafetyKit::Resources::DeletionRequests.new(client: self)
132
138
  @client_sessions = SafetyKit::Resources::ClientSessions.new(client: self)
133
139
  @beta = SafetyKit::Resources::Beta.new(client: self)
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SafetyKit
4
+ module Models
5
+ # @see SafetyKit::Resources::Content#create
6
+ class ContentCreateParams < SafetyKit::Internal::Type::BaseModel
7
+ extend SafetyKit::Internal::Type::RequestParameters::Converter
8
+ include SafetyKit::Internal::Type::RequestParameters
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.
13
+ #
14
+ # @return [String]
15
+ required :entity_id, String
16
+
17
+ # @!attribute content_id
18
+ # Your identifier for this content, matching the content_id sent on /v1/events.
19
+ # Prevents double-counting content submitted to both endpoints.
20
+ #
21
+ # @return [String, nil]
22
+ optional :content_id, String
23
+
24
+ # @!attribute images
25
+ # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
26
+ # most 4 images, 5MB each.
27
+ #
28
+ # @return [Array<String>, nil]
29
+ optional :images, SafetyKit::Internal::Type::ArrayOf[String]
30
+
31
+ # @!attribute metadata
32
+ # Additional product context for this content. At most 8KB when serialized.
33
+ #
34
+ # @return [Hash{Symbol=>Object, nil}, nil]
35
+ optional :metadata, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
36
+
37
+ # @!attribute text
38
+ # User-authored text to classify. At most 20000 characters. Classification is
39
+ # based on the first 16,000 characters.
40
+ #
41
+ # @return [String, nil]
42
+ optional :text, String
43
+
44
+ # @!method initialize(entity_id:, content_id: nil, images: nil, metadata: nil, text: nil, request_options: {})
45
+ # Some parameter documentations has been truncated, see
46
+ # {SafetyKit::Models::ContentCreateParams} for more details.
47
+ #
48
+ # @param entity_id [String] Your stable identifier for the entity this content belongs to, such as a user, l
49
+ #
50
+ # @param content_id [String] Your identifier for this content, matching the content_id sent on /v1/events. Pr
51
+ #
52
+ # @param images [Array<String>] Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
53
+ #
54
+ # @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content. At most 8KB when serialized.
55
+ #
56
+ # @param text [String] User-authored text to classify. At most 20000 characters. Classification is base
57
+ #
58
+ # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}]
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,154 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SafetyKit
4
+ module Models
5
+ # @see SafetyKit::Resources::Content#create
6
+ class ContentCreateResponse < SafetyKit::Internal::Type::BaseModel
7
+ # @!attribute content_id
8
+ # SafetyKit identifier for the classified content.
9
+ #
10
+ # @return [String]
11
+ required :content_id, String
12
+
13
+ # @!attribute decision
14
+ # SafetyKit's decision for the submitted content: approve (no violation found),
15
+ # reject (violating), or review (needs human review).
16
+ #
17
+ # @return [Symbol, SafetyKit::Models::ContentCreateResponse::Decision]
18
+ required :decision, enum: -> { SafetyKit::Models::ContentCreateResponse::Decision }
19
+
20
+ # @!attribute entity_id
21
+ # The entity_id from the request.
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
38
+
39
+ # @!attribute reference_set_matches
40
+ # Reference set matches found for the submitted content.
41
+ #
42
+ # @return [Array<SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch>]
43
+ required :reference_set_matches,
44
+ -> { SafetyKit::Internal::Type::ArrayOf[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch] }
45
+
46
+ # @!attribute scores
47
+ # Classifier scores produced for the submitted content.
48
+ #
49
+ # @return [Array<SafetyKit::Models::ContentCreateResponse::Score>]
50
+ required :scores,
51
+ -> { SafetyKit::Internal::Type::ArrayOf[SafetyKit::Models::ContentCreateResponse::Score] }
52
+
53
+ # @!method initialize(content_id:, decision:, entity_id:, escalation:, mirrored:, reference_set_matches:, scores:)
54
+ # Some parameter documentations has been truncated, see
55
+ # {SafetyKit::Models::ContentCreateResponse} for more details.
56
+ #
57
+ # Synchronous classification result for the submitted content.
58
+ #
59
+ # @param content_id [String] SafetyKit identifier for the classified content.
60
+ #
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
66
+ #
67
+ # @param mirrored [Boolean] Whether SafetyKit mirrored the submitted content for later review.
68
+ #
69
+ # @param reference_set_matches [Array<SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch>] Reference set matches found for the submitted content.
70
+ #
71
+ # @param scores [Array<SafetyKit::Models::ContentCreateResponse::Score>] Classifier scores produced for the submitted content.
72
+
73
+ # SafetyKit's decision for the submitted content: approve (no violation found),
74
+ # reject (violating), or review (needs human review).
75
+ #
76
+ # @see SafetyKit::Models::ContentCreateResponse#decision
77
+ module Decision
78
+ extend SafetyKit::Internal::Type::Enum
79
+
80
+ APPROVE = :approve
81
+ REJECT = :reject
82
+ REVIEW = :review
83
+
84
+ # @!method self.values
85
+ # @return [Array<Symbol>]
86
+ end
87
+
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
94
+
95
+ NONE = :none
96
+ COMPLETED = :completed
97
+ TIMED_OUT = :timed_out
98
+
99
+ # @!method self.values
100
+ # @return [Array<Symbol>]
101
+ end
102
+
103
+ class ReferenceSetMatch < SafetyKit::Internal::Type::BaseModel
104
+ # @!attribute set_id
105
+ # Identifier of the matched reference set.
106
+ #
107
+ # @return [String]
108
+ required :set_id, String
109
+
110
+ # @!attribute similarity
111
+ # Similarity between the submitted content and the matched reference set entry.
112
+ #
113
+ # @return [Float]
114
+ required :similarity, Float
115
+
116
+ # @!method initialize(set_id:, similarity:)
117
+ # Reference set match found for the submitted content.
118
+ #
119
+ # @param set_id [String] Identifier of the matched reference set.
120
+ #
121
+ # @param similarity [Float] Similarity between the submitted content and the matched reference set entry.
122
+ 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
+ end
153
+ end
154
+ end
@@ -49,6 +49,8 @@ module SafetyKit
49
49
 
50
50
  ClientSessionCreateSessionParams = SafetyKit::Models::ClientSessionCreateSessionParams
51
51
 
52
+ ContentCreateParams = SafetyKit::Models::ContentCreateParams
53
+
52
54
  DataAddParams = SafetyKit::Models::DataAddParams
53
55
 
54
56
  DataCreateUploadURLParams = SafetyKit::Models::DataCreateUploadURLParams
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SafetyKit
4
+ module Resources
5
+ # Classify user-authored text and images synchronously and receive a decision in
6
+ # the response.
7
+ class Content
8
+ # Some parameter documentations has been truncated, see
9
+ # {SafetyKit::Models::ContentCreateParams} for more details.
10
+ #
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.
14
+ #
15
+ # @overload create(entity_id:, content_id: nil, images: nil, metadata: nil, text: nil, request_options: {})
16
+ #
17
+ # @param entity_id [String] Your stable identifier for the entity this content belongs to, such as a user, l
18
+ #
19
+ # @param content_id [String] Your identifier for this content, matching the content_id sent on /v1/events. Pr
20
+ #
21
+ # @param images [Array<String>] Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
22
+ #
23
+ # @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content. At most 8KB when serialized.
24
+ #
25
+ # @param text [String] User-authored text to classify. At most 20000 characters. Classification is base
26
+ #
27
+ # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}, nil]
28
+ #
29
+ # @return [SafetyKit::Models::ContentCreateResponse]
30
+ #
31
+ # @see SafetyKit::Models::ContentCreateParams
32
+ def create(params)
33
+ parsed, options = SafetyKit::ContentCreateParams.dump_request(params)
34
+ @client.request(
35
+ method: :post,
36
+ path: "v1/content",
37
+ body: parsed,
38
+ model: SafetyKit::Models::ContentCreateResponse,
39
+ options: options
40
+ )
41
+ end
42
+
43
+ # @api private
44
+ #
45
+ # @param client [SafetyKit::Client]
46
+ def initialize(client:)
47
+ @client = client
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SafetyKit
4
- VERSION = "0.50.0"
4
+ VERSION = "0.52.0"
5
5
  end
data/lib/safety_kit.rb CHANGED
@@ -62,6 +62,8 @@ require_relative "safety_kit/models/beta/event_create_params"
62
62
  require_relative "safety_kit/models/beta/event_create_response"
63
63
  require_relative "safety_kit/models/client_session_create_session_params"
64
64
  require_relative "safety_kit/models/client_session_create_session_response"
65
+ require_relative "safety_kit/models/content_create_params"
66
+ require_relative "safety_kit/models/content_create_response"
65
67
  require_relative "safety_kit/models/data_add_params"
66
68
  require_relative "safety_kit/models/data_add_response"
67
69
  require_relative "safety_kit/models/data_create_upload_url_params"
@@ -88,6 +90,7 @@ require_relative "safety_kit/resources/async"
88
90
  require_relative "safety_kit/resources/beta"
89
91
  require_relative "safety_kit/resources/beta/events"
90
92
  require_relative "safety_kit/resources/client_sessions"
93
+ require_relative "safety_kit/resources/content"
91
94
  require_relative "safety_kit/resources/data"
92
95
  require_relative "safety_kit/resources/deletion_requests"
93
96
  require_relative "safety_kit/resources/streams"
@@ -37,6 +37,11 @@ module SafetyKit
37
37
  sig { returns(SafetyKit::Resources::Async) }
38
38
  attr_reader :async
39
39
 
40
+ # Classify user-authored text and images synchronously and receive a decision in
41
+ # the response.
42
+ sig { returns(SafetyKit::Resources::Content) }
43
+ attr_reader :content
44
+
40
45
  # Submit end-user deletion requests. Accepted requests are processed
41
46
  # asynchronously.
42
47
  sig { returns(SafetyKit::Resources::DeletionRequests) }
@@ -0,0 +1,95 @@
1
+ # typed: strong
2
+
3
+ module SafetyKit
4
+ module Models
5
+ class ContentCreateParams < SafetyKit::Internal::Type::BaseModel
6
+ extend SafetyKit::Internal::Type::RequestParameters::Converter
7
+ include SafetyKit::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(SafetyKit::ContentCreateParams, SafetyKit::Internal::AnyHash)
12
+ end
13
+
14
+ # Your stable identifier for the entity this content belongs to, such as a user,
15
+ # listing, or message thread.
16
+ sig { returns(String) }
17
+ attr_accessor :entity_id
18
+
19
+ # Your identifier for this content, matching the content_id sent on /v1/events.
20
+ # Prevents double-counting content submitted to both endpoints.
21
+ sig { returns(T.nilable(String)) }
22
+ attr_reader :content_id
23
+
24
+ sig { params(content_id: String).void }
25
+ attr_writer :content_id
26
+
27
+ # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
28
+ # most 4 images, 5MB each.
29
+ sig { returns(T.nilable(T::Array[String])) }
30
+ attr_reader :images
31
+
32
+ sig { params(images: T::Array[String]).void }
33
+ attr_writer :images
34
+
35
+ # Additional product context for this content. At most 8KB when serialized.
36
+ sig { returns(T.nilable(T::Hash[Symbol, T.nilable(T.anything)])) }
37
+ attr_reader :metadata
38
+
39
+ sig { params(metadata: T::Hash[Symbol, T.nilable(T.anything)]).void }
40
+ attr_writer :metadata
41
+
42
+ # User-authored text to classify. At most 20000 characters. Classification is
43
+ # based on the first 16,000 characters.
44
+ sig { returns(T.nilable(String)) }
45
+ attr_reader :text
46
+
47
+ sig { params(text: String).void }
48
+ attr_writer :text
49
+
50
+ sig do
51
+ params(
52
+ entity_id: String,
53
+ content_id: String,
54
+ images: T::Array[String],
55
+ metadata: T::Hash[Symbol, T.nilable(T.anything)],
56
+ text: String,
57
+ request_options: SafetyKit::RequestOptions::OrHash
58
+ ).returns(T.attached_class)
59
+ end
60
+ 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:,
64
+ # Your identifier for this content, matching the content_id sent on /v1/events.
65
+ # Prevents double-counting content submitted to both endpoints.
66
+ content_id: nil,
67
+ # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
68
+ # most 4 images, 5MB each.
69
+ images: nil,
70
+ # Additional product context for this content. At most 8KB when serialized.
71
+ metadata: nil,
72
+ # User-authored text to classify. At most 20000 characters. Classification is
73
+ # based on the first 16,000 characters.
74
+ text: nil,
75
+ request_options: {}
76
+ )
77
+ end
78
+
79
+ sig do
80
+ override.returns(
81
+ {
82
+ entity_id: String,
83
+ content_id: String,
84
+ images: T::Array[String],
85
+ metadata: T::Hash[Symbol, T.nilable(T.anything)],
86
+ text: String,
87
+ request_options: SafetyKit::RequestOptions
88
+ }
89
+ )
90
+ end
91
+ def to_hash
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,272 @@
1
+ # typed: strong
2
+
3
+ module SafetyKit
4
+ module Models
5
+ class ContentCreateResponse < SafetyKit::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ SafetyKit::Models::ContentCreateResponse,
10
+ SafetyKit::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # SafetyKit identifier for the classified content.
15
+ sig { returns(String) }
16
+ attr_accessor :content_id
17
+
18
+ # SafetyKit's decision for the submitted content: approve (no violation found),
19
+ # reject (violating), or review (needs human review).
20
+ sig do
21
+ returns(
22
+ SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
23
+ )
24
+ end
25
+ attr_accessor :decision
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).
33
+ sig do
34
+ returns(
35
+ SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
36
+ )
37
+ 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
43
+
44
+ # Reference set matches found for the submitted content.
45
+ sig do
46
+ returns(
47
+ T::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch]
48
+ )
49
+ end
50
+ attr_accessor :reference_set_matches
51
+
52
+ # Classifier scores produced for the submitted content.
53
+ sig { returns(T::Array[SafetyKit::Models::ContentCreateResponse::Score]) }
54
+ attr_accessor :scores
55
+
56
+ # Synchronous classification result for the submitted content.
57
+ sig do
58
+ params(
59
+ content_id: String,
60
+ decision:
61
+ SafetyKit::Models::ContentCreateResponse::Decision::OrSymbol,
62
+ entity_id: String,
63
+ escalation:
64
+ SafetyKit::Models::ContentCreateResponse::Escalation::OrSymbol,
65
+ mirrored: T::Boolean,
66
+ reference_set_matches:
67
+ T::Array[
68
+ SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch::OrHash
69
+ ],
70
+ scores:
71
+ T::Array[SafetyKit::Models::ContentCreateResponse::Score::OrHash]
72
+ ).returns(T.attached_class)
73
+ end
74
+ def self.new(
75
+ # SafetyKit identifier for the classified content.
76
+ content_id:,
77
+ # SafetyKit's decision for the submitted content: approve (no violation found),
78
+ # reject (violating), or review (needs human review).
79
+ 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:,
87
+ # Reference set matches found for the submitted content.
88
+ reference_set_matches:,
89
+ # Classifier scores produced for the submitted content.
90
+ scores:
91
+ )
92
+ end
93
+
94
+ sig do
95
+ override.returns(
96
+ {
97
+ content_id: String,
98
+ decision:
99
+ SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol,
100
+ entity_id: String,
101
+ escalation:
102
+ SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol,
103
+ mirrored: T::Boolean,
104
+ reference_set_matches:
105
+ T::Array[
106
+ SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch
107
+ ],
108
+ scores: T::Array[SafetyKit::Models::ContentCreateResponse::Score]
109
+ }
110
+ )
111
+ end
112
+ def to_hash
113
+ end
114
+
115
+ # SafetyKit's decision for the submitted content: approve (no violation found),
116
+ # reject (violating), or review (needs human review).
117
+ module Decision
118
+ extend SafetyKit::Internal::Type::Enum
119
+
120
+ TaggedSymbol =
121
+ T.type_alias do
122
+ T.all(Symbol, SafetyKit::Models::ContentCreateResponse::Decision)
123
+ end
124
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
125
+
126
+ APPROVE =
127
+ T.let(
128
+ :approve,
129
+ SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
130
+ )
131
+ REJECT =
132
+ T.let(
133
+ :reject,
134
+ SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
135
+ )
136
+ REVIEW =
137
+ T.let(
138
+ :review,
139
+ SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
140
+ )
141
+
142
+ sig do
143
+ override.returns(
144
+ T::Array[
145
+ SafetyKit::Models::ContentCreateResponse::Decision::TaggedSymbol
146
+ ]
147
+ )
148
+ end
149
+ def self.values
150
+ end
151
+ end
152
+
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 =
159
+ T.type_alias do
160
+ T.all(Symbol, SafetyKit::Models::ContentCreateResponse::Escalation)
161
+ end
162
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
163
+
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
173
+ )
174
+ TIMED_OUT =
175
+ T.let(
176
+ :timed_out,
177
+ SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
178
+ )
179
+
180
+ sig do
181
+ override.returns(
182
+ T::Array[
183
+ SafetyKit::Models::ContentCreateResponse::Escalation::TaggedSymbol
184
+ ]
185
+ )
186
+ end
187
+ def self.values
188
+ end
189
+ end
190
+
191
+ class ReferenceSetMatch < SafetyKit::Internal::Type::BaseModel
192
+ OrHash =
193
+ T.type_alias do
194
+ T.any(
195
+ SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch,
196
+ SafetyKit::Internal::AnyHash
197
+ )
198
+ end
199
+
200
+ # Identifier of the matched reference set.
201
+ sig { returns(String) }
202
+ attr_accessor :set_id
203
+
204
+ # Similarity between the submitted content and the matched reference set entry.
205
+ sig { returns(Float) }
206
+ attr_accessor :similarity
207
+
208
+ # Reference set match found for the submitted content.
209
+ sig do
210
+ params(set_id: String, similarity: Float).returns(T.attached_class)
211
+ end
212
+ def self.new(
213
+ # Identifier of the matched reference set.
214
+ set_id:,
215
+ # Similarity between the submitted content and the matched reference set entry.
216
+ similarity:
217
+ )
218
+ end
219
+
220
+ sig { override.returns({ set_id: String, similarity: Float }) }
221
+ def to_hash
222
+ end
223
+ 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
+ end
271
+ end
272
+ end
@@ -14,6 +14,8 @@ module SafetyKit
14
14
  ClientSessionCreateSessionParams =
15
15
  SafetyKit::Models::ClientSessionCreateSessionParams
16
16
 
17
+ ContentCreateParams = SafetyKit::Models::ContentCreateParams
18
+
17
19
  DataAddParams = SafetyKit::Models::DataAddParams
18
20
 
19
21
  DataCreateUploadURLParams = SafetyKit::Models::DataCreateUploadURLParams
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module SafetyKit
4
+ module Resources
5
+ # Classify user-authored text and images synchronously and receive a decision in
6
+ # the response.
7
+ class Content
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.
11
+ sig do
12
+ params(
13
+ entity_id: String,
14
+ content_id: String,
15
+ images: T::Array[String],
16
+ metadata: T::Hash[Symbol, T.nilable(T.anything)],
17
+ text: String,
18
+ request_options: SafetyKit::RequestOptions::OrHash
19
+ ).returns(SafetyKit::Models::ContentCreateResponse)
20
+ end
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:,
25
+ # Your identifier for this content, matching the content_id sent on /v1/events.
26
+ # Prevents double-counting content submitted to both endpoints.
27
+ content_id: nil,
28
+ # Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
29
+ # most 4 images, 5MB each.
30
+ images: nil,
31
+ # Additional product context for this content. At most 8KB when serialized.
32
+ metadata: nil,
33
+ # User-authored text to classify. At most 20000 characters. Classification is
34
+ # based on the first 16,000 characters.
35
+ text: nil,
36
+ request_options: {}
37
+ )
38
+ end
39
+
40
+ # @api private
41
+ sig { params(client: SafetyKit::Client).returns(T.attached_class) }
42
+ def self.new(client:)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -20,6 +20,8 @@ module SafetyKit
20
20
 
21
21
  attr_reader async: SafetyKit::Resources::Async
22
22
 
23
+ attr_reader content: SafetyKit::Resources::Content
24
+
23
25
  attr_reader deletion_requests: SafetyKit::Resources::DeletionRequests
24
26
 
25
27
  attr_reader client_sessions: SafetyKit::Resources::ClientSessions
@@ -0,0 +1,54 @@
1
+ module SafetyKit
2
+ module Models
3
+ type content_create_params =
4
+ {
5
+ entity_id: String,
6
+ content_id: String,
7
+ images: ::Array[String],
8
+ metadata: ::Hash[Symbol, top?],
9
+ text: String
10
+ }
11
+ & SafetyKit::Internal::Type::request_parameters
12
+
13
+ class ContentCreateParams < SafetyKit::Internal::Type::BaseModel
14
+ extend SafetyKit::Internal::Type::RequestParameters::Converter
15
+ include SafetyKit::Internal::Type::RequestParameters
16
+
17
+ attr_accessor entity_id: String
18
+
19
+ attr_reader content_id: String?
20
+
21
+ def content_id=: (String) -> String
22
+
23
+ attr_reader images: ::Array[String]?
24
+
25
+ def images=: (::Array[String]) -> ::Array[String]
26
+
27
+ attr_reader metadata: ::Hash[Symbol, top?]?
28
+
29
+ def metadata=: (::Hash[Symbol, top?]) -> ::Hash[Symbol, top?]
30
+
31
+ attr_reader text: String?
32
+
33
+ def text=: (String) -> String
34
+
35
+ def initialize: (
36
+ entity_id: String,
37
+ ?content_id: String,
38
+ ?images: ::Array[String],
39
+ ?metadata: ::Hash[Symbol, top?],
40
+ ?text: String,
41
+ ?request_options: SafetyKit::request_opts
42
+ ) -> void
43
+
44
+ def to_hash: -> {
45
+ entity_id: String,
46
+ content_id: String,
47
+ images: ::Array[String],
48
+ metadata: ::Hash[Symbol, top?],
49
+ text: String,
50
+ request_options: SafetyKit::RequestOptions
51
+ }
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,104 @@
1
+ module SafetyKit
2
+ module Models
3
+ type content_create_response =
4
+ {
5
+ content_id: String,
6
+ decision: SafetyKit::Models::ContentCreateResponse::decision,
7
+ entity_id: String,
8
+ escalation: SafetyKit::Models::ContentCreateResponse::escalation,
9
+ mirrored: bool,
10
+ reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch],
11
+ scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
12
+ }
13
+
14
+ class ContentCreateResponse < SafetyKit::Internal::Type::BaseModel
15
+ attr_accessor content_id: String
16
+
17
+ attr_accessor decision: SafetyKit::Models::ContentCreateResponse::decision
18
+
19
+ attr_accessor entity_id: String
20
+
21
+ attr_accessor escalation: SafetyKit::Models::ContentCreateResponse::escalation
22
+
23
+ attr_accessor mirrored: bool
24
+
25
+ attr_accessor reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch]
26
+
27
+ attr_accessor scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
28
+
29
+ def initialize: (
30
+ content_id: String,
31
+ decision: SafetyKit::Models::ContentCreateResponse::decision,
32
+ entity_id: String,
33
+ escalation: SafetyKit::Models::ContentCreateResponse::escalation,
34
+ mirrored: bool,
35
+ reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch],
36
+ scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
37
+ ) -> void
38
+
39
+ def to_hash: -> {
40
+ content_id: String,
41
+ decision: SafetyKit::Models::ContentCreateResponse::decision,
42
+ entity_id: String,
43
+ escalation: SafetyKit::Models::ContentCreateResponse::escalation,
44
+ mirrored: bool,
45
+ reference_set_matches: ::Array[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch],
46
+ scores: ::Array[SafetyKit::Models::ContentCreateResponse::Score]
47
+ }
48
+
49
+ type decision = :approve | :reject | :review
50
+
51
+ module Decision
52
+ extend SafetyKit::Internal::Type::Enum
53
+
54
+ APPROVE: :approve
55
+ REJECT: :reject
56
+ REVIEW: :review
57
+
58
+ def self?.values: -> ::Array[SafetyKit::Models::ContentCreateResponse::decision]
59
+ end
60
+
61
+ type escalation = :none | :completed | :timed_out
62
+
63
+ module Escalation
64
+ extend SafetyKit::Internal::Type::Enum
65
+
66
+ NONE: :none
67
+ COMPLETED: :completed
68
+ TIMED_OUT: :timed_out
69
+
70
+ def self?.values: -> ::Array[SafetyKit::Models::ContentCreateResponse::escalation]
71
+ end
72
+
73
+ type reference_set_match = { set_id: String, similarity: Float }
74
+
75
+ class ReferenceSetMatch < SafetyKit::Internal::Type::BaseModel
76
+ attr_accessor set_id: String
77
+
78
+ attr_accessor similarity: Float
79
+
80
+ def initialize: (set_id: String, similarity: Float) -> void
81
+
82
+ def to_hash: -> { set_id: String, similarity: Float }
83
+ 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
+ end
103
+ end
104
+ end
@@ -9,6 +9,8 @@ module SafetyKit
9
9
 
10
10
  class ClientSessionCreateSessionParams = SafetyKit::Models::ClientSessionCreateSessionParams
11
11
 
12
+ class ContentCreateParams = SafetyKit::Models::ContentCreateParams
13
+
12
14
  class DataAddParams = SafetyKit::Models::DataAddParams
13
15
 
14
16
  class DataCreateUploadURLParams = SafetyKit::Models::DataCreateUploadURLParams
@@ -0,0 +1,16 @@
1
+ module SafetyKit
2
+ module Resources
3
+ class Content
4
+ def create: (
5
+ entity_id: String,
6
+ ?content_id: String,
7
+ ?images: ::Array[String],
8
+ ?metadata: ::Hash[Symbol, top?],
9
+ ?text: String,
10
+ ?request_options: SafetyKit::request_opts
11
+ ) -> SafetyKit::Models::ContentCreateResponse
12
+
13
+ def initialize: (client: SafetyKit::Client) -> void
14
+ end
15
+ end
16
+ end
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.50.0
4
+ version: 0.52.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-01 00:00:00.000000000 Z
11
+ date: 2026-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi
@@ -79,6 +79,8 @@ files:
79
79
  - lib/safety_kit/models/beta/event_create_response.rb
80
80
  - lib/safety_kit/models/client_session_create_session_params.rb
81
81
  - lib/safety_kit/models/client_session_create_session_response.rb
82
+ - lib/safety_kit/models/content_create_params.rb
83
+ - lib/safety_kit/models/content_create_response.rb
82
84
  - lib/safety_kit/models/data_add_params.rb
83
85
  - lib/safety_kit/models/data_add_response.rb
84
86
  - lib/safety_kit/models/data_create_upload_url_params.rb
@@ -105,6 +107,7 @@ files:
105
107
  - lib/safety_kit/resources/beta.rb
106
108
  - lib/safety_kit/resources/beta/events.rb
107
109
  - lib/safety_kit/resources/client_sessions.rb
110
+ - lib/safety_kit/resources/content.rb
108
111
  - lib/safety_kit/resources/data.rb
109
112
  - lib/safety_kit/resources/deletion_requests.rb
110
113
  - lib/safety_kit/resources/streams.rb
@@ -139,6 +142,8 @@ files:
139
142
  - rbi/safety_kit/models/beta/event_create_response.rbi
140
143
  - rbi/safety_kit/models/client_session_create_session_params.rbi
141
144
  - rbi/safety_kit/models/client_session_create_session_response.rbi
145
+ - rbi/safety_kit/models/content_create_params.rbi
146
+ - rbi/safety_kit/models/content_create_response.rbi
142
147
  - rbi/safety_kit/models/data_add_params.rbi
143
148
  - rbi/safety_kit/models/data_add_response.rbi
144
149
  - rbi/safety_kit/models/data_create_upload_url_params.rbi
@@ -165,6 +170,7 @@ files:
165
170
  - rbi/safety_kit/resources/beta.rbi
166
171
  - rbi/safety_kit/resources/beta/events.rbi
167
172
  - rbi/safety_kit/resources/client_sessions.rbi
173
+ - rbi/safety_kit/resources/content.rbi
168
174
  - rbi/safety_kit/resources/data.rbi
169
175
  - rbi/safety_kit/resources/deletion_requests.rbi
170
176
  - rbi/safety_kit/resources/streams.rbi
@@ -198,6 +204,8 @@ files:
198
204
  - sig/safety_kit/models/beta/event_create_response.rbs
199
205
  - sig/safety_kit/models/client_session_create_session_params.rbs
200
206
  - sig/safety_kit/models/client_session_create_session_response.rbs
207
+ - sig/safety_kit/models/content_create_params.rbs
208
+ - sig/safety_kit/models/content_create_response.rbs
201
209
  - sig/safety_kit/models/data_add_params.rbs
202
210
  - sig/safety_kit/models/data_add_response.rbs
203
211
  - sig/safety_kit/models/data_create_upload_url_params.rbs
@@ -224,6 +232,7 @@ files:
224
232
  - sig/safety_kit/resources/beta.rbs
225
233
  - sig/safety_kit/resources/beta/events.rbs
226
234
  - sig/safety_kit/resources/client_sessions.rbs
235
+ - sig/safety_kit/resources/content.rbs
227
236
  - sig/safety_kit/resources/data.rbs
228
237
  - sig/safety_kit/resources/deletion_requests.rbs
229
238
  - sig/safety_kit/resources/streams.rbs