trieve_ruby_client 0.8.2 → 0.10.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 (219) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +39 -30
  3. data/docs/ApiKeyRespBody.md +32 -0
  4. data/docs/AutocompleteData.md +42 -0
  5. data/docs/AutocompleteReqPayload.md +50 -0
  6. data/docs/BoostPhrase.md +20 -0
  7. data/docs/ChunkApi.md +140 -66
  8. data/docs/ChunkData.md +3 -1
  9. data/docs/ChunkFilter.md +3 -3
  10. data/docs/ChunkGroup.md +1 -1
  11. data/docs/ChunkGroupApi.md +35 -33
  12. data/docs/ChunkMetadata.md +5 -1
  13. data/docs/ChunkMetadataStringTagSet.md +46 -0
  14. data/docs/ChunkMetadataTypes.md +51 -0
  15. data/docs/ChunkReqPayload.md +50 -0
  16. data/docs/ClientDatasetConfiguration.md +0 -2
  17. data/docs/ConditionType.md +49 -0
  18. data/docs/ContentChunkMetadata.md +32 -0
  19. data/docs/CreateChunkGroupReqPayload.md +28 -0
  20. data/docs/CreateChunkReqPayloadEnum.md +49 -0
  21. data/docs/CreateDatasetRequest.md +2 -2
  22. data/docs/CreateMessageData.md +2 -2
  23. data/docs/CreateMessageReqPayload.md +42 -0
  24. data/docs/CreateTopicReqPayload.md +22 -0
  25. data/docs/Dataset.md +2 -0
  26. data/docs/DatasetApi.md +236 -12
  27. data/docs/DateRange.md +24 -0
  28. data/docs/EditMessageReqPayload.md +44 -0
  29. data/docs/FieldCondition.md +2 -0
  30. data/docs/File.md +1 -1
  31. data/docs/FileApi.md +7 -7
  32. data/docs/GenerateChunksRequest.md +2 -0
  33. data/docs/GetDatasetsPagination.md +20 -0
  34. data/docs/HasIDCondition.md +20 -0
  35. data/docs/InvitationApi.md +1 -1
  36. data/docs/MatchCondition.md +3 -1
  37. data/docs/MessageApi.md +42 -42
  38. data/docs/Organization.md +2 -0
  39. data/docs/OrganizationApi.md +24 -25
  40. data/docs/RangeCondition.md +1 -3
  41. data/docs/RegenerateMessageReqPayload.md +40 -0
  42. data/docs/RemoveChunkFromGroupReqPayload.md +18 -0
  43. data/docs/ScoreChunkDTO.md +3 -1
  44. data/docs/SearchChunkData.md +9 -3
  45. data/docs/SearchChunksReqPayload.md +54 -0
  46. data/docs/SearchOverGroupsData.md +10 -2
  47. data/docs/SearchWithinGroupData.md +12 -2
  48. data/docs/SetUserApiKeyRequest.md +4 -0
  49. data/docs/SlimChunkMetadata.md +4 -0
  50. data/docs/SuggestedQueriesReqPayload.md +18 -0
  51. data/docs/TopicApi.md +16 -16
  52. data/docs/UpdateChunkData.md +2 -0
  53. data/docs/UpdateChunkReqPayload.md +46 -0
  54. data/docs/UpdateDatasetRequest.md +2 -0
  55. data/docs/UpdateGroupByTrackingIDReqPayload.md +26 -0
  56. data/docs/UpdateTopicReqPayload.md +20 -0
  57. data/docs/UpdateUserOrgRoleData.md +1 -1
  58. data/docs/UploadFileReqPayload.md +40 -0
  59. data/docs/UserApi.md +7 -8
  60. data/lib/trieve_ruby_client/api/auth_api.rb +1 -1
  61. data/lib/trieve_ruby_client/api/chunk_api.rb +158 -83
  62. data/lib/trieve_ruby_client/api/chunk_group_api.rb +58 -51
  63. data/lib/trieve_ruby_client/api/dataset_api.rb +224 -15
  64. data/lib/trieve_ruby_client/api/events_api.rb +1 -1
  65. data/lib/trieve_ruby_client/api/file_api.rb +12 -12
  66. data/lib/trieve_ruby_client/api/health_api.rb +1 -1
  67. data/lib/trieve_ruby_client/api/invitation_api.rb +3 -3
  68. data/lib/trieve_ruby_client/api/message_api.rb +50 -50
  69. data/lib/trieve_ruby_client/api/organization_api.rb +27 -27
  70. data/lib/trieve_ruby_client/api/stripe_api.rb +1 -1
  71. data/lib/trieve_ruby_client/api/topic_api.rb +27 -27
  72. data/lib/trieve_ruby_client/api/user_api.rb +8 -8
  73. data/lib/trieve_ruby_client/api_client.rb +1 -1
  74. data/lib/trieve_ruby_client/api_error.rb +1 -1
  75. data/lib/trieve_ruby_client/configuration.rb +1 -1
  76. data/lib/trieve_ruby_client/models/add_chunk_to_group_data.rb +1 -1
  77. data/lib/trieve_ruby_client/models/api_key_dto.rb +1 -1
  78. data/lib/trieve_ruby_client/models/api_key_resp_body.rb +325 -0
  79. data/lib/trieve_ruby_client/models/auth_query.rb +1 -1
  80. data/lib/trieve_ruby_client/models/autocomplete_data.rb +378 -0
  81. data/lib/trieve_ruby_client/models/autocomplete_req_payload.rb +467 -0
  82. data/lib/trieve_ruby_client/models/batch_queued_chunk_response.rb +1 -1
  83. data/lib/trieve_ruby_client/models/bookmark_data.rb +1 -1
  84. data/lib/trieve_ruby_client/models/bookmark_group_result.rb +1 -1
  85. data/lib/trieve_ruby_client/models/boost_phrase.rb +240 -0
  86. data/lib/trieve_ruby_client/models/chat_message_proxy.rb +1 -1
  87. data/lib/trieve_ruby_client/models/chunk_data.rb +16 -9
  88. data/lib/trieve_ruby_client/models/chunk_filter.rb +4 -4
  89. data/lib/trieve_ruby_client/models/chunk_group.rb +5 -3
  90. data/lib/trieve_ruby_client/models/chunk_group_and_file.rb +1 -1
  91. data/lib/trieve_ruby_client/models/chunk_metadata.rb +28 -4
  92. data/lib/trieve_ruby_client/models/chunk_metadata_string_tag_set.rb +387 -0
  93. data/lib/trieve_ruby_client/models/chunk_metadata_types.rb +106 -0
  94. data/lib/trieve_ruby_client/models/chunk_metadata_with_score.rb +1 -1
  95. data/lib/trieve_ruby_client/models/chunk_req_payload.rb +400 -0
  96. data/lib/trieve_ruby_client/models/client_dataset_configuration.rb +2 -18
  97. data/lib/trieve_ruby_client/models/condition_type.rb +105 -0
  98. data/lib/trieve_ruby_client/models/content_chunk_metadata.rb +299 -0
  99. data/lib/trieve_ruby_client/models/create_chunk_data.rb +1 -1
  100. data/lib/trieve_ruby_client/models/create_chunk_group_data.rb +1 -1
  101. data/lib/trieve_ruby_client/models/create_chunk_group_req_payload.rb +273 -0
  102. data/lib/trieve_ruby_client/models/create_chunk_req_payload_enum.rb +105 -0
  103. data/lib/trieve_ruby_client/models/create_dataset_request.rb +3 -3
  104. data/lib/trieve_ruby_client/models/create_message_data.rb +13 -13
  105. data/lib/trieve_ruby_client/models/create_message_req_payload.rb +378 -0
  106. data/lib/trieve_ruby_client/models/create_organization_data.rb +1 -1
  107. data/lib/trieve_ruby_client/models/create_topic_data.rb +1 -1
  108. data/lib/trieve_ruby_client/models/create_topic_req_payload.rb +244 -0
  109. data/lib/trieve_ruby_client/models/dataset.rb +18 -2
  110. data/lib/trieve_ruby_client/models/dataset_and_usage.rb +1 -1
  111. data/lib/trieve_ruby_client/models/dataset_dto.rb +1 -1
  112. data/lib/trieve_ruby_client/models/dataset_usage_count.rb +1 -1
  113. data/lib/trieve_ruby_client/models/date_range.rb +245 -0
  114. data/lib/trieve_ruby_client/models/delete_topic_data.rb +1 -1
  115. data/lib/trieve_ruby_client/models/delete_user_api_key_request.rb +1 -1
  116. data/lib/trieve_ruby_client/models/edit_message_data.rb +1 -1
  117. data/lib/trieve_ruby_client/models/edit_message_req_payload.rb +395 -0
  118. data/lib/trieve_ruby_client/models/error_response_body.rb +1 -1
  119. data/lib/trieve_ruby_client/models/event.rb +1 -1
  120. data/lib/trieve_ruby_client/models/event_return.rb +1 -1
  121. data/lib/trieve_ruby_client/models/field_condition.rb +12 -2
  122. data/lib/trieve_ruby_client/models/file.rb +5 -3
  123. data/lib/trieve_ruby_client/models/file_dto.rb +1 -1
  124. data/lib/trieve_ruby_client/models/generate_chunks_request.rb +13 -2
  125. data/lib/trieve_ruby_client/models/geo_info.rb +1 -1
  126. data/lib/trieve_ruby_client/models/geo_types.rb +1 -1
  127. data/lib/trieve_ruby_client/models/get_chunks_data.rb +1 -1
  128. data/lib/trieve_ruby_client/models/get_datasets_pagination.rb +225 -0
  129. data/lib/trieve_ruby_client/models/get_events_data.rb +1 -1
  130. data/lib/trieve_ruby_client/models/get_groups_for_chunks_data.rb +1 -1
  131. data/lib/trieve_ruby_client/models/get_tracking_chunks_data.rb +1 -1
  132. data/lib/trieve_ruby_client/models/group_data.rb +1 -1
  133. data/lib/trieve_ruby_client/models/group_score_chunk.rb +1 -1
  134. data/lib/trieve_ruby_client/models/has_id_condition.rb +229 -0
  135. data/lib/trieve_ruby_client/models/invitation_data.rb +1 -1
  136. data/lib/trieve_ruby_client/models/location_bounding_box.rb +1 -1
  137. data/lib/trieve_ruby_client/models/location_polygon.rb +1 -1
  138. data/lib/trieve_ruby_client/models/location_radius.rb +1 -1
  139. data/lib/trieve_ruby_client/models/match_condition.rb +2 -1
  140. data/lib/trieve_ruby_client/models/message.rb +1 -1
  141. data/lib/trieve_ruby_client/models/organization.rb +18 -2
  142. data/lib/trieve_ruby_client/models/organization_usage_count.rb +1 -1
  143. data/lib/trieve_ruby_client/models/range.rb +1 -1
  144. data/lib/trieve_ruby_client/models/range_condition.rb +2 -3
  145. data/lib/trieve_ruby_client/models/recommend_chunks_request.rb +1 -1
  146. data/lib/trieve_ruby_client/models/recommend_group_chunks_request.rb +1 -1
  147. data/lib/trieve_ruby_client/models/regenerate_message_data.rb +1 -1
  148. data/lib/trieve_ruby_client/models/regenerate_message_req_payload.rb +361 -0
  149. data/lib/trieve_ruby_client/models/remove_chunk_from_group_req_payload.rb +222 -0
  150. data/lib/trieve_ruby_client/models/return_queued_chunk.rb +1 -1
  151. data/lib/trieve_ruby_client/models/score_chunk_dto.rb +15 -3
  152. data/lib/trieve_ruby_client/models/search_chunk_data.rb +40 -5
  153. data/lib/trieve_ruby_client/models/search_chunk_query_response_body.rb +1 -1
  154. data/lib/trieve_ruby_client/models/search_chunks_req_payload.rb +504 -0
  155. data/lib/trieve_ruby_client/models/search_over_groups_data.rb +93 -4
  156. data/lib/trieve_ruby_client/models/search_over_groups_results.rb +1 -1
  157. data/lib/trieve_ruby_client/models/search_within_group_data.rb +106 -4
  158. data/lib/trieve_ruby_client/models/search_within_group_results.rb +1 -1
  159. data/lib/trieve_ruby_client/models/set_user_api_key_request.rb +28 -2
  160. data/lib/trieve_ruby_client/models/set_user_api_key_response.rb +1 -1
  161. data/lib/trieve_ruby_client/models/single_queued_chunk_response.rb +1 -1
  162. data/lib/trieve_ruby_client/models/slim_chunk_metadata.rb +24 -2
  163. data/lib/trieve_ruby_client/models/slim_chunk_metadata_with_score.rb +1 -1
  164. data/lib/trieve_ruby_client/models/slim_group.rb +1 -1
  165. data/lib/trieve_ruby_client/models/slim_user.rb +1 -1
  166. data/lib/trieve_ruby_client/models/stripe_plan.rb +1 -1
  167. data/lib/trieve_ruby_client/models/suggested_queries_req_payload.rb +222 -0
  168. data/lib/trieve_ruby_client/models/suggested_queries_request.rb +1 -1
  169. data/lib/trieve_ruby_client/models/suggested_queries_response.rb +1 -1
  170. data/lib/trieve_ruby_client/models/topic.rb +1 -1
  171. data/lib/trieve_ruby_client/models/update_chunk_by_tracking_id_data.rb +1 -1
  172. data/lib/trieve_ruby_client/models/update_chunk_data.rb +15 -2
  173. data/lib/trieve_ruby_client/models/update_chunk_group_data.rb +1 -1
  174. data/lib/trieve_ruby_client/models/update_chunk_req_payload.rb +376 -0
  175. data/lib/trieve_ruby_client/models/update_dataset_request.rb +13 -2
  176. data/lib/trieve_ruby_client/models/update_group_by_tracking_id_data.rb +1 -1
  177. data/lib/trieve_ruby_client/models/update_group_by_tracking_id_req_payload.rb +268 -0
  178. data/lib/trieve_ruby_client/models/update_organization_data.rb +1 -1
  179. data/lib/trieve_ruby_client/models/update_topic_data.rb +1 -1
  180. data/lib/trieve_ruby_client/models/update_topic_req_payload.rb +239 -0
  181. data/lib/trieve_ruby_client/models/update_user_org_role_data.rb +2 -2
  182. data/lib/trieve_ruby_client/models/upload_file_data.rb +1 -1
  183. data/lib/trieve_ruby_client/models/upload_file_req_payload.rb +368 -0
  184. data/lib/trieve_ruby_client/models/upload_file_result.rb +1 -1
  185. data/lib/trieve_ruby_client/models/user_organization.rb +1 -1
  186. data/lib/trieve_ruby_client/version.rb +2 -2
  187. data/lib/trieve_ruby_client.rb +25 -20
  188. data/openapi-generator.yaml +1 -1
  189. data/openapi.json +1 -7789
  190. data/spec/models/api_key_resp_body_spec.rb +78 -0
  191. data/spec/models/autocomplete_data_spec.rb +108 -0
  192. data/spec/models/autocomplete_req_payload_spec.rb +132 -0
  193. data/spec/models/boost_phrase_spec.rb +42 -0
  194. data/spec/models/chunk_metadata_string_tag_set_spec.rb +120 -0
  195. data/spec/models/chunk_metadata_types_spec.rb +32 -0
  196. data/spec/models/chunk_req_payload_spec.rb +132 -0
  197. data/spec/models/condition_type_spec.rb +32 -0
  198. data/spec/models/content_chunk_metadata_spec.rb +72 -0
  199. data/spec/models/create_chunk_group_req_payload_spec.rb +66 -0
  200. data/spec/models/create_chunk_req_payload_enum_spec.rb +32 -0
  201. data/spec/models/create_message_req_payload_spec.rb +108 -0
  202. data/spec/models/create_topic_req_payload_spec.rb +48 -0
  203. data/spec/models/date_range_spec.rb +54 -0
  204. data/spec/models/edit_message_req_payload_spec.rb +114 -0
  205. data/spec/models/get_datasets_pagination_spec.rb +42 -0
  206. data/spec/models/has_id_condition_spec.rb +42 -0
  207. data/spec/models/regenerate_message_req_payload_spec.rb +102 -0
  208. data/spec/models/remove_chunk_from_group_req_payload_spec.rb +36 -0
  209. data/spec/models/search_chunks_req_payload_spec.rb +144 -0
  210. data/spec/models/suggested_queries_req_payload_spec.rb +36 -0
  211. data/spec/models/update_chunk_req_payload_spec.rb +120 -0
  212. data/spec/models/update_group_by_tracking_id_req_payload_spec.rb +60 -0
  213. data/spec/models/update_topic_req_payload_spec.rb +42 -0
  214. data/spec/models/upload_file_req_payload_spec.rb +102 -0
  215. data/spec/spec_helper.rb +1 -1
  216. data/trieve_ruby_client-0.8.2.gem +0 -0
  217. data/trieve_ruby_client-0.8.5.gem +0 -0
  218. data/trieve_ruby_client.gemspec +1 -1
  219. metadata +104 -2
@@ -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.8.2
6
+ The version of the OpenAPI document: 0.8.5
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -15,6 +15,9 @@ require 'time'
15
15
 
16
16
  module TrieveRubyClient
17
17
  class SearchChunkData
18
+ # Set content_only to true to only returning the chunk_html of the chunks. This is useful for when you want to reduce amount of data over the wire for latency improvement (typically 10-50ms). Default is false.
19
+ attr_accessor :content_only
20
+
18
21
  attr_accessor :filters
19
22
 
20
23
  # 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.
@@ -26,9 +29,12 @@ module TrieveRubyClient
26
29
  # Set highlight_delimiters to a list of strings to use as delimiters for highlighting. If not specified, this defaults to [\"?\", \",\", \".\", \"!\"].
27
30
  attr_accessor :highlight_delimiters
28
31
 
29
- # Set highlight_results to false for a slight latency improvement (1-10ms). If not specified, this defaults to true. This will add <b><mark> tags to the chunk_html of the chunks to highlight matching sub-sentences.
32
+ # Set highlight_results to false for a slight latency improvement (1-10ms). If not specified, this defaults to true. This will add `<b><mark>` tags to the chunk_html of the chunks to highlight matching sub-sentences.
30
33
  attr_accessor :highlight_results
31
34
 
35
+ # Set highlight_threshold to a lower or higher value to adjust the sensitivity of the highlights applied to the chunk html. If not specified, this defaults to 0.8. The range is 0.0 to 1.0.
36
+ attr_accessor :highlight_threshold
37
+
32
38
  # Page of chunks to fetch. Page is 1-indexed.
33
39
  attr_accessor :page
34
40
 
@@ -44,23 +50,28 @@ module TrieveRubyClient
44
50
  # Set score_threshold to a float to filter out chunks with a score below the threshold.
45
51
  attr_accessor :score_threshold
46
52
 
47
- # 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.
53
+ # Can be either \"semantic\", \"fulltext\", or \"hybrid\". If specified as \"hybrid\", it 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.
48
54
  attr_accessor :search_type
49
55
 
50
- # 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 (typicall 10-50ms). Default is false.
56
+ # 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 (typically 10-50ms). Default is false.
51
57
  attr_accessor :slim_chunks
52
58
 
59
+ # Tag weights is a JSON object which can be used to boost the ranking of chunks with certain tags. This is useful for when you want to be able to bias towards chunks with a certain tag on the fly. The keys are the tag names and the values are the weights.
60
+ attr_accessor :tag_weights
61
+
53
62
  # Set use_weights to true to use the weights of the chunks in the result set in order to sort them. If not specified, this defaults to true.
54
63
  attr_accessor :use_weights
55
64
 
56
65
  # Attribute mapping from ruby-style variable name to JSON key.
57
66
  def self.attribute_map
58
67
  {
68
+ :'content_only' => :'content_only',
59
69
  :'filters' => :'filters',
60
70
  :'get_collisions' => :'get_collisions',
61
71
  :'get_total_pages' => :'get_total_pages',
62
72
  :'highlight_delimiters' => :'highlight_delimiters',
63
73
  :'highlight_results' => :'highlight_results',
74
+ :'highlight_threshold' => :'highlight_threshold',
64
75
  :'page' => :'page',
65
76
  :'page_size' => :'page_size',
66
77
  :'query' => :'query',
@@ -68,6 +79,7 @@ module TrieveRubyClient
68
79
  :'score_threshold' => :'score_threshold',
69
80
  :'search_type' => :'search_type',
70
81
  :'slim_chunks' => :'slim_chunks',
82
+ :'tag_weights' => :'tag_weights',
71
83
  :'use_weights' => :'use_weights'
72
84
  }
73
85
  end
@@ -80,11 +92,13 @@ module TrieveRubyClient
80
92
  # Attribute type mapping.
81
93
  def self.openapi_types
82
94
  {
95
+ :'content_only' => :'Boolean',
83
96
  :'filters' => :'ChunkFilter',
84
97
  :'get_collisions' => :'Boolean',
85
98
  :'get_total_pages' => :'Boolean',
86
99
  :'highlight_delimiters' => :'Array<String>',
87
100
  :'highlight_results' => :'Boolean',
101
+ :'highlight_threshold' => :'Float',
88
102
  :'page' => :'Integer',
89
103
  :'page_size' => :'Integer',
90
104
  :'query' => :'String',
@@ -92,6 +106,7 @@ module TrieveRubyClient
92
106
  :'score_threshold' => :'Float',
93
107
  :'search_type' => :'String',
94
108
  :'slim_chunks' => :'Boolean',
109
+ :'tag_weights' => :'Hash<String, Float>',
95
110
  :'use_weights' => :'Boolean'
96
111
  }
97
112
  end
@@ -99,16 +114,19 @@ module TrieveRubyClient
99
114
  # List of attributes with nullable: true
100
115
  def self.openapi_nullable
101
116
  Set.new([
117
+ :'content_only',
102
118
  :'filters',
103
119
  :'get_collisions',
104
120
  :'get_total_pages',
105
121
  :'highlight_delimiters',
106
122
  :'highlight_results',
123
+ :'highlight_threshold',
107
124
  :'page',
108
125
  :'page_size',
109
126
  :'recency_bias',
110
127
  :'score_threshold',
111
128
  :'slim_chunks',
129
+ :'tag_weights',
112
130
  :'use_weights'
113
131
  ])
114
132
  end
@@ -128,6 +146,10 @@ module TrieveRubyClient
128
146
  h[k.to_sym] = v
129
147
  }
130
148
 
149
+ if attributes.key?(:'content_only')
150
+ self.content_only = attributes[:'content_only']
151
+ end
152
+
131
153
  if attributes.key?(:'filters')
132
154
  self.filters = attributes[:'filters']
133
155
  end
@@ -150,6 +172,10 @@ module TrieveRubyClient
150
172
  self.highlight_results = attributes[:'highlight_results']
151
173
  end
152
174
 
175
+ if attributes.key?(:'highlight_threshold')
176
+ self.highlight_threshold = attributes[:'highlight_threshold']
177
+ end
178
+
153
179
  if attributes.key?(:'page')
154
180
  self.page = attributes[:'page']
155
181
  end
@@ -182,6 +208,12 @@ module TrieveRubyClient
182
208
  self.slim_chunks = attributes[:'slim_chunks']
183
209
  end
184
210
 
211
+ if attributes.key?(:'tag_weights')
212
+ if (value = attributes[:'tag_weights']).is_a?(Hash)
213
+ self.tag_weights = value
214
+ end
215
+ end
216
+
185
217
  if attributes.key?(:'use_weights')
186
218
  self.use_weights = attributes[:'use_weights']
187
219
  end
@@ -247,11 +279,13 @@ module TrieveRubyClient
247
279
  def ==(o)
248
280
  return true if self.equal?(o)
249
281
  self.class == o.class &&
282
+ content_only == o.content_only &&
250
283
  filters == o.filters &&
251
284
  get_collisions == o.get_collisions &&
252
285
  get_total_pages == o.get_total_pages &&
253
286
  highlight_delimiters == o.highlight_delimiters &&
254
287
  highlight_results == o.highlight_results &&
288
+ highlight_threshold == o.highlight_threshold &&
255
289
  page == o.page &&
256
290
  page_size == o.page_size &&
257
291
  query == o.query &&
@@ -259,6 +293,7 @@ module TrieveRubyClient
259
293
  score_threshold == o.score_threshold &&
260
294
  search_type == o.search_type &&
261
295
  slim_chunks == o.slim_chunks &&
296
+ tag_weights == o.tag_weights &&
262
297
  use_weights == o.use_weights
263
298
  end
264
299
 
@@ -271,7 +306,7 @@ module TrieveRubyClient
271
306
  # Calculates hash code according to all attributes.
272
307
  # @return [Integer] Hash code
273
308
  def hash
274
- [filters, get_collisions, get_total_pages, highlight_delimiters, highlight_results, page, page_size, query, recency_bias, score_threshold, search_type, slim_chunks, use_weights].hash
309
+ [content_only, filters, get_collisions, get_total_pages, highlight_delimiters, highlight_results, highlight_threshold, page, page_size, query, recency_bias, score_threshold, search_type, slim_chunks, tag_weights, use_weights].hash
275
310
  end
276
311
 
277
312
  # 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.8.2
6
+ The version of the OpenAPI document: 0.10.7
7
7
  Contact: developers@trieve.ai
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.4.0
@@ -0,0 +1,504 @@
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.10.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 SearchChunksReqPayload
18
+ # Set content_only to true to only returning the chunk_html of the chunks. This is useful for when you want to reduce amount of data over the wire for latency improvement (typically 10-50ms). Default is false.
19
+ attr_accessor :content_only
20
+
21
+ attr_accessor :filters
22
+
23
+ # 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.
24
+ attr_accessor :get_collisions
25
+
26
+ # Get total page count for the query accounting for the applied filters. Defaults to false, but can be set to true when the latency penalty is acceptable (typically 50-200ms).
27
+ attr_accessor :get_total_pages
28
+
29
+ # Set highlight_delimiters to a list of strings to use as delimiters for highlighting. If not specified, this defaults to [\"?\", \",\", \".\", \"!\"]. These are the characters that will be used to split the chunk_html into splits for highlighting. These are the characters that will be used to split the chunk_html into splits for highlighting.
30
+ attr_accessor :highlight_delimiters
31
+
32
+ # Set highlight_max_length to control the maximum number of tokens (typically whitespace separated strings, but sometimes also word stems) which can be present within a single highlight. If not specified, this defaults to 8. This is useful to shorten large splits which may have low scores due to length compared to the query. Set to something very large like 100 to highlight entire splits.
33
+ attr_accessor :highlight_max_length
34
+
35
+ # Set highlight_max_num to control the maximum number of highlights per chunk. If not specified, this defaults to 3. It may be less than 3 if no snippets score above the highlight_threshold.
36
+ attr_accessor :highlight_max_num
37
+
38
+ # Set highlight_results to false for a slight latency improvement (1-10ms). If not specified, this defaults to true. This will add `<b><mark>` tags to the chunk_html of the chunks to highlight matching splits and return the highlights on each scored chunk in the response.
39
+ attr_accessor :highlight_results
40
+
41
+ # Set highlight_threshold to a lower or higher value to adjust the sensitivity of the highlights applied to the chunk html. If not specified, this defaults to 0.8. The range is 0.0 to 1.0.
42
+ attr_accessor :highlight_threshold
43
+
44
+ # Set highlight_window to a number to control the amount of words that are returned around the matched phrases. If not specified, this defaults to 0. This is useful for when you want to show more context around the matched words. When specified, window/2 whitespace separated words are added before and after each highlight in the response's highlights array. If an extended highlight overlaps with another highlight, the overlapping words are only included once.
45
+ attr_accessor :highlight_window
46
+
47
+ # Page of chunks to fetch. Page is 1-indexed.
48
+ attr_accessor :page
49
+
50
+ # Page size is the number of chunks to fetch. This can be used to fetch more than 10 chunks at a time.
51
+ attr_accessor :page_size
52
+
53
+ # 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.
54
+ attr_accessor :query
55
+
56
+ # Recency Bias lets you determine how much of an effect the recency of chunks will have on the search results. If not specified, this defaults to 0.0. We recommend setting this to 1.0 for a gentle reranking of the results, >3.0 for a strong reranking of the results.
57
+ attr_accessor :recency_bias
58
+
59
+ # Set score_threshold to a float to filter out chunks with a score below the threshold.
60
+ attr_accessor :score_threshold
61
+
62
+ # Can be either \"semantic\", \"fulltext\", or \"hybrid\". If specified as \"hybrid\", it 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.
63
+ attr_accessor :search_type
64
+
65
+ # 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 (typically 10-50ms). Default is false.
66
+ attr_accessor :slim_chunks
67
+
68
+ # Tag weights is a JSON object which can be used to boost the ranking of chunks with certain tags. This is useful for when you want to be able to bias towards chunks with a certain tag on the fly. The keys are the tag names and the values are the weights.
69
+ attr_accessor :tag_weights
70
+
71
+ # Set use_weights to true to use the weights of the chunks in the result set in order to sort them. If not specified, this defaults to true.
72
+ attr_accessor :use_weights
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ {
77
+ :'content_only' => :'content_only',
78
+ :'filters' => :'filters',
79
+ :'get_collisions' => :'get_collisions',
80
+ :'get_total_pages' => :'get_total_pages',
81
+ :'highlight_delimiters' => :'highlight_delimiters',
82
+ :'highlight_max_length' => :'highlight_max_length',
83
+ :'highlight_max_num' => :'highlight_max_num',
84
+ :'highlight_results' => :'highlight_results',
85
+ :'highlight_threshold' => :'highlight_threshold',
86
+ :'highlight_window' => :'highlight_window',
87
+ :'page' => :'page',
88
+ :'page_size' => :'page_size',
89
+ :'query' => :'query',
90
+ :'recency_bias' => :'recency_bias',
91
+ :'score_threshold' => :'score_threshold',
92
+ :'search_type' => :'search_type',
93
+ :'slim_chunks' => :'slim_chunks',
94
+ :'tag_weights' => :'tag_weights',
95
+ :'use_weights' => :'use_weights'
96
+ }
97
+ end
98
+
99
+ # Returns all the JSON keys this model knows about
100
+ def self.acceptable_attributes
101
+ attribute_map.values
102
+ end
103
+
104
+ # Attribute type mapping.
105
+ def self.openapi_types
106
+ {
107
+ :'content_only' => :'Boolean',
108
+ :'filters' => :'ChunkFilter',
109
+ :'get_collisions' => :'Boolean',
110
+ :'get_total_pages' => :'Boolean',
111
+ :'highlight_delimiters' => :'Array<String>',
112
+ :'highlight_max_length' => :'Integer',
113
+ :'highlight_max_num' => :'Integer',
114
+ :'highlight_results' => :'Boolean',
115
+ :'highlight_threshold' => :'Float',
116
+ :'highlight_window' => :'Integer',
117
+ :'page' => :'Integer',
118
+ :'page_size' => :'Integer',
119
+ :'query' => :'String',
120
+ :'recency_bias' => :'Float',
121
+ :'score_threshold' => :'Float',
122
+ :'search_type' => :'String',
123
+ :'slim_chunks' => :'Boolean',
124
+ :'tag_weights' => :'Hash<String, Float>',
125
+ :'use_weights' => :'Boolean'
126
+ }
127
+ end
128
+
129
+ # List of attributes with nullable: true
130
+ def self.openapi_nullable
131
+ Set.new([
132
+ :'content_only',
133
+ :'filters',
134
+ :'get_collisions',
135
+ :'get_total_pages',
136
+ :'highlight_delimiters',
137
+ :'highlight_max_length',
138
+ :'highlight_max_num',
139
+ :'highlight_results',
140
+ :'highlight_threshold',
141
+ :'highlight_window',
142
+ :'page',
143
+ :'page_size',
144
+ :'recency_bias',
145
+ :'score_threshold',
146
+ :'slim_chunks',
147
+ :'tag_weights',
148
+ :'use_weights'
149
+ ])
150
+ end
151
+
152
+ # Initializes the object
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ def initialize(attributes = {})
155
+ if (!attributes.is_a?(Hash))
156
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrieveRubyClient::SearchChunksReqPayload` initialize method"
157
+ end
158
+
159
+ # check to see if the attribute exists and convert string to symbol for hash key
160
+ attributes = attributes.each_with_object({}) { |(k, v), h|
161
+ if (!self.class.attribute_map.key?(k.to_sym))
162
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrieveRubyClient::SearchChunksReqPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
163
+ end
164
+ h[k.to_sym] = v
165
+ }
166
+
167
+ if attributes.key?(:'content_only')
168
+ self.content_only = attributes[:'content_only']
169
+ end
170
+
171
+ if attributes.key?(:'filters')
172
+ self.filters = attributes[:'filters']
173
+ end
174
+
175
+ if attributes.key?(:'get_collisions')
176
+ self.get_collisions = attributes[:'get_collisions']
177
+ end
178
+
179
+ if attributes.key?(:'get_total_pages')
180
+ self.get_total_pages = attributes[:'get_total_pages']
181
+ end
182
+
183
+ if attributes.key?(:'highlight_delimiters')
184
+ if (value = attributes[:'highlight_delimiters']).is_a?(Array)
185
+ self.highlight_delimiters = value
186
+ end
187
+ end
188
+
189
+ if attributes.key?(:'highlight_max_length')
190
+ self.highlight_max_length = attributes[:'highlight_max_length']
191
+ end
192
+
193
+ if attributes.key?(:'highlight_max_num')
194
+ self.highlight_max_num = attributes[:'highlight_max_num']
195
+ end
196
+
197
+ if attributes.key?(:'highlight_results')
198
+ self.highlight_results = attributes[:'highlight_results']
199
+ end
200
+
201
+ if attributes.key?(:'highlight_threshold')
202
+ self.highlight_threshold = attributes[:'highlight_threshold']
203
+ end
204
+
205
+ if attributes.key?(:'highlight_window')
206
+ self.highlight_window = attributes[:'highlight_window']
207
+ end
208
+
209
+ if attributes.key?(:'page')
210
+ self.page = attributes[:'page']
211
+ end
212
+
213
+ if attributes.key?(:'page_size')
214
+ self.page_size = attributes[:'page_size']
215
+ end
216
+
217
+ if attributes.key?(:'query')
218
+ self.query = attributes[:'query']
219
+ else
220
+ self.query = nil
221
+ end
222
+
223
+ if attributes.key?(:'recency_bias')
224
+ self.recency_bias = attributes[:'recency_bias']
225
+ end
226
+
227
+ if attributes.key?(:'score_threshold')
228
+ self.score_threshold = attributes[:'score_threshold']
229
+ end
230
+
231
+ if attributes.key?(:'search_type')
232
+ self.search_type = attributes[:'search_type']
233
+ else
234
+ self.search_type = nil
235
+ end
236
+
237
+ if attributes.key?(:'slim_chunks')
238
+ self.slim_chunks = attributes[:'slim_chunks']
239
+ end
240
+
241
+ if attributes.key?(:'tag_weights')
242
+ if (value = attributes[:'tag_weights']).is_a?(Hash)
243
+ self.tag_weights = value
244
+ end
245
+ end
246
+
247
+ if attributes.key?(:'use_weights')
248
+ self.use_weights = attributes[:'use_weights']
249
+ end
250
+ end
251
+
252
+ # Show invalid properties with the reasons. Usually used together with valid?
253
+ # @return Array for valid properties with the reasons
254
+ def list_invalid_properties
255
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
256
+ invalid_properties = Array.new
257
+ if !@highlight_max_length.nil? && @highlight_max_length < 0
258
+ invalid_properties.push('invalid value for "highlight_max_length", must be greater than or equal to 0.')
259
+ end
260
+
261
+ if !@highlight_max_num.nil? && @highlight_max_num < 0
262
+ invalid_properties.push('invalid value for "highlight_max_num", must be greater than or equal to 0.')
263
+ end
264
+
265
+ if !@highlight_window.nil? && @highlight_window < 0
266
+ invalid_properties.push('invalid value for "highlight_window", must be greater than or equal to 0.')
267
+ end
268
+
269
+ if !@page.nil? && @page < 0
270
+ invalid_properties.push('invalid value for "page", must be greater than or equal to 0.')
271
+ end
272
+
273
+ if !@page_size.nil? && @page_size < 0
274
+ invalid_properties.push('invalid value for "page_size", must be greater than or equal to 0.')
275
+ end
276
+
277
+ if @query.nil?
278
+ invalid_properties.push('invalid value for "query", query cannot be nil.')
279
+ end
280
+
281
+ if @search_type.nil?
282
+ invalid_properties.push('invalid value for "search_type", search_type cannot be nil.')
283
+ end
284
+
285
+ invalid_properties
286
+ end
287
+
288
+ # Check to see if the all the properties in the model are valid
289
+ # @return true if the model is valid
290
+ def valid?
291
+ warn '[DEPRECATED] the `valid?` method is obsolete'
292
+ return false if !@highlight_max_length.nil? && @highlight_max_length < 0
293
+ return false if !@highlight_max_num.nil? && @highlight_max_num < 0
294
+ return false if !@highlight_window.nil? && @highlight_window < 0
295
+ return false if !@page.nil? && @page < 0
296
+ return false if !@page_size.nil? && @page_size < 0
297
+ return false if @query.nil?
298
+ return false if @search_type.nil?
299
+ true
300
+ end
301
+
302
+ # Custom attribute writer method with validation
303
+ # @param [Object] highlight_max_length Value to be assigned
304
+ def highlight_max_length=(highlight_max_length)
305
+ if !highlight_max_length.nil? && highlight_max_length < 0
306
+ fail ArgumentError, 'invalid value for "highlight_max_length", must be greater than or equal to 0.'
307
+ end
308
+
309
+ @highlight_max_length = highlight_max_length
310
+ end
311
+
312
+ # Custom attribute writer method with validation
313
+ # @param [Object] highlight_max_num Value to be assigned
314
+ def highlight_max_num=(highlight_max_num)
315
+ if !highlight_max_num.nil? && highlight_max_num < 0
316
+ fail ArgumentError, 'invalid value for "highlight_max_num", must be greater than or equal to 0.'
317
+ end
318
+
319
+ @highlight_max_num = highlight_max_num
320
+ end
321
+
322
+ # Custom attribute writer method with validation
323
+ # @param [Object] highlight_window Value to be assigned
324
+ def highlight_window=(highlight_window)
325
+ if !highlight_window.nil? && highlight_window < 0
326
+ fail ArgumentError, 'invalid value for "highlight_window", must be greater than or equal to 0.'
327
+ end
328
+
329
+ @highlight_window = highlight_window
330
+ end
331
+
332
+ # Custom attribute writer method with validation
333
+ # @param [Object] page Value to be assigned
334
+ def page=(page)
335
+ if !page.nil? && page < 0
336
+ fail ArgumentError, 'invalid value for "page", must be greater than or equal to 0.'
337
+ end
338
+
339
+ @page = page
340
+ end
341
+
342
+ # Custom attribute writer method with validation
343
+ # @param [Object] page_size Value to be assigned
344
+ def page_size=(page_size)
345
+ if !page_size.nil? && page_size < 0
346
+ fail ArgumentError, 'invalid value for "page_size", must be greater than or equal to 0.'
347
+ end
348
+
349
+ @page_size = page_size
350
+ end
351
+
352
+ # Checks equality by comparing each attribute.
353
+ # @param [Object] Object to be compared
354
+ def ==(o)
355
+ return true if self.equal?(o)
356
+ self.class == o.class &&
357
+ content_only == o.content_only &&
358
+ filters == o.filters &&
359
+ get_collisions == o.get_collisions &&
360
+ get_total_pages == o.get_total_pages &&
361
+ highlight_delimiters == o.highlight_delimiters &&
362
+ highlight_max_length == o.highlight_max_length &&
363
+ highlight_max_num == o.highlight_max_num &&
364
+ highlight_results == o.highlight_results &&
365
+ highlight_threshold == o.highlight_threshold &&
366
+ highlight_window == o.highlight_window &&
367
+ page == o.page &&
368
+ page_size == o.page_size &&
369
+ query == o.query &&
370
+ recency_bias == o.recency_bias &&
371
+ score_threshold == o.score_threshold &&
372
+ search_type == o.search_type &&
373
+ slim_chunks == o.slim_chunks &&
374
+ tag_weights == o.tag_weights &&
375
+ use_weights == o.use_weights
376
+ end
377
+
378
+ # @see the `==` method
379
+ # @param [Object] Object to be compared
380
+ def eql?(o)
381
+ self == o
382
+ end
383
+
384
+ # Calculates hash code according to all attributes.
385
+ # @return [Integer] Hash code
386
+ def hash
387
+ [content_only, filters, get_collisions, get_total_pages, highlight_delimiters, highlight_max_length, highlight_max_num, highlight_results, highlight_threshold, highlight_window, page, page_size, query, recency_bias, score_threshold, search_type, slim_chunks, tag_weights, use_weights].hash
388
+ end
389
+
390
+ # Builds the object from hash
391
+ # @param [Hash] attributes Model attributes in the form of hash
392
+ # @return [Object] Returns the model itself
393
+ def self.build_from_hash(attributes)
394
+ return nil unless attributes.is_a?(Hash)
395
+ attributes = attributes.transform_keys(&:to_sym)
396
+ transformed_hash = {}
397
+ openapi_types.each_pair do |key, type|
398
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
399
+ transformed_hash["#{key}"] = nil
400
+ elsif type =~ /\AArray<(.*)>/i
401
+ # check to ensure the input is an array given that the attribute
402
+ # is documented as an array but the input is not
403
+ if attributes[attribute_map[key]].is_a?(Array)
404
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
405
+ end
406
+ elsif !attributes[attribute_map[key]].nil?
407
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
408
+ end
409
+ end
410
+ new(transformed_hash)
411
+ end
412
+
413
+ # Deserializes the data based on type
414
+ # @param string type Data type
415
+ # @param string value Value to be deserialized
416
+ # @return [Object] Deserialized data
417
+ def self._deserialize(type, value)
418
+ case type.to_sym
419
+ when :Time
420
+ Time.parse(value)
421
+ when :Date
422
+ Date.parse(value)
423
+ when :String
424
+ value.to_s
425
+ when :Integer
426
+ value.to_i
427
+ when :Float
428
+ value.to_f
429
+ when :Boolean
430
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
431
+ true
432
+ else
433
+ false
434
+ end
435
+ when :Object
436
+ # generic object (usually a Hash), return directly
437
+ value
438
+ when /\AArray<(?<inner_type>.+)>\z/
439
+ inner_type = Regexp.last_match[:inner_type]
440
+ value.map { |v| _deserialize(inner_type, v) }
441
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
442
+ k_type = Regexp.last_match[:k_type]
443
+ v_type = Regexp.last_match[:v_type]
444
+ {}.tap do |hash|
445
+ value.each do |k, v|
446
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
447
+ end
448
+ end
449
+ else # model
450
+ # models (e.g. Pet) or oneOf
451
+ klass = TrieveRubyClient.const_get(type)
452
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
453
+ end
454
+ end
455
+
456
+ # Returns the string representation of the object
457
+ # @return [String] String presentation of the object
458
+ def to_s
459
+ to_hash.to_s
460
+ end
461
+
462
+ # to_body is an alias to to_hash (backward compatibility)
463
+ # @return [Hash] Returns the object in the form of hash
464
+ def to_body
465
+ to_hash
466
+ end
467
+
468
+ # Returns the object in the form of hash
469
+ # @return [Hash] Returns the object in the form of hash
470
+ def to_hash
471
+ hash = {}
472
+ self.class.attribute_map.each_pair do |attr, param|
473
+ value = self.send(attr)
474
+ if value.nil?
475
+ is_nullable = self.class.openapi_nullable.include?(attr)
476
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
477
+ end
478
+
479
+ hash[param] = _to_hash(value)
480
+ end
481
+ hash
482
+ end
483
+
484
+ # Outputs non-array value in the form of hash
485
+ # For object, use to_hash. Otherwise, just return the value
486
+ # @param [Object] value Any valid value
487
+ # @return [Hash] Returns the value in the form of hash
488
+ def _to_hash(value)
489
+ if value.is_a?(Array)
490
+ value.compact.map { |v| _to_hash(v) }
491
+ elsif value.is_a?(Hash)
492
+ {}.tap do |hash|
493
+ value.each { |k, v| hash[k] = _to_hash(v) }
494
+ end
495
+ elsif value.respond_to? :to_hash
496
+ value.to_hash
497
+ else
498
+ value
499
+ end
500
+ end
501
+
502
+ end
503
+
504
+ end