Class: OpenApiOpenAIClient::RunStepObject
- Inherits:
-
Object
- Object
- OpenApiOpenAIClient::RunStepObject
- Defined in:
- lib/openapi_openai/models/run_step_object.rb
Overview
Represents a step in execution of a run.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#assistant_id ⇒ Object
The ID of the [assistant](/docs/api-reference/assistants) associated with the run step.
-
#cancelled_at ⇒ Object
The Unix timestamp (in seconds) for when the run step was cancelled.
-
#completed_at ⇒ Object
The Unix timestamp (in seconds) for when the run step completed.
-
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the run step was created.
-
#expired_at ⇒ Object
The Unix timestamp (in seconds) for when the run step expired.
-
#failed_at ⇒ Object
The Unix timestamp (in seconds) for when the run step failed.
-
#id ⇒ Object
The identifier of the run step, which can be referenced in API endpoints.
-
#last_error ⇒ Object
Returns the value of attribute last_error.
-
#metadata ⇒ Object
Set of 16 key-value pairs that can be attached to an object.
-
#object ⇒ Object
The object type, which is always ‘thread.run.step`.
-
#run_id ⇒ Object
The ID of the [run](/docs/api-reference/runs) that this run step is a part of.
-
#status ⇒ Object
The status of the run step, which can be either ‘in_progress`, `cancelled`, `failed`, `completed`, or `expired`.
-
#step_details ⇒ Object
Returns the value of attribute step_details.
-
#thread_id ⇒ Object
The ID of the [thread](/docs/api-reference/threads) that was run.
-
#type ⇒ Object
The type of run step, which can be either ‘message_creation` or `tool_calls`.
-
#usage ⇒ Object
Returns the value of attribute usage.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.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.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ RunStepObject
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ RunStepObject
Initializes the object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 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 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 150 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::RunStepObject` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenApiOpenAIClient::RunStepObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.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?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'assistant_id') self.assistant_id = attributes[:'assistant_id'] else self.assistant_id = nil end if attributes.key?(:'thread_id') self.thread_id = attributes[:'thread_id'] else self.thread_id = nil end if attributes.key?(:'run_id') self.run_id = attributes[:'run_id'] else self.run_id = nil end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'step_details') self.step_details = attributes[:'step_details'] else self.step_details = nil end if attributes.key?(:'last_error') self.last_error = attributes[:'last_error'] else self.last_error = nil end if attributes.key?(:'expired_at') self.expired_at = attributes[:'expired_at'] else self.expired_at = nil end if attributes.key?(:'cancelled_at') self.cancelled_at = attributes[:'cancelled_at'] else self.cancelled_at = nil end if attributes.key?(:'failed_at') self.failed_at = attributes[:'failed_at'] else self.failed_at = nil end if attributes.key?(:'completed_at') self.completed_at = attributes[:'completed_at'] else self.completed_at = nil end if attributes.key?(:'metadata') self. = attributes[:'metadata'] else self. = nil end if attributes.key?(:'usage') self.usage = attributes[:'usage'] else self.usage = nil end end |
Instance Attribute Details
#assistant_id ⇒ Object
The ID of the [assistant](/docs/api-reference/assistants) associated with the run step.
29 30 31 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 29 def assistant_id @assistant_id end |
#cancelled_at ⇒ Object
The Unix timestamp (in seconds) for when the run step was cancelled.
51 52 53 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 51 def cancelled_at @cancelled_at end |
#completed_at ⇒ Object
The Unix timestamp (in seconds) for when the run step completed.
57 58 59 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 57 def completed_at @completed_at end |
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the run step was created.
26 27 28 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 26 def created_at @created_at end |
#expired_at ⇒ Object
The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.
48 49 50 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 48 def expired_at @expired_at end |
#failed_at ⇒ Object
The Unix timestamp (in seconds) for when the run step failed.
54 55 56 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 54 def failed_at @failed_at end |
#id ⇒ Object
The identifier of the run step, which can be referenced in API endpoints.
20 21 22 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 20 def id @id end |
#last_error ⇒ Object
Returns the value of attribute last_error.
45 46 47 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 45 def last_error @last_error 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 maxium of 512 characters long.
60 61 62 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 60 def @metadata end |
#object ⇒ Object
The object type, which is always ‘thread.run.step`.
23 24 25 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 23 def object @object end |
#run_id ⇒ Object
The ID of the [run](/docs/api-reference/runs) that this run step is a part of.
35 36 37 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 35 def run_id @run_id end |
#status ⇒ Object
The status of the run step, which can be either ‘in_progress`, `cancelled`, `failed`, `completed`, or `expired`.
41 42 43 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 41 def status @status end |
#step_details ⇒ Object
Returns the value of attribute step_details.
43 44 45 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 43 def step_details @step_details end |
#thread_id ⇒ Object
The ID of the [thread](/docs/api-reference/threads) that was run.
32 33 34 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 32 def thread_id @thread_id end |
#type ⇒ Object
The type of run step, which can be either ‘message_creation` or `tool_calls`.
38 39 40 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 38 def type @type end |
#usage ⇒ Object
Returns the value of attribute usage.
62 63 64 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 62 def usage @usage end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 418 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = OpenApiOpenAIClient.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
109 110 111 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 109 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 87 def self.attribute_map { :'id' => :'id', :'object' => :'object', :'created_at' => :'created_at', :'assistant_id' => :'assistant_id', :'thread_id' => :'thread_id', :'run_id' => :'run_id', :'type' => :'type', :'status' => :'status', :'step_details' => :'step_details', :'last_error' => :'last_error', :'expired_at' => :'expired_at', :'cancelled_at' => :'cancelled_at', :'failed_at' => :'failed_at', :'completed_at' => :'completed_at', :'metadata' => :'metadata', :'usage' => :'usage' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 394 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
136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 136 def self.openapi_nullable Set.new([ :'last_error', :'expired_at', :'cancelled_at', :'failed_at', :'completed_at', :'metadata', :'usage' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 114 def self.openapi_types { :'id' => :'String', :'object' => :'String', :'created_at' => :'Integer', :'assistant_id' => :'String', :'thread_id' => :'String', :'run_id' => :'String', :'type' => :'String', :'status' => :'String', :'step_details' => :'RunStepObjectStepDetails', :'last_error' => :'RunStepObjectLastError', :'expired_at' => :'Integer', :'cancelled_at' => :'Integer', :'failed_at' => :'Integer', :'completed_at' => :'Integer', :'metadata' => :'Object', :'usage' => :'RunStepCompletionUsage' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 358 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && object == o.object && created_at == o.created_at && assistant_id == o.assistant_id && thread_id == o.thread_id && run_id == o.run_id && type == o.type && status == o.status && step_details == o.step_details && last_error == o.last_error && expired_at == o.expired_at && cancelled_at == o.cancelled_at && failed_at == o.failed_at && completed_at == o.completed_at && == o. && usage == o.usage end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 489 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
381 382 383 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 381 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
387 388 389 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 387 def hash [id, object, created_at, assistant_id, thread_id, run_id, type, status, step_details, last_error, expired_at, cancelled_at, failed_at, completed_at, , usage].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 262 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 @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @assistant_id.nil? invalid_properties.push('invalid value for "assistant_id", assistant_id cannot be nil.') end if @thread_id.nil? invalid_properties.push('invalid value for "thread_id", thread_id cannot be nil.') end if @run_id.nil? invalid_properties.push('invalid value for "run_id", run_id cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @step_details.nil? invalid_properties.push('invalid value for "step_details", step_details cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
465 466 467 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 465 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 471 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 |
#to_s ⇒ String
Returns the string representation of the object
459 460 461 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 459 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/openapi_openai/models/run_step_object.rb', line 306 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["thread.run.step"]) return false unless object_validator.valid?(@object) return false if @created_at.nil? return false if @assistant_id.nil? return false if @thread_id.nil? return false if @run_id.nil? return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["message_creation", "tool_calls"]) return false unless type_validator.valid?(@type) return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["in_progress", "cancelled", "failed", "completed", "expired"]) return false unless status_validator.valid?(@status) return false if @step_details.nil? true end |