safetykit 0.56.0 → 0.58.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/safety_kit/models/content_create_params.rb +136 -17
- data/lib/safety_kit/models/content_create_response.rb +206 -105
- data/lib/safety_kit/resources/content.rb +12 -10
- data/lib/safety_kit/resources/streams.rb +20 -0
- data/lib/safety_kit/version.rb +1 -1
- data/rbi/safety_kit/models/content_create_params.rbi +359 -22
- data/rbi/safety_kit/models/content_create_response.rbi +424 -171
- data/rbi/safety_kit/resources/content.rbi +20 -13
- data/rbi/safety_kit/resources/streams.rbi +20 -0
- data/sig/safety_kit/models/content_create_params.rbs +142 -12
- data/sig/safety_kit/models/content_create_response.rbs +156 -62
- data/sig/safety_kit/resources/content.rbs +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9283c72242f9da00698a358a99a018701a042b3de8b402a9efc5aa998b7cb145
|
|
4
|
+
data.tar.gz: 4f0e511b6540d3b7c05d9f2ab09cc90aedd779c0c5a39c8c3f10c6334eae4730
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 754d578687d2e96ae89e407fe3d5edd4bcecc658fefc899d382d4da7b52c0703e8624539ce59a66733595a17810454a150e25b6c39b69812edf350795a34d241
|
|
7
|
+
data.tar.gz: fd0eb6f82659e7f5b55e0a0f0380cafae7e85aef310776a9b37fa6236f354037fabf2579415f5f45356b977b193b3a71cf9d6298b3e1147454917b03216f3fa2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.58.0 (2026-08-11)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.57.0...v0.58.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.57.0...v0.58.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([6e357b2](https://github.com/GetSafetyKit/safetykit-ruby/commit/6e357b2845a8f97084b348cb2bf7dccdb97c5d43))
|
|
10
|
+
|
|
11
|
+
## 0.57.0 (2026-08-11)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.56.0...v0.57.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.56.0...v0.57.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** api update ([85b1dd1](https://github.com/GetSafetyKit/safetykit-ruby/commit/85b1dd123b3cd30db6824146d29bffe4ef5e2f57))
|
|
18
|
+
|
|
3
19
|
## 0.56.0 (2026-08-07)
|
|
4
20
|
|
|
5
21
|
Full Changelog: [v0.55.0...v0.56.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.55.0...v0.56.0)
|
data/README.md
CHANGED
|
@@ -7,6 +7,13 @@ module SafetyKit
|
|
|
7
7
|
extend SafetyKit::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include SafetyKit::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
|
+
# @!attribute content
|
|
11
|
+
# Content parts to classify together. At most 20 images.
|
|
12
|
+
#
|
|
13
|
+
# @return [Array<SafetyKit::Models::ContentCreateParams::Content::UnionMember0, SafetyKit::Models::ContentCreateParams::Content::UnionMember1>]
|
|
14
|
+
required :content,
|
|
15
|
+
-> { SafetyKit::Internal::Type::ArrayOf[union: SafetyKit::ContentCreateParams::Content] }
|
|
16
|
+
|
|
10
17
|
# @!attribute user_id
|
|
11
18
|
# Your stable identifier for the user this content belongs to.
|
|
12
19
|
#
|
|
@@ -19,40 +26,152 @@ module SafetyKit
|
|
|
19
26
|
# @return [String, nil]
|
|
20
27
|
optional :content_id, String
|
|
21
28
|
|
|
22
|
-
# @!attribute images
|
|
23
|
-
# Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
|
|
24
|
-
# most 5MB each.
|
|
25
|
-
#
|
|
26
|
-
# @return [Array<String>, nil]
|
|
27
|
-
optional :images, SafetyKit::Internal::Type::ArrayOf[String]
|
|
28
|
-
|
|
29
29
|
# @!attribute metadata
|
|
30
30
|
# Additional product context for this content. At most 8KB when serialized.
|
|
31
31
|
#
|
|
32
32
|
# @return [Hash{Symbol=>Object, nil}, nil]
|
|
33
33
|
optional :metadata, SafetyKit::Internal::Type::HashOf[SafetyKit::Internal::Type::Unknown, nil?: true]
|
|
34
34
|
|
|
35
|
-
# @!attribute
|
|
36
|
-
#
|
|
35
|
+
# @!attribute safety_kit_version
|
|
36
|
+
# The API version this operation is defined against.
|
|
37
37
|
#
|
|
38
|
-
# @return [
|
|
39
|
-
optional :
|
|
38
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateParams::SafetyKitVersion, nil]
|
|
39
|
+
optional :safety_kit_version, enum: -> { SafetyKit::ContentCreateParams::SafetyKitVersion }
|
|
40
40
|
|
|
41
|
-
# @!method initialize(user_id:, content_id: nil,
|
|
42
|
-
#
|
|
43
|
-
# {SafetyKit::Models::ContentCreateParams} for more details.
|
|
41
|
+
# @!method initialize(content:, user_id:, content_id: nil, metadata: nil, safety_kit_version: nil, request_options: {})
|
|
42
|
+
# @param content [Array<SafetyKit::Models::ContentCreateParams::Content::UnionMember0, SafetyKit::Models::ContentCreateParams::Content::UnionMember1>] Content parts to classify together. At most 20 images.
|
|
44
43
|
#
|
|
45
44
|
# @param user_id [String] Your stable identifier for the user this content belongs to.
|
|
46
45
|
#
|
|
47
46
|
# @param content_id [String] Your content identifier.
|
|
48
47
|
#
|
|
49
|
-
# @param images [Array<String>] Images to classify, each as base64-encoded image bytes, raw or as a data URI. At
|
|
50
|
-
#
|
|
51
48
|
# @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content. At most 8KB when serialized.
|
|
52
49
|
#
|
|
53
|
-
# @param
|
|
50
|
+
# @param safety_kit_version [Symbol, SafetyKit::Models::ContentCreateParams::SafetyKitVersion] The API version this operation is defined against.
|
|
54
51
|
#
|
|
55
52
|
# @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}]
|
|
53
|
+
|
|
54
|
+
# One part of the submitted content.
|
|
55
|
+
module Content
|
|
56
|
+
extend SafetyKit::Internal::Type::Union
|
|
57
|
+
|
|
58
|
+
variant -> { SafetyKit::ContentCreateParams::Content::UnionMember0 }
|
|
59
|
+
|
|
60
|
+
variant -> { SafetyKit::ContentCreateParams::Content::UnionMember1 }
|
|
61
|
+
|
|
62
|
+
class UnionMember0 < SafetyKit::Internal::Type::BaseModel
|
|
63
|
+
# @!attribute text
|
|
64
|
+
# User-authored text to classify.
|
|
65
|
+
#
|
|
66
|
+
# @return [String]
|
|
67
|
+
required :text, String
|
|
68
|
+
|
|
69
|
+
# @!attribute type
|
|
70
|
+
#
|
|
71
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateParams::Content::UnionMember0::Type]
|
|
72
|
+
required :type, enum: -> { SafetyKit::ContentCreateParams::Content::UnionMember0::Type }
|
|
73
|
+
|
|
74
|
+
# @!attribute key
|
|
75
|
+
# Your name for where this part came from.
|
|
76
|
+
#
|
|
77
|
+
# @return [String, nil]
|
|
78
|
+
optional :key, String
|
|
79
|
+
|
|
80
|
+
# @!method initialize(text:, type:, key: nil)
|
|
81
|
+
# @param text [String] User-authored text to classify.
|
|
82
|
+
#
|
|
83
|
+
# @param type [Symbol, SafetyKit::Models::ContentCreateParams::Content::UnionMember0::Type]
|
|
84
|
+
#
|
|
85
|
+
# @param key [String] Your name for where this part came from.
|
|
86
|
+
|
|
87
|
+
# @see SafetyKit::Models::ContentCreateParams::Content::UnionMember0#type
|
|
88
|
+
module Type
|
|
89
|
+
extend SafetyKit::Internal::Type::Enum
|
|
90
|
+
|
|
91
|
+
TEXT = :text
|
|
92
|
+
|
|
93
|
+
# @!method self.values
|
|
94
|
+
# @return [Array<Symbol>]
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class UnionMember1 < SafetyKit::Internal::Type::BaseModel
|
|
99
|
+
# @!attribute source
|
|
100
|
+
#
|
|
101
|
+
# @return [SafetyKit::Models::ContentCreateParams::Content::UnionMember1::Source]
|
|
102
|
+
required :source, -> { SafetyKit::ContentCreateParams::Content::UnionMember1::Source }
|
|
103
|
+
|
|
104
|
+
# @!attribute type
|
|
105
|
+
#
|
|
106
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateParams::Content::UnionMember1::Type]
|
|
107
|
+
required :type, enum: -> { SafetyKit::ContentCreateParams::Content::UnionMember1::Type }
|
|
108
|
+
|
|
109
|
+
# @!attribute key
|
|
110
|
+
# Your name for where this part came from.
|
|
111
|
+
#
|
|
112
|
+
# @return [String, nil]
|
|
113
|
+
optional :key, String
|
|
114
|
+
|
|
115
|
+
# @!method initialize(source:, type:, key: nil)
|
|
116
|
+
# @param source [SafetyKit::Models::ContentCreateParams::Content::UnionMember1::Source]
|
|
117
|
+
#
|
|
118
|
+
# @param type [Symbol, SafetyKit::Models::ContentCreateParams::Content::UnionMember1::Type]
|
|
119
|
+
#
|
|
120
|
+
# @param key [String] Your name for where this part came from.
|
|
121
|
+
|
|
122
|
+
# @see SafetyKit::Models::ContentCreateParams::Content::UnionMember1#source
|
|
123
|
+
class Source < SafetyKit::Internal::Type::BaseModel
|
|
124
|
+
# @!attribute data
|
|
125
|
+
# Base64-encoded image bytes, raw or as a data URI. At most 5MB.
|
|
126
|
+
#
|
|
127
|
+
# @return [String]
|
|
128
|
+
required :data, String
|
|
129
|
+
|
|
130
|
+
# @!attribute type
|
|
131
|
+
#
|
|
132
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateParams::Content::UnionMember1::Source::Type]
|
|
133
|
+
required :type, enum: -> { SafetyKit::ContentCreateParams::Content::UnionMember1::Source::Type }
|
|
134
|
+
|
|
135
|
+
# @!method initialize(data:, type:)
|
|
136
|
+
# @param data [String] Base64-encoded image bytes, raw or as a data URI. At most 5MB.
|
|
137
|
+
#
|
|
138
|
+
# @param type [Symbol, SafetyKit::Models::ContentCreateParams::Content::UnionMember1::Source::Type]
|
|
139
|
+
|
|
140
|
+
# @see SafetyKit::Models::ContentCreateParams::Content::UnionMember1::Source#type
|
|
141
|
+
module Type
|
|
142
|
+
extend SafetyKit::Internal::Type::Enum
|
|
143
|
+
|
|
144
|
+
BASE64 = :base64
|
|
145
|
+
|
|
146
|
+
# @!method self.values
|
|
147
|
+
# @return [Array<Symbol>]
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# @see SafetyKit::Models::ContentCreateParams::Content::UnionMember1#type
|
|
152
|
+
module Type
|
|
153
|
+
extend SafetyKit::Internal::Type::Enum
|
|
154
|
+
|
|
155
|
+
IMAGE = :image
|
|
156
|
+
|
|
157
|
+
# @!method self.values
|
|
158
|
+
# @return [Array<Symbol>]
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# @!method self.variants
|
|
163
|
+
# @return [Array(SafetyKit::Models::ContentCreateParams::Content::UnionMember0, SafetyKit::Models::ContentCreateParams::Content::UnionMember1)]
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# The API version this operation is defined against.
|
|
167
|
+
module SafetyKitVersion
|
|
168
|
+
extend SafetyKit::Internal::Type::Enum
|
|
169
|
+
|
|
170
|
+
SAFETY_KIT_VERSION_2026_08_11 = :"2026-08-11"
|
|
171
|
+
|
|
172
|
+
# @!method self.values
|
|
173
|
+
# @return [Array<Symbol>]
|
|
174
|
+
end
|
|
56
175
|
end
|
|
57
176
|
end
|
|
58
177
|
end
|
|
@@ -10,19 +10,12 @@ module SafetyKit
|
|
|
10
10
|
# @return [String]
|
|
11
11
|
required :content_id, String
|
|
12
12
|
|
|
13
|
-
# @!attribute
|
|
14
|
-
# Per-
|
|
13
|
+
# @!attribute labels
|
|
14
|
+
# Per-label results for the submitted content.
|
|
15
15
|
#
|
|
16
|
-
# @return [Array<SafetyKit::Models::ContentCreateResponse::
|
|
17
|
-
required :
|
|
18
|
-
-> { SafetyKit::Internal::Type::ArrayOf[SafetyKit::Models::ContentCreateResponse::
|
|
19
|
-
|
|
20
|
-
# @!attribute reference_set_matches
|
|
21
|
-
# Reference set matches found for the submitted content.
|
|
22
|
-
#
|
|
23
|
-
# @return [Array<SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch>]
|
|
24
|
-
required :reference_set_matches,
|
|
25
|
-
-> { SafetyKit::Internal::Type::ArrayOf[SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch] }
|
|
16
|
+
# @return [Array<SafetyKit::Models::ContentCreateResponse::Label::UnionMember0, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1>]
|
|
17
|
+
required :labels,
|
|
18
|
+
-> { SafetyKit::Internal::Type::ArrayOf[union: SafetyKit::Models::ContentCreateResponse::Label] }
|
|
26
19
|
|
|
27
20
|
# @!attribute user_id
|
|
28
21
|
# The user_id from the request.
|
|
@@ -30,109 +23,217 @@ module SafetyKit
|
|
|
30
23
|
# @return [String]
|
|
31
24
|
required :user_id, String
|
|
32
25
|
|
|
33
|
-
# @!
|
|
26
|
+
# @!attribute version
|
|
27
|
+
# The API version that served this request.
|
|
28
|
+
#
|
|
29
|
+
# @return [String]
|
|
30
|
+
required :version, String
|
|
31
|
+
|
|
32
|
+
# @!method initialize(content_id:, labels:, user_id:, version:)
|
|
34
33
|
# Synchronous classification result for the submitted content.
|
|
35
34
|
#
|
|
36
35
|
# @param content_id [String] SafetyKit identifier for the classified content.
|
|
37
36
|
#
|
|
38
|
-
# @param
|
|
39
|
-
#
|
|
40
|
-
# @param reference_set_matches [Array<SafetyKit::Models::ContentCreateResponse::ReferenceSetMatch>] Reference set matches found for the submitted content.
|
|
37
|
+
# @param labels [Array<SafetyKit::Models::ContentCreateResponse::Label::UnionMember0, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1>] Per-label results for the submitted content.
|
|
41
38
|
#
|
|
42
39
|
# @param user_id [String] The user_id from the request.
|
|
43
|
-
|
|
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
|
-
# @
|
|
40
|
+
#
|
|
41
|
+
# @param version [String] The API version that served this request.
|
|
42
|
+
|
|
43
|
+
# Result for one label evaluated against the submitted content.
|
|
44
|
+
module Label
|
|
45
|
+
extend SafetyKit::Internal::Type::Union
|
|
46
|
+
|
|
47
|
+
variant -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember0 }
|
|
48
|
+
|
|
49
|
+
variant -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember1 }
|
|
50
|
+
|
|
51
|
+
class UnionMember0 < SafetyKit::Internal::Type::BaseModel
|
|
52
|
+
# @!attribute decision
|
|
53
|
+
# Whether the submitted content matches the label.
|
|
54
|
+
#
|
|
55
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Decision]
|
|
56
|
+
required :decision, enum: -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Decision }
|
|
57
|
+
|
|
58
|
+
# @!attribute escalation
|
|
59
|
+
# Escalation outcome for this label.
|
|
60
|
+
#
|
|
61
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Escalation]
|
|
62
|
+
required :escalation,
|
|
63
|
+
enum: -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Escalation }
|
|
64
|
+
|
|
65
|
+
# @!attribute label
|
|
66
|
+
# Label identifier.
|
|
67
|
+
#
|
|
68
|
+
# @return [String]
|
|
69
|
+
required :label, String
|
|
70
|
+
|
|
71
|
+
# @!attribute score
|
|
72
|
+
# Classifier score between 0 and 1. Higher means more likely matching. Null when
|
|
73
|
+
# no classifier scored the label.
|
|
74
|
+
#
|
|
75
|
+
# @return [Float, nil]
|
|
76
|
+
required :score, Float, nil?: true
|
|
77
|
+
|
|
78
|
+
# @!attribute type
|
|
79
|
+
#
|
|
80
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Type]
|
|
81
|
+
required :type, enum: -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Type }
|
|
82
|
+
|
|
83
|
+
# @!method initialize(decision:, escalation:, label:, score:, type:)
|
|
84
|
+
# Some parameter documentations has been truncated, see
|
|
85
|
+
# {SafetyKit::Models::ContentCreateResponse::Label::UnionMember0} for more
|
|
86
|
+
# details.
|
|
87
|
+
#
|
|
88
|
+
# @param decision [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Decision] Whether the submitted content matches the label.
|
|
89
|
+
#
|
|
90
|
+
# @param escalation [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Escalation] Escalation outcome for this label.
|
|
91
|
+
#
|
|
92
|
+
# @param label [String] Label identifier.
|
|
93
|
+
#
|
|
94
|
+
# @param score [Float, nil] Classifier score between 0 and 1. Higher means more likely matching. Null when n
|
|
95
|
+
#
|
|
96
|
+
# @param type [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember0::Type]
|
|
97
|
+
|
|
98
|
+
# Whether the submitted content matches the label.
|
|
99
|
+
#
|
|
100
|
+
# @see SafetyKit::Models::ContentCreateResponse::Label::UnionMember0#decision
|
|
101
|
+
module Decision
|
|
102
|
+
extend SafetyKit::Internal::Type::Enum
|
|
103
|
+
|
|
104
|
+
MATCH = :match
|
|
105
|
+
NOT_MATCH = :not_match
|
|
106
|
+
REVIEW = :review
|
|
107
|
+
|
|
108
|
+
# @!method self.values
|
|
109
|
+
# @return [Array<Symbol>]
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Escalation outcome for this label.
|
|
113
|
+
#
|
|
114
|
+
# @see SafetyKit::Models::ContentCreateResponse::Label::UnionMember0#escalation
|
|
115
|
+
module Escalation
|
|
116
|
+
extend SafetyKit::Internal::Type::Enum
|
|
117
|
+
|
|
118
|
+
NONE = :none
|
|
119
|
+
COMPLETED = :completed
|
|
120
|
+
ERROR = :error
|
|
121
|
+
|
|
122
|
+
# @!method self.values
|
|
123
|
+
# @return [Array<Symbol>]
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# @see SafetyKit::Models::ContentCreateResponse::Label::UnionMember0#type
|
|
127
|
+
module Type
|
|
128
|
+
extend SafetyKit::Internal::Type::Enum
|
|
129
|
+
|
|
130
|
+
CLASSIFIER = :classifier
|
|
131
|
+
|
|
132
|
+
# @!method self.values
|
|
133
|
+
# @return [Array<Symbol>]
|
|
134
|
+
end
|
|
100
135
|
end
|
|
101
136
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
#
|
|
113
|
-
|
|
137
|
+
class UnionMember1 < SafetyKit::Internal::Type::BaseModel
|
|
138
|
+
# @!attribute decision
|
|
139
|
+
# Whether the submitted content matches the label.
|
|
140
|
+
#
|
|
141
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Decision]
|
|
142
|
+
required :decision, enum: -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Decision }
|
|
143
|
+
|
|
144
|
+
# @!attribute escalation
|
|
145
|
+
# Escalation outcome for this label.
|
|
146
|
+
#
|
|
147
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Escalation]
|
|
148
|
+
required :escalation,
|
|
149
|
+
enum: -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Escalation }
|
|
150
|
+
|
|
151
|
+
# @!attribute label
|
|
152
|
+
#
|
|
153
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Label]
|
|
154
|
+
required :label, enum: -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Label }
|
|
155
|
+
|
|
156
|
+
# @!attribute score
|
|
157
|
+
# Similarity between the submitted content and the matched entry.
|
|
158
|
+
#
|
|
159
|
+
# @return [Float]
|
|
160
|
+
required :score, Float
|
|
161
|
+
|
|
162
|
+
# @!attribute set_id
|
|
163
|
+
# Identifier of the matched reference set.
|
|
164
|
+
#
|
|
165
|
+
# @return [String]
|
|
166
|
+
required :set_id, String
|
|
167
|
+
|
|
168
|
+
# @!attribute type
|
|
169
|
+
#
|
|
170
|
+
# @return [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Type]
|
|
171
|
+
required :type, enum: -> { SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Type }
|
|
172
|
+
|
|
173
|
+
# @!method initialize(decision:, escalation:, label:, score:, set_id:, type:)
|
|
174
|
+
# @param decision [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Decision] Whether the submitted content matches the label.
|
|
175
|
+
#
|
|
176
|
+
# @param escalation [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Escalation] Escalation outcome for this label.
|
|
177
|
+
#
|
|
178
|
+
# @param label [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Label]
|
|
179
|
+
#
|
|
180
|
+
# @param score [Float] Similarity between the submitted content and the matched entry.
|
|
181
|
+
#
|
|
182
|
+
# @param set_id [String] Identifier of the matched reference set.
|
|
183
|
+
#
|
|
184
|
+
# @param type [Symbol, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1::Type]
|
|
185
|
+
|
|
186
|
+
# Whether the submitted content matches the label.
|
|
187
|
+
#
|
|
188
|
+
# @see SafetyKit::Models::ContentCreateResponse::Label::UnionMember1#decision
|
|
189
|
+
module Decision
|
|
190
|
+
extend SafetyKit::Internal::Type::Enum
|
|
191
|
+
|
|
192
|
+
MATCH = :match
|
|
193
|
+
NOT_MATCH = :not_match
|
|
194
|
+
REVIEW = :review
|
|
195
|
+
|
|
196
|
+
# @!method self.values
|
|
197
|
+
# @return [Array<Symbol>]
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Escalation outcome for this label.
|
|
201
|
+
#
|
|
202
|
+
# @see SafetyKit::Models::ContentCreateResponse::Label::UnionMember1#escalation
|
|
203
|
+
module Escalation
|
|
204
|
+
extend SafetyKit::Internal::Type::Enum
|
|
205
|
+
|
|
206
|
+
NONE = :none
|
|
207
|
+
COMPLETED = :completed
|
|
208
|
+
ERROR = :error
|
|
209
|
+
|
|
210
|
+
# @!method self.values
|
|
211
|
+
# @return [Array<Symbol>]
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# @see SafetyKit::Models::ContentCreateResponse::Label::UnionMember1#label
|
|
215
|
+
module Label
|
|
216
|
+
extend SafetyKit::Internal::Type::Enum
|
|
217
|
+
|
|
218
|
+
REFERENCE_SET_MATCH = :reference_set_match
|
|
219
|
+
|
|
220
|
+
# @!method self.values
|
|
221
|
+
# @return [Array<Symbol>]
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# @see SafetyKit::Models::ContentCreateResponse::Label::UnionMember1#type
|
|
225
|
+
module Type
|
|
226
|
+
extend SafetyKit::Internal::Type::Enum
|
|
227
|
+
|
|
228
|
+
SIMILARITY = :similarity
|
|
229
|
+
|
|
230
|
+
# @!method self.values
|
|
231
|
+
# @return [Array<Symbol>]
|
|
232
|
+
end
|
|
114
233
|
end
|
|
115
|
-
end
|
|
116
234
|
|
|
117
|
-
|
|
118
|
-
#
|
|
119
|
-
# Identifier of the matched reference set.
|
|
120
|
-
#
|
|
121
|
-
# @return [String]
|
|
122
|
-
required :set_id, String
|
|
123
|
-
|
|
124
|
-
# @!attribute similarity
|
|
125
|
-
# Similarity between the submitted content and the matched reference set entry.
|
|
126
|
-
#
|
|
127
|
-
# @return [Float]
|
|
128
|
-
required :similarity, Float
|
|
129
|
-
|
|
130
|
-
# @!method initialize(set_id:, similarity:)
|
|
131
|
-
# Reference set match found for the submitted content.
|
|
132
|
-
#
|
|
133
|
-
# @param set_id [String] Identifier of the matched reference set.
|
|
134
|
-
#
|
|
135
|
-
# @param similarity [Float] Similarity between the submitted content and the matched reference set entry.
|
|
235
|
+
# @!method self.variants
|
|
236
|
+
# @return [Array(SafetyKit::Models::ContentCreateResponse::Label::UnionMember0, SafetyKit::Models::ContentCreateResponse::Label::UnionMember1)]
|
|
136
237
|
end
|
|
137
238
|
end
|
|
138
239
|
end
|
|
@@ -8,26 +8,26 @@ module SafetyKit
|
|
|
8
8
|
# Some parameter documentations has been truncated, see
|
|
9
9
|
# {SafetyKit::Models::ContentCreateParams} for more details.
|
|
10
10
|
#
|
|
11
|
-
# Classify a piece of content synchronously. Send
|
|
12
|
-
#
|
|
13
|
-
#
|
|
11
|
+
# Classify a piece of content synchronously. Send text and image parts and receive
|
|
12
|
+
# per-label results in the response. Requests have a maximum size of 6MB. API
|
|
13
|
+
# version 2026-08-11; see the API versioning guide for superseded versions.
|
|
14
14
|
#
|
|
15
15
|
# Errors: 400 for an invalid body or images, with the failing field in the
|
|
16
16
|
# message. 401 for a missing or invalid API key. 413 for requests over 6MB. 503
|
|
17
17
|
# when classification is temporarily unavailable, in which case the request was
|
|
18
18
|
# not processed and is safe to retry.
|
|
19
19
|
#
|
|
20
|
-
# @overload create(user_id:, content_id: nil,
|
|
20
|
+
# @overload create(content:, user_id:, content_id: nil, metadata: nil, safety_kit_version: nil, request_options: {})
|
|
21
21
|
#
|
|
22
|
-
# @param
|
|
22
|
+
# @param content [Array<SafetyKit::Models::ContentCreateParams::Content::UnionMember0, SafetyKit::Models::ContentCreateParams::Content::UnionMember1>] Body param: Content parts to classify together. At most 20 images.
|
|
23
23
|
#
|
|
24
|
-
# @param
|
|
24
|
+
# @param user_id [String] Body param: Your stable identifier for the user this content belongs to.
|
|
25
25
|
#
|
|
26
|
-
# @param
|
|
26
|
+
# @param content_id [String] Body param: Your content identifier.
|
|
27
27
|
#
|
|
28
|
-
# @param metadata [Hash{Symbol=>Object, nil}] Additional product context for this content. At most 8KB when
|
|
28
|
+
# @param metadata [Hash{Symbol=>Object, nil}] Body param: Additional product context for this content. At most 8KB when serial
|
|
29
29
|
#
|
|
30
|
-
# @param
|
|
30
|
+
# @param safety_kit_version [Symbol, SafetyKit::Models::ContentCreateParams::SafetyKitVersion] Header param: The API version this operation is defined against.
|
|
31
31
|
#
|
|
32
32
|
# @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
33
33
|
#
|
|
@@ -36,10 +36,12 @@ module SafetyKit
|
|
|
36
36
|
# @see SafetyKit::Models::ContentCreateParams
|
|
37
37
|
def create(params)
|
|
38
38
|
parsed, options = SafetyKit::ContentCreateParams.dump_request(params)
|
|
39
|
+
header_params = {safety_kit_version: "safetykit-version"}
|
|
39
40
|
@client.request(
|
|
40
41
|
method: :post,
|
|
41
42
|
path: "v1/content",
|
|
42
|
-
|
|
43
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
44
|
+
body: parsed.except(*header_params.keys),
|
|
43
45
|
model: SafetyKit::Models::ContentCreateResponse,
|
|
44
46
|
options: options
|
|
45
47
|
)
|
|
@@ -6,6 +6,12 @@ module SafetyKit
|
|
|
6
6
|
class Streams
|
|
7
7
|
# Monitor the livestream at the given stream URL. This method returns immediately.
|
|
8
8
|
#
|
|
9
|
+
# Errors: 400 for an invalid body, with the reason in the message. 401 for a
|
|
10
|
+
# missing Authorization header. 403 for an invalid API key. 429 when the rate
|
|
11
|
+
# limit is exceeded. 5xx for transient internal failures. Retry 429 and 5xx with
|
|
12
|
+
# exponential backoff. Do not retry other 4xx errors, they indicate a problem with
|
|
13
|
+
# the request.
|
|
14
|
+
#
|
|
9
15
|
# @overload add(namespace, id:, stream_url:, request_options: {})
|
|
10
16
|
#
|
|
11
17
|
# @param namespace [String] The namespace to ingest stream data into
|
|
@@ -43,6 +49,13 @@ module SafetyKit
|
|
|
43
49
|
# ignored by downstream processing. This method returns immediately after the
|
|
44
50
|
# frame has been accepted for processing.
|
|
45
51
|
#
|
|
52
|
+
# Errors: 400 for an invalid body or an image that fails validation, with the
|
|
53
|
+
# reason in the message. 401 for a missing Authorization header. 403 for an
|
|
54
|
+
# invalid API key. 429 when the rate limit is exceeded. 5xx for transient internal
|
|
55
|
+
# failures. Retry 429 and 5xx with exponential backoff. Frame ingestion is
|
|
56
|
+
# idempotent, so a retried request that already succeeded is ignored. Do not retry
|
|
57
|
+
# other 4xx errors, they indicate a problem with the request.
|
|
58
|
+
#
|
|
46
59
|
# @overload add_frame(namespace, image_data_uri:, stream_id:, timestamp:, frame_id: nil, metadata: nil, request_options: {})
|
|
47
60
|
#
|
|
48
61
|
# @param namespace [String] The namespace to ingest stream data into
|
|
@@ -80,6 +93,13 @@ module SafetyKit
|
|
|
80
93
|
# correctly with later frames. This method returns immediately after the
|
|
81
94
|
# transcript has been accepted for processing.
|
|
82
95
|
#
|
|
96
|
+
# Errors: 400 for an invalid body, with the reason in the message. 401 for a
|
|
97
|
+
# missing Authorization header. 403 for an invalid API key. 429 when the rate
|
|
98
|
+
# limit is exceeded. 5xx for transient internal failures. Retry 429 and 5xx with
|
|
99
|
+
# exponential backoff. Transcript ingestion is idempotent, so a retried request
|
|
100
|
+
# that already succeeded is ignored. Do not retry other 4xx errors, they indicate
|
|
101
|
+
# a problem with the request.
|
|
102
|
+
#
|
|
83
103
|
# @overload add_transcript(namespace, stream_id:, text:, timestamp:, transcript_id: nil, request_options: {})
|
|
84
104
|
#
|
|
85
105
|
# @param namespace [String] The namespace to ingest stream data into
|
data/lib/safety_kit/version.rb
CHANGED