Class: OpenApiOpenAIClient::VectorStoreObject

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/openapi_openai/models/vector_store_object.rb

Overview

A vector store is a collection of processed files can be used by the file_search tool.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ VectorStoreObject

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {}) —

    Model attributes in the form of hash



137
138
139
140
141
142
143
144
145
146
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
# File 'lib/openapi_openai/models/vector_store_object.rb', line 137

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::VectorStoreObject` 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::VectorStoreObject`. 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?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'usage_bytes')
    self.usage_bytes = attributes[:'usage_bytes']
  else
    self.usage_bytes = nil
  end

  if attributes.key?(:'file_counts')
    self.file_counts = attributes[:'file_counts']
  else
    self.file_counts = nil
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'expires_after')
    self.expires_after = attributes[:'expires_after']
  end

  if attributes.key?(:'expires_at')
    self.expires_at = attributes[:'expires_at']
  end

  if attributes.key?(:'last_active_at')
    self.last_active_at = attributes[:'last_active_at']
  else
    self.last_active_at = nil
  end

  if attributes.key?(:'metadata')
    self. = attributes[:'metadata']
  else
    self. = nil
  end
end

Instance Attribute Details

#created_at ⇒ Object

The Unix timestamp (in seconds) for when the vector store was created.



26
27
28
# File 'lib/openapi_openai/models/vector_store_object.rb', line 26

def created_at
  @created_at
end

#expires_after ⇒ Object

Returns the value of attribute expires_after.



39
40
41
# File 'lib/openapi_openai/models/vector_store_object.rb', line 39

def expires_after
  @expires_after
end

#expires_at ⇒ Object

The Unix timestamp (in seconds) for when the vector store will expire.



42
43
44
# File 'lib/openapi_openai/models/vector_store_object.rb', line 42

def expires_at
  @expires_at
end

#file_counts ⇒ Object

Returns the value of attribute file_counts.



34
35
36
# File 'lib/openapi_openai/models/vector_store_object.rb', line 34

def file_counts
  @file_counts
end

#id ⇒ Object

The identifier, which can be referenced in API endpoints.



20
21
22
# File 'lib/openapi_openai/models/vector_store_object.rb', line 20

def id
  @id
end

#last_active_at ⇒ Object

The Unix timestamp (in seconds) for when the vector store was last active.



45
46
47
# File 'lib/openapi_openai/models/vector_store_object.rb', line 45

def last_active_at
  @last_active_at
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.



48
49
50
# File 'lib/openapi_openai/models/vector_store_object.rb', line 48

def 
  @metadata
end

#name ⇒ Object

The name of the vector store.



29
30
31
# File 'lib/openapi_openai/models/vector_store_object.rb', line 29

def name
  @name
end

#object ⇒ Object

The object type, which is always vector_store.



23
24
25
# File 'lib/openapi_openai/models/vector_store_object.rb', line 23

def object
  @object
end

#status ⇒ Object

The status of the vector store, which can be either expired, in_progress, or completed. A status of completed indicates that the vector store is ready for use.



37
38
39
# File 'lib/openapi_openai/models/vector_store_object.rb', line 37

def status
  @status
end

#usage_bytes ⇒ Object

The total number of bytes used by the files in the vector store.



32
33
34
# File 'lib/openapi_openai/models/vector_store_object.rb', line 32

def usage_bytes
  @usage_bytes
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



90
91
92
# File 'lib/openapi_openai/models/vector_store_object.rb', line 90

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



95
96
97
# File 'lib/openapi_openai/models/vector_store_object.rb', line 95

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.acceptable_openapi_nullable ⇒ Object

Returns the nullable attributes



131
132
133
# File 'lib/openapi_openai/models/vector_store_object.rb', line 131

def self.acceptable_openapi_nullable
  openapi_nullable
end

.acceptable_openapi_types ⇒ Object

Returns attribute type mapping



126
127
128
# File 'lib/openapi_openai/models/vector_store_object.rb', line 126

def self.acceptable_openapi_types
  openapi_types
end

.attribute_map ⇒ Object

Attribute mapping from ruby-style variable name to JSON key.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/openapi_openai/models/vector_store_object.rb', line 73

def self.attribute_map
  {
    :'id' => :'id',
    :'object' => :'object',
    :'created_at' => :'created_at',
    :'name' => :'name',
    :'usage_bytes' => :'usage_bytes',
    :'file_counts' => :'file_counts',
    :'status' => :'status',
    :'expires_after' => :'expires_after',
    :'expires_at' => :'expires_at',
    :'last_active_at' => :'last_active_at',
    :'metadata' => :'metadata'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/openapi_openai/models/vector_store_object.rb', line 371

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  # include attributes inherited from allOf parents (the nearest declaration wins)
  map = acceptable_attribute_map
  transformed_hash = {}
  acceptable_openapi_types.each_pair do |key, type|
    if attributes.key?(map[key]) && attributes[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[map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullable ⇒ Object

List of attributes with nullable: true



117
118
119
120
121
122
123
# File 'lib/openapi_openai/models/vector_store_object.rb', line 117

def self.openapi_nullable
  Set.new([
    :'expires_at',
    :'last_active_at',
    :'metadata'
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/openapi_openai/models/vector_store_object.rb', line 100

def self.openapi_types
  {
    :'id' => :'String',
    :'object' => :'String',
    :'created_at' => :'Integer',
    :'name' => :'String',
    :'usage_bytes' => :'Integer',
    :'file_counts' => :'VectorStoreObjectFileCounts',
    :'status' => :'String',
    :'expires_after' => :'VectorStoreExpirationAfter',
    :'expires_at' => :'Integer',
    :'last_active_at' => :'Integer',
    :'metadata' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/openapi_openai/models/vector_store_object.rb', line 340

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      object == o.object &&
      created_at == o.created_at &&
      name == o.name &&
      usage_bytes == o.usage_bytes &&
      file_counts == o.file_counts &&
      status == o.status &&
      expires_after == o.expires_after &&
      expires_at == o.expires_at &&
      last_active_at == o.last_active_at &&
       == o.
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


358
359
360
# File 'lib/openapi_openai/models/vector_store_object.rb', line 358

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



364
365
366
# File 'lib/openapi_openai/models/vector_store_object.rb', line 364

def hash
  [id, object, created_at, name, usage_bytes, file_counts, status, expires_after, expires_at, last_active_at, ].hash
end

#list_invalid_properties ⇒ Object

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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/vector_store_object.rb', line 216

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 @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @usage_bytes.nil?
    invalid_properties.push('invalid value for "usage_bytes", usage_bytes cannot be nil.')
  end

  if @file_counts.nil?
    invalid_properties.push('invalid value for "file_counts", file_counts cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/openapi_openai/models/vector_store_object.rb', line 395

def to_hash
  hash = {}
  # include attributes inherited from allOf parents (the nearest declaration wins)
  self.class.acceptable_attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.acceptable_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

Returns:

  • (Boolean) —

    true if the model is valid



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/openapi_openai/models/vector_store_object.rb', line 252

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @object.nil?
  object_validator = EnumAttributeValidator.new('String', ["vector_store"])
  return false unless object_validator.valid?(@object)
  return false if @created_at.nil?
  return false if @name.nil?
  return false if @usage_bytes.nil?
  return false if @file_counts.nil?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["expired", "in_progress", "completed"])
  return false unless status_validator.valid?(@status)
  true
end