Class: OpenApiOpenAIClient::MessageObject
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpenApiOpenAIClient::MessageObject
- Defined in:
- lib/openapi_openai/models/message_object.rb
Overview
Represents a message within a [thread](/docs/api-reference/threads).
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#assistant_id ⇒ Object
If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message.
-
#attachments ⇒ Object
A list of files attached to the message, and the tools they were added to.
-
#completed_at ⇒ Object
The Unix timestamp (in seconds) for when the message was completed.
-
#content ⇒ Object
The content of the message in array of text and/or images.
-
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the message was created.
-
#id ⇒ Object
The identifier, which can be referenced in API endpoints.
-
#incomplete_at ⇒ Object
The Unix timestamp (in seconds) for when the message was marked as incomplete.
-
#incomplete_details ⇒ Object
Returns the value of attribute incomplete_details.
-
#metadata ⇒ Object
Set of 16 key-value pairs that can be attached to an object.
-
#object ⇒ Object
The object type, which is always
thread.message. -
#role ⇒ Object
The entity that produced the message.
-
#run_id ⇒ Object
The ID of the [run](/docs/api-reference/runs) associated with the creation of this message.
-
#status ⇒ Object
The status of the message, which can be either
in_progress,incomplete, orcompleted. -
#thread_id ⇒ Object
The [thread](/docs/api-reference/threads) ID that this message belongs to.
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 = {}) ⇒ MessageObject
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 = {}) ⇒ MessageObject
Initializes the object
147 148 149 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 |
# File 'lib/openapi_openai/models/message_object.rb', line 147 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::MessageObject` 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::MessageObject`. 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?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'thread_id') self.thread_id = attributes[:'thread_id'] else self.thread_id = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'incomplete_details') self.incomplete_details = attributes[:'incomplete_details'] else self.incomplete_details = nil end if attributes.key?(:'completed_at') self.completed_at = attributes[:'completed_at'] else self.completed_at = nil end if attributes.key?(:'incomplete_at') self.incomplete_at = attributes[:'incomplete_at'] else self.incomplete_at = nil end if attributes.key?(:'role') self.role = attributes[:'role'] else self.role = nil end if attributes.key?(:'content') if (value = attributes[:'content']).is_a?(Array) self.content = value end else self.content = nil end if attributes.key?(:'assistant_id') self.assistant_id = attributes[:'assistant_id'] else self.assistant_id = nil end if attributes.key?(:'run_id') self.run_id = attributes[:'run_id'] else self.run_id = nil end if attributes.key?(:'attachments') if (value = attributes[:'attachments']).is_a?(Array) self. = value end else self. = nil end if attributes.key?(:'metadata') self. = attributes[:'metadata'] else self. = nil end end |
Instance Attribute Details
#assistant_id ⇒ Object
If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message.
49 50 51 |
# File 'lib/openapi_openai/models/message_object.rb', line 49 def assistant_id @assistant_id end |
#attachments ⇒ Object
A list of files attached to the message, and the tools they were added to.
55 56 57 |
# File 'lib/openapi_openai/models/message_object.rb', line 55 def end |
#completed_at ⇒ Object
The Unix timestamp (in seconds) for when the message was completed.
37 38 39 |
# File 'lib/openapi_openai/models/message_object.rb', line 37 def completed_at @completed_at end |
#content ⇒ Object
The content of the message in array of text and/or images.
46 47 48 |
# File 'lib/openapi_openai/models/message_object.rb', line 46 def content @content end |
#created_at ⇒ Object
The Unix timestamp (in seconds) for when the message was created.
26 27 28 |
# File 'lib/openapi_openai/models/message_object.rb', line 26 def created_at @created_at end |
#id ⇒ Object
The identifier, which can be referenced in API endpoints.
20 21 22 |
# File 'lib/openapi_openai/models/message_object.rb', line 20 def id @id end |
#incomplete_at ⇒ Object
The Unix timestamp (in seconds) for when the message was marked as incomplete.
40 41 42 |
# File 'lib/openapi_openai/models/message_object.rb', line 40 def incomplete_at @incomplete_at end |
#incomplete_details ⇒ Object
Returns the value of attribute incomplete_details.
34 35 36 |
# File 'lib/openapi_openai/models/message_object.rb', line 34 def incomplete_details @incomplete_details 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.
58 59 60 |
# File 'lib/openapi_openai/models/message_object.rb', line 58 def end |
#object ⇒ Object
The object type, which is always thread.message.
23 24 25 |
# File 'lib/openapi_openai/models/message_object.rb', line 23 def object @object end |
#role ⇒ Object
The entity that produced the message. One of user or assistant.
43 44 45 |
# File 'lib/openapi_openai/models/message_object.rb', line 43 def role @role end |
#run_id ⇒ Object
The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is null when messages are created manually using the create message or create thread endpoints.
52 53 54 |
# File 'lib/openapi_openai/models/message_object.rb', line 52 def run_id @run_id end |
#status ⇒ Object
The status of the message, which can be either in_progress, incomplete, or completed.
32 33 34 |
# File 'lib/openapi_openai/models/message_object.rb', line 32 def status @status end |
#thread_id ⇒ Object
The [thread](/docs/api-reference/threads) ID that this message belongs to.
29 30 31 |
# File 'lib/openapi_openai/models/message_object.rb', line 29 def thread_id @thread_id end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
103 104 105 |
# File 'lib/openapi_openai/models/message_object.rb', line 103 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
108 109 110 |
# File 'lib/openapi_openai/models/message_object.rb', line 108 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/openapi_openai/models/message_object.rb', line 83 def self.attribute_map { :'id' => :'id', :'object' => :'object', :'created_at' => :'created_at', :'thread_id' => :'thread_id', :'status' => :'status', :'incomplete_details' => :'incomplete_details', :'completed_at' => :'completed_at', :'incomplete_at' => :'incomplete_at', :'role' => :'role', :'content' => :'content', :'assistant_id' => :'assistant_id', :'run_id' => :'run_id', :'attachments' => :'attachments', :'metadata' => :'metadata' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/openapi_openai/models/message_object.rb', line 412 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
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/openapi_openai/models/message_object.rb', line 133 def self.openapi_nullable Set.new([ :'incomplete_details', :'completed_at', :'incomplete_at', :'assistant_id', :'run_id', :'attachments', :'metadata' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/openapi_openai/models/message_object.rb', line 113 def self.openapi_types { :'id' => :'String', :'object' => :'String', :'created_at' => :'Integer', :'thread_id' => :'String', :'status' => :'String', :'incomplete_details' => :'MessageObjectIncompleteDetails', :'completed_at' => :'Integer', :'incomplete_at' => :'Integer', :'role' => :'String', :'content' => :'Array<MessageObjectContentInner>', :'assistant_id' => :'String', :'run_id' => :'String', :'attachments' => :'Array<CreateMessageRequestAttachmentsInner>', :'metadata' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/openapi_openai/models/message_object.rb', line 378 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && object == o.object && created_at == o.created_at && thread_id == o.thread_id && status == o.status && incomplete_details == o.incomplete_details && completed_at == o.completed_at && incomplete_at == o.incomplete_at && role == o.role && content == o.content && assistant_id == o.assistant_id && run_id == o.run_id && == o. && == o. end |
#eql?(o) ⇒ Boolean
399 400 401 |
# File 'lib/openapi_openai/models/message_object.rb', line 399 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
405 406 407 |
# File 'lib/openapi_openai/models/message_object.rb', line 405 def hash [id, object, created_at, thread_id, status, incomplete_details, completed_at, incomplete_at, role, content, assistant_id, run_id, , ].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/openapi_openai/models/message_object.rb', line 252 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 @thread_id.nil? invalid_properties.push('invalid value for "thread_id", thread_id cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @role.nil? invalid_properties.push('invalid value for "role", role cannot be nil.') end if @content.nil? invalid_properties.push('invalid value for "content", content cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/openapi_openai/models/message_object.rb', line 434 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
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/openapi_openai/models/message_object.rb', line 288 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.message"]) return false unless object_validator.valid?(@object) return false if @created_at.nil? return false if @thread_id.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["in_progress", "incomplete", "completed"]) return false unless status_validator.valid?(@status) return false if @role.nil? role_validator = EnumAttributeValidator.new('String', ["user", "assistant"]) return false unless role_validator.valid?(@role) return false if @content.nil? true end |