trieve_ruby_client 0.3.4

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 (272) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +240 -0
  5. data/Rakefile +10 -0
  6. data/docs/AddChunkToGroupData.md +18 -0
  7. data/docs/ApiKeyDTO.md +28 -0
  8. data/docs/AuthApi.md +274 -0
  9. data/docs/BookmarkData.md +22 -0
  10. data/docs/BookmarkGroupResult.md +20 -0
  11. data/docs/ChatMessageProxy.md +20 -0
  12. data/docs/ChunkApi.md +955 -0
  13. data/docs/ChunkFilter.md +22 -0
  14. data/docs/ChunkGroup.md +30 -0
  15. data/docs/ChunkGroupAndFile.md +32 -0
  16. data/docs/ChunkGroupApi.md +1262 -0
  17. data/docs/ChunkMetadata.md +42 -0
  18. data/docs/ChunkMetadataWithFileData.md +44 -0
  19. data/docs/ClientDatasetConfiguration.md +38 -0
  20. data/docs/CreateChunkData.md +42 -0
  21. data/docs/CreateChunkGroupData.md +22 -0
  22. data/docs/CreateDatasetRequest.md +24 -0
  23. data/docs/CreateMessageData.md +28 -0
  24. data/docs/CreateOrganizationData.md +18 -0
  25. data/docs/CreateTopicData.md +22 -0
  26. data/docs/Dataset.md +30 -0
  27. data/docs/DatasetAndUsage.md +20 -0
  28. data/docs/DatasetApi.md +480 -0
  29. data/docs/DatasetDTO.md +28 -0
  30. data/docs/DatasetUsageCount.md +22 -0
  31. data/docs/DeleteDatasetRequest.md +18 -0
  32. data/docs/DeleteTopicData.md +18 -0
  33. data/docs/DeleteUserApiKeyRequest.md +18 -0
  34. data/docs/EditMessageData.md +30 -0
  35. data/docs/ErrorResponseBody.md +18 -0
  36. data/docs/Event.md +28 -0
  37. data/docs/EventReturn.md +20 -0
  38. data/docs/EventsApi.md +86 -0
  39. data/docs/FieldCondition.md +22 -0
  40. data/docs/File.md +36 -0
  41. data/docs/FileApi.md +326 -0
  42. data/docs/FileDTO.md +32 -0
  43. data/docs/GenerateChunksRequest.md +26 -0
  44. data/docs/GetGroupsForChunksData.md +18 -0
  45. data/docs/GroupData.md +20 -0
  46. data/docs/GroupScoreChunkDTO.md +20 -0
  47. data/docs/HealthApi.md +66 -0
  48. data/docs/InvitationApi.md +85 -0
  49. data/docs/InvitationData.md +26 -0
  50. data/docs/MatchCondition.md +49 -0
  51. data/docs/Message.md +38 -0
  52. data/docs/MessageApi.md +322 -0
  53. data/docs/Organization.md +26 -0
  54. data/docs/OrganizationApi.md +479 -0
  55. data/docs/OrganizationUsageCount.md +28 -0
  56. data/docs/Range.md +24 -0
  57. data/docs/ReccomendGroupChunksRequest.md +30 -0
  58. data/docs/RecommendChunksRequest.md +28 -0
  59. data/docs/RegenerateMessageData.md +26 -0
  60. data/docs/ReturnQueuedChunk.md +20 -0
  61. data/docs/ScoreChunkDTO.md +20 -0
  62. data/docs/SearchChunkData.md +38 -0
  63. data/docs/SearchChunkQueryResponseBody.md +20 -0
  64. data/docs/SearchGroupsResult.md +22 -0
  65. data/docs/SearchOverGroupsData.md +36 -0
  66. data/docs/SearchOverGroupsResponseBody.md +20 -0
  67. data/docs/SearchWithinGroupData.md +40 -0
  68. data/docs/SetUserApiKeyRequest.md +20 -0
  69. data/docs/SetUserApiKeyResponse.md +18 -0
  70. data/docs/SlimGroup.md +24 -0
  71. data/docs/SlimUser.md +32 -0
  72. data/docs/StripeApi.md +285 -0
  73. data/docs/StripePlan.md +38 -0
  74. data/docs/StripeSubscription.md +30 -0
  75. data/docs/SuggestedQueriesRequest.md +18 -0
  76. data/docs/SuggestedQueriesResponse.md +18 -0
  77. data/docs/Topic.md +30 -0
  78. data/docs/TopicApi.md +321 -0
  79. data/docs/UpdateChunkByTrackingIdData.md +32 -0
  80. data/docs/UpdateChunkData.md +34 -0
  81. data/docs/UpdateChunkGroupData.md +24 -0
  82. data/docs/UpdateDatasetRequest.md +24 -0
  83. data/docs/UpdateGroupByTrackingIDData.md +22 -0
  84. data/docs/UpdateOrganizationData.md +20 -0
  85. data/docs/UpdateTopicData.md +20 -0
  86. data/docs/UpdateUserData.md +30 -0
  87. data/docs/UploadFileData.md +34 -0
  88. data/docs/UploadFileResult.md +18 -0
  89. data/docs/UserApi.md +238 -0
  90. data/docs/UserOrganization.md +28 -0
  91. data/git_push.sh +57 -0
  92. data/lib/trieve_ruby_client/api/auth_api.rb +262 -0
  93. data/lib/trieve_ruby_client/api/chunk_api.rb +906 -0
  94. data/lib/trieve_ruby_client/api/chunk_group_api.rb +1230 -0
  95. data/lib/trieve_ruby_client/api/dataset_api.rb +458 -0
  96. data/lib/trieve_ruby_client/api/events_api.rb +92 -0
  97. data/lib/trieve_ruby_client/api/file_api.rb +324 -0
  98. data/lib/trieve_ruby_client/api/health_api.rb +75 -0
  99. data/lib/trieve_ruby_client/api/invitation_api.rb +97 -0
  100. data/lib/trieve_ruby_client/api/message_api.rb +317 -0
  101. data/lib/trieve_ruby_client/api/organization_api.rb +445 -0
  102. data/lib/trieve_ruby_client/api/stripe_api.rb +278 -0
  103. data/lib/trieve_ruby_client/api/topic_api.rb +317 -0
  104. data/lib/trieve_ruby_client/api/user_api.rb +226 -0
  105. data/lib/trieve_ruby_client/api_client.rb +394 -0
  106. data/lib/trieve_ruby_client/api_error.rb +58 -0
  107. data/lib/trieve_ruby_client/configuration.rb +305 -0
  108. data/lib/trieve_ruby_client/models/add_chunk_to_group_data.rb +222 -0
  109. data/lib/trieve_ruby_client/models/api_key_dto.rb +301 -0
  110. data/lib/trieve_ruby_client/models/bookmark_data.rb +255 -0
  111. data/lib/trieve_ruby_client/models/bookmark_group_result.rb +239 -0
  112. data/lib/trieve_ruby_client/models/chat_message_proxy.rb +237 -0
  113. data/lib/trieve_ruby_client/models/chunk_filter.rb +244 -0
  114. data/lib/trieve_ruby_client/models/chunk_group.rb +311 -0
  115. data/lib/trieve_ruby_client/models/chunk_group_and_file.rb +321 -0
  116. data/lib/trieve_ruby_client/models/chunk_metadata.rb +371 -0
  117. data/lib/trieve_ruby_client/models/chunk_metadata_with_file_data.rb +381 -0
  118. data/lib/trieve_ruby_client/models/client_dataset_configuration.rb +336 -0
  119. data/lib/trieve_ruby_client/models/create_chunk_data.rb +356 -0
  120. data/lib/trieve_ruby_client/models/create_chunk_group_data.rb +250 -0
  121. data/lib/trieve_ruby_client/models/create_dataset_request.rb +265 -0
  122. data/lib/trieve_ruby_client/models/create_message_data.rb +285 -0
  123. data/lib/trieve_ruby_client/models/create_organization_data.rb +222 -0
  124. data/lib/trieve_ruby_client/models/create_topic_data.rb +238 -0
  125. data/lib/trieve_ruby_client/models/dataset.rb +309 -0
  126. data/lib/trieve_ruby_client/models/dataset_and_usage.rb +237 -0
  127. data/lib/trieve_ruby_client/models/dataset_dto.rb +297 -0
  128. data/lib/trieve_ruby_client/models/dataset_usage_count.rb +253 -0
  129. data/lib/trieve_ruby_client/models/delete_dataset_request.rb +222 -0
  130. data/lib/trieve_ruby_client/models/delete_topic_data.rb +222 -0
  131. data/lib/trieve_ruby_client/models/delete_user_api_key_request.rb +222 -0
  132. data/lib/trieve_ruby_client/models/edit_message_data.rb +302 -0
  133. data/lib/trieve_ruby_client/models/error_response_body.rb +221 -0
  134. data/lib/trieve_ruby_client/models/event.rb +297 -0
  135. data/lib/trieve_ruby_client/models/event_return.rb +239 -0
  136. data/lib/trieve_ruby_client/models/field_condition.rb +245 -0
  137. data/lib/trieve_ruby_client/models/file.rb +341 -0
  138. data/lib/trieve_ruby_client/models/file_dto.rb +321 -0
  139. data/lib/trieve_ruby_client/models/generate_chunks_request.rb +276 -0
  140. data/lib/trieve_ruby_client/models/get_groups_for_chunks_data.rb +223 -0
  141. data/lib/trieve_ruby_client/models/group_data.rb +239 -0
  142. data/lib/trieve_ruby_client/models/group_score_chunk_dto.rb +239 -0
  143. data/lib/trieve_ruby_client/models/invitation_data.rb +290 -0
  144. data/lib/trieve_ruby_client/models/match_condition.rb +105 -0
  145. data/lib/trieve_ruby_client/models/message.rb +369 -0
  146. data/lib/trieve_ruby_client/models/organization.rb +279 -0
  147. data/lib/trieve_ruby_client/models/organization_usage_count.rb +301 -0
  148. data/lib/trieve_ruby_client/models/range.rb +245 -0
  149. data/lib/trieve_ruby_client/models/reccomend_group_chunks_request.rb +319 -0
  150. data/lib/trieve_ruby_client/models/recommend_chunks_request.rb +293 -0
  151. data/lib/trieve_ruby_client/models/regenerate_message_data.rb +268 -0
  152. data/lib/trieve_ruby_client/models/return_queued_chunk.rb +237 -0
  153. data/lib/trieve_ruby_client/models/score_chunk_dto.rb +239 -0
  154. data/lib/trieve_ruby_client/models/search_chunk_data.rb +369 -0
  155. data/lib/trieve_ruby_client/models/search_chunk_query_response_body.rb +239 -0
  156. data/lib/trieve_ruby_client/models/search_groups_result.rb +255 -0
  157. data/lib/trieve_ruby_client/models/search_over_groups_data.rb +372 -0
  158. data/lib/trieve_ruby_client/models/search_over_groups_response_body.rb +239 -0
  159. data/lib/trieve_ruby_client/models/search_within_group_data.rb +380 -0
  160. data/lib/trieve_ruby_client/models/set_user_api_key_request.rb +239 -0
  161. data/lib/trieve_ruby_client/models/set_user_api_key_response.rb +222 -0
  162. data/lib/trieve_ruby_client/models/slim_group.rb +269 -0
  163. data/lib/trieve_ruby_client/models/slim_user.rb +319 -0
  164. data/lib/trieve_ruby_client/models/stripe_plan.rb +381 -0
  165. data/lib/trieve_ruby_client/models/stripe_subscription.rb +311 -0
  166. data/lib/trieve_ruby_client/models/suggested_queries_request.rb +222 -0
  167. data/lib/trieve_ruby_client/models/suggested_queries_response.rb +223 -0
  168. data/lib/trieve_ruby_client/models/topic.rb +317 -0
  169. data/lib/trieve_ruby_client/models/update_chunk_by_tracking_id_data.rb +303 -0
  170. data/lib/trieve_ruby_client/models/update_chunk_data.rb +308 -0
  171. data/lib/trieve_ruby_client/models/update_chunk_group_data.rb +249 -0
  172. data/lib/trieve_ruby_client/models/update_dataset_request.rb +255 -0
  173. data/lib/trieve_ruby_client/models/update_group_by_tracking_id_data.rb +244 -0
  174. data/lib/trieve_ruby_client/models/update_organization_data.rb +233 -0
  175. data/lib/trieve_ruby_client/models/update_topic_data.rb +239 -0
  176. data/lib/trieve_ruby_client/models/update_user_data.rb +288 -0
  177. data/lib/trieve_ruby_client/models/upload_file_data.rb +324 -0
  178. data/lib/trieve_ruby_client/models/upload_file_result.rb +221 -0
  179. data/lib/trieve_ruby_client/models/user_organization.rb +301 -0
  180. data/lib/trieve_ruby_client/version.rb +15 -0
  181. data/lib/trieve_ruby_client.rb +124 -0
  182. data/openapi-generator.yaml +9 -0
  183. data/openapi.json +6530 -0
  184. data/openapitools.json +7 -0
  185. data/spec/api/auth_api_spec.rb +82 -0
  186. data/spec/api/chunk_api_spec.rb +191 -0
  187. data/spec/api/chunk_group_api_spec.rb +242 -0
  188. data/spec/api/dataset_api_spec.rb +113 -0
  189. data/spec/api/events_api_spec.rb +48 -0
  190. data/spec/api/file_api_spec.rb +89 -0
  191. data/spec/api/health_api_spec.rb +44 -0
  192. data/spec/api/invitation_api_spec.rb +48 -0
  193. data/spec/api/message_api_spec.rb +87 -0
  194. data/spec/api/organization_api_spec.rb +112 -0
  195. data/spec/api/stripe_api_spec.rb +78 -0
  196. data/spec/api/topic_api_spec.rb +87 -0
  197. data/spec/api/user_api_spec.rb +71 -0
  198. data/spec/models/add_chunk_to_group_data_spec.rb +36 -0
  199. data/spec/models/api_key_dto_spec.rb +66 -0
  200. data/spec/models/bookmark_data_spec.rb +48 -0
  201. data/spec/models/bookmark_group_result_spec.rb +42 -0
  202. data/spec/models/chat_message_proxy_spec.rb +42 -0
  203. data/spec/models/chunk_filter_spec.rb +48 -0
  204. data/spec/models/chunk_group_and_file_spec.rb +78 -0
  205. data/spec/models/chunk_group_spec.rb +72 -0
  206. data/spec/models/chunk_metadata_spec.rb +108 -0
  207. data/spec/models/chunk_metadata_with_file_data_spec.rb +114 -0
  208. data/spec/models/client_dataset_configuration_spec.rb +96 -0
  209. data/spec/models/create_chunk_data_spec.rb +108 -0
  210. data/spec/models/create_chunk_group_data_spec.rb +48 -0
  211. data/spec/models/create_dataset_request_spec.rb +54 -0
  212. data/spec/models/create_message_data_spec.rb +66 -0
  213. data/spec/models/create_organization_data_spec.rb +36 -0
  214. data/spec/models/create_topic_data_spec.rb +48 -0
  215. data/spec/models/dataset_and_usage_spec.rb +42 -0
  216. data/spec/models/dataset_dto_spec.rb +66 -0
  217. data/spec/models/dataset_spec.rb +72 -0
  218. data/spec/models/dataset_usage_count_spec.rb +48 -0
  219. data/spec/models/delete_dataset_request_spec.rb +36 -0
  220. data/spec/models/delete_topic_data_spec.rb +36 -0
  221. data/spec/models/delete_user_api_key_request_spec.rb +36 -0
  222. data/spec/models/edit_message_data_spec.rb +72 -0
  223. data/spec/models/error_response_body_spec.rb +36 -0
  224. data/spec/models/event_return_spec.rb +42 -0
  225. data/spec/models/event_spec.rb +66 -0
  226. data/spec/models/field_condition_spec.rb +48 -0
  227. data/spec/models/file_dto_spec.rb +78 -0
  228. data/spec/models/file_spec.rb +90 -0
  229. data/spec/models/generate_chunks_request_spec.rb +60 -0
  230. data/spec/models/get_groups_for_chunks_data_spec.rb +36 -0
  231. data/spec/models/group_data_spec.rb +42 -0
  232. data/spec/models/group_score_chunk_dto_spec.rb +42 -0
  233. data/spec/models/invitation_data_spec.rb +60 -0
  234. data/spec/models/match_condition_spec.rb +32 -0
  235. data/spec/models/message_spec.rb +96 -0
  236. data/spec/models/organization_spec.rb +60 -0
  237. data/spec/models/organization_usage_count_spec.rb +66 -0
  238. data/spec/models/range_spec.rb +54 -0
  239. data/spec/models/reccomend_group_chunks_request_spec.rb +72 -0
  240. data/spec/models/recommend_chunks_request_spec.rb +66 -0
  241. data/spec/models/regenerate_message_data_spec.rb +60 -0
  242. data/spec/models/return_queued_chunk_spec.rb +42 -0
  243. data/spec/models/score_chunk_dto_spec.rb +42 -0
  244. data/spec/models/search_chunk_data_spec.rb +96 -0
  245. data/spec/models/search_chunk_query_response_body_spec.rb +42 -0
  246. data/spec/models/search_groups_result_spec.rb +48 -0
  247. data/spec/models/search_over_groups_data_spec.rb +90 -0
  248. data/spec/models/search_over_groups_response_body_spec.rb +42 -0
  249. data/spec/models/search_within_group_data_spec.rb +102 -0
  250. data/spec/models/set_user_api_key_request_spec.rb +42 -0
  251. data/spec/models/set_user_api_key_response_spec.rb +36 -0
  252. data/spec/models/slim_group_spec.rb +54 -0
  253. data/spec/models/slim_user_spec.rb +78 -0
  254. data/spec/models/stripe_plan_spec.rb +96 -0
  255. data/spec/models/stripe_subscription_spec.rb +72 -0
  256. data/spec/models/suggested_queries_request_spec.rb +36 -0
  257. data/spec/models/suggested_queries_response_spec.rb +36 -0
  258. data/spec/models/topic_spec.rb +72 -0
  259. data/spec/models/update_chunk_by_tracking_id_data_spec.rb +66 -0
  260. data/spec/models/update_chunk_data_spec.rb +72 -0
  261. data/spec/models/update_chunk_group_data_spec.rb +48 -0
  262. data/spec/models/update_dataset_request_spec.rb +54 -0
  263. data/spec/models/update_group_by_tracking_id_data_spec.rb +48 -0
  264. data/spec/models/update_organization_data_spec.rb +42 -0
  265. data/spec/models/update_topic_data_spec.rb +42 -0
  266. data/spec/models/update_user_data_spec.rb +72 -0
  267. data/spec/models/upload_file_data_spec.rb +84 -0
  268. data/spec/models/upload_file_result_spec.rb +36 -0
  269. data/spec/models/user_organization_spec.rb +66 -0
  270. data/spec/spec_helper.rb +111 -0
  271. data/trieve_ruby_client.gemspec +39 -0
  272. metadata +439 -0
@@ -0,0 +1,906 @@
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.3.4
7
+ Contact: developers@trieve.ai
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module TrieveRubyClient
16
+ class ChunkApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # bulk_create_chunk
23
+ # bulk_create_chunk Create a new chunk from an array of chunks. If the chunk has the same tracking_id as an existing chunk, the request will fail. Once a chunk is created, it can be searched for using the search endpoint.
24
+ # @param tr_dataset [String] The dataset id to use for the request
25
+ # @param create_chunk_data [CreateChunkData] JSON request payload to create a new chunk (chunk)
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [ReturnQueuedChunk]
28
+ def bulk_create_chunk(tr_dataset, create_chunk_data, opts = {})
29
+ data, _status_code, _headers = bulk_create_chunk_with_http_info(tr_dataset, create_chunk_data, opts)
30
+ data
31
+ end
32
+
33
+ # bulk_create_chunk
34
+ # bulk_create_chunk Create a new chunk from an array of chunks. If the chunk has the same tracking_id as an existing chunk, the request will fail. Once a chunk is created, it can be searched for using the search endpoint.
35
+ # @param tr_dataset [String] The dataset id to use for the request
36
+ # @param create_chunk_data [CreateChunkData] JSON request payload to create a new chunk (chunk)
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(ReturnQueuedChunk, Integer, Hash)>] ReturnQueuedChunk data, response status code and response headers
39
+ def bulk_create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: ChunkApi.bulk_create_chunk ...'
42
+ end
43
+ # verify the required parameter 'tr_dataset' is set
44
+ if @api_client.config.client_side_validation && tr_dataset.nil?
45
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.bulk_create_chunk"
46
+ end
47
+ # verify the required parameter 'create_chunk_data' is set
48
+ if @api_client.config.client_side_validation && create_chunk_data.nil?
49
+ fail ArgumentError, "Missing the required parameter 'create_chunk_data' when calling ChunkApi.bulk_create_chunk"
50
+ end
51
+ # resource path
52
+ local_var_path = '/api/chunk/bulk'
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+ header_params[:'TR-Dataset'] = tr_dataset
67
+
68
+ # form parameters
69
+ form_params = opts[:form_params] || {}
70
+
71
+ # http body (model)
72
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_chunk_data)
73
+
74
+ # return_type
75
+ return_type = opts[:debug_return_type] || 'ReturnQueuedChunk'
76
+
77
+ # auth_names
78
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
79
+
80
+ new_options = opts.merge(
81
+ :operation => :"ChunkApi.bulk_create_chunk",
82
+ :header_params => header_params,
83
+ :query_params => query_params,
84
+ :form_params => form_params,
85
+ :body => post_body,
86
+ :auth_names => auth_names,
87
+ :return_type => return_type
88
+ )
89
+
90
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug "API called: ChunkApi#bulk_create_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
+ end
94
+ return data, status_code, headers
95
+ end
96
+
97
+ # create_chunk
98
+ # create_chunk Create a new chunk. If the chunk has the same tracking_id as an existing chunk, the request will fail. Once a chunk is created, it can be searched for using the search endpoint.
99
+ # @param tr_dataset [String] The dataset id to use for the request
100
+ # @param create_chunk_data [CreateChunkData] JSON request payload to create a new chunk (chunk)
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [ReturnQueuedChunk]
103
+ def create_chunk(tr_dataset, create_chunk_data, opts = {})
104
+ data, _status_code, _headers = create_chunk_with_http_info(tr_dataset, create_chunk_data, opts)
105
+ data
106
+ end
107
+
108
+ # create_chunk
109
+ # create_chunk Create a new chunk. If the chunk has the same tracking_id as an existing chunk, the request will fail. Once a chunk is created, it can be searched for using the search endpoint.
110
+ # @param tr_dataset [String] The dataset id to use for the request
111
+ # @param create_chunk_data [CreateChunkData] JSON request payload to create a new chunk (chunk)
112
+ # @param [Hash] opts the optional parameters
113
+ # @return [Array<(ReturnQueuedChunk, Integer, Hash)>] ReturnQueuedChunk data, response status code and response headers
114
+ def create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {})
115
+ if @api_client.config.debugging
116
+ @api_client.config.logger.debug 'Calling API: ChunkApi.create_chunk ...'
117
+ end
118
+ # verify the required parameter 'tr_dataset' is set
119
+ if @api_client.config.client_side_validation && tr_dataset.nil?
120
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.create_chunk"
121
+ end
122
+ # verify the required parameter 'create_chunk_data' is set
123
+ if @api_client.config.client_side_validation && create_chunk_data.nil?
124
+ fail ArgumentError, "Missing the required parameter 'create_chunk_data' when calling ChunkApi.create_chunk"
125
+ end
126
+ # resource path
127
+ local_var_path = '/api/chunk'
128
+
129
+ # query parameters
130
+ query_params = opts[:query_params] || {}
131
+
132
+ # header parameters
133
+ header_params = opts[:header_params] || {}
134
+ # HTTP header 'Accept' (if needed)
135
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
136
+ # HTTP header 'Content-Type'
137
+ content_type = @api_client.select_header_content_type(['application/json'])
138
+ if !content_type.nil?
139
+ header_params['Content-Type'] = content_type
140
+ end
141
+ header_params[:'TR-Dataset'] = tr_dataset
142
+
143
+ # form parameters
144
+ form_params = opts[:form_params] || {}
145
+
146
+ # http body (model)
147
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_chunk_data)
148
+
149
+ # return_type
150
+ return_type = opts[:debug_return_type] || 'ReturnQueuedChunk'
151
+
152
+ # auth_names
153
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
154
+
155
+ new_options = opts.merge(
156
+ :operation => :"ChunkApi.create_chunk",
157
+ :header_params => header_params,
158
+ :query_params => query_params,
159
+ :form_params => form_params,
160
+ :body => post_body,
161
+ :auth_names => auth_names,
162
+ :return_type => return_type
163
+ )
164
+
165
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug "API called: ChunkApi#create_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
168
+ end
169
+ return data, status_code, headers
170
+ end
171
+
172
+ # get_suggested_queries
173
+ # get_suggested_queries This endpoint will generate 3 suggested queries based off the query provided in the request body and return them as a JSON object.
174
+ # @param tr_dataset [String] The dataset id to use for the request
175
+ # @param suggested_queries_request [SuggestedQueriesRequest] JSON request payload to get alternative suggested queries
176
+ # @param [Hash] opts the optional parameters
177
+ # @return [SuggestedQueriesResponse]
178
+ def create_suggested_queries_handler(tr_dataset, suggested_queries_request, opts = {})
179
+ data, _status_code, _headers = create_suggested_queries_handler_with_http_info(tr_dataset, suggested_queries_request, opts)
180
+ data
181
+ end
182
+
183
+ # get_suggested_queries
184
+ # get_suggested_queries This endpoint will generate 3 suggested queries based off the query provided in the request body and return them as a JSON object.
185
+ # @param tr_dataset [String] The dataset id to use for the request
186
+ # @param suggested_queries_request [SuggestedQueriesRequest] JSON request payload to get alternative suggested queries
187
+ # @param [Hash] opts the optional parameters
188
+ # @return [Array<(SuggestedQueriesResponse, Integer, Hash)>] SuggestedQueriesResponse data, response status code and response headers
189
+ def create_suggested_queries_handler_with_http_info(tr_dataset, suggested_queries_request, opts = {})
190
+ if @api_client.config.debugging
191
+ @api_client.config.logger.debug 'Calling API: ChunkApi.create_suggested_queries_handler ...'
192
+ end
193
+ # verify the required parameter 'tr_dataset' is set
194
+ if @api_client.config.client_side_validation && tr_dataset.nil?
195
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.create_suggested_queries_handler"
196
+ end
197
+ # verify the required parameter 'suggested_queries_request' is set
198
+ if @api_client.config.client_side_validation && suggested_queries_request.nil?
199
+ fail ArgumentError, "Missing the required parameter 'suggested_queries_request' when calling ChunkApi.create_suggested_queries_handler"
200
+ end
201
+ # resource path
202
+ local_var_path = '/api/chunk/gen_suggestions'
203
+
204
+ # query parameters
205
+ query_params = opts[:query_params] || {}
206
+
207
+ # header parameters
208
+ header_params = opts[:header_params] || {}
209
+ # HTTP header 'Accept' (if needed)
210
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
211
+ # HTTP header 'Content-Type'
212
+ content_type = @api_client.select_header_content_type(['application/json'])
213
+ if !content_type.nil?
214
+ header_params['Content-Type'] = content_type
215
+ end
216
+ header_params[:'TR-Dataset'] = tr_dataset
217
+
218
+ # form parameters
219
+ form_params = opts[:form_params] || {}
220
+
221
+ # http body (model)
222
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(suggested_queries_request)
223
+
224
+ # return_type
225
+ return_type = opts[:debug_return_type] || 'SuggestedQueriesResponse'
226
+
227
+ # auth_names
228
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
229
+
230
+ new_options = opts.merge(
231
+ :operation => :"ChunkApi.create_suggested_queries_handler",
232
+ :header_params => header_params,
233
+ :query_params => query_params,
234
+ :form_params => form_params,
235
+ :body => post_body,
236
+ :auth_names => auth_names,
237
+ :return_type => return_type
238
+ )
239
+
240
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
241
+ if @api_client.config.debugging
242
+ @api_client.config.logger.debug "API called: ChunkApi#create_suggested_queries_handler\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
243
+ end
244
+ return data, status_code, headers
245
+ end
246
+
247
+ # delete_chunk
248
+ # delete_chunk Delete a chunk by its id. If deleting a root chunk which has a collision, the most recently created collision will become a new root chunk.
249
+ # @param tr_dataset [String] The dataset id to use for the request
250
+ # @param chunk_id [Uuid] Id of the chunk you want to fetch. This can be either the chunk_id or the tracking_id.
251
+ # @param tracking_or_chunk [String] The type of id you are using to search for the chunk. This can be either &#39;chunk&#39; or &#39;tracking_id&#39;
252
+ # @param [Hash] opts the optional parameters
253
+ # @return [nil]
254
+ def delete_chunk(tr_dataset, chunk_id, tracking_or_chunk, opts = {})
255
+ delete_chunk_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts)
256
+ nil
257
+ end
258
+
259
+ # delete_chunk
260
+ # delete_chunk Delete a chunk by its id. If deleting a root chunk which has a collision, the most recently created collision will become a new root chunk.
261
+ # @param tr_dataset [String] The dataset id to use for the request
262
+ # @param chunk_id [Uuid] Id of the chunk you want to fetch. This can be either the chunk_id or the tracking_id.
263
+ # @param tracking_or_chunk [String] The type of id you are using to search for the chunk. This can be either &#39;chunk&#39; or &#39;tracking_id&#39;
264
+ # @param [Hash] opts the optional parameters
265
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
266
+ def delete_chunk_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {})
267
+ if @api_client.config.debugging
268
+ @api_client.config.logger.debug 'Calling API: ChunkApi.delete_chunk ...'
269
+ end
270
+ # verify the required parameter 'tr_dataset' is set
271
+ if @api_client.config.client_side_validation && tr_dataset.nil?
272
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.delete_chunk"
273
+ end
274
+ # verify the required parameter 'tracking_or_chunk' is set
275
+ if @api_client.config.client_side_validation && tracking_or_chunk.nil?
276
+ fail ArgumentError, "Missing the required parameter 'tracking_or_chunk' when calling ChunkApi.delete_chunk"
277
+ end
278
+ # resource path
279
+ local_var_path = '/api/{tracking_or_chunk}/{chunk_id}'.sub('{' + 'chunk_id' + '}', CGI.escape(chunk_id.to_s)).sub('{' + 'tracking_or_chunk' + '}', CGI.escape(tracking_or_chunk.to_s))
280
+
281
+ # query parameters
282
+ query_params = opts[:query_params] || {}
283
+
284
+ # header parameters
285
+ header_params = opts[:header_params] || {}
286
+ # HTTP header 'Accept' (if needed)
287
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
288
+ header_params[:'TR-Dataset'] = tr_dataset
289
+
290
+ # form parameters
291
+ form_params = opts[:form_params] || {}
292
+
293
+ # http body (model)
294
+ post_body = opts[:debug_body]
295
+
296
+ # return_type
297
+ return_type = opts[:debug_return_type]
298
+
299
+ # auth_names
300
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
301
+
302
+ new_options = opts.merge(
303
+ :operation => :"ChunkApi.delete_chunk",
304
+ :header_params => header_params,
305
+ :query_params => query_params,
306
+ :form_params => form_params,
307
+ :body => post_body,
308
+ :auth_names => auth_names,
309
+ :return_type => return_type
310
+ )
311
+
312
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
313
+ if @api_client.config.debugging
314
+ @api_client.config.logger.debug "API called: ChunkApi#delete_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
315
+ end
316
+ return data, status_code, headers
317
+ end
318
+
319
+ # delete_chunk_by_tracking_id
320
+ # delete_chunk_by_tracking_id Delete a chunk by tracking_id. This is useful for when you are coordinating with an external system and want to use the tracking_id to identify the chunk. If deleting a root chunk which has a collision, the most recently created collision will become a new root chunk.
321
+ # @param tr_dataset [String] The dataset id to use for the request
322
+ # @param tracking_id [String] tracking_id of the chunk you want to delete
323
+ # @param [Hash] opts the optional parameters
324
+ # @return [nil]
325
+ def delete_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {})
326
+ delete_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts)
327
+ nil
328
+ end
329
+
330
+ # delete_chunk_by_tracking_id
331
+ # delete_chunk_by_tracking_id Delete a chunk by tracking_id. This is useful for when you are coordinating with an external system and want to use the tracking_id to identify the chunk. If deleting a root chunk which has a collision, the most recently created collision will become a new root chunk.
332
+ # @param tr_dataset [String] The dataset id to use for the request
333
+ # @param tracking_id [String] tracking_id of the chunk you want to delete
334
+ # @param [Hash] opts the optional parameters
335
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
336
+ def delete_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {})
337
+ if @api_client.config.debugging
338
+ @api_client.config.logger.debug 'Calling API: ChunkApi.delete_chunk_by_tracking_id ...'
339
+ end
340
+ # verify the required parameter 'tr_dataset' is set
341
+ if @api_client.config.client_side_validation && tr_dataset.nil?
342
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.delete_chunk_by_tracking_id"
343
+ end
344
+ # verify the required parameter 'tracking_id' is set
345
+ if @api_client.config.client_side_validation && tracking_id.nil?
346
+ fail ArgumentError, "Missing the required parameter 'tracking_id' when calling ChunkApi.delete_chunk_by_tracking_id"
347
+ end
348
+ # resource path
349
+ local_var_path = '/api/chunk/tracking_id/{tracking_id}'.sub('{' + 'tracking_id' + '}', CGI.escape(tracking_id.to_s))
350
+
351
+ # query parameters
352
+ query_params = opts[:query_params] || {}
353
+
354
+ # header parameters
355
+ header_params = opts[:header_params] || {}
356
+ # HTTP header 'Accept' (if needed)
357
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
358
+ header_params[:'TR-Dataset'] = tr_dataset
359
+
360
+ # form parameters
361
+ form_params = opts[:form_params] || {}
362
+
363
+ # http body (model)
364
+ post_body = opts[:debug_body]
365
+
366
+ # return_type
367
+ return_type = opts[:debug_return_type]
368
+
369
+ # auth_names
370
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
371
+
372
+ new_options = opts.merge(
373
+ :operation => :"ChunkApi.delete_chunk_by_tracking_id",
374
+ :header_params => header_params,
375
+ :query_params => query_params,
376
+ :form_params => form_params,
377
+ :body => post_body,
378
+ :auth_names => auth_names,
379
+ :return_type => return_type
380
+ )
381
+
382
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
383
+ if @api_client.config.debugging
384
+ @api_client.config.logger.debug "API called: ChunkApi#delete_chunk_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
385
+ end
386
+ return data, status_code, headers
387
+ end
388
+
389
+ # augmented_generation_from_chunks
390
+ # augmented_generation_from_chunks This endpoint exists as an alternative to the topic+message concept where our API handles chat memory. With this endpoint, the user is responsible for providing the context window and the prompt. See more in the \"search before generate\" page at docs.trieve.ai.
391
+ # @param tr_dataset [String] The dataset id to use for the request
392
+ # @param generate_chunks_request [GenerateChunksRequest] JSON request payload to perform RAG on some chunks (chunks)
393
+ # @param [Hash] opts the optional parameters
394
+ # @return [String]
395
+ def generate_off_chunks(tr_dataset, generate_chunks_request, opts = {})
396
+ data, _status_code, _headers = generate_off_chunks_with_http_info(tr_dataset, generate_chunks_request, opts)
397
+ data
398
+ end
399
+
400
+ # augmented_generation_from_chunks
401
+ # augmented_generation_from_chunks This endpoint exists as an alternative to the topic+message concept where our API handles chat memory. With this endpoint, the user is responsible for providing the context window and the prompt. See more in the \&quot;search before generate\&quot; page at docs.trieve.ai.
402
+ # @param tr_dataset [String] The dataset id to use for the request
403
+ # @param generate_chunks_request [GenerateChunksRequest] JSON request payload to perform RAG on some chunks (chunks)
404
+ # @param [Hash] opts the optional parameters
405
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
406
+ def generate_off_chunks_with_http_info(tr_dataset, generate_chunks_request, opts = {})
407
+ if @api_client.config.debugging
408
+ @api_client.config.logger.debug 'Calling API: ChunkApi.generate_off_chunks ...'
409
+ end
410
+ # verify the required parameter 'tr_dataset' is set
411
+ if @api_client.config.client_side_validation && tr_dataset.nil?
412
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.generate_off_chunks"
413
+ end
414
+ # verify the required parameter 'generate_chunks_request' is set
415
+ if @api_client.config.client_side_validation && generate_chunks_request.nil?
416
+ fail ArgumentError, "Missing the required parameter 'generate_chunks_request' when calling ChunkApi.generate_off_chunks"
417
+ end
418
+ # resource path
419
+ local_var_path = '/api/chunk/generate'
420
+
421
+ # query parameters
422
+ query_params = opts[:query_params] || {}
423
+
424
+ # header parameters
425
+ header_params = opts[:header_params] || {}
426
+ # HTTP header 'Accept' (if needed)
427
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json'])
428
+ # HTTP header 'Content-Type'
429
+ content_type = @api_client.select_header_content_type(['application/json'])
430
+ if !content_type.nil?
431
+ header_params['Content-Type'] = content_type
432
+ end
433
+ header_params[:'TR-Dataset'] = tr_dataset
434
+
435
+ # form parameters
436
+ form_params = opts[:form_params] || {}
437
+
438
+ # http body (model)
439
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_chunks_request)
440
+
441
+ # return_type
442
+ return_type = opts[:debug_return_type] || 'String'
443
+
444
+ # auth_names
445
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
446
+
447
+ new_options = opts.merge(
448
+ :operation => :"ChunkApi.generate_off_chunks",
449
+ :header_params => header_params,
450
+ :query_params => query_params,
451
+ :form_params => form_params,
452
+ :body => post_body,
453
+ :auth_names => auth_names,
454
+ :return_type => return_type
455
+ )
456
+
457
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
458
+ if @api_client.config.debugging
459
+ @api_client.config.logger.debug "API called: ChunkApi#generate_off_chunks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
460
+ end
461
+ return data, status_code, headers
462
+ end
463
+
464
+ # get_chunk
465
+ # get_chunk Get a singular chunk by id.
466
+ # @param tr_dataset [String] The dataset id to use for the request
467
+ # @param chunk_id [Uuid] Id of the chunk you want to fetch. This can be either the chunk_id or the tracking_id.
468
+ # @param tracking_or_chunk [String] The type of id you are using to search for the chunk. This can be either &#39;chunk&#39; or &#39;tracking_id&#39;
469
+ # @param [Hash] opts the optional parameters
470
+ # @return [ChunkMetadata]
471
+ def get_chunk_by_id(tr_dataset, chunk_id, tracking_or_chunk, opts = {})
472
+ data, _status_code, _headers = get_chunk_by_id_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts)
473
+ data
474
+ end
475
+
476
+ # get_chunk
477
+ # get_chunk Get a singular chunk by id.
478
+ # @param tr_dataset [String] The dataset id to use for the request
479
+ # @param chunk_id [Uuid] Id of the chunk you want to fetch. This can be either the chunk_id or the tracking_id.
480
+ # @param tracking_or_chunk [String] The type of id you are using to search for the chunk. This can be either &#39;chunk&#39; or &#39;tracking_id&#39;
481
+ # @param [Hash] opts the optional parameters
482
+ # @return [Array<(ChunkMetadata, Integer, Hash)>] ChunkMetadata data, response status code and response headers
483
+ def get_chunk_by_id_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {})
484
+ if @api_client.config.debugging
485
+ @api_client.config.logger.debug 'Calling API: ChunkApi.get_chunk_by_id ...'
486
+ end
487
+ # verify the required parameter 'tr_dataset' is set
488
+ if @api_client.config.client_side_validation && tr_dataset.nil?
489
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.get_chunk_by_id"
490
+ end
491
+ # verify the required parameter 'tracking_or_chunk' is set
492
+ if @api_client.config.client_side_validation && tracking_or_chunk.nil?
493
+ fail ArgumentError, "Missing the required parameter 'tracking_or_chunk' when calling ChunkApi.get_chunk_by_id"
494
+ end
495
+ # resource path
496
+ local_var_path = '/api/{tracking_or_chunk}/{chunk_id}'.sub('{' + 'chunk_id' + '}', CGI.escape(chunk_id.to_s)).sub('{' + 'tracking_or_chunk' + '}', CGI.escape(tracking_or_chunk.to_s))
497
+
498
+ # query parameters
499
+ query_params = opts[:query_params] || {}
500
+
501
+ # header parameters
502
+ header_params = opts[:header_params] || {}
503
+ # HTTP header 'Accept' (if needed)
504
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
505
+ header_params[:'TR-Dataset'] = tr_dataset
506
+
507
+ # form parameters
508
+ form_params = opts[:form_params] || {}
509
+
510
+ # http body (model)
511
+ post_body = opts[:debug_body]
512
+
513
+ # return_type
514
+ return_type = opts[:debug_return_type] || 'ChunkMetadata'
515
+
516
+ # auth_names
517
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
518
+
519
+ new_options = opts.merge(
520
+ :operation => :"ChunkApi.get_chunk_by_id",
521
+ :header_params => header_params,
522
+ :query_params => query_params,
523
+ :form_params => form_params,
524
+ :body => post_body,
525
+ :auth_names => auth_names,
526
+ :return_type => return_type
527
+ )
528
+
529
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
530
+ if @api_client.config.debugging
531
+ @api_client.config.logger.debug "API called: ChunkApi#get_chunk_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
532
+ end
533
+ return data, status_code, headers
534
+ end
535
+
536
+ # get_chunk_by_tracking_id
537
+ # get_chunk_by_tracking_id Get a singular chunk by tracking_id. This is useful for when you are coordinating with an external system and want to use your own id as the primary reference for a chunk.
538
+ # @param tr_dataset [String] The dataset id to use for the request
539
+ # @param tracking_id [String] tracking_id of the chunk you want to fetch
540
+ # @param [Hash] opts the optional parameters
541
+ # @return [ChunkMetadata]
542
+ def get_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {})
543
+ data, _status_code, _headers = get_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts)
544
+ data
545
+ end
546
+
547
+ # get_chunk_by_tracking_id
548
+ # get_chunk_by_tracking_id Get a singular chunk by tracking_id. This is useful for when you are coordinating with an external system and want to use your own id as the primary reference for a chunk.
549
+ # @param tr_dataset [String] The dataset id to use for the request
550
+ # @param tracking_id [String] tracking_id of the chunk you want to fetch
551
+ # @param [Hash] opts the optional parameters
552
+ # @return [Array<(ChunkMetadata, Integer, Hash)>] ChunkMetadata data, response status code and response headers
553
+ def get_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {})
554
+ if @api_client.config.debugging
555
+ @api_client.config.logger.debug 'Calling API: ChunkApi.get_chunk_by_tracking_id ...'
556
+ end
557
+ # verify the required parameter 'tr_dataset' is set
558
+ if @api_client.config.client_side_validation && tr_dataset.nil?
559
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.get_chunk_by_tracking_id"
560
+ end
561
+ # verify the required parameter 'tracking_id' is set
562
+ if @api_client.config.client_side_validation && tracking_id.nil?
563
+ fail ArgumentError, "Missing the required parameter 'tracking_id' when calling ChunkApi.get_chunk_by_tracking_id"
564
+ end
565
+ # resource path
566
+ local_var_path = '/api/chunk/tracking_id/{tracking_id}'.sub('{' + 'tracking_id' + '}', CGI.escape(tracking_id.to_s))
567
+
568
+ # query parameters
569
+ query_params = opts[:query_params] || {}
570
+
571
+ # header parameters
572
+ header_params = opts[:header_params] || {}
573
+ # HTTP header 'Accept' (if needed)
574
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
575
+ header_params[:'TR-Dataset'] = tr_dataset
576
+
577
+ # form parameters
578
+ form_params = opts[:form_params] || {}
579
+
580
+ # http body (model)
581
+ post_body = opts[:debug_body]
582
+
583
+ # return_type
584
+ return_type = opts[:debug_return_type] || 'ChunkMetadata'
585
+
586
+ # auth_names
587
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
588
+
589
+ new_options = opts.merge(
590
+ :operation => :"ChunkApi.get_chunk_by_tracking_id",
591
+ :header_params => header_params,
592
+ :query_params => query_params,
593
+ :form_params => form_params,
594
+ :body => post_body,
595
+ :auth_names => auth_names,
596
+ :return_type => return_type
597
+ )
598
+
599
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
600
+ if @api_client.config.debugging
601
+ @api_client.config.logger.debug "API called: ChunkApi#get_chunk_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
602
+ end
603
+ return data, status_code, headers
604
+ end
605
+
606
+ # get_recommended_chunks
607
+ # get_recommended_chunks Get recommendations of chunks similar to the chunks in the request. Think about this as a feature similar to the \"add to playlist\" recommendation feature on Spotify. This request pairs especially well with our groups endpoint.
608
+ # @param tr_dataset [String] The dataset id to use for the request
609
+ # @param recommend_chunks_request [RecommendChunksRequest] JSON request payload to get recommendations of chunks similar to the chunks in the request
610
+ # @param [Hash] opts the optional parameters
611
+ # @return [Array<ChunkMetadataWithFileData>]
612
+ def get_recommended_chunks(tr_dataset, recommend_chunks_request, opts = {})
613
+ data, _status_code, _headers = get_recommended_chunks_with_http_info(tr_dataset, recommend_chunks_request, opts)
614
+ data
615
+ end
616
+
617
+ # get_recommended_chunks
618
+ # get_recommended_chunks Get recommendations of chunks similar to the chunks in the request. Think about this as a feature similar to the \&quot;add to playlist\&quot; recommendation feature on Spotify. This request pairs especially well with our groups endpoint.
619
+ # @param tr_dataset [String] The dataset id to use for the request
620
+ # @param recommend_chunks_request [RecommendChunksRequest] JSON request payload to get recommendations of chunks similar to the chunks in the request
621
+ # @param [Hash] opts the optional parameters
622
+ # @return [Array<(Array<ChunkMetadataWithFileData>, Integer, Hash)>] Array<ChunkMetadataWithFileData> data, response status code and response headers
623
+ def get_recommended_chunks_with_http_info(tr_dataset, recommend_chunks_request, opts = {})
624
+ if @api_client.config.debugging
625
+ @api_client.config.logger.debug 'Calling API: ChunkApi.get_recommended_chunks ...'
626
+ end
627
+ # verify the required parameter 'tr_dataset' is set
628
+ if @api_client.config.client_side_validation && tr_dataset.nil?
629
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.get_recommended_chunks"
630
+ end
631
+ # verify the required parameter 'recommend_chunks_request' is set
632
+ if @api_client.config.client_side_validation && recommend_chunks_request.nil?
633
+ fail ArgumentError, "Missing the required parameter 'recommend_chunks_request' when calling ChunkApi.get_recommended_chunks"
634
+ end
635
+ # resource path
636
+ local_var_path = '/api/chunk/recommend'
637
+
638
+ # query parameters
639
+ query_params = opts[:query_params] || {}
640
+
641
+ # header parameters
642
+ header_params = opts[:header_params] || {}
643
+ # HTTP header 'Accept' (if needed)
644
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
645
+ # HTTP header 'Content-Type'
646
+ content_type = @api_client.select_header_content_type(['application/json'])
647
+ if !content_type.nil?
648
+ header_params['Content-Type'] = content_type
649
+ end
650
+ header_params[:'TR-Dataset'] = tr_dataset
651
+
652
+ # form parameters
653
+ form_params = opts[:form_params] || {}
654
+
655
+ # http body (model)
656
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(recommend_chunks_request)
657
+
658
+ # return_type
659
+ return_type = opts[:debug_return_type] || 'Array<ChunkMetadataWithFileData>'
660
+
661
+ # auth_names
662
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
663
+
664
+ new_options = opts.merge(
665
+ :operation => :"ChunkApi.get_recommended_chunks",
666
+ :header_params => header_params,
667
+ :query_params => query_params,
668
+ :form_params => form_params,
669
+ :body => post_body,
670
+ :auth_names => auth_names,
671
+ :return_type => return_type
672
+ )
673
+
674
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
675
+ if @api_client.config.debugging
676
+ @api_client.config.logger.debug "API called: ChunkApi#get_recommended_chunks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
677
+ end
678
+ return data, status_code, headers
679
+ end
680
+
681
+ # search
682
+ # search This route provides the primary search functionality for the API. It can be used to search for chunks by semantic similarity, full-text similarity, or a combination of both. Results' `chunk_html` values will be modified with `<b>` tags for sub-sentence highlighting.
683
+ # @param tr_dataset [String] The dataset id to use for the request
684
+ # @param search_chunk_data [SearchChunkData] JSON request payload to semantically search for chunks (chunks)
685
+ # @param [Hash] opts the optional parameters
686
+ # @return [SearchChunkQueryResponseBody]
687
+ def search_chunk(tr_dataset, search_chunk_data, opts = {})
688
+ data, _status_code, _headers = search_chunk_with_http_info(tr_dataset, search_chunk_data, opts)
689
+ data
690
+ end
691
+
692
+ # search
693
+ # search This route provides the primary search functionality for the API. It can be used to search for chunks by semantic similarity, full-text similarity, or a combination of both. Results&#39; &#x60;chunk_html&#x60; values will be modified with &#x60;&lt;b&gt;&#x60; tags for sub-sentence highlighting.
694
+ # @param tr_dataset [String] The dataset id to use for the request
695
+ # @param search_chunk_data [SearchChunkData] JSON request payload to semantically search for chunks (chunks)
696
+ # @param [Hash] opts the optional parameters
697
+ # @return [Array<(SearchChunkQueryResponseBody, Integer, Hash)>] SearchChunkQueryResponseBody data, response status code and response headers
698
+ def search_chunk_with_http_info(tr_dataset, search_chunk_data, opts = {})
699
+ if @api_client.config.debugging
700
+ @api_client.config.logger.debug 'Calling API: ChunkApi.search_chunk ...'
701
+ end
702
+ # verify the required parameter 'tr_dataset' is set
703
+ if @api_client.config.client_side_validation && tr_dataset.nil?
704
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.search_chunk"
705
+ end
706
+ # verify the required parameter 'search_chunk_data' is set
707
+ if @api_client.config.client_side_validation && search_chunk_data.nil?
708
+ fail ArgumentError, "Missing the required parameter 'search_chunk_data' when calling ChunkApi.search_chunk"
709
+ end
710
+ # resource path
711
+ local_var_path = '/api/chunk/search'
712
+
713
+ # query parameters
714
+ query_params = opts[:query_params] || {}
715
+
716
+ # header parameters
717
+ header_params = opts[:header_params] || {}
718
+ # HTTP header 'Accept' (if needed)
719
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
720
+ # HTTP header 'Content-Type'
721
+ content_type = @api_client.select_header_content_type(['application/json'])
722
+ if !content_type.nil?
723
+ header_params['Content-Type'] = content_type
724
+ end
725
+ header_params[:'TR-Dataset'] = tr_dataset
726
+
727
+ # form parameters
728
+ form_params = opts[:form_params] || {}
729
+
730
+ # http body (model)
731
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(search_chunk_data)
732
+
733
+ # return_type
734
+ return_type = opts[:debug_return_type] || 'SearchChunkQueryResponseBody'
735
+
736
+ # auth_names
737
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
738
+
739
+ new_options = opts.merge(
740
+ :operation => :"ChunkApi.search_chunk",
741
+ :header_params => header_params,
742
+ :query_params => query_params,
743
+ :form_params => form_params,
744
+ :body => post_body,
745
+ :auth_names => auth_names,
746
+ :return_type => return_type
747
+ )
748
+
749
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
750
+ if @api_client.config.debugging
751
+ @api_client.config.logger.debug "API called: ChunkApi#search_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
752
+ end
753
+ return data, status_code, headers
754
+ end
755
+
756
+ # update_chunk
757
+ # update_chunk Update a chunk. If you try to change the tracking_id of the chunk to have the same tracking_id as an existing chunk, the request will fail.
758
+ # @param tr_dataset [String] The dataset id to use for the request
759
+ # @param update_chunk_data [UpdateChunkData] JSON request payload to update a chunk (chunk)
760
+ # @param [Hash] opts the optional parameters
761
+ # @return [nil]
762
+ def update_chunk(tr_dataset, update_chunk_data, opts = {})
763
+ update_chunk_with_http_info(tr_dataset, update_chunk_data, opts)
764
+ nil
765
+ end
766
+
767
+ # update_chunk
768
+ # update_chunk Update a chunk. If you try to change the tracking_id of the chunk to have the same tracking_id as an existing chunk, the request will fail.
769
+ # @param tr_dataset [String] The dataset id to use for the request
770
+ # @param update_chunk_data [UpdateChunkData] JSON request payload to update a chunk (chunk)
771
+ # @param [Hash] opts the optional parameters
772
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
773
+ def update_chunk_with_http_info(tr_dataset, update_chunk_data, opts = {})
774
+ if @api_client.config.debugging
775
+ @api_client.config.logger.debug 'Calling API: ChunkApi.update_chunk ...'
776
+ end
777
+ # verify the required parameter 'tr_dataset' is set
778
+ if @api_client.config.client_side_validation && tr_dataset.nil?
779
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.update_chunk"
780
+ end
781
+ # verify the required parameter 'update_chunk_data' is set
782
+ if @api_client.config.client_side_validation && update_chunk_data.nil?
783
+ fail ArgumentError, "Missing the required parameter 'update_chunk_data' when calling ChunkApi.update_chunk"
784
+ end
785
+ # resource path
786
+ local_var_path = '/api/chunk/update'
787
+
788
+ # query parameters
789
+ query_params = opts[:query_params] || {}
790
+
791
+ # header parameters
792
+ header_params = opts[:header_params] || {}
793
+ # HTTP header 'Accept' (if needed)
794
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
795
+ # HTTP header 'Content-Type'
796
+ content_type = @api_client.select_header_content_type(['application/json'])
797
+ if !content_type.nil?
798
+ header_params['Content-Type'] = content_type
799
+ end
800
+ header_params[:'TR-Dataset'] = tr_dataset
801
+
802
+ # form parameters
803
+ form_params = opts[:form_params] || {}
804
+
805
+ # http body (model)
806
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_chunk_data)
807
+
808
+ # return_type
809
+ return_type = opts[:debug_return_type]
810
+
811
+ # auth_names
812
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
813
+
814
+ new_options = opts.merge(
815
+ :operation => :"ChunkApi.update_chunk",
816
+ :header_params => header_params,
817
+ :query_params => query_params,
818
+ :form_params => form_params,
819
+ :body => post_body,
820
+ :auth_names => auth_names,
821
+ :return_type => return_type
822
+ )
823
+
824
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
825
+ if @api_client.config.debugging
826
+ @api_client.config.logger.debug "API called: ChunkApi#update_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
827
+ end
828
+ return data, status_code, headers
829
+ end
830
+
831
+ # update_chunk_by_tracking_id
832
+ # update_chunk_by_tracking_id Update a chunk by tracking_id. This is useful for when you are coordinating with an external system and want to use the tracking_id to identify the chunk.
833
+ # @param tr_dataset [String] The dataset id to use for the request
834
+ # @param update_chunk_by_tracking_id_data [UpdateChunkByTrackingIdData] JSON request payload to update a chunk by tracking_id (chunks)
835
+ # @param [Hash] opts the optional parameters
836
+ # @return [nil]
837
+ def update_chunk_by_tracking_id(tr_dataset, update_chunk_by_tracking_id_data, opts = {})
838
+ update_chunk_by_tracking_id_with_http_info(tr_dataset, update_chunk_by_tracking_id_data, opts)
839
+ nil
840
+ end
841
+
842
+ # update_chunk_by_tracking_id
843
+ # update_chunk_by_tracking_id Update a chunk by tracking_id. This is useful for when you are coordinating with an external system and want to use the tracking_id to identify the chunk.
844
+ # @param tr_dataset [String] The dataset id to use for the request
845
+ # @param update_chunk_by_tracking_id_data [UpdateChunkByTrackingIdData] JSON request payload to update a chunk by tracking_id (chunks)
846
+ # @param [Hash] opts the optional parameters
847
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
848
+ def update_chunk_by_tracking_id_with_http_info(tr_dataset, update_chunk_by_tracking_id_data, opts = {})
849
+ if @api_client.config.debugging
850
+ @api_client.config.logger.debug 'Calling API: ChunkApi.update_chunk_by_tracking_id ...'
851
+ end
852
+ # verify the required parameter 'tr_dataset' is set
853
+ if @api_client.config.client_side_validation && tr_dataset.nil?
854
+ fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.update_chunk_by_tracking_id"
855
+ end
856
+ # verify the required parameter 'update_chunk_by_tracking_id_data' is set
857
+ if @api_client.config.client_side_validation && update_chunk_by_tracking_id_data.nil?
858
+ fail ArgumentError, "Missing the required parameter 'update_chunk_by_tracking_id_data' when calling ChunkApi.update_chunk_by_tracking_id"
859
+ end
860
+ # resource path
861
+ local_var_path = '/api/chunk/tracking_id/update'
862
+
863
+ # query parameters
864
+ query_params = opts[:query_params] || {}
865
+
866
+ # header parameters
867
+ header_params = opts[:header_params] || {}
868
+ # HTTP header 'Accept' (if needed)
869
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
870
+ # HTTP header 'Content-Type'
871
+ content_type = @api_client.select_header_content_type(['application/json'])
872
+ if !content_type.nil?
873
+ header_params['Content-Type'] = content_type
874
+ end
875
+ header_params[:'TR-Dataset'] = tr_dataset
876
+
877
+ # form parameters
878
+ form_params = opts[:form_params] || {}
879
+
880
+ # http body (model)
881
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_chunk_by_tracking_id_data)
882
+
883
+ # return_type
884
+ return_type = opts[:debug_return_type]
885
+
886
+ # auth_names
887
+ auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey']
888
+
889
+ new_options = opts.merge(
890
+ :operation => :"ChunkApi.update_chunk_by_tracking_id",
891
+ :header_params => header_params,
892
+ :query_params => query_params,
893
+ :form_params => form_params,
894
+ :body => post_body,
895
+ :auth_names => auth_names,
896
+ :return_type => return_type
897
+ )
898
+
899
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
900
+ if @api_client.config.debugging
901
+ @api_client.config.logger.debug "API called: ChunkApi#update_chunk_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
902
+ end
903
+ return data, status_code, headers
904
+ end
905
+ end
906
+ end