chromadb-experimental 0.1.0

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.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/lib/chromadb/admin_client.rb +6 -0
  3. data/lib/chromadb/client.rb +317 -0
  4. data/lib/chromadb/collection.rb +573 -0
  5. data/lib/chromadb/embedding_functions/chroma_bm25.rb +459 -0
  6. data/lib/chromadb/embedding_functions/chroma_cloud_qwen.rb +139 -0
  7. data/lib/chromadb/embedding_functions/chroma_cloud_splade.rb +121 -0
  8. data/lib/chromadb/embedding_functions.rb +121 -0
  9. data/lib/chromadb/errors.rb +120 -0
  10. data/lib/chromadb/http_client.rb +142 -0
  11. data/lib/chromadb/openapi/lib/chromadb/api/default_api.rb +2349 -0
  12. data/lib/chromadb/openapi/lib/chromadb/api_client.rb +392 -0
  13. data/lib/chromadb/openapi/lib/chromadb/api_error.rb +58 -0
  14. data/lib/chromadb/openapi/lib/chromadb/configuration.rb +295 -0
  15. data/lib/chromadb/openapi/lib/chromadb/models/add_collection_records_payload.rb +260 -0
  16. data/lib/chromadb/openapi/lib/chromadb/models/attach_function_request.rb +250 -0
  17. data/lib/chromadb/openapi/lib/chromadb/models/attach_function_response.rb +235 -0
  18. data/lib/chromadb/openapi/lib/chromadb/models/attached_function_api_response.rb +361 -0
  19. data/lib/chromadb/openapi/lib/chromadb/models/attached_function_info.rb +240 -0
  20. data/lib/chromadb/openapi/lib/chromadb/models/bool_inverted_index_type.rb +229 -0
  21. data/lib/chromadb/openapi/lib/chromadb/models/bool_value_type.rb +221 -0
  22. data/lib/chromadb/openapi/lib/chromadb/models/checklist_response.rb +245 -0
  23. data/lib/chromadb/openapi/lib/chromadb/models/collection.rb +315 -0
  24. data/lib/chromadb/openapi/lib/chromadb/models/collection_configuration.rb +240 -0
  25. data/lib/chromadb/openapi/lib/chromadb/models/create_collection_payload.rb +260 -0
  26. data/lib/chromadb/openapi/lib/chromadb/models/create_database_payload.rb +220 -0
  27. data/lib/chromadb/openapi/lib/chromadb/models/create_tenant_payload.rb +220 -0
  28. data/lib/chromadb/openapi/lib/chromadb/models/database.rb +240 -0
  29. data/lib/chromadb/openapi/lib/chromadb/models/detach_function_request.rb +221 -0
  30. data/lib/chromadb/openapi/lib/chromadb/models/detach_function_response.rb +220 -0
  31. data/lib/chromadb/openapi/lib/chromadb/models/embedding_function_new_configuration.rb +230 -0
  32. data/lib/chromadb/openapi/lib/chromadb/models/error_response.rb +230 -0
  33. data/lib/chromadb/openapi/lib/chromadb/models/float_inverted_index_type.rb +229 -0
  34. data/lib/chromadb/openapi/lib/chromadb/models/float_list_value_type.rb +221 -0
  35. data/lib/chromadb/openapi/lib/chromadb/models/float_value_type.rb +221 -0
  36. data/lib/chromadb/openapi/lib/chromadb/models/fork_collection_payload.rb +220 -0
  37. data/lib/chromadb/openapi/lib/chromadb/models/fts_index_type.rb +229 -0
  38. data/lib/chromadb/openapi/lib/chromadb/models/get_attached_function_response.rb +224 -0
  39. data/lib/chromadb/openapi/lib/chromadb/models/get_response.rb +270 -0
  40. data/lib/chromadb/openapi/lib/chromadb/models/get_tenant_response.rb +230 -0
  41. data/lib/chromadb/openapi/lib/chromadb/models/get_user_identity_response.rb +246 -0
  42. data/lib/chromadb/openapi/lib/chromadb/models/heartbeat_response.rb +235 -0
  43. data/lib/chromadb/openapi/lib/chromadb/models/hnsw_configuration.rb +330 -0
  44. data/lib/chromadb/openapi/lib/chromadb/models/hnsw_index_config.rb +371 -0
  45. data/lib/chromadb/openapi/lib/chromadb/models/include.rb +210 -0
  46. data/lib/chromadb/openapi/lib/chromadb/models/int_inverted_index_type.rb +229 -0
  47. data/lib/chromadb/openapi/lib/chromadb/models/int_value_type.rb +221 -0
  48. data/lib/chromadb/openapi/lib/chromadb/models/query_response.rb +280 -0
  49. data/lib/chromadb/openapi/lib/chromadb/models/raw_where_fields.rb +230 -0
  50. data/lib/chromadb/openapi/lib/chromadb/models/schema.rb +258 -0
  51. data/lib/chromadb/openapi/lib/chromadb/models/search_payload.rb +256 -0
  52. data/lib/chromadb/openapi/lib/chromadb/models/search_payload_filter.rb +230 -0
  53. data/lib/chromadb/openapi/lib/chromadb/models/search_payload_group_by.rb +230 -0
  54. data/lib/chromadb/openapi/lib/chromadb/models/search_payload_limit.rb +230 -0
  55. data/lib/chromadb/openapi/lib/chromadb/models/search_payload_select.rb +220 -0
  56. data/lib/chromadb/openapi/lib/chromadb/models/search_request_payload.rb +220 -0
  57. data/lib/chromadb/openapi/lib/chromadb/models/search_response.rb +270 -0
  58. data/lib/chromadb/openapi/lib/chromadb/models/space.rb +210 -0
  59. data/lib/chromadb/openapi/lib/chromadb/models/spann_configuration.rb +420 -0
  60. data/lib/chromadb/openapi/lib/chromadb/models/spann_index_config.rb +536 -0
  61. data/lib/chromadb/openapi/lib/chromadb/models/sparse_vector.rb +244 -0
  62. data/lib/chromadb/openapi/lib/chromadb/models/sparse_vector_index_config.rb +242 -0
  63. data/lib/chromadb/openapi/lib/chromadb/models/sparse_vector_index_type.rb +234 -0
  64. data/lib/chromadb/openapi/lib/chromadb/models/sparse_vector_value_type.rb +221 -0
  65. data/lib/chromadb/openapi/lib/chromadb/models/string_inverted_index_type.rb +229 -0
  66. data/lib/chromadb/openapi/lib/chromadb/models/string_value_type.rb +231 -0
  67. data/lib/chromadb/openapi/lib/chromadb/models/update_collection_configuration.rb +240 -0
  68. data/lib/chromadb/openapi/lib/chromadb/models/update_collection_payload.rb +240 -0
  69. data/lib/chromadb/openapi/lib/chromadb/models/update_collection_records_payload.rb +260 -0
  70. data/lib/chromadb/openapi/lib/chromadb/models/update_hnsw_configuration.rb +345 -0
  71. data/lib/chromadb/openapi/lib/chromadb/models/update_spann_configuration.rb +260 -0
  72. data/lib/chromadb/openapi/lib/chromadb/models/update_tenant_payload.rb +220 -0
  73. data/lib/chromadb/openapi/lib/chromadb/models/upsert_collection_records_payload.rb +260 -0
  74. data/lib/chromadb/openapi/lib/chromadb/models/value_types.rb +271 -0
  75. data/lib/chromadb/openapi/lib/chromadb/models/vector_index_config.rb +261 -0
  76. data/lib/chromadb/openapi/lib/chromadb/models/vector_index_type.rb +234 -0
  77. data/lib/chromadb/openapi/lib/chromadb/version.rb +15 -0
  78. data/lib/chromadb/openapi/lib/chromadb.rb +102 -0
  79. data/lib/chromadb/openapi.rb +6 -0
  80. data/lib/chromadb/schema.rb +744 -0
  81. data/lib/chromadb/schemas/chroma-cloud-qwen.json +61 -0
  82. data/lib/chromadb/schemas/chroma-cloud-splade.json +31 -0
  83. data/lib/chromadb/schemas/chroma_bm25.json +37 -0
  84. data/lib/chromadb/search/key.rb +94 -0
  85. data/lib/chromadb/search/limit.rb +41 -0
  86. data/lib/chromadb/search/rank.rb +425 -0
  87. data/lib/chromadb/search/search.rb +73 -0
  88. data/lib/chromadb/search/select.rb +54 -0
  89. data/lib/chromadb/search/where.rb +157 -0
  90. data/lib/chromadb/search.rb +8 -0
  91. data/lib/chromadb/types/results.rb +96 -0
  92. data/lib/chromadb/types/sparse_vector.rb +86 -0
  93. data/lib/chromadb/types/validation.rb +519 -0
  94. data/lib/chromadb/types.rb +13 -0
  95. data/lib/chromadb/version.rb +5 -0
  96. data/lib/chromadb.rb +15 -0
  97. metadata +233 -0
@@ -0,0 +1,536 @@
1
+ =begin
2
+ #chroma-frontend
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Chromadb
17
+ # Configuration for SPANN vector index algorithm parameters
18
+ class SpannIndexConfig
19
+ attr_accessor :ef_construction
20
+
21
+ attr_accessor :ef_search
22
+
23
+ attr_accessor :initial_lambda
24
+
25
+ attr_accessor :max_neighbors
26
+
27
+ attr_accessor :merge_threshold
28
+
29
+ attr_accessor :nreplica_count
30
+
31
+ attr_accessor :num_centers_to_merge_to
32
+
33
+ attr_accessor :num_samples_kmeans
34
+
35
+ attr_accessor :reassign_neighbor_count
36
+
37
+ attr_accessor :search_nprobe
38
+
39
+ attr_accessor :search_rng_epsilon
40
+
41
+ attr_accessor :search_rng_factor
42
+
43
+ attr_accessor :split_threshold
44
+
45
+ attr_accessor :write_nprobe
46
+
47
+ attr_accessor :write_rng_epsilon
48
+
49
+ attr_accessor :write_rng_factor
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'ef_construction' => :'ef_construction',
55
+ :'ef_search' => :'ef_search',
56
+ :'initial_lambda' => :'initial_lambda',
57
+ :'max_neighbors' => :'max_neighbors',
58
+ :'merge_threshold' => :'merge_threshold',
59
+ :'nreplica_count' => :'nreplica_count',
60
+ :'num_centers_to_merge_to' => :'num_centers_to_merge_to',
61
+ :'num_samples_kmeans' => :'num_samples_kmeans',
62
+ :'reassign_neighbor_count' => :'reassign_neighbor_count',
63
+ :'search_nprobe' => :'search_nprobe',
64
+ :'search_rng_epsilon' => :'search_rng_epsilon',
65
+ :'search_rng_factor' => :'search_rng_factor',
66
+ :'split_threshold' => :'split_threshold',
67
+ :'write_nprobe' => :'write_nprobe',
68
+ :'write_rng_epsilon' => :'write_rng_epsilon',
69
+ :'write_rng_factor' => :'write_rng_factor'
70
+ }
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'ef_construction' => :'Object',
82
+ :'ef_search' => :'Object',
83
+ :'initial_lambda' => :'Object',
84
+ :'max_neighbors' => :'Object',
85
+ :'merge_threshold' => :'Object',
86
+ :'nreplica_count' => :'Object',
87
+ :'num_centers_to_merge_to' => :'Object',
88
+ :'num_samples_kmeans' => :'Object',
89
+ :'reassign_neighbor_count' => :'Object',
90
+ :'search_nprobe' => :'Object',
91
+ :'search_rng_epsilon' => :'Object',
92
+ :'search_rng_factor' => :'Object',
93
+ :'split_threshold' => :'Object',
94
+ :'write_nprobe' => :'Object',
95
+ :'write_rng_epsilon' => :'Object',
96
+ :'write_rng_factor' => :'Object'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ :'ef_construction',
104
+ :'ef_search',
105
+ :'initial_lambda',
106
+ :'max_neighbors',
107
+ :'merge_threshold',
108
+ :'nreplica_count',
109
+ :'num_centers_to_merge_to',
110
+ :'num_samples_kmeans',
111
+ :'reassign_neighbor_count',
112
+ :'search_nprobe',
113
+ :'search_rng_epsilon',
114
+ :'search_rng_factor',
115
+ :'split_threshold',
116
+ :'write_nprobe',
117
+ :'write_rng_epsilon',
118
+ :'write_rng_factor'
119
+ ])
120
+ end
121
+
122
+ # Initializes the object
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ def initialize(attributes = {})
125
+ if (!attributes.is_a?(Hash))
126
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Chromadb::SpannIndexConfig` initialize method"
127
+ end
128
+
129
+ # check to see if the attribute exists and convert string to symbol for hash key
130
+ attributes = attributes.each_with_object({}) { |(k, v), h|
131
+ if (!self.class.attribute_map.key?(k.to_sym))
132
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Chromadb::SpannIndexConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
133
+ end
134
+ h[k.to_sym] = v
135
+ }
136
+
137
+ if attributes.key?(:'ef_construction')
138
+ self.ef_construction = attributes[:'ef_construction']
139
+ end
140
+
141
+ if attributes.key?(:'ef_search')
142
+ self.ef_search = attributes[:'ef_search']
143
+ end
144
+
145
+ if attributes.key?(:'initial_lambda')
146
+ self.initial_lambda = attributes[:'initial_lambda']
147
+ end
148
+
149
+ if attributes.key?(:'max_neighbors')
150
+ self.max_neighbors = attributes[:'max_neighbors']
151
+ end
152
+
153
+ if attributes.key?(:'merge_threshold')
154
+ self.merge_threshold = attributes[:'merge_threshold']
155
+ end
156
+
157
+ if attributes.key?(:'nreplica_count')
158
+ self.nreplica_count = attributes[:'nreplica_count']
159
+ end
160
+
161
+ if attributes.key?(:'num_centers_to_merge_to')
162
+ self.num_centers_to_merge_to = attributes[:'num_centers_to_merge_to']
163
+ end
164
+
165
+ if attributes.key?(:'num_samples_kmeans')
166
+ self.num_samples_kmeans = attributes[:'num_samples_kmeans']
167
+ end
168
+
169
+ if attributes.key?(:'reassign_neighbor_count')
170
+ self.reassign_neighbor_count = attributes[:'reassign_neighbor_count']
171
+ end
172
+
173
+ if attributes.key?(:'search_nprobe')
174
+ self.search_nprobe = attributes[:'search_nprobe']
175
+ end
176
+
177
+ if attributes.key?(:'search_rng_epsilon')
178
+ self.search_rng_epsilon = attributes[:'search_rng_epsilon']
179
+ end
180
+
181
+ if attributes.key?(:'search_rng_factor')
182
+ self.search_rng_factor = attributes[:'search_rng_factor']
183
+ end
184
+
185
+ if attributes.key?(:'split_threshold')
186
+ self.split_threshold = attributes[:'split_threshold']
187
+ end
188
+
189
+ if attributes.key?(:'write_nprobe')
190
+ self.write_nprobe = attributes[:'write_nprobe']
191
+ end
192
+
193
+ if attributes.key?(:'write_rng_epsilon')
194
+ self.write_rng_epsilon = attributes[:'write_rng_epsilon']
195
+ end
196
+
197
+ if attributes.key?(:'write_rng_factor')
198
+ self.write_rng_factor = attributes[:'write_rng_factor']
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ invalid_properties = Array.new
206
+ if !@ef_construction.nil? && @ef_construction < 0
207
+ invalid_properties.push('invalid value for "ef_construction", must be greater than or equal to 0.')
208
+ end
209
+
210
+ if !@ef_search.nil? && @ef_search < 0
211
+ invalid_properties.push('invalid value for "ef_search", must be greater than or equal to 0.')
212
+ end
213
+
214
+ if !@max_neighbors.nil? && @max_neighbors < 0
215
+ invalid_properties.push('invalid value for "max_neighbors", must be greater than or equal to 0.')
216
+ end
217
+
218
+ if !@merge_threshold.nil? && @merge_threshold < 0
219
+ invalid_properties.push('invalid value for "merge_threshold", must be greater than or equal to 0.')
220
+ end
221
+
222
+ if !@nreplica_count.nil? && @nreplica_count < 0
223
+ invalid_properties.push('invalid value for "nreplica_count", must be greater than or equal to 0.')
224
+ end
225
+
226
+ if !@num_centers_to_merge_to.nil? && @num_centers_to_merge_to < 0
227
+ invalid_properties.push('invalid value for "num_centers_to_merge_to", must be greater than or equal to 0.')
228
+ end
229
+
230
+ if !@num_samples_kmeans.nil? && @num_samples_kmeans < 0
231
+ invalid_properties.push('invalid value for "num_samples_kmeans", must be greater than or equal to 0.')
232
+ end
233
+
234
+ if !@reassign_neighbor_count.nil? && @reassign_neighbor_count < 0
235
+ invalid_properties.push('invalid value for "reassign_neighbor_count", must be greater than or equal to 0.')
236
+ end
237
+
238
+ if !@search_nprobe.nil? && @search_nprobe < 0
239
+ invalid_properties.push('invalid value for "search_nprobe", must be greater than or equal to 0.')
240
+ end
241
+
242
+ if !@split_threshold.nil? && @split_threshold < 0
243
+ invalid_properties.push('invalid value for "split_threshold", must be greater than or equal to 0.')
244
+ end
245
+
246
+ if !@write_nprobe.nil? && @write_nprobe < 0
247
+ invalid_properties.push('invalid value for "write_nprobe", must be greater than or equal to 0.')
248
+ end
249
+
250
+ invalid_properties
251
+ end
252
+
253
+ # Check to see if the all the properties in the model are valid
254
+ # @return true if the model is valid
255
+ def valid?
256
+ return false if !@ef_construction.nil? && @ef_construction < 0
257
+ return false if !@ef_search.nil? && @ef_search < 0
258
+ return false if !@max_neighbors.nil? && @max_neighbors < 0
259
+ return false if !@merge_threshold.nil? && @merge_threshold < 0
260
+ return false if !@nreplica_count.nil? && @nreplica_count < 0
261
+ return false if !@num_centers_to_merge_to.nil? && @num_centers_to_merge_to < 0
262
+ return false if !@num_samples_kmeans.nil? && @num_samples_kmeans < 0
263
+ return false if !@reassign_neighbor_count.nil? && @reassign_neighbor_count < 0
264
+ return false if !@search_nprobe.nil? && @search_nprobe < 0
265
+ return false if !@split_threshold.nil? && @split_threshold < 0
266
+ return false if !@write_nprobe.nil? && @write_nprobe < 0
267
+ true
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] ef_construction Value to be assigned
272
+ def ef_construction=(ef_construction)
273
+ if !ef_construction.nil? && ef_construction < 0
274
+ fail ArgumentError, 'invalid value for "ef_construction", must be greater than or equal to 0.'
275
+ end
276
+
277
+ @ef_construction = ef_construction
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] ef_search Value to be assigned
282
+ def ef_search=(ef_search)
283
+ if !ef_search.nil? && ef_search < 0
284
+ fail ArgumentError, 'invalid value for "ef_search", must be greater than or equal to 0.'
285
+ end
286
+
287
+ @ef_search = ef_search
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] max_neighbors Value to be assigned
292
+ def max_neighbors=(max_neighbors)
293
+ if !max_neighbors.nil? && max_neighbors < 0
294
+ fail ArgumentError, 'invalid value for "max_neighbors", must be greater than or equal to 0.'
295
+ end
296
+
297
+ @max_neighbors = max_neighbors
298
+ end
299
+
300
+ # Custom attribute writer method with validation
301
+ # @param [Object] merge_threshold Value to be assigned
302
+ def merge_threshold=(merge_threshold)
303
+ if !merge_threshold.nil? && merge_threshold < 0
304
+ fail ArgumentError, 'invalid value for "merge_threshold", must be greater than or equal to 0.'
305
+ end
306
+
307
+ @merge_threshold = merge_threshold
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] nreplica_count Value to be assigned
312
+ def nreplica_count=(nreplica_count)
313
+ if !nreplica_count.nil? && nreplica_count < 0
314
+ fail ArgumentError, 'invalid value for "nreplica_count", must be greater than or equal to 0.'
315
+ end
316
+
317
+ @nreplica_count = nreplica_count
318
+ end
319
+
320
+ # Custom attribute writer method with validation
321
+ # @param [Object] num_centers_to_merge_to Value to be assigned
322
+ def num_centers_to_merge_to=(num_centers_to_merge_to)
323
+ if !num_centers_to_merge_to.nil? && num_centers_to_merge_to < 0
324
+ fail ArgumentError, 'invalid value for "num_centers_to_merge_to", must be greater than or equal to 0.'
325
+ end
326
+
327
+ @num_centers_to_merge_to = num_centers_to_merge_to
328
+ end
329
+
330
+ # Custom attribute writer method with validation
331
+ # @param [Object] num_samples_kmeans Value to be assigned
332
+ def num_samples_kmeans=(num_samples_kmeans)
333
+ if !num_samples_kmeans.nil? && num_samples_kmeans < 0
334
+ fail ArgumentError, 'invalid value for "num_samples_kmeans", must be greater than or equal to 0.'
335
+ end
336
+
337
+ @num_samples_kmeans = num_samples_kmeans
338
+ end
339
+
340
+ # Custom attribute writer method with validation
341
+ # @param [Object] reassign_neighbor_count Value to be assigned
342
+ def reassign_neighbor_count=(reassign_neighbor_count)
343
+ if !reassign_neighbor_count.nil? && reassign_neighbor_count < 0
344
+ fail ArgumentError, 'invalid value for "reassign_neighbor_count", must be greater than or equal to 0.'
345
+ end
346
+
347
+ @reassign_neighbor_count = reassign_neighbor_count
348
+ end
349
+
350
+ # Custom attribute writer method with validation
351
+ # @param [Object] search_nprobe Value to be assigned
352
+ def search_nprobe=(search_nprobe)
353
+ if !search_nprobe.nil? && search_nprobe < 0
354
+ fail ArgumentError, 'invalid value for "search_nprobe", must be greater than or equal to 0.'
355
+ end
356
+
357
+ @search_nprobe = search_nprobe
358
+ end
359
+
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] split_threshold Value to be assigned
362
+ def split_threshold=(split_threshold)
363
+ if !split_threshold.nil? && split_threshold < 0
364
+ fail ArgumentError, 'invalid value for "split_threshold", must be greater than or equal to 0.'
365
+ end
366
+
367
+ @split_threshold = split_threshold
368
+ end
369
+
370
+ # Custom attribute writer method with validation
371
+ # @param [Object] write_nprobe Value to be assigned
372
+ def write_nprobe=(write_nprobe)
373
+ if !write_nprobe.nil? && write_nprobe < 0
374
+ fail ArgumentError, 'invalid value for "write_nprobe", must be greater than or equal to 0.'
375
+ end
376
+
377
+ @write_nprobe = write_nprobe
378
+ end
379
+
380
+ # Checks equality by comparing each attribute.
381
+ # @param [Object] Object to be compared
382
+ def ==(o)
383
+ return true if self.equal?(o)
384
+ self.class == o.class &&
385
+ ef_construction == o.ef_construction &&
386
+ ef_search == o.ef_search &&
387
+ initial_lambda == o.initial_lambda &&
388
+ max_neighbors == o.max_neighbors &&
389
+ merge_threshold == o.merge_threshold &&
390
+ nreplica_count == o.nreplica_count &&
391
+ num_centers_to_merge_to == o.num_centers_to_merge_to &&
392
+ num_samples_kmeans == o.num_samples_kmeans &&
393
+ reassign_neighbor_count == o.reassign_neighbor_count &&
394
+ search_nprobe == o.search_nprobe &&
395
+ search_rng_epsilon == o.search_rng_epsilon &&
396
+ search_rng_factor == o.search_rng_factor &&
397
+ split_threshold == o.split_threshold &&
398
+ write_nprobe == o.write_nprobe &&
399
+ write_rng_epsilon == o.write_rng_epsilon &&
400
+ write_rng_factor == o.write_rng_factor
401
+ end
402
+
403
+ # @see the `==` method
404
+ # @param [Object] Object to be compared
405
+ def eql?(o)
406
+ self == o
407
+ end
408
+
409
+ # Calculates hash code according to all attributes.
410
+ # @return [Integer] Hash code
411
+ def hash
412
+ [ef_construction, ef_search, initial_lambda, max_neighbors, merge_threshold, nreplica_count, num_centers_to_merge_to, num_samples_kmeans, reassign_neighbor_count, search_nprobe, search_rng_epsilon, search_rng_factor, split_threshold, write_nprobe, write_rng_epsilon, write_rng_factor].hash
413
+ end
414
+
415
+ # Builds the object from hash
416
+ # @param [Hash] attributes Model attributes in the form of hash
417
+ # @return [Object] Returns the model itself
418
+ def self.build_from_hash(attributes)
419
+ new.build_from_hash(attributes)
420
+ end
421
+
422
+ # Builds the object from hash
423
+ # @param [Hash] attributes Model attributes in the form of hash
424
+ # @return [Object] Returns the model itself
425
+ def build_from_hash(attributes)
426
+ return nil unless attributes.is_a?(Hash)
427
+ attributes = attributes.transform_keys(&:to_sym)
428
+ self.class.openapi_types.each_pair do |key, type|
429
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
430
+ self.send("#{key}=", nil)
431
+ elsif type =~ /\AArray<(.*)>/i
432
+ # check to ensure the input is an array given that the attribute
433
+ # is documented as an array but the input is not
434
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
435
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
436
+ end
437
+ elsif !attributes[self.class.attribute_map[key]].nil?
438
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
439
+ end
440
+ end
441
+
442
+ self
443
+ end
444
+
445
+ # Deserializes the data based on type
446
+ # @param string type Data type
447
+ # @param string value Value to be deserialized
448
+ # @return [Object] Deserialized data
449
+ def _deserialize(type, value)
450
+ case type.to_sym
451
+ when :Time
452
+ Time.parse(value)
453
+ when :Date
454
+ Date.parse(value)
455
+ when :String
456
+ value.to_s
457
+ when :Integer
458
+ value.to_i
459
+ when :Float
460
+ value.to_f
461
+ when :Boolean
462
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
463
+ true
464
+ else
465
+ false
466
+ end
467
+ when :Object
468
+ # generic object (usually a Hash), return directly
469
+ value
470
+ when /\AArray<(?<inner_type>.+)>\z/
471
+ inner_type = Regexp.last_match[:inner_type]
472
+ value.map { |v| _deserialize(inner_type, v) }
473
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
474
+ k_type = Regexp.last_match[:k_type]
475
+ v_type = Regexp.last_match[:v_type]
476
+ {}.tap do |hash|
477
+ value.each do |k, v|
478
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
479
+ end
480
+ end
481
+ else # model
482
+ # models (e.g. Pet) or oneOf
483
+ klass = Chromadb.const_get(type)
484
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
485
+ end
486
+ end
487
+
488
+ # Returns the string representation of the object
489
+ # @return [String] String presentation of the object
490
+ def to_s
491
+ to_hash.to_s
492
+ end
493
+
494
+ # to_body is an alias to to_hash (backward compatibility)
495
+ # @return [Hash] Returns the object in the form of hash
496
+ def to_body
497
+ to_hash
498
+ end
499
+
500
+ # Returns the object in the form of hash
501
+ # @return [Hash] Returns the object in the form of hash
502
+ def to_hash
503
+ hash = {}
504
+ self.class.attribute_map.each_pair do |attr, param|
505
+ value = self.send(attr)
506
+ if value.nil?
507
+ is_nullable = self.class.openapi_nullable.include?(attr)
508
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
509
+ end
510
+
511
+ hash[param] = _to_hash(value)
512
+ end
513
+ hash
514
+ end
515
+
516
+ # Outputs non-array value in the form of hash
517
+ # For object, use to_hash. Otherwise, just return the value
518
+ # @param [Object] value Any valid value
519
+ # @return [Hash] Returns the value in the form of hash
520
+ def _to_hash(value)
521
+ if value.is_a?(Array)
522
+ value.compact.map { |v| _to_hash(v) }
523
+ elsif value.is_a?(Hash)
524
+ {}.tap do |hash|
525
+ value.each { |k, v| hash[k] = _to_hash(v) }
526
+ end
527
+ elsif value.respond_to? :to_hash
528
+ value.to_hash
529
+ else
530
+ value
531
+ end
532
+ end
533
+
534
+ end
535
+
536
+ end