abliteration 0.1.6 → 0.1.7

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.
@@ -0,0 +1,384 @@
1
+ =begin
2
+ #abliteration.org Public API
3
+
4
+ #Read access to the abliteration.org catalog: models and their method classification, alignment datasets and their passports, the M-code taxonomy, the four flagship indices and the curated field timeline. Every call is authenticated with a bearer key and metered in credits against the same wallet the Research Agent spends from. There is no free tier for machine traffic and no separate billing. Responses report `cost` and `credits_remaining` on every success. While `metering` reads `preview`, the cost shown is what the call will bill once metering is enabled and nothing is actually deducted; when it reads `billed`, it was.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Abliteration
17
+ class GetHistoricalDeletionSummary200Response < ApiModelBase
18
+ attr_accessor :data
19
+
20
+ # Credits this call costs.
21
+ attr_accessor :cost
22
+
23
+ # Wallet balance after the call. Unchanged while metering is preview.
24
+ attr_accessor :credits_remaining
25
+
26
+ # Ceiling for the current window. Also returned as X-RateLimit-Limit.
27
+ attr_accessor :rate_limit_limit
28
+
29
+ # Calls left in the current window for this key. Also returned as X-RateLimit-Remaining.
30
+ attr_accessor :rate_limit_remaining
31
+
32
+ # Unix seconds at which the window resets to full ceiling. Also returned as X-RateLimit-Reset.
33
+ attr_accessor :rate_limit_reset
34
+
35
+ # Whether cost was actually deducted.
36
+ attr_accessor :metering
37
+
38
+ # Also returned in the x-request-id header.
39
+ attr_accessor :request_id
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'data' => :'data',
67
+ :'cost' => :'cost',
68
+ :'credits_remaining' => :'credits_remaining',
69
+ :'rate_limit_limit' => :'rate_limit_limit',
70
+ :'rate_limit_remaining' => :'rate_limit_remaining',
71
+ :'rate_limit_reset' => :'rate_limit_reset',
72
+ :'metering' => :'metering',
73
+ :'request_id' => :'request_id'
74
+ }
75
+ end
76
+
77
+ # Returns attribute mapping this model knows about
78
+ def self.acceptable_attribute_map
79
+ attribute_map
80
+ end
81
+
82
+ # Returns all the JSON keys this model knows about
83
+ def self.acceptable_attributes
84
+ acceptable_attribute_map.values
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.openapi_types
89
+ {
90
+ :'data' => :'DeletionSummary',
91
+ :'cost' => :'Integer',
92
+ :'credits_remaining' => :'Integer',
93
+ :'rate_limit_limit' => :'Integer',
94
+ :'rate_limit_remaining' => :'Integer',
95
+ :'rate_limit_reset' => :'Integer',
96
+ :'metering' => :'String',
97
+ :'request_id' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # List of class defined in allOf (OpenAPI v3)
108
+ def self.openapi_all_of
109
+ [
110
+ :'Envelope'
111
+ ]
112
+ end
113
+
114
+ # Initializes the object
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ def initialize(attributes = {})
117
+ if (!attributes.is_a?(Hash))
118
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::GetHistoricalDeletionSummary200Response` initialize method"
119
+ end
120
+
121
+ # check to see if the attribute exists and convert string to symbol for hash key
122
+ acceptable_attribute_map = self.class.acceptable_attribute_map
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!acceptable_attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Abliteration::GetHistoricalDeletionSummary200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'data')
131
+ self.data = attributes[:'data']
132
+ else
133
+ self.data = nil
134
+ end
135
+
136
+ if attributes.key?(:'cost')
137
+ self.cost = attributes[:'cost']
138
+ else
139
+ self.cost = nil
140
+ end
141
+
142
+ if attributes.key?(:'credits_remaining')
143
+ self.credits_remaining = attributes[:'credits_remaining']
144
+ else
145
+ self.credits_remaining = nil
146
+ end
147
+
148
+ if attributes.key?(:'rate_limit_limit')
149
+ self.rate_limit_limit = attributes[:'rate_limit_limit']
150
+ else
151
+ self.rate_limit_limit = nil
152
+ end
153
+
154
+ if attributes.key?(:'rate_limit_remaining')
155
+ self.rate_limit_remaining = attributes[:'rate_limit_remaining']
156
+ else
157
+ self.rate_limit_remaining = nil
158
+ end
159
+
160
+ if attributes.key?(:'rate_limit_reset')
161
+ self.rate_limit_reset = attributes[:'rate_limit_reset']
162
+ else
163
+ self.rate_limit_reset = nil
164
+ end
165
+
166
+ if attributes.key?(:'metering')
167
+ self.metering = attributes[:'metering']
168
+ else
169
+ self.metering = nil
170
+ end
171
+
172
+ if attributes.key?(:'request_id')
173
+ self.request_id = attributes[:'request_id']
174
+ else
175
+ self.request_id = nil
176
+ end
177
+ end
178
+
179
+ # Show invalid properties with the reasons. Usually used together with valid?
180
+ # @return Array for valid properties with the reasons
181
+ def list_invalid_properties
182
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
183
+ invalid_properties = Array.new
184
+ if @data.nil?
185
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
186
+ end
187
+
188
+ if @cost.nil?
189
+ invalid_properties.push('invalid value for "cost", cost cannot be nil.')
190
+ end
191
+
192
+ if @credits_remaining.nil?
193
+ invalid_properties.push('invalid value for "credits_remaining", credits_remaining cannot be nil.')
194
+ end
195
+
196
+ if @rate_limit_limit.nil?
197
+ invalid_properties.push('invalid value for "rate_limit_limit", rate_limit_limit cannot be nil.')
198
+ end
199
+
200
+ if @rate_limit_remaining.nil?
201
+ invalid_properties.push('invalid value for "rate_limit_remaining", rate_limit_remaining cannot be nil.')
202
+ end
203
+
204
+ if @rate_limit_reset.nil?
205
+ invalid_properties.push('invalid value for "rate_limit_reset", rate_limit_reset cannot be nil.')
206
+ end
207
+
208
+ if @metering.nil?
209
+ invalid_properties.push('invalid value for "metering", metering cannot be nil.')
210
+ end
211
+
212
+ if @request_id.nil?
213
+ invalid_properties.push('invalid value for "request_id", request_id cannot be nil.')
214
+ end
215
+
216
+ invalid_properties
217
+ end
218
+
219
+ # Check to see if the all the properties in the model are valid
220
+ # @return true if the model is valid
221
+ def valid?
222
+ warn '[DEPRECATED] the `valid?` method is obsolete'
223
+ return false if @data.nil?
224
+ return false if @cost.nil?
225
+ return false if @credits_remaining.nil?
226
+ return false if @rate_limit_limit.nil?
227
+ return false if @rate_limit_remaining.nil?
228
+ return false if @rate_limit_reset.nil?
229
+ return false if @metering.nil?
230
+ metering_validator = EnumAttributeValidator.new('String', ["preview", "billed"])
231
+ return false unless metering_validator.valid?(@metering)
232
+ return false if @request_id.nil?
233
+ true
234
+ end
235
+
236
+ # Custom attribute writer method with validation
237
+ # @param [Object] data Value to be assigned
238
+ def data=(data)
239
+ if data.nil?
240
+ fail ArgumentError, 'data cannot be nil'
241
+ end
242
+
243
+ @data = data
244
+ end
245
+
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] cost Value to be assigned
248
+ def cost=(cost)
249
+ if cost.nil?
250
+ fail ArgumentError, 'cost cannot be nil'
251
+ end
252
+
253
+ @cost = cost
254
+ end
255
+
256
+ # Custom attribute writer method with validation
257
+ # @param [Object] credits_remaining Value to be assigned
258
+ def credits_remaining=(credits_remaining)
259
+ if credits_remaining.nil?
260
+ fail ArgumentError, 'credits_remaining cannot be nil'
261
+ end
262
+
263
+ @credits_remaining = credits_remaining
264
+ end
265
+
266
+ # Custom attribute writer method with validation
267
+ # @param [Object] rate_limit_limit Value to be assigned
268
+ def rate_limit_limit=(rate_limit_limit)
269
+ if rate_limit_limit.nil?
270
+ fail ArgumentError, 'rate_limit_limit cannot be nil'
271
+ end
272
+
273
+ @rate_limit_limit = rate_limit_limit
274
+ end
275
+
276
+ # Custom attribute writer method with validation
277
+ # @param [Object] rate_limit_remaining Value to be assigned
278
+ def rate_limit_remaining=(rate_limit_remaining)
279
+ if rate_limit_remaining.nil?
280
+ fail ArgumentError, 'rate_limit_remaining cannot be nil'
281
+ end
282
+
283
+ @rate_limit_remaining = rate_limit_remaining
284
+ end
285
+
286
+ # Custom attribute writer method with validation
287
+ # @param [Object] rate_limit_reset Value to be assigned
288
+ def rate_limit_reset=(rate_limit_reset)
289
+ if rate_limit_reset.nil?
290
+ fail ArgumentError, 'rate_limit_reset cannot be nil'
291
+ end
292
+
293
+ @rate_limit_reset = rate_limit_reset
294
+ end
295
+
296
+ # Custom attribute writer method checking allowed values (enum).
297
+ # @param [Object] metering Object to be assigned
298
+ def metering=(metering)
299
+ validator = EnumAttributeValidator.new('String', ["preview", "billed"])
300
+ unless validator.valid?(metering)
301
+ fail ArgumentError, "invalid value for \"metering\", must be one of #{validator.allowable_values}."
302
+ end
303
+ @metering = metering
304
+ end
305
+
306
+ # Custom attribute writer method with validation
307
+ # @param [Object] request_id Value to be assigned
308
+ def request_id=(request_id)
309
+ if request_id.nil?
310
+ fail ArgumentError, 'request_id cannot be nil'
311
+ end
312
+
313
+ @request_id = request_id
314
+ end
315
+
316
+ # Checks equality by comparing each attribute.
317
+ # @param [Object] Object to be compared
318
+ def ==(o)
319
+ return true if self.equal?(o)
320
+ self.class == o.class &&
321
+ data == o.data &&
322
+ cost == o.cost &&
323
+ credits_remaining == o.credits_remaining &&
324
+ rate_limit_limit == o.rate_limit_limit &&
325
+ rate_limit_remaining == o.rate_limit_remaining &&
326
+ rate_limit_reset == o.rate_limit_reset &&
327
+ metering == o.metering &&
328
+ request_id == o.request_id
329
+ end
330
+
331
+ # @see the `==` method
332
+ # @param [Object] Object to be compared
333
+ def eql?(o)
334
+ self == o
335
+ end
336
+
337
+ # Calculates hash code according to all attributes.
338
+ # @return [Integer] Hash code
339
+ def hash
340
+ [data, cost, credits_remaining, rate_limit_limit, rate_limit_remaining, rate_limit_reset, metering, request_id].hash
341
+ end
342
+
343
+ # Builds the object from hash
344
+ # @param [Hash] attributes Model attributes in the form of hash
345
+ # @return [Object] Returns the model itself
346
+ def self.build_from_hash(attributes)
347
+ return nil unless attributes.is_a?(Hash)
348
+ attributes = attributes.transform_keys(&:to_sym)
349
+ transformed_hash = {}
350
+ openapi_types.each_pair do |key, type|
351
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
352
+ transformed_hash["#{key}"] = nil
353
+ elsif type =~ /\AArray<(.*)>/i
354
+ # check to ensure the input is an array given that the attribute
355
+ # is documented as an array but the input is not
356
+ if attributes[attribute_map[key]].is_a?(Array)
357
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
358
+ end
359
+ elsif !attributes[attribute_map[key]].nil?
360
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
361
+ end
362
+ end
363
+ new(transformed_hash)
364
+ end
365
+
366
+ # Returns the object in the form of hash
367
+ # @return [Hash] Returns the object in the form of hash
368
+ def to_hash
369
+ hash = {}
370
+ self.class.attribute_map.each_pair do |attr, param|
371
+ value = self.send(attr)
372
+ if value.nil?
373
+ is_nullable = self.class.openapi_nullable.include?(attr)
374
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
375
+ end
376
+
377
+ hash[param] = _to_hash(value)
378
+ end
379
+ hash
380
+ end
381
+
382
+ end
383
+
384
+ end
@@ -0,0 +1,197 @@
1
+ =begin
2
+ #abliteration.org Public API
3
+
4
+ #Read access to the abliteration.org catalog: models and their method classification, alignment datasets and their passports, the M-code taxonomy, the four flagship indices and the curated field timeline. Every call is authenticated with a bearer key and metered in credits against the same wallet the Research Agent spends from. There is no free tier for machine traffic and no separate billing. Responses report `cost` and `credits_remaining` on every success. While `metering` reads `preview`, the cost shown is what the call will bill once metering is enabled and nothing is actually deducted; when it reads `billed`, it was.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Abliteration
17
+ class HistoricalDeletion < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ # ISO YYYY-MM of the earliest snapshot the model appears in.
21
+ attr_accessor :first_seen_month
22
+
23
+ # ISO YYYY-MM of the final snapshot before deletion.
24
+ attr_accessor :last_seen_month
25
+
26
+ # Whole months between first and last observation.
27
+ attr_accessor :total_months_alive
28
+
29
+ # Highest downloads count observed during the model's lifetime.
30
+ attr_accessor :peak_downloads
31
+
32
+ # ISO-8601 timestamp the model was originally created on HF (from the frozen snapshot).
33
+ attr_accessor :created_at
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'id' => :'id',
39
+ :'first_seen_month' => :'first_seen_month',
40
+ :'last_seen_month' => :'last_seen_month',
41
+ :'total_months_alive' => :'total_months_alive',
42
+ :'peak_downloads' => :'peak_downloads',
43
+ :'created_at' => :'created_at'
44
+ }
45
+ end
46
+
47
+ # Returns attribute mapping this model knows about
48
+ def self.acceptable_attribute_map
49
+ attribute_map
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ acceptable_attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'id' => :'String',
61
+ :'first_seen_month' => :'String',
62
+ :'last_seen_month' => :'String',
63
+ :'total_months_alive' => :'Integer',
64
+ :'peak_downloads' => :'Integer',
65
+ :'created_at' => :'String'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Abliteration::HistoricalDeletion` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ acceptable_attribute_map = self.class.acceptable_attribute_map
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!acceptable_attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Abliteration::HistoricalDeletion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'id')
92
+ self.id = attributes[:'id']
93
+ end
94
+
95
+ if attributes.key?(:'first_seen_month')
96
+ self.first_seen_month = attributes[:'first_seen_month']
97
+ end
98
+
99
+ if attributes.key?(:'last_seen_month')
100
+ self.last_seen_month = attributes[:'last_seen_month']
101
+ end
102
+
103
+ if attributes.key?(:'total_months_alive')
104
+ self.total_months_alive = attributes[:'total_months_alive']
105
+ end
106
+
107
+ if attributes.key?(:'peak_downloads')
108
+ self.peak_downloads = attributes[:'peak_downloads']
109
+ end
110
+
111
+ if attributes.key?(:'created_at')
112
+ self.created_at = attributes[:'created_at']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ warn '[DEPRECATED] the `valid?` method is obsolete'
128
+ true
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ id == o.id &&
137
+ first_seen_month == o.first_seen_month &&
138
+ last_seen_month == o.last_seen_month &&
139
+ total_months_alive == o.total_months_alive &&
140
+ peak_downloads == o.peak_downloads &&
141
+ created_at == o.created_at
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [id, first_seen_month, last_seen_month, total_months_alive, peak_downloads, created_at].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ transformed_hash = {}
163
+ openapi_types.each_pair do |key, type|
164
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = nil
166
+ elsif type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[attribute_map[key]].is_a?(Array)
170
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
171
+ end
172
+ elsif !attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
174
+ end
175
+ end
176
+ new(transformed_hash)
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ end
196
+
197
+ end