trieve_ruby_client 0.5.0 → 0.6.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 (172) hide show
  1. checksums.yaml +4 -4
  2. data/GENERATE_COMMAND.txt +1 -0
  3. data/README.md +22 -11
  4. data/docs/AddChunkToGroupData.md +4 -2
  5. data/docs/AuthApi.md +13 -7
  6. data/docs/ChunkApi.md +9 -9
  7. data/docs/ChunkGroup.md +4 -0
  8. data/docs/ChunkGroupApi.md +36 -27
  9. data/docs/CreateChunkGroupData.md +4 -0
  10. data/docs/DatasetApi.md +11 -11
  11. data/docs/EventsApi.md +2 -2
  12. data/docs/FileApi.md +3 -3
  13. data/docs/GroupScoreChunkDTO.md +2 -0
  14. data/docs/GroupSlimChunksDTO.md +20 -0
  15. data/docs/HealthApi.md +1 -1
  16. data/docs/InvitationApi.md +1 -1
  17. data/docs/MessageApi.md +1 -1
  18. data/docs/OrganizationApi.md +1 -1
  19. data/docs/Range.md +4 -4
  20. data/docs/RangeCondition.md +49 -0
  21. data/docs/ReccomendGroupChunksRequest.md +3 -1
  22. data/docs/RecommendChunksRequest.md +5 -1
  23. data/docs/RecommendChunksResponseTypes.md +49 -0
  24. data/docs/RecommendGroupChunkResponseTypes.md +49 -0
  25. data/docs/RecommendGroupChunksRequest.md +34 -0
  26. data/docs/ScoreSlimChunks.md +20 -0
  27. data/docs/SearchChunkData.md +3 -1
  28. data/docs/SearchChunkResponseTypes.md +49 -0
  29. data/docs/SearchGroupSlimChunksResult.md +22 -0
  30. data/docs/SearchOverGroupsData.md +6 -4
  31. data/docs/SearchOverGroupsResponseTypes.md +49 -0
  32. data/docs/SearchOverGroupsSlimChunksResponseBody.md +20 -0
  33. data/docs/SearchSlimChunkQueryResponseBody.md +20 -0
  34. data/docs/SearchWithinGroupData.md +3 -1
  35. data/docs/SearchWithinGroupResponseTypes.md +49 -0
  36. data/docs/SlimChunkMetadata.md +36 -0
  37. data/docs/SlimUser.md +1 -7
  38. data/docs/StripeApi.md +1 -1
  39. data/docs/TopicApi.md +9 -9
  40. data/docs/UpdateChunkData.md +2 -0
  41. data/docs/UpdateChunkGroupData.md +4 -0
  42. data/docs/UpdateGroupByTrackingIDData.md +4 -0
  43. data/docs/UpdateUserData.md +1 -7
  44. data/docs/UserApi.md +9 -9
  45. data/lib/trieve_ruby_client/api/auth_api.rb +13 -11
  46. data/lib/trieve_ruby_client/api/chunk_api.rb +7 -7
  47. data/lib/trieve_ruby_client/api/chunk_group_api.rb +38 -31
  48. data/lib/trieve_ruby_client/api/dataset_api.rb +17 -22
  49. data/lib/trieve_ruby_client/api/events_api.rb +3 -3
  50. data/lib/trieve_ruby_client/api/file_api.rb +5 -5
  51. data/lib/trieve_ruby_client/api/health_api.rb +1 -1
  52. data/lib/trieve_ruby_client/api/invitation_api.rb +1 -1
  53. data/lib/trieve_ruby_client/api/message_api.rb +1 -1
  54. data/lib/trieve_ruby_client/api/organization_api.rb +1 -1
  55. data/lib/trieve_ruby_client/api/stripe_api.rb +1 -1
  56. data/lib/trieve_ruby_client/api/topic_api.rb +11 -16
  57. data/lib/trieve_ruby_client/api/user_api.rb +11 -16
  58. data/lib/trieve_ruby_client/api_client.rb +1 -1
  59. data/lib/trieve_ruby_client/api_error.rb +1 -1
  60. data/lib/trieve_ruby_client/configuration.rb +7 -7
  61. data/lib/trieve_ruby_client/models/add_chunk_to_group_data.rb +17 -12
  62. data/lib/trieve_ruby_client/models/api_key_dto.rb +1 -1
  63. data/lib/trieve_ruby_client/models/auth_query.rb +1 -1
  64. data/lib/trieve_ruby_client/models/batch_queued_chunk_response.rb +1 -1
  65. data/lib/trieve_ruby_client/models/bookmark_data.rb +1 -1
  66. data/lib/trieve_ruby_client/models/bookmark_group_result.rb +1 -1
  67. data/lib/trieve_ruby_client/models/chat_message_proxy.rb +1 -1
  68. data/lib/trieve_ruby_client/models/chunk_data.rb +1 -1
  69. data/lib/trieve_ruby_client/models/chunk_filter.rb +1 -1
  70. data/lib/trieve_ruby_client/models/chunk_group.rb +22 -2
  71. data/lib/trieve_ruby_client/models/chunk_group_and_file.rb +1 -1
  72. data/lib/trieve_ruby_client/models/chunk_metadata.rb +1 -1
  73. data/lib/trieve_ruby_client/models/chunk_metadata_with_file_data.rb +1 -1
  74. data/lib/trieve_ruby_client/models/client_dataset_configuration.rb +1 -1
  75. data/lib/trieve_ruby_client/models/create_chunk_data.rb +1 -1
  76. data/lib/trieve_ruby_client/models/create_chunk_group_data.rb +26 -2
  77. data/lib/trieve_ruby_client/models/create_dataset_request.rb +1 -1
  78. data/lib/trieve_ruby_client/models/create_message_data.rb +1 -1
  79. data/lib/trieve_ruby_client/models/create_organization_data.rb +1 -1
  80. data/lib/trieve_ruby_client/models/create_topic_data.rb +1 -1
  81. data/lib/trieve_ruby_client/models/dataset.rb +1 -1
  82. data/lib/trieve_ruby_client/models/dataset_and_usage.rb +1 -1
  83. data/lib/trieve_ruby_client/models/dataset_dto.rb +1 -1
  84. data/lib/trieve_ruby_client/models/dataset_usage_count.rb +1 -1
  85. data/lib/trieve_ruby_client/models/delete_topic_data.rb +1 -1
  86. data/lib/trieve_ruby_client/models/delete_user_api_key_request.rb +1 -1
  87. data/lib/trieve_ruby_client/models/edit_message_data.rb +1 -1
  88. data/lib/trieve_ruby_client/models/error_response_body.rb +1 -1
  89. data/lib/trieve_ruby_client/models/event.rb +1 -1
  90. data/lib/trieve_ruby_client/models/event_return.rb +1 -1
  91. data/lib/trieve_ruby_client/models/field_condition.rb +1 -1
  92. data/lib/trieve_ruby_client/models/file.rb +1 -1
  93. data/lib/trieve_ruby_client/models/file_dto.rb +1 -1
  94. data/lib/trieve_ruby_client/models/generate_chunks_request.rb +1 -1
  95. data/lib/trieve_ruby_client/models/get_events_data.rb +1 -1
  96. data/lib/trieve_ruby_client/models/get_groups_for_chunks_data.rb +1 -1
  97. data/lib/trieve_ruby_client/models/group_data.rb +1 -1
  98. data/lib/trieve_ruby_client/models/group_score_chunk_dto.rb +12 -2
  99. data/lib/trieve_ruby_client/models/group_slim_chunks_dto.rb +239 -0
  100. data/lib/trieve_ruby_client/models/invitation_data.rb +1 -1
  101. data/lib/trieve_ruby_client/models/match_condition.rb +1 -1
  102. data/lib/trieve_ruby_client/models/message.rb +1 -1
  103. data/lib/trieve_ruby_client/models/organization.rb +1 -1
  104. data/lib/trieve_ruby_client/models/organization_usage_count.rb +1 -1
  105. data/lib/trieve_ruby_client/models/range.rb +5 -5
  106. data/lib/trieve_ruby_client/models/range_condition.rb +105 -0
  107. data/lib/trieve_ruby_client/models/reccomend_group_chunks_request.rb +17 -6
  108. data/lib/trieve_ruby_client/models/recommend_chunks_request.rb +28 -6
  109. data/lib/trieve_ruby_client/models/recommend_chunks_response_types.rb +105 -0
  110. data/lib/trieve_ruby_client/models/recommend_group_chunk_response_types.rb +105 -0
  111. data/lib/trieve_ruby_client/models/recommend_group_chunks_request.rb +341 -0
  112. data/lib/trieve_ruby_client/models/regenerate_message_data.rb +1 -1
  113. data/lib/trieve_ruby_client/models/return_queued_chunk.rb +1 -1
  114. data/lib/trieve_ruby_client/models/score_chunk_dto.rb +1 -1
  115. data/lib/trieve_ruby_client/models/score_slim_chunks.rb +239 -0
  116. data/lib/trieve_ruby_client/models/search_chunk_data.rb +14 -3
  117. data/lib/trieve_ruby_client/models/search_chunk_query_response_body.rb +1 -1
  118. data/lib/trieve_ruby_client/models/search_chunk_response_types.rb +105 -0
  119. data/lib/trieve_ruby_client/models/search_group_slim_chunks_result.rb +255 -0
  120. data/lib/trieve_ruby_client/models/search_groups_result.rb +1 -1
  121. data/lib/trieve_ruby_client/models/search_over_groups_data.rb +19 -7
  122. data/lib/trieve_ruby_client/models/search_over_groups_response_body.rb +1 -1
  123. data/lib/trieve_ruby_client/models/search_over_groups_response_types.rb +105 -0
  124. data/lib/trieve_ruby_client/models/search_over_groups_slim_chunks_response_body.rb +239 -0
  125. data/lib/trieve_ruby_client/models/search_slim_chunk_query_response_body.rb +239 -0
  126. data/lib/trieve_ruby_client/models/search_within_group_data.rb +14 -3
  127. data/lib/trieve_ruby_client/models/search_within_group_response_types.rb +105 -0
  128. data/lib/trieve_ruby_client/models/set_user_api_key_request.rb +1 -1
  129. data/lib/trieve_ruby_client/models/set_user_api_key_response.rb +1 -1
  130. data/lib/trieve_ruby_client/models/single_queued_chunk_response.rb +1 -1
  131. data/lib/trieve_ruby_client/models/slim_chunk_metadata.rb +329 -0
  132. data/lib/trieve_ruby_client/models/slim_group.rb +1 -1
  133. data/lib/trieve_ruby_client/models/slim_user.rb +5 -41
  134. data/lib/trieve_ruby_client/models/stripe_plan.rb +1 -1
  135. data/lib/trieve_ruby_client/models/suggested_queries_request.rb +1 -1
  136. data/lib/trieve_ruby_client/models/suggested_queries_response.rb +1 -1
  137. data/lib/trieve_ruby_client/models/topic.rb +1 -1
  138. data/lib/trieve_ruby_client/models/update_chunk_by_tracking_id_data.rb +1 -1
  139. data/lib/trieve_ruby_client/models/update_chunk_data.rb +15 -2
  140. data/lib/trieve_ruby_client/models/update_chunk_group_data.rb +26 -2
  141. data/lib/trieve_ruby_client/models/update_dataset_request.rb +1 -1
  142. data/lib/trieve_ruby_client/models/update_group_by_tracking_id_data.rb +26 -2
  143. data/lib/trieve_ruby_client/models/update_organization_data.rb +1 -1
  144. data/lib/trieve_ruby_client/models/update_topic_data.rb +1 -1
  145. data/lib/trieve_ruby_client/models/update_user_data.rb +6 -39
  146. data/lib/trieve_ruby_client/models/upload_file_data.rb +1 -1
  147. data/lib/trieve_ruby_client/models/upload_file_result.rb +1 -1
  148. data/lib/trieve_ruby_client/models/user_organization.rb +1 -1
  149. data/lib/trieve_ruby_client/version.rb +2 -2
  150. data/lib/trieve_ruby_client.rb +14 -3
  151. data/openapi-generator.yaml +1 -1
  152. data/openapi.json +679 -261
  153. data/spec/models/group_slim_chunks_dto_spec.rb +42 -0
  154. data/spec/models/range_condition_spec.rb +32 -0
  155. data/spec/models/recommend_chunks_response_types_spec.rb +32 -0
  156. data/spec/models/recommend_group_chunk_response_types_spec.rb +32 -0
  157. data/spec/models/recommend_group_chunks_request_spec.rb +84 -0
  158. data/spec/models/score_slim_chunks_spec.rb +42 -0
  159. data/spec/models/search_chunk_response_types_spec.rb +32 -0
  160. data/spec/models/search_group_slim_chunks_result_spec.rb +48 -0
  161. data/spec/models/search_over_groups_response_types_spec.rb +32 -0
  162. data/spec/models/search_over_groups_slim_chunks_response_body_spec.rb +42 -0
  163. data/spec/models/search_slim_chunk_query_response_body_spec.rb +42 -0
  164. data/spec/models/search_within_group_response_types_spec.rb +32 -0
  165. data/spec/models/slim_chunk_metadata_spec.rb +90 -0
  166. data/spec/spec_helper.rb +1 -1
  167. data/trieve_ruby_client-0.5.0.gem +0 -0
  168. data/trieve_ruby_client-0.5.7.gem +0 -0
  169. data/trieve_ruby_client.gemspec +1 -1
  170. metadata +57 -4
  171. data/trieve_ruby_client-0.3.5.gem +0 -0
  172. data/trieve_ruby_client-0.4.0.gem +0 -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.5.0
6
+ The version of the OpenAPI document: 0.6.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -20,6 +20,7 @@ module TrieveRubyClient
20
20
  # Set get_collisions to true to get the collisions for each chunk. This will only apply if environment variable COLLISIONS_ENABLED is set to true.
21
21
  attr_accessor :get_collisions
22
22
 
23
+ # Group_size is the number of chunks to fetch for each group. The default is 3. If a group has less than group_size chunks, all chunks will be returned. If this is set to a large number, we recommend setting slim_chunks to true to avoid returning the content and chunk_html of the chunks so as to lower the amount of time required for content download and serialization.
23
24
  attr_accessor :group_size
24
25
 
25
26
  # Set highlight_delimiters to a list of strings to use as delimiters for highlighting. If not specified, this defaults to [\"?\", \",\", \".\", \"!\"].
@@ -28,10 +29,10 @@ module TrieveRubyClient
28
29
  # Set highlight_results to true to highlight the results. If not specified, this defaults to true.
29
30
  attr_accessor :highlight_results
30
31
 
31
- # Page of chunks to fetch. Each page is 10 chunks. Support for custom page size is coming soon.
32
+ # Page of group results to fetch. Page is 1-indexed.
32
33
  attr_accessor :page
33
34
 
34
- # Page size is the number of chunks to fetch. This can be used to fetch more than 10 chunks at a time.
35
+ # Page size is the number of group results to fetch. The default is 10.
35
36
  attr_accessor :page_size
36
37
 
37
38
  # Query is the search query. This can be any string. The query will be used to create an embedding vector and/or SPLADE vector which will be used to find the result set.
@@ -43,6 +44,9 @@ module TrieveRubyClient
43
44
  # Can be either \"semantic\", \"fulltext\", or \"hybrid\". \"hybrid\" will pull in one page (10 chunks) of both semantic and full-text results then re-rank them using BAAI/bge-reranker-large. \"semantic\" will pull in one page (10 chunks) of the nearest cosine distant vectors. \"fulltext\" will pull in one page (10 chunks) of full-text results based on SPLADE.
44
45
  attr_accessor :search_type
45
46
 
47
+ # Set slim_chunks to true to avoid returning the content and chunk_html of the chunks. This is useful for when you want to reduce amount of data over the wire for latency improvement. Default is false.
48
+ attr_accessor :slim_chunks
49
+
46
50
  # Attribute mapping from ruby-style variable name to JSON key.
47
51
  def self.attribute_map
48
52
  {
@@ -55,7 +59,8 @@ module TrieveRubyClient
55
59
  :'page_size' => :'page_size',
56
60
  :'query' => :'query',
57
61
  :'score_threshold' => :'score_threshold',
58
- :'search_type' => :'search_type'
62
+ :'search_type' => :'search_type',
63
+ :'slim_chunks' => :'slim_chunks'
59
64
  }
60
65
  end
61
66
 
@@ -76,7 +81,8 @@ module TrieveRubyClient
76
81
  :'page_size' => :'Integer',
77
82
  :'query' => :'String',
78
83
  :'score_threshold' => :'Float',
79
- :'search_type' => :'String'
84
+ :'search_type' => :'String',
85
+ :'slim_chunks' => :'Boolean'
80
86
  }
81
87
  end
82
88
 
@@ -91,6 +97,7 @@ module TrieveRubyClient
91
97
  :'page',
92
98
  :'page_size',
93
99
  :'score_threshold',
100
+ :'slim_chunks'
94
101
  ])
95
102
  end
96
103
 
@@ -154,6 +161,10 @@ module TrieveRubyClient
154
161
  else
155
162
  self.search_type = nil
156
163
  end
164
+
165
+ if attributes.key?(:'slim_chunks')
166
+ self.slim_chunks = attributes[:'slim_chunks']
167
+ end
157
168
  end
158
169
 
159
170
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -240,7 +251,8 @@ module TrieveRubyClient
240
251
  page_size == o.page_size &&
241
252
  query == o.query &&
242
253
  score_threshold == o.score_threshold &&
243
- search_type == o.search_type
254
+ search_type == o.search_type &&
255
+ slim_chunks == o.slim_chunks
244
256
  end
245
257
 
246
258
  # @see the `==` method
@@ -252,7 +264,7 @@ module TrieveRubyClient
252
264
  # Calculates hash code according to all attributes.
253
265
  # @return [Integer] Hash code
254
266
  def hash
255
- [filters, get_collisions, group_size, highlight_delimiters, highlight_results, page, page_size, query, score_threshold, search_type].hash
267
+ [filters, get_collisions, group_size, highlight_delimiters, highlight_results, page, page_size, query, score_threshold, search_type, slim_chunks].hash
256
268
  end
257
269
 
258
270
  # Builds the object from hash
@@ -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.5.0
6
+ The version of the OpenAPI document: 0.6.0
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -0,0 +1,105 @@
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.0
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
+ module SearchOverGroupsResponseTypes
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'SearchOverGroupsResponseBody',
23
+ :'SearchOverGroupsSlimChunksResponseBody'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = TrieveRubyClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ 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.0
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 SearchOverGroupsSlimChunksResponseBody
18
+ attr_accessor :group_chunks
19
+
20
+ attr_accessor :total_chunk_pages
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'group_chunks' => :'group_chunks',
26
+ :'total_chunk_pages' => :'total_chunk_pages'
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_chunks' => :'Array<GroupSlimChunksDTO>',
39
+ :'total_chunk_pages' => :'Integer'
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::SearchOverGroupsSlimChunksResponseBody` 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::SearchOverGroupsSlimChunksResponseBody`. 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_chunks')
65
+ if (value = attributes[:'group_chunks']).is_a?(Array)
66
+ self.group_chunks = value
67
+ end
68
+ else
69
+ self.group_chunks = nil
70
+ end
71
+
72
+ if attributes.key?(:'total_chunk_pages')
73
+ self.total_chunk_pages = attributes[:'total_chunk_pages']
74
+ else
75
+ self.total_chunk_pages = 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_chunks.nil?
85
+ invalid_properties.push('invalid value for "group_chunks", group_chunks cannot be nil.')
86
+ end
87
+
88
+ if @total_chunk_pages.nil?
89
+ invalid_properties.push('invalid value for "total_chunk_pages", total_chunk_pages 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_chunks.nil?
100
+ return false if @total_chunk_pages.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_chunks == o.group_chunks &&
110
+ total_chunk_pages == o.total_chunk_pages
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_chunks, total_chunk_pages].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
@@ -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.0
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 SearchSlimChunkQueryResponseBody
18
+ attr_accessor :score_chunks
19
+
20
+ attr_accessor :total_chunk_pages
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'score_chunks' => :'score_chunks',
26
+ :'total_chunk_pages' => :'total_chunk_pages'
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
+ :'score_chunks' => :'Array<ScoreSlimChunks>',
39
+ :'total_chunk_pages' => :'Integer'
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::SearchSlimChunkQueryResponseBody` 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::SearchSlimChunkQueryResponseBody`. 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?(:'score_chunks')
65
+ if (value = attributes[:'score_chunks']).is_a?(Array)
66
+ self.score_chunks = value
67
+ end
68
+ else
69
+ self.score_chunks = nil
70
+ end
71
+
72
+ if attributes.key?(:'total_chunk_pages')
73
+ self.total_chunk_pages = attributes[:'total_chunk_pages']
74
+ else
75
+ self.total_chunk_pages = 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 @score_chunks.nil?
85
+ invalid_properties.push('invalid value for "score_chunks", score_chunks cannot be nil.')
86
+ end
87
+
88
+ if @total_chunk_pages.nil?
89
+ invalid_properties.push('invalid value for "total_chunk_pages", total_chunk_pages 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 @score_chunks.nil?
100
+ return false if @total_chunk_pages.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
+ score_chunks == o.score_chunks &&
110
+ total_chunk_pages == o.total_chunk_pages
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
+ [score_chunks, total_chunk_pages].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