Class: OpenApiOpenAIClient::Batch
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpenApiOpenAIClient::Batch
- Defined in:
- lib/openapi_openai/models/batch.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#cancelled_at ⇒ Object
The Unix timestamp (in seconds) for when the batch was cancelled.
-
#cancelling_at ⇒ Object
The Unix timestamp (in seconds) for when the batch started cancelling.
-
#completed_at ⇒ Object
The Unix timestamp (in seconds) for when the batch was completed.
-
#completion_window ⇒ Object
The time frame within which the batch should be processed.
-
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the batch was created.
-
#endpoint ⇒ Object
The OpenAI API endpoint used by the batch.
-
#error_file_id ⇒ Object
The ID of the file containing the outputs of requests with errors.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#expired_at ⇒ Object
The Unix timestamp (in seconds) for when the batch expired.
-
#expires_at ⇒ Object
The Unix timestamp (in seconds) for when the batch will expire.
-
#failed_at ⇒ Object
The Unix timestamp (in seconds) for when the batch failed.
-
#finalizing_at ⇒ Object
The Unix timestamp (in seconds) for when the batch started finalizing.
-
#id ⇒ Object
Returns the value of attribute id.
-
#in_progress_at ⇒ Object
The Unix timestamp (in seconds) for when the batch started processing.
-
#input_file_id ⇒ Object
The ID of the input file for the batch.
-
#metadata ⇒ Object
Set of 16 key-value pairs that can be attached to an object.
-
#object ⇒ Object
The object type, which is always
batch. -
#output_file_id ⇒ Object
The ID of the file containing the outputs of successfully executed requests.
-
#request_counts ⇒ Object
Returns the value of attribute request_counts.
-
#status ⇒ Object
The current status of the batch.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Batch
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Batch
Initializes the object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/openapi_openai/models/batch.rb', line 168 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::Batch` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenApiOpenAIClient::Batch`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'object') self.object = attributes[:'object'] else self.object = nil end if attributes.key?(:'endpoint') self.endpoint = attributes[:'endpoint'] else self.endpoint = nil end if attributes.key?(:'errors') self.errors = attributes[:'errors'] end if attributes.key?(:'input_file_id') self.input_file_id = attributes[:'input_file_id'] else self.input_file_id = nil end if attributes.key?(:'completion_window') self.completion_window = attributes[:'completion_window'] else self.completion_window = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'output_file_id') self.output_file_id = attributes[:'output_file_id'] end if attributes.key?(:'error_file_id') self.error_file_id = attributes[:'error_file_id'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'in_progress_at') self.in_progress_at = attributes[:'in_progress_at'] end if attributes.key?(:'expires_at') self.expires_at = attributes[:'expires_at'] end if attributes.key?(:'finalizing_at') self.finalizing_at = attributes[:'finalizing_at'] end if attributes.key?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'failed_at') self.failed_at = attributes[:'failed_at'] end if attributes.key?(:'expired_at') self.expired_at = attributes[:'expired_at'] end if attributes.key?(:'cancelling_at') self.cancelling_at = attributes[:'cancelling_at'] end if attributes.key?(:'cancelled_at') self.cancelled_at = attributes[:'cancelled_at'] end if attributes.key?(:'request_counts') self.request_counts = attributes[:'request_counts'] end if attributes.key?(:'metadata') self. = attributes[:'metadata'] end end |
Instance Attribute Details
#cancelled_at ⇒ Object
The Unix timestamp (in seconds) for when the batch was cancelled.
68 69 70 |
# File 'lib/openapi_openai/models/batch.rb', line 68 def cancelled_at @cancelled_at end |
#cancelling_at ⇒ Object
The Unix timestamp (in seconds) for when the batch started cancelling.
65 66 67 |
# File 'lib/openapi_openai/models/batch.rb', line 65 def cancelling_at @cancelling_at end |
#completed_at ⇒ Object
The Unix timestamp (in seconds) for when the batch was completed.
56 57 58 |
# File 'lib/openapi_openai/models/batch.rb', line 56 def completed_at @completed_at end |
#completion_window ⇒ Object
The time frame within which the batch should be processed.
32 33 34 |
# File 'lib/openapi_openai/models/batch.rb', line 32 def completion_window @completion_window end |
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the batch was created.
44 45 46 |
# File 'lib/openapi_openai/models/batch.rb', line 44 def created_at @created_at end |
#endpoint ⇒ Object
The OpenAI API endpoint used by the batch.
24 25 26 |
# File 'lib/openapi_openai/models/batch.rb', line 24 def endpoint @endpoint end |
#error_file_id ⇒ Object
The ID of the file containing the outputs of requests with errors.
41 42 43 |
# File 'lib/openapi_openai/models/batch.rb', line 41 def error_file_id @error_file_id end |
#errors ⇒ Object
Returns the value of attribute errors.
26 27 28 |
# File 'lib/openapi_openai/models/batch.rb', line 26 def errors @errors end |
#expired_at ⇒ Object
The Unix timestamp (in seconds) for when the batch expired.
62 63 64 |
# File 'lib/openapi_openai/models/batch.rb', line 62 def expired_at @expired_at end |
#expires_at ⇒ Object
The Unix timestamp (in seconds) for when the batch will expire.
50 51 52 |
# File 'lib/openapi_openai/models/batch.rb', line 50 def expires_at @expires_at end |
#failed_at ⇒ Object
The Unix timestamp (in seconds) for when the batch failed.
59 60 61 |
# File 'lib/openapi_openai/models/batch.rb', line 59 def failed_at @failed_at end |
#finalizing_at ⇒ Object
The Unix timestamp (in seconds) for when the batch started finalizing.
53 54 55 |
# File 'lib/openapi_openai/models/batch.rb', line 53 def finalizing_at @finalizing_at end |
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/openapi_openai/models/batch.rb', line 18 def id @id end |
#in_progress_at ⇒ Object
The Unix timestamp (in seconds) for when the batch started processing.
47 48 49 |
# File 'lib/openapi_openai/models/batch.rb', line 47 def in_progress_at @in_progress_at end |
#input_file_id ⇒ Object
The ID of the input file for the batch.
29 30 31 |
# File 'lib/openapi_openai/models/batch.rb', line 29 def input_file_id @input_file_id end |
#metadata ⇒ Object
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
73 74 75 |
# File 'lib/openapi_openai/models/batch.rb', line 73 def @metadata end |
#object ⇒ Object
The object type, which is always batch.
21 22 23 |
# File 'lib/openapi_openai/models/batch.rb', line 21 def object @object end |
#output_file_id ⇒ Object
The ID of the file containing the outputs of successfully executed requests.
38 39 40 |
# File 'lib/openapi_openai/models/batch.rb', line 38 def output_file_id @output_file_id end |
#request_counts ⇒ Object
Returns the value of attribute request_counts.
70 71 72 |
# File 'lib/openapi_openai/models/batch.rb', line 70 def request_counts @request_counts end |
#status ⇒ Object
The current status of the batch.
35 36 37 |
# File 'lib/openapi_openai/models/batch.rb', line 35 def status @status end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
124 125 126 |
# File 'lib/openapi_openai/models/batch.rb', line 124 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
129 130 131 |
# File 'lib/openapi_openai/models/batch.rb', line 129 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/openapi_openai/models/batch.rb', line 98 def self.attribute_map { :'id' => :'id', :'object' => :'object', :'endpoint' => :'endpoint', :'errors' => :'errors', :'input_file_id' => :'input_file_id', :'completion_window' => :'completion_window', :'status' => :'status', :'output_file_id' => :'output_file_id', :'error_file_id' => :'error_file_id', :'created_at' => :'created_at', :'in_progress_at' => :'in_progress_at', :'expires_at' => :'expires_at', :'finalizing_at' => :'finalizing_at', :'completed_at' => :'completed_at', :'failed_at' => :'failed_at', :'expired_at' => :'expired_at', :'cancelling_at' => :'cancelling_at', :'cancelled_at' => :'cancelled_at', :'request_counts' => :'request_counts', :'metadata' => :'metadata' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/openapi_openai/models/batch.rb', line 443 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
160 161 162 163 164 |
# File 'lib/openapi_openai/models/batch.rb', line 160 def self.openapi_nullable Set.new([ :'metadata' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/openapi_openai/models/batch.rb', line 134 def self.openapi_types { :'id' => :'String', :'object' => :'String', :'endpoint' => :'String', :'errors' => :'BatchErrors', :'input_file_id' => :'String', :'completion_window' => :'String', :'status' => :'String', :'output_file_id' => :'String', :'error_file_id' => :'String', :'created_at' => :'Integer', :'in_progress_at' => :'Integer', :'expires_at' => :'Integer', :'finalizing_at' => :'Integer', :'completed_at' => :'Integer', :'failed_at' => :'Integer', :'expired_at' => :'Integer', :'cancelling_at' => :'Integer', :'cancelled_at' => :'Integer', :'request_counts' => :'BatchRequestCounts', :'metadata' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/openapi_openai/models/batch.rb', line 403 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && object == o.object && endpoint == o.endpoint && errors == o.errors && input_file_id == o.input_file_id && completion_window == o.completion_window && status == o.status && output_file_id == o.output_file_id && error_file_id == o.error_file_id && created_at == o.created_at && in_progress_at == o.in_progress_at && expires_at == o.expires_at && finalizing_at == o.finalizing_at && completed_at == o.completed_at && failed_at == o.failed_at && expired_at == o.expired_at && cancelling_at == o.cancelling_at && cancelled_at == o.cancelled_at && request_counts == o.request_counts && == o. end |
#eql?(o) ⇒ Boolean
430 431 432 |
# File 'lib/openapi_openai/models/batch.rb', line 430 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
436 437 438 |
# File 'lib/openapi_openai/models/batch.rb', line 436 def hash [id, object, endpoint, errors, input_file_id, completion_window, status, output_file_id, error_file_id, created_at, in_progress_at, expires_at, finalizing_at, completed_at, failed_at, expired_at, cancelling_at, cancelled_at, request_counts, ].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/openapi_openai/models/batch.rb', line 279 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end if @endpoint.nil? invalid_properties.push('invalid value for "endpoint", endpoint cannot be nil.') end if @input_file_id.nil? invalid_properties.push('invalid value for "input_file_id", input_file_id cannot be nil.') end if @completion_window.nil? invalid_properties.push('invalid value for "completion_window", completion_window cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
465 466 467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/openapi_openai/models/batch.rb', line 465 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/openapi_openai/models/batch.rb', line 315 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["batch"]) return false unless object_validator.valid?(@object) return false if @endpoint.nil? return false if @input_file_id.nil? return false if @completion_window.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled"]) return false unless status_validator.valid?(@status) return false if @created_at.nil? true end |