moderation_api 2.34.0 → 2.36.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/moderation_api/models/content_submit_response.rb +119 -1
- data/lib/moderation_api/models/queue_retrieve_response.rb +21 -1
- data/lib/moderation_api/version.rb +1 -1
- data/rbi/moderation_api/models/content_submit_response.rbi +226 -0
- data/rbi/moderation_api/models/queue_retrieve_response.rbi +61 -0
- data/sig/moderation_api/models/content_submit_response.rbs +72 -0
- data/sig/moderation_api/models/queue_retrieve_response.rbs +21 -0
- 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: 0b2f092ece0ba8250396eff6b7d47dab8a667bc7989f980b1233a04db59ef83a
|
|
4
|
+
data.tar.gz: 9f1428ab035b3565d0ede0d83ad78bcbc4d29ec89682df227299119c4f16db0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aee81fbb058666bc8913eba73621a8d2e7a105af8d097939644238221a31348c4f8659ca4c701777be6e012244399b1632b545ac34eadc43a5e686a739cf4430
|
|
7
|
+
data.tar.gz: d0403bd95eb8461ddb1c06fd7e1048a0971efceba3841228666a881f5c66d2bcc8096360812f90a103ae74f1ac5ccb5dfebfd75080cf27a152415a1f964b8f79
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.36.0 (2026-08-24)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v2.35.0...v2.36.0](https://github.com/moderation-api/sdk-ruby/compare/v2.35.0...v2.36.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([7710268](https://github.com/moderation-api/sdk-ruby/commit/7710268d6a85d13d3b4cb3cef7cee8c442f473c7))
|
|
10
|
+
|
|
11
|
+
## 2.35.0 (2026-08-21)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v2.34.0...v2.35.0](https://github.com/moderation-api/sdk-ruby/compare/v2.34.0...v2.35.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** api update ([ce30b48](https://github.com/moderation-api/sdk-ruby/commit/ce30b48c33ec082b8143b3af082d07de83c44a3d))
|
|
18
|
+
|
|
3
19
|
## 2.34.0 (2026-08-20)
|
|
4
20
|
|
|
5
21
|
Full Changelog: [v2.33.0...v2.34.0](https://github.com/moderation-api/sdk-ruby/compare/v2.33.0...v2.34.0)
|
data/README.md
CHANGED
|
@@ -11,6 +11,16 @@ module ModerationAPI
|
|
|
11
11
|
# @return [ModerationAPI::Models::ContentSubmitResponse::Author, nil]
|
|
12
12
|
required :author, -> { ModerationAPI::Models::ContentSubmitResponse::Author }, nil?: true
|
|
13
13
|
|
|
14
|
+
# @!attribute casebook
|
|
15
|
+
# What your casebook — the record of your past moderation decisions — found for
|
|
16
|
+
# this content, or null when it had nothing close enough to say, when the matching
|
|
17
|
+
# cases disagreed, or when casebook lookups are not switched on for this channel.
|
|
18
|
+
# Reports what the casebook found; whether it decided the outcome is shown in
|
|
19
|
+
# `recommendation`, where a higher-priority rule may have settled the item first.
|
|
20
|
+
#
|
|
21
|
+
# @return [ModerationAPI::Models::ContentSubmitResponse::Casebook, nil]
|
|
22
|
+
required :casebook, -> { ModerationAPI::Models::ContentSubmitResponse::Casebook }, nil?: true
|
|
23
|
+
|
|
14
24
|
# @!attribute content
|
|
15
25
|
# Potentially modified content.
|
|
16
26
|
#
|
|
@@ -56,12 +66,14 @@ module ModerationAPI
|
|
|
56
66
|
optional :errors,
|
|
57
67
|
-> { ModerationAPI::Internal::Type::ArrayOf[ModerationAPI::Models::ContentSubmitResponse::Error] }
|
|
58
68
|
|
|
59
|
-
# @!method initialize(author:, content:, evaluation:, insights:, meta:, policies:, recommendation:, errors: nil)
|
|
69
|
+
# @!method initialize(author:, casebook:, content:, evaluation:, insights:, meta:, policies:, recommendation:, errors: nil)
|
|
60
70
|
# Some parameter documentations has been truncated, see
|
|
61
71
|
# {ModerationAPI::Models::ContentSubmitResponse} for more details.
|
|
62
72
|
#
|
|
63
73
|
# @param author [ModerationAPI::Models::ContentSubmitResponse::Author, nil] The author of the content if your account has authors enabled. Requires you to s
|
|
64
74
|
#
|
|
75
|
+
# @param casebook [ModerationAPI::Models::ContentSubmitResponse::Casebook, nil] What your casebook — the record of your past moderation decisions — found for th
|
|
76
|
+
#
|
|
65
77
|
# @param content [ModerationAPI::Models::ContentSubmitResponse::Content] Potentially modified content.
|
|
66
78
|
#
|
|
67
79
|
# @param evaluation [ModerationAPI::Models::ContentSubmitResponse::Evaluation] The evaluation of the content after running the channel policies.
|
|
@@ -178,6 +190,109 @@ module ModerationAPI
|
|
|
178
190
|
end
|
|
179
191
|
end
|
|
180
192
|
|
|
193
|
+
# @see ModerationAPI::Models::ContentSubmitResponse#casebook
|
|
194
|
+
class Casebook < ModerationAPI::Internal::Type::BaseModel
|
|
195
|
+
# @!attribute agreement
|
|
196
|
+
# How unanimous the matching cases are, from 0 to 1: the share of them that
|
|
197
|
+
# decided this way, ignoring how many there are. Always at least 0.8 when a ruling
|
|
198
|
+
# is returned — below that the casebook reports a disagreement instead of picking
|
|
199
|
+
# a side — so it tells you how clean the consensus was, and is not a threshold to
|
|
200
|
+
# re-apply yourself.
|
|
201
|
+
#
|
|
202
|
+
# @return [Float]
|
|
203
|
+
required :agreement, Float
|
|
204
|
+
|
|
205
|
+
# @!attribute case_count
|
|
206
|
+
# How many of your past cases backed this ruling.
|
|
207
|
+
#
|
|
208
|
+
# @return [Float]
|
|
209
|
+
required :case_count, Float
|
|
210
|
+
|
|
211
|
+
# @!attribute confidence
|
|
212
|
+
# How strongly the casebook holds this ruling, from 0 to 1: the agreement scaled
|
|
213
|
+
# by how much evidence backs it, so a handful of close, recent cases outweighs one
|
|
214
|
+
# distant one. Older cases count for less, halving in weight roughly every 180
|
|
215
|
+
# days. This is the number to use in rules when you want a strength condition.
|
|
216
|
+
#
|
|
217
|
+
# @return [Float]
|
|
218
|
+
required :confidence, Float
|
|
219
|
+
|
|
220
|
+
# @!attribute similarity
|
|
221
|
+
# How close the nearest matching case is, from 0 to 1. 1 means the content is
|
|
222
|
+
# identical to something you have already decided.
|
|
223
|
+
#
|
|
224
|
+
# @return [Float]
|
|
225
|
+
required :similarity, Float
|
|
226
|
+
|
|
227
|
+
# @!attribute topic
|
|
228
|
+
# The topic the closest matching case is filed under, or null when it has not been
|
|
229
|
+
# grouped into one yet.
|
|
230
|
+
#
|
|
231
|
+
# @return [ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic, nil]
|
|
232
|
+
required :topic, -> { ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic }, nil?: true
|
|
233
|
+
|
|
234
|
+
# @!attribute verdict
|
|
235
|
+
# The ruling your past decisions point to for this content.
|
|
236
|
+
#
|
|
237
|
+
# @return [Symbol, ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict]
|
|
238
|
+
required :verdict, enum: -> { ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict }
|
|
239
|
+
|
|
240
|
+
# @!method initialize(agreement:, case_count:, confidence:, similarity:, topic:, verdict:)
|
|
241
|
+
# Some parameter documentations has been truncated, see
|
|
242
|
+
# {ModerationAPI::Models::ContentSubmitResponse::Casebook} for more details.
|
|
243
|
+
#
|
|
244
|
+
# What your casebook — the record of your past moderation decisions — found for
|
|
245
|
+
# this content, or null when it had nothing close enough to say, when the matching
|
|
246
|
+
# cases disagreed, or when casebook lookups are not switched on for this channel.
|
|
247
|
+
# Reports what the casebook found; whether it decided the outcome is shown in
|
|
248
|
+
# `recommendation`, where a higher-priority rule may have settled the item first.
|
|
249
|
+
#
|
|
250
|
+
# @param agreement [Float] How unanimous the matching cases are, from 0 to 1: the share of them that decide
|
|
251
|
+
#
|
|
252
|
+
# @param case_count [Float] How many of your past cases backed this ruling.
|
|
253
|
+
#
|
|
254
|
+
# @param confidence [Float] How strongly the casebook holds this ruling, from 0 to 1: the agreement scaled b
|
|
255
|
+
#
|
|
256
|
+
# @param similarity [Float] How close the nearest matching case is, from 0 to 1. 1 means the content is iden
|
|
257
|
+
#
|
|
258
|
+
# @param topic [ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic, nil] The topic the closest matching case is filed under, or null when it has not been
|
|
259
|
+
#
|
|
260
|
+
# @param verdict [Symbol, ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict] The ruling your past decisions point to for this content.
|
|
261
|
+
|
|
262
|
+
# @see ModerationAPI::Models::ContentSubmitResponse::Casebook#topic
|
|
263
|
+
class Topic < ModerationAPI::Internal::Type::BaseModel
|
|
264
|
+
# @!attribute id
|
|
265
|
+
#
|
|
266
|
+
# @return [String]
|
|
267
|
+
required :id, String
|
|
268
|
+
|
|
269
|
+
# @!attribute label
|
|
270
|
+
#
|
|
271
|
+
# @return [String]
|
|
272
|
+
required :label, String
|
|
273
|
+
|
|
274
|
+
# @!method initialize(id:, label:)
|
|
275
|
+
# The topic the closest matching case is filed under, or null when it has not been
|
|
276
|
+
# grouped into one yet.
|
|
277
|
+
#
|
|
278
|
+
# @param id [String]
|
|
279
|
+
# @param label [String]
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# The ruling your past decisions point to for this content.
|
|
283
|
+
#
|
|
284
|
+
# @see ModerationAPI::Models::ContentSubmitResponse::Casebook#verdict
|
|
285
|
+
module Verdict
|
|
286
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
287
|
+
|
|
288
|
+
ALLOW = :allow
|
|
289
|
+
REJECT = :reject
|
|
290
|
+
|
|
291
|
+
# @!method self.values
|
|
292
|
+
# @return [Array<Symbol>]
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
181
296
|
# @see ModerationAPI::Models::ContentSubmitResponse#content
|
|
182
297
|
class Content < ModerationAPI::Internal::Type::BaseModel
|
|
183
298
|
# @!attribute id
|
|
@@ -935,6 +1050,8 @@ module ModerationAPI
|
|
|
935
1050
|
|
|
936
1051
|
variant const: -> { ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::CLIENT_OVERRIDE }
|
|
937
1052
|
|
|
1053
|
+
variant const: -> { ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::CASEBOOK_MATCH }
|
|
1054
|
+
|
|
938
1055
|
variant String
|
|
939
1056
|
|
|
940
1057
|
# @!method self.variants
|
|
@@ -956,6 +1073,7 @@ module ModerationAPI
|
|
|
956
1073
|
RULE_DEFAULT = :rule_default
|
|
957
1074
|
RULE_FALLBACK = :rule_fallback
|
|
958
1075
|
CLIENT_OVERRIDE = :client_override
|
|
1076
|
+
CASEBOOK_MATCH = :casebook_match
|
|
959
1077
|
|
|
960
1078
|
# @!endgroup
|
|
961
1079
|
end
|
|
@@ -82,6 +82,13 @@ module ModerationAPI
|
|
|
82
82
|
# @return [String, nil]
|
|
83
83
|
optional :before_date, String, api_name: :beforeDate
|
|
84
84
|
|
|
85
|
+
# @!attribute casebook_handled
|
|
86
|
+
#
|
|
87
|
+
# @return [Symbol, ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled, nil]
|
|
88
|
+
optional :casebook_handled,
|
|
89
|
+
enum: -> { ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled },
|
|
90
|
+
api_name: :casebookHandled
|
|
91
|
+
|
|
85
92
|
# @!attribute check_status
|
|
86
93
|
#
|
|
87
94
|
# @return [Symbol, ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CheckStatus, nil]
|
|
@@ -193,11 +200,12 @@ module ModerationAPI
|
|
|
193
200
|
enum: -> { ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::WithinUnit },
|
|
194
201
|
api_name: :withinUnit
|
|
195
202
|
|
|
196
|
-
# @!method initialize(after_date: nil, author_id: nil, author_trust_levels: nil, before_date: nil, check_status: nil, clear_date_window: nil, content_id: nil, content_types: nil, conversation_ids: nil, filtered_action_ids: nil, filtered_channel_ids: nil, filter_labels: nil, is_flagged: nil, labels: nil, languages: nil, max_severity: nil, media_types: nil, min_severity: nil, recommendation_actions: nil, search: nil, within: nil, within_unit: nil)
|
|
203
|
+
# @!method initialize(after_date: nil, author_id: nil, author_trust_levels: nil, before_date: nil, casebook_handled: nil, check_status: nil, clear_date_window: nil, content_id: nil, content_types: nil, conversation_ids: nil, filtered_action_ids: nil, filtered_channel_ids: nil, filter_labels: nil, is_flagged: nil, labels: nil, languages: nil, max_severity: nil, media_types: nil, min_severity: nil, recommendation_actions: nil, search: nil, within: nil, within_unit: nil)
|
|
197
204
|
# @param after_date [String]
|
|
198
205
|
# @param author_id [String]
|
|
199
206
|
# @param author_trust_levels [Array<Integer>]
|
|
200
207
|
# @param before_date [String]
|
|
208
|
+
# @param casebook_handled [Symbol, ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled]
|
|
201
209
|
# @param check_status [Symbol, ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CheckStatus, nil]
|
|
202
210
|
# @param clear_date_window [Boolean]
|
|
203
211
|
# @param content_id [String]
|
|
@@ -217,6 +225,18 @@ module ModerationAPI
|
|
|
217
225
|
# @param within [Float]
|
|
218
226
|
# @param within_unit [Symbol, ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::WithinUnit]
|
|
219
227
|
|
|
228
|
+
# @see ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter#casebook_handled
|
|
229
|
+
module CasebookHandled
|
|
230
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
231
|
+
|
|
232
|
+
ALL = :ALL
|
|
233
|
+
HANDLED = :HANDLED
|
|
234
|
+
WOULD_HAVE_HANDLED = :WOULD_HAVE_HANDLED
|
|
235
|
+
|
|
236
|
+
# @!method self.values
|
|
237
|
+
# @return [Array<Symbol>]
|
|
238
|
+
end
|
|
239
|
+
|
|
220
240
|
# @see ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter#check_status
|
|
221
241
|
module CheckStatus
|
|
222
242
|
extend ModerationAPI::Internal::Type::Enum
|
|
@@ -28,6 +28,28 @@ module ModerationAPI
|
|
|
28
28
|
end
|
|
29
29
|
attr_writer :author
|
|
30
30
|
|
|
31
|
+
# What your casebook — the record of your past moderation decisions — found for
|
|
32
|
+
# this content, or null when it had nothing close enough to say, when the matching
|
|
33
|
+
# cases disagreed, or when casebook lookups are not switched on for this channel.
|
|
34
|
+
# Reports what the casebook found; whether it decided the outcome is shown in
|
|
35
|
+
# `recommendation`, where a higher-priority rule may have settled the item first.
|
|
36
|
+
sig do
|
|
37
|
+
returns(
|
|
38
|
+
T.nilable(ModerationAPI::Models::ContentSubmitResponse::Casebook)
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
attr_reader :casebook
|
|
42
|
+
|
|
43
|
+
sig do
|
|
44
|
+
params(
|
|
45
|
+
casebook:
|
|
46
|
+
T.nilable(
|
|
47
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::OrHash
|
|
48
|
+
)
|
|
49
|
+
).void
|
|
50
|
+
end
|
|
51
|
+
attr_writer :casebook
|
|
52
|
+
|
|
31
53
|
# Potentially modified content.
|
|
32
54
|
sig { returns(ModerationAPI::Models::ContentSubmitResponse::Content) }
|
|
33
55
|
attr_reader :content
|
|
@@ -122,6 +144,10 @@ module ModerationAPI
|
|
|
122
144
|
T.nilable(
|
|
123
145
|
ModerationAPI::Models::ContentSubmitResponse::Author::OrHash
|
|
124
146
|
),
|
|
147
|
+
casebook:
|
|
148
|
+
T.nilable(
|
|
149
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::OrHash
|
|
150
|
+
),
|
|
125
151
|
content:
|
|
126
152
|
ModerationAPI::Models::ContentSubmitResponse::Content::OrHash,
|
|
127
153
|
evaluation:
|
|
@@ -153,6 +179,12 @@ module ModerationAPI
|
|
|
153
179
|
# The author of the content if your account has authors enabled. Requires you to
|
|
154
180
|
# send authorId when submitting content.
|
|
155
181
|
author:,
|
|
182
|
+
# What your casebook — the record of your past moderation decisions — found for
|
|
183
|
+
# this content, or null when it had nothing close enough to say, when the matching
|
|
184
|
+
# cases disagreed, or when casebook lookups are not switched on for this channel.
|
|
185
|
+
# Reports what the casebook found; whether it decided the outcome is shown in
|
|
186
|
+
# `recommendation`, where a higher-priority rule may have settled the item first.
|
|
187
|
+
casebook:,
|
|
156
188
|
# Potentially modified content.
|
|
157
189
|
content:,
|
|
158
190
|
# The evaluation of the content after running the channel policies.
|
|
@@ -175,6 +207,8 @@ module ModerationAPI
|
|
|
175
207
|
{
|
|
176
208
|
author:
|
|
177
209
|
T.nilable(ModerationAPI::Models::ContentSubmitResponse::Author),
|
|
210
|
+
casebook:
|
|
211
|
+
T.nilable(ModerationAPI::Models::ContentSubmitResponse::Casebook),
|
|
178
212
|
content: ModerationAPI::Models::ContentSubmitResponse::Content,
|
|
179
213
|
evaluation:
|
|
180
214
|
ModerationAPI::Models::ContentSubmitResponse::Evaluation,
|
|
@@ -419,6 +453,193 @@ module ModerationAPI
|
|
|
419
453
|
end
|
|
420
454
|
end
|
|
421
455
|
|
|
456
|
+
class Casebook < ModerationAPI::Internal::Type::BaseModel
|
|
457
|
+
OrHash =
|
|
458
|
+
T.type_alias do
|
|
459
|
+
T.any(
|
|
460
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook,
|
|
461
|
+
ModerationAPI::Internal::AnyHash
|
|
462
|
+
)
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
# How unanimous the matching cases are, from 0 to 1: the share of them that
|
|
466
|
+
# decided this way, ignoring how many there are. Always at least 0.8 when a ruling
|
|
467
|
+
# is returned — below that the casebook reports a disagreement instead of picking
|
|
468
|
+
# a side — so it tells you how clean the consensus was, and is not a threshold to
|
|
469
|
+
# re-apply yourself.
|
|
470
|
+
sig { returns(Float) }
|
|
471
|
+
attr_accessor :agreement
|
|
472
|
+
|
|
473
|
+
# How many of your past cases backed this ruling.
|
|
474
|
+
sig { returns(Float) }
|
|
475
|
+
attr_accessor :case_count
|
|
476
|
+
|
|
477
|
+
# How strongly the casebook holds this ruling, from 0 to 1: the agreement scaled
|
|
478
|
+
# by how much evidence backs it, so a handful of close, recent cases outweighs one
|
|
479
|
+
# distant one. Older cases count for less, halving in weight roughly every 180
|
|
480
|
+
# days. This is the number to use in rules when you want a strength condition.
|
|
481
|
+
sig { returns(Float) }
|
|
482
|
+
attr_accessor :confidence
|
|
483
|
+
|
|
484
|
+
# How close the nearest matching case is, from 0 to 1. 1 means the content is
|
|
485
|
+
# identical to something you have already decided.
|
|
486
|
+
sig { returns(Float) }
|
|
487
|
+
attr_accessor :similarity
|
|
488
|
+
|
|
489
|
+
# The topic the closest matching case is filed under, or null when it has not been
|
|
490
|
+
# grouped into one yet.
|
|
491
|
+
sig do
|
|
492
|
+
returns(
|
|
493
|
+
T.nilable(
|
|
494
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic
|
|
495
|
+
)
|
|
496
|
+
)
|
|
497
|
+
end
|
|
498
|
+
attr_reader :topic
|
|
499
|
+
|
|
500
|
+
sig do
|
|
501
|
+
params(
|
|
502
|
+
topic:
|
|
503
|
+
T.nilable(
|
|
504
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic::OrHash
|
|
505
|
+
)
|
|
506
|
+
).void
|
|
507
|
+
end
|
|
508
|
+
attr_writer :topic
|
|
509
|
+
|
|
510
|
+
# The ruling your past decisions point to for this content.
|
|
511
|
+
sig do
|
|
512
|
+
returns(
|
|
513
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict::TaggedSymbol
|
|
514
|
+
)
|
|
515
|
+
end
|
|
516
|
+
attr_accessor :verdict
|
|
517
|
+
|
|
518
|
+
# What your casebook — the record of your past moderation decisions — found for
|
|
519
|
+
# this content, or null when it had nothing close enough to say, when the matching
|
|
520
|
+
# cases disagreed, or when casebook lookups are not switched on for this channel.
|
|
521
|
+
# Reports what the casebook found; whether it decided the outcome is shown in
|
|
522
|
+
# `recommendation`, where a higher-priority rule may have settled the item first.
|
|
523
|
+
sig do
|
|
524
|
+
params(
|
|
525
|
+
agreement: Float,
|
|
526
|
+
case_count: Float,
|
|
527
|
+
confidence: Float,
|
|
528
|
+
similarity: Float,
|
|
529
|
+
topic:
|
|
530
|
+
T.nilable(
|
|
531
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic::OrHash
|
|
532
|
+
),
|
|
533
|
+
verdict:
|
|
534
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict::OrSymbol
|
|
535
|
+
).returns(T.attached_class)
|
|
536
|
+
end
|
|
537
|
+
def self.new(
|
|
538
|
+
# How unanimous the matching cases are, from 0 to 1: the share of them that
|
|
539
|
+
# decided this way, ignoring how many there are. Always at least 0.8 when a ruling
|
|
540
|
+
# is returned — below that the casebook reports a disagreement instead of picking
|
|
541
|
+
# a side — so it tells you how clean the consensus was, and is not a threshold to
|
|
542
|
+
# re-apply yourself.
|
|
543
|
+
agreement:,
|
|
544
|
+
# How many of your past cases backed this ruling.
|
|
545
|
+
case_count:,
|
|
546
|
+
# How strongly the casebook holds this ruling, from 0 to 1: the agreement scaled
|
|
547
|
+
# by how much evidence backs it, so a handful of close, recent cases outweighs one
|
|
548
|
+
# distant one. Older cases count for less, halving in weight roughly every 180
|
|
549
|
+
# days. This is the number to use in rules when you want a strength condition.
|
|
550
|
+
confidence:,
|
|
551
|
+
# How close the nearest matching case is, from 0 to 1. 1 means the content is
|
|
552
|
+
# identical to something you have already decided.
|
|
553
|
+
similarity:,
|
|
554
|
+
# The topic the closest matching case is filed under, or null when it has not been
|
|
555
|
+
# grouped into one yet.
|
|
556
|
+
topic:,
|
|
557
|
+
# The ruling your past decisions point to for this content.
|
|
558
|
+
verdict:
|
|
559
|
+
)
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
sig do
|
|
563
|
+
override.returns(
|
|
564
|
+
{
|
|
565
|
+
agreement: Float,
|
|
566
|
+
case_count: Float,
|
|
567
|
+
confidence: Float,
|
|
568
|
+
similarity: Float,
|
|
569
|
+
topic:
|
|
570
|
+
T.nilable(
|
|
571
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic
|
|
572
|
+
),
|
|
573
|
+
verdict:
|
|
574
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict::TaggedSymbol
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
end
|
|
578
|
+
def to_hash
|
|
579
|
+
end
|
|
580
|
+
|
|
581
|
+
class Topic < ModerationAPI::Internal::Type::BaseModel
|
|
582
|
+
OrHash =
|
|
583
|
+
T.type_alias do
|
|
584
|
+
T.any(
|
|
585
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic,
|
|
586
|
+
ModerationAPI::Internal::AnyHash
|
|
587
|
+
)
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
sig { returns(String) }
|
|
591
|
+
attr_accessor :id
|
|
592
|
+
|
|
593
|
+
sig { returns(String) }
|
|
594
|
+
attr_accessor :label
|
|
595
|
+
|
|
596
|
+
# The topic the closest matching case is filed under, or null when it has not been
|
|
597
|
+
# grouped into one yet.
|
|
598
|
+
sig { params(id: String, label: String).returns(T.attached_class) }
|
|
599
|
+
def self.new(id:, label:)
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
sig { override.returns({ id: String, label: String }) }
|
|
603
|
+
def to_hash
|
|
604
|
+
end
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
# The ruling your past decisions point to for this content.
|
|
608
|
+
module Verdict
|
|
609
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
610
|
+
|
|
611
|
+
TaggedSymbol =
|
|
612
|
+
T.type_alias do
|
|
613
|
+
T.all(
|
|
614
|
+
Symbol,
|
|
615
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict
|
|
616
|
+
)
|
|
617
|
+
end
|
|
618
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
619
|
+
|
|
620
|
+
ALLOW =
|
|
621
|
+
T.let(
|
|
622
|
+
:allow,
|
|
623
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict::TaggedSymbol
|
|
624
|
+
)
|
|
625
|
+
REJECT =
|
|
626
|
+
T.let(
|
|
627
|
+
:reject,
|
|
628
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict::TaggedSymbol
|
|
629
|
+
)
|
|
630
|
+
|
|
631
|
+
sig do
|
|
632
|
+
override.returns(
|
|
633
|
+
T::Array[
|
|
634
|
+
ModerationAPI::Models::ContentSubmitResponse::Casebook::Verdict::TaggedSymbol
|
|
635
|
+
]
|
|
636
|
+
)
|
|
637
|
+
end
|
|
638
|
+
def self.values
|
|
639
|
+
end
|
|
640
|
+
end
|
|
641
|
+
end
|
|
642
|
+
|
|
422
643
|
class Content < ModerationAPI::Internal::Type::BaseModel
|
|
423
644
|
OrHash =
|
|
424
645
|
T.type_alias do
|
|
@@ -1828,6 +2049,11 @@ module ModerationAPI
|
|
|
1828
2049
|
:client_override,
|
|
1829
2050
|
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
|
|
1830
2051
|
)
|
|
2052
|
+
CASEBOOK_MATCH =
|
|
2053
|
+
T.let(
|
|
2054
|
+
:casebook_match,
|
|
2055
|
+
ModerationAPI::Models::ContentSubmitResponse::Recommendation::ReasonCode::TaggedSymbol
|
|
2056
|
+
)
|
|
1831
2057
|
end
|
|
1832
2058
|
|
|
1833
2059
|
class MatchedRule < ModerationAPI::Internal::Type::BaseModel
|
|
@@ -150,6 +150,23 @@ module ModerationAPI
|
|
|
150
150
|
sig { params(before_date: String).void }
|
|
151
151
|
attr_writer :before_date
|
|
152
152
|
|
|
153
|
+
sig do
|
|
154
|
+
returns(
|
|
155
|
+
T.nilable(
|
|
156
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::TaggedSymbol
|
|
157
|
+
)
|
|
158
|
+
)
|
|
159
|
+
end
|
|
160
|
+
attr_reader :casebook_handled
|
|
161
|
+
|
|
162
|
+
sig do
|
|
163
|
+
params(
|
|
164
|
+
casebook_handled:
|
|
165
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::OrSymbol
|
|
166
|
+
).void
|
|
167
|
+
end
|
|
168
|
+
attr_writer :casebook_handled
|
|
169
|
+
|
|
153
170
|
sig do
|
|
154
171
|
returns(
|
|
155
172
|
T.nilable(
|
|
@@ -349,6 +366,8 @@ module ModerationAPI
|
|
|
349
366
|
author_id: String,
|
|
350
367
|
author_trust_levels: T::Array[Integer],
|
|
351
368
|
before_date: String,
|
|
369
|
+
casebook_handled:
|
|
370
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::OrSymbol,
|
|
352
371
|
check_status:
|
|
353
372
|
T.nilable(
|
|
354
373
|
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CheckStatus::OrSymbol
|
|
@@ -391,6 +410,7 @@ module ModerationAPI
|
|
|
391
410
|
author_id: nil,
|
|
392
411
|
author_trust_levels: nil,
|
|
393
412
|
before_date: nil,
|
|
413
|
+
casebook_handled: nil,
|
|
394
414
|
check_status: nil,
|
|
395
415
|
clear_date_window: nil,
|
|
396
416
|
content_id: nil,
|
|
@@ -419,6 +439,8 @@ module ModerationAPI
|
|
|
419
439
|
author_id: String,
|
|
420
440
|
author_trust_levels: T::Array[Integer],
|
|
421
441
|
before_date: String,
|
|
442
|
+
casebook_handled:
|
|
443
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::TaggedSymbol,
|
|
422
444
|
check_status:
|
|
423
445
|
T.nilable(
|
|
424
446
|
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CheckStatus::TaggedSymbol
|
|
@@ -460,6 +482,45 @@ module ModerationAPI
|
|
|
460
482
|
def to_hash
|
|
461
483
|
end
|
|
462
484
|
|
|
485
|
+
module CasebookHandled
|
|
486
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
487
|
+
|
|
488
|
+
TaggedSymbol =
|
|
489
|
+
T.type_alias do
|
|
490
|
+
T.all(
|
|
491
|
+
Symbol,
|
|
492
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled
|
|
493
|
+
)
|
|
494
|
+
end
|
|
495
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
496
|
+
|
|
497
|
+
ALL =
|
|
498
|
+
T.let(
|
|
499
|
+
:ALL,
|
|
500
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::TaggedSymbol
|
|
501
|
+
)
|
|
502
|
+
HANDLED =
|
|
503
|
+
T.let(
|
|
504
|
+
:HANDLED,
|
|
505
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::TaggedSymbol
|
|
506
|
+
)
|
|
507
|
+
WOULD_HAVE_HANDLED =
|
|
508
|
+
T.let(
|
|
509
|
+
:WOULD_HAVE_HANDLED,
|
|
510
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::TaggedSymbol
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
sig do
|
|
514
|
+
override.returns(
|
|
515
|
+
T::Array[
|
|
516
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::CasebookHandled::TaggedSymbol
|
|
517
|
+
]
|
|
518
|
+
)
|
|
519
|
+
end
|
|
520
|
+
def self.values
|
|
521
|
+
end
|
|
522
|
+
end
|
|
523
|
+
|
|
463
524
|
module CheckStatus
|
|
464
525
|
extend ModerationAPI::Internal::Type::Enum
|
|
465
526
|
|
|
@@ -3,6 +3,7 @@ module ModerationAPI
|
|
|
3
3
|
type content_submit_response =
|
|
4
4
|
{
|
|
5
5
|
author: ModerationAPI::Models::ContentSubmitResponse::Author?,
|
|
6
|
+
casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?,
|
|
6
7
|
content: ModerationAPI::Models::ContentSubmitResponse::Content,
|
|
7
8
|
evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation,
|
|
8
9
|
insights: ::Array[ModerationAPI::Models::ContentSubmitResponse::insight],
|
|
@@ -15,6 +16,8 @@ module ModerationAPI
|
|
|
15
16
|
class ContentSubmitResponse < ModerationAPI::Internal::Type::BaseModel
|
|
16
17
|
attr_accessor author: ModerationAPI::Models::ContentSubmitResponse::Author?
|
|
17
18
|
|
|
19
|
+
attr_accessor casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?
|
|
20
|
+
|
|
18
21
|
attr_accessor content: ModerationAPI::Models::ContentSubmitResponse::Content
|
|
19
22
|
|
|
20
23
|
attr_accessor evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation
|
|
@@ -35,6 +38,7 @@ module ModerationAPI
|
|
|
35
38
|
|
|
36
39
|
def initialize: (
|
|
37
40
|
author: ModerationAPI::Models::ContentSubmitResponse::Author?,
|
|
41
|
+
casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?,
|
|
38
42
|
content: ModerationAPI::Models::ContentSubmitResponse::Content,
|
|
39
43
|
evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation,
|
|
40
44
|
insights: ::Array[ModerationAPI::Models::ContentSubmitResponse::insight],
|
|
@@ -46,6 +50,7 @@ module ModerationAPI
|
|
|
46
50
|
|
|
47
51
|
def to_hash: -> {
|
|
48
52
|
author: ModerationAPI::Models::ContentSubmitResponse::Author?,
|
|
53
|
+
casebook: ModerationAPI::Models::ContentSubmitResponse::Casebook?,
|
|
49
54
|
content: ModerationAPI::Models::ContentSubmitResponse::Content,
|
|
50
55
|
evaluation: ModerationAPI::Models::ContentSubmitResponse::Evaluation,
|
|
51
56
|
insights: ::Array[ModerationAPI::Models::ContentSubmitResponse::insight],
|
|
@@ -128,6 +133,71 @@ module ModerationAPI
|
|
|
128
133
|
end
|
|
129
134
|
end
|
|
130
135
|
|
|
136
|
+
type casebook =
|
|
137
|
+
{
|
|
138
|
+
agreement: Float,
|
|
139
|
+
case_count: Float,
|
|
140
|
+
confidence: Float,
|
|
141
|
+
similarity: Float,
|
|
142
|
+
topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?,
|
|
143
|
+
verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
class Casebook < ModerationAPI::Internal::Type::BaseModel
|
|
147
|
+
attr_accessor agreement: Float
|
|
148
|
+
|
|
149
|
+
attr_accessor case_count: Float
|
|
150
|
+
|
|
151
|
+
attr_accessor confidence: Float
|
|
152
|
+
|
|
153
|
+
attr_accessor similarity: Float
|
|
154
|
+
|
|
155
|
+
attr_accessor topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?
|
|
156
|
+
|
|
157
|
+
attr_accessor verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
158
|
+
|
|
159
|
+
def initialize: (
|
|
160
|
+
agreement: Float,
|
|
161
|
+
case_count: Float,
|
|
162
|
+
confidence: Float,
|
|
163
|
+
similarity: Float,
|
|
164
|
+
topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?,
|
|
165
|
+
verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
166
|
+
) -> void
|
|
167
|
+
|
|
168
|
+
def to_hash: -> {
|
|
169
|
+
agreement: Float,
|
|
170
|
+
case_count: Float,
|
|
171
|
+
confidence: Float,
|
|
172
|
+
similarity: Float,
|
|
173
|
+
topic: ModerationAPI::Models::ContentSubmitResponse::Casebook::Topic?,
|
|
174
|
+
verdict: ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
type topic = { id: String, label: String }
|
|
178
|
+
|
|
179
|
+
class Topic < ModerationAPI::Internal::Type::BaseModel
|
|
180
|
+
attr_accessor id: String
|
|
181
|
+
|
|
182
|
+
attr_accessor label: String
|
|
183
|
+
|
|
184
|
+
def initialize: (id: String, label: String) -> void
|
|
185
|
+
|
|
186
|
+
def to_hash: -> { id: String, label: String }
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
type verdict = :allow | :reject
|
|
190
|
+
|
|
191
|
+
module Verdict
|
|
192
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
193
|
+
|
|
194
|
+
ALLOW: :allow
|
|
195
|
+
REJECT: :reject
|
|
196
|
+
|
|
197
|
+
def self?.values: -> ::Array[ModerationAPI::Models::ContentSubmitResponse::Casebook::verdict]
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
131
201
|
type content =
|
|
132
202
|
{
|
|
133
203
|
id: String,
|
|
@@ -758,6 +828,7 @@ module ModerationAPI
|
|
|
758
828
|
| :rule_default
|
|
759
829
|
| :rule_fallback
|
|
760
830
|
| :client_override
|
|
831
|
+
| :casebook_match
|
|
761
832
|
| String
|
|
762
833
|
|
|
763
834
|
module ReasonCode
|
|
@@ -775,6 +846,7 @@ module ModerationAPI
|
|
|
775
846
|
RULE_DEFAULT: :rule_default
|
|
776
847
|
RULE_FALLBACK: :rule_fallback
|
|
777
848
|
CLIENT_OVERRIDE: :client_override
|
|
849
|
+
CASEBOOK_MATCH: :casebook_match
|
|
778
850
|
end
|
|
779
851
|
|
|
780
852
|
type matched_rule = { key: String, name: String }
|
|
@@ -66,6 +66,7 @@ module ModerationAPI
|
|
|
66
66
|
author_id: String,
|
|
67
67
|
author_trust_levels: ::Array[Integer],
|
|
68
68
|
before_date: String,
|
|
69
|
+
casebook_handled: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::casebook_handled,
|
|
69
70
|
check_status: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::check_status?,
|
|
70
71
|
clear_date_window: bool,
|
|
71
72
|
content_id: String,
|
|
@@ -103,6 +104,12 @@ module ModerationAPI
|
|
|
103
104
|
|
|
104
105
|
def before_date=: (String) -> String
|
|
105
106
|
|
|
107
|
+
attr_reader casebook_handled: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::casebook_handled?
|
|
108
|
+
|
|
109
|
+
def casebook_handled=: (
|
|
110
|
+
ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::casebook_handled
|
|
111
|
+
) -> ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::casebook_handled
|
|
112
|
+
|
|
106
113
|
attr_accessor check_status: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::check_status?
|
|
107
114
|
|
|
108
115
|
attr_reader clear_date_window: bool?
|
|
@@ -190,6 +197,7 @@ module ModerationAPI
|
|
|
190
197
|
?author_id: String,
|
|
191
198
|
?author_trust_levels: ::Array[Integer],
|
|
192
199
|
?before_date: String,
|
|
200
|
+
?casebook_handled: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::casebook_handled,
|
|
193
201
|
?check_status: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::check_status?,
|
|
194
202
|
?clear_date_window: bool,
|
|
195
203
|
?content_id: String,
|
|
@@ -215,6 +223,7 @@ module ModerationAPI
|
|
|
215
223
|
author_id: String,
|
|
216
224
|
author_trust_levels: ::Array[Integer],
|
|
217
225
|
before_date: String,
|
|
226
|
+
casebook_handled: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::casebook_handled,
|
|
218
227
|
check_status: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::check_status?,
|
|
219
228
|
clear_date_window: bool,
|
|
220
229
|
content_id: String,
|
|
@@ -235,6 +244,18 @@ module ModerationAPI
|
|
|
235
244
|
within_unit: ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::within_unit
|
|
236
245
|
}
|
|
237
246
|
|
|
247
|
+
type casebook_handled = :ALL | :HANDLED | :WOULD_HAVE_HANDLED
|
|
248
|
+
|
|
249
|
+
module CasebookHandled
|
|
250
|
+
extend ModerationAPI::Internal::Type::Enum
|
|
251
|
+
|
|
252
|
+
ALL: :ALL
|
|
253
|
+
HANDLED: :HANDLED
|
|
254
|
+
WOULD_HAVE_HANDLED: :WOULD_HAVE_HANDLED
|
|
255
|
+
|
|
256
|
+
def self?.values: -> ::Array[ModerationAPI::Models::QueueRetrieveResponse::Queue::Filter::casebook_handled]
|
|
257
|
+
end
|
|
258
|
+
|
|
238
259
|
type check_status = :all | :checked | :unchecked
|
|
239
260
|
|
|
240
261
|
module CheckStatus
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moderation_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.36.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Moderation API
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cgi
|