trieve_ruby_client 0.6.0 → 0.6.7

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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -19
  3. data/docs/BookmarkData.md +1 -1
  4. data/docs/ChunkApi.md +9 -9
  5. data/docs/ChunkData.md +2 -0
  6. data/docs/ChunkGroupApi.md +14 -14
  7. data/docs/ChunkMetadataWithScore.md +44 -0
  8. data/docs/CreateChunkGroupData.md +1 -1
  9. data/docs/FileApi.md +1 -1
  10. data/docs/GetEventsData.md +1 -1
  11. data/docs/GroupScoreChunk.md +24 -0
  12. data/docs/GroupScoreSlimChunks.md +20 -0
  13. data/docs/ScoreChunkDTO.md +1 -1
  14. data/docs/SearchOverGroupsResults.md +20 -0
  15. data/docs/SearchOverGroupsSlimResults.md +20 -0
  16. data/docs/SearchWithinGroupResults.md +22 -0
  17. data/docs/SearchWithinGroupSlimResults.md +22 -0
  18. data/docs/SlimChunkMetadataWithScore.md +38 -0
  19. data/docs/UpdateChunkByTrackingIdData.md +2 -0
  20. data/docs/UpdateChunkData.md +2 -0
  21. data/docs/UploadFileData.md +2 -2
  22. data/docs/UserApi.md +2 -2
  23. data/lib/trieve_ruby_client/api/auth_api.rb +1 -1
  24. data/lib/trieve_ruby_client/api/chunk_api.rb +9 -9
  25. data/lib/trieve_ruby_client/api/chunk_group_api.rb +10 -10
  26. data/lib/trieve_ruby_client/api/dataset_api.rb +1 -1
  27. data/lib/trieve_ruby_client/api/events_api.rb +1 -1
  28. data/lib/trieve_ruby_client/api/file_api.rb +1 -1
  29. data/lib/trieve_ruby_client/api/health_api.rb +1 -1
  30. data/lib/trieve_ruby_client/api/invitation_api.rb +1 -1
  31. data/lib/trieve_ruby_client/api/message_api.rb +1 -1
  32. data/lib/trieve_ruby_client/api/organization_api.rb +1 -1
  33. data/lib/trieve_ruby_client/api/stripe_api.rb +1 -1
  34. data/lib/trieve_ruby_client/api/topic_api.rb +1 -1
  35. data/lib/trieve_ruby_client/api/user_api.rb +3 -3
  36. data/lib/trieve_ruby_client/api_client.rb +1 -1
  37. data/lib/trieve_ruby_client/api_error.rb +1 -1
  38. data/lib/trieve_ruby_client/configuration.rb +1 -1
  39. data/lib/trieve_ruby_client/models/add_chunk_to_group_data.rb +1 -1
  40. data/lib/trieve_ruby_client/models/api_key_dto.rb +1 -1
  41. data/lib/trieve_ruby_client/models/auth_query.rb +1 -1
  42. data/lib/trieve_ruby_client/models/batch_queued_chunk_response.rb +1 -1
  43. data/lib/trieve_ruby_client/models/bookmark_data.rb +2 -2
  44. data/lib/trieve_ruby_client/models/bookmark_group_result.rb +1 -1
  45. data/lib/trieve_ruby_client/models/chat_message_proxy.rb +1 -1
  46. data/lib/trieve_ruby_client/models/chunk_data.rb +13 -2
  47. data/lib/trieve_ruby_client/models/chunk_filter.rb +1 -1
  48. data/lib/trieve_ruby_client/models/chunk_group.rb +1 -1
  49. data/lib/trieve_ruby_client/models/chunk_group_and_file.rb +1 -1
  50. data/lib/trieve_ruby_client/models/chunk_metadata.rb +1 -1
  51. data/lib/trieve_ruby_client/models/chunk_metadata_with_score.rb +387 -0
  52. data/lib/trieve_ruby_client/models/client_dataset_configuration.rb +1 -1
  53. data/lib/trieve_ruby_client/models/create_chunk_data.rb +1 -1
  54. data/lib/trieve_ruby_client/models/create_chunk_group_data.rb +2 -8
  55. data/lib/trieve_ruby_client/models/create_dataset_request.rb +1 -1
  56. data/lib/trieve_ruby_client/models/create_message_data.rb +1 -1
  57. data/lib/trieve_ruby_client/models/create_organization_data.rb +1 -1
  58. data/lib/trieve_ruby_client/models/create_topic_data.rb +1 -1
  59. data/lib/trieve_ruby_client/models/dataset.rb +1 -1
  60. data/lib/trieve_ruby_client/models/dataset_and_usage.rb +1 -1
  61. data/lib/trieve_ruby_client/models/dataset_dto.rb +1 -1
  62. data/lib/trieve_ruby_client/models/dataset_usage_count.rb +1 -1
  63. data/lib/trieve_ruby_client/models/delete_topic_data.rb +1 -1
  64. data/lib/trieve_ruby_client/models/delete_user_api_key_request.rb +1 -1
  65. data/lib/trieve_ruby_client/models/edit_message_data.rb +1 -1
  66. data/lib/trieve_ruby_client/models/error_response_body.rb +1 -1
  67. data/lib/trieve_ruby_client/models/event.rb +1 -1
  68. data/lib/trieve_ruby_client/models/event_return.rb +1 -1
  69. data/lib/trieve_ruby_client/models/field_condition.rb +1 -1
  70. data/lib/trieve_ruby_client/models/file.rb +1 -1
  71. data/lib/trieve_ruby_client/models/file_dto.rb +1 -1
  72. data/lib/trieve_ruby_client/models/generate_chunks_request.rb +1 -1
  73. data/lib/trieve_ruby_client/models/get_events_data.rb +2 -2
  74. data/lib/trieve_ruby_client/models/get_groups_for_chunks_data.rb +1 -1
  75. data/lib/trieve_ruby_client/models/group_data.rb +1 -1
  76. data/lib/trieve_ruby_client/models/group_score_chunk.rb +259 -0
  77. data/lib/trieve_ruby_client/models/group_score_slim_chunks.rb +239 -0
  78. data/lib/trieve_ruby_client/models/invitation_data.rb +1 -1
  79. data/lib/trieve_ruby_client/models/match_condition.rb +1 -1
  80. data/lib/trieve_ruby_client/models/message.rb +1 -1
  81. data/lib/trieve_ruby_client/models/organization.rb +1 -1
  82. data/lib/trieve_ruby_client/models/organization_usage_count.rb +1 -1
  83. data/lib/trieve_ruby_client/models/range.rb +1 -1
  84. data/lib/trieve_ruby_client/models/range_condition.rb +1 -1
  85. data/lib/trieve_ruby_client/models/recommend_chunks_request.rb +1 -1
  86. data/lib/trieve_ruby_client/models/recommend_group_chunks_request.rb +1 -1
  87. data/lib/trieve_ruby_client/models/regenerate_message_data.rb +1 -1
  88. data/lib/trieve_ruby_client/models/return_queued_chunk.rb +1 -1
  89. data/lib/trieve_ruby_client/models/score_chunk_dto.rb +2 -2
  90. data/lib/trieve_ruby_client/models/score_slim_chunks.rb +1 -1
  91. data/lib/trieve_ruby_client/models/search_chunk_data.rb +1 -1
  92. data/lib/trieve_ruby_client/models/search_chunk_query_response_body.rb +1 -1
  93. data/lib/trieve_ruby_client/models/search_over_groups_data.rb +1 -1
  94. data/lib/trieve_ruby_client/models/search_over_groups_results.rb +239 -0
  95. data/lib/trieve_ruby_client/models/search_over_groups_slim_results.rb +239 -0
  96. data/lib/trieve_ruby_client/models/search_slim_chunk_query_response_body.rb +1 -1
  97. data/lib/trieve_ruby_client/models/search_within_group_data.rb +1 -1
  98. data/lib/trieve_ruby_client/models/search_within_group_results.rb +255 -0
  99. data/lib/trieve_ruby_client/models/search_within_group_slim_results.rb +255 -0
  100. data/lib/trieve_ruby_client/models/set_user_api_key_request.rb +1 -1
  101. data/lib/trieve_ruby_client/models/set_user_api_key_response.rb +1 -1
  102. data/lib/trieve_ruby_client/models/single_queued_chunk_response.rb +1 -1
  103. data/lib/trieve_ruby_client/models/slim_chunk_metadata.rb +1 -1
  104. data/lib/trieve_ruby_client/models/slim_chunk_metadata_with_score.rb +345 -0
  105. data/lib/trieve_ruby_client/models/slim_group.rb +1 -1
  106. data/lib/trieve_ruby_client/models/slim_user.rb +1 -1
  107. data/lib/trieve_ruby_client/models/stripe_plan.rb +1 -1
  108. data/lib/trieve_ruby_client/models/suggested_queries_request.rb +1 -1
  109. data/lib/trieve_ruby_client/models/suggested_queries_response.rb +1 -1
  110. data/lib/trieve_ruby_client/models/topic.rb +1 -1
  111. data/lib/trieve_ruby_client/models/update_chunk_by_tracking_id_data.rb +13 -2
  112. data/lib/trieve_ruby_client/models/update_chunk_data.rb +13 -2
  113. data/lib/trieve_ruby_client/models/update_chunk_group_data.rb +1 -1
  114. data/lib/trieve_ruby_client/models/update_dataset_request.rb +1 -1
  115. data/lib/trieve_ruby_client/models/update_group_by_tracking_id_data.rb +1 -1
  116. data/lib/trieve_ruby_client/models/update_organization_data.rb +1 -1
  117. data/lib/trieve_ruby_client/models/update_topic_data.rb +1 -1
  118. data/lib/trieve_ruby_client/models/update_user_data.rb +1 -1
  119. data/lib/trieve_ruby_client/models/upload_file_data.rb +13 -19
  120. data/lib/trieve_ruby_client/models/upload_file_result.rb +1 -1
  121. data/lib/trieve_ruby_client/models/user_organization.rb +1 -1
  122. data/lib/trieve_ruby_client/version.rb +2 -2
  123. data/lib/trieve_ruby_client.rb +9 -13
  124. data/openapi-generator.yaml +1 -1
  125. data/openapi.json +279 -198
  126. data/spec/models/chunk_metadata_with_score_spec.rb +114 -0
  127. data/spec/models/group_score_chunk_spec.rb +48 -0
  128. data/spec/models/group_score_slim_chunks_spec.rb +42 -0
  129. data/spec/models/search_over_groups_results_spec.rb +42 -0
  130. data/spec/models/search_over_groups_slim_results_spec.rb +42 -0
  131. data/spec/models/search_within_group_results_spec.rb +48 -0
  132. data/spec/models/search_within_group_slim_results_spec.rb +48 -0
  133. data/spec/models/slim_chunk_metadata_with_score_spec.rb +96 -0
  134. data/spec/spec_helper.rb +1 -1
  135. data/trieve_ruby_client-0.6.0.gem +0 -0
  136. data/trieve_ruby_client-0.6.2.gem +0 -0
  137. data/trieve_ruby_client.gemspec +1 -1
  138. metadata +36 -2
@@ -0,0 +1,259 @@
1
+ =begin
2
+ #Trieve API
3
+
4
+ #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
+
6
+ The version of the OpenAPI document: 0.6.7
7
+ Contact: developers@trieve.ai
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrieveRubyClient
17
+ class GroupScoreChunk
18
+ attr_accessor :group_id
19
+
20
+ attr_accessor :group_name
21
+
22
+ attr_accessor :group_tracking_id
23
+
24
+ attr_accessor :metadata
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'group_id' => :'group_id',
30
+ :'group_name' => :'group_name',
31
+ :'group_tracking_id' => :'group_tracking_id',
32
+ :'metadata' => :'metadata'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'group_id' => :'String',
45
+ :'group_name' => :'String',
46
+ :'group_tracking_id' => :'String',
47
+ :'metadata' => :'Array<ScoreChunkDTO>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'group_name',
55
+ :'group_tracking_id',
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrieveRubyClient::GroupScoreChunk` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrieveRubyClient::GroupScoreChunk`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'group_id')
75
+ self.group_id = attributes[:'group_id']
76
+ else
77
+ self.group_id = nil
78
+ end
79
+
80
+ if attributes.key?(:'group_name')
81
+ self.group_name = attributes[:'group_name']
82
+ end
83
+
84
+ if attributes.key?(:'group_tracking_id')
85
+ self.group_tracking_id = attributes[:'group_tracking_id']
86
+ end
87
+
88
+ if attributes.key?(:'metadata')
89
+ if (value = attributes[:'metadata']).is_a?(Array)
90
+ self.metadata = value
91
+ end
92
+ else
93
+ self.metadata = nil
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @group_id.nil?
103
+ invalid_properties.push('invalid value for "group_id", group_id cannot be nil.')
104
+ end
105
+
106
+ if @metadata.nil?
107
+ invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @group_id.nil?
118
+ return false if @metadata.nil?
119
+ true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ group_id == o.group_id &&
128
+ group_name == o.group_name &&
129
+ group_tracking_id == o.group_tracking_id &&
130
+ metadata == o.metadata
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [group_id, group_name, group_tracking_id, metadata].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
160
+ end
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
164
+ end
165
+ new(transformed_hash)
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def self._deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = TrieveRubyClient.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end
@@ -0,0 +1,239 @@
1
+ =begin
2
+ #Trieve API
3
+
4
+ #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
+
6
+ The version of the OpenAPI document: 0.6.7
7
+ Contact: developers@trieve.ai
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrieveRubyClient
17
+ class GroupScoreSlimChunks
18
+ attr_accessor :group_id
19
+
20
+ attr_accessor :metadata
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'group_id' => :'group_id',
26
+ :'metadata' => :'metadata'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'group_id' => :'String',
39
+ :'metadata' => :'Array<ScoreSlimChunks>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrieveRubyClient::GroupScoreSlimChunks` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrieveRubyClient::GroupScoreSlimChunks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'group_id')
65
+ self.group_id = attributes[:'group_id']
66
+ else
67
+ self.group_id = nil
68
+ end
69
+
70
+ if attributes.key?(:'metadata')
71
+ if (value = attributes[:'metadata']).is_a?(Array)
72
+ self.metadata = value
73
+ end
74
+ else
75
+ self.metadata = nil
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ if @group_id.nil?
85
+ invalid_properties.push('invalid value for "group_id", group_id cannot be nil.')
86
+ end
87
+
88
+ if @metadata.nil?
89
+ invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @group_id.nil?
100
+ return false if @metadata.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ group_id == o.group_id &&
110
+ metadata == o.metadata
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [group_id, metadata].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = TrieveRubyClient.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -35,7 +35,7 @@ module TrieveRubyClient
35
35
  # Attribute type mapping.
36
36
  def self.openapi_types
37
37
  {
38
- :'metadata' => :'Array<ChunkMetadataWithFileData>',
38
+ :'metadata' => :'Array<ChunkMetadata>',
39
39
  :'score' => :'Float'
40
40
  }
41
41
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5
5
 
6
- The version of the OpenAPI document: 0.6.0
6
+ The version of the OpenAPI document: 0.6.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0