Class: TrieveRubyClient::ChunkApi
- Inherits:
-
Object
- Object
- TrieveRubyClient::ChunkApi
- Defined in:
- lib/trieve_ruby_client/api/chunk_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#bulk_create_chunk(tr_dataset, create_chunk_data, opts = {}) ⇒ ReturnQueuedChunk
bulk_create_chunk bulk_create_chunk Create a new chunk from an array of chunks.
-
#bulk_create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {}) ⇒ Array<(ReturnQueuedChunk, Integer, Hash)>
bulk_create_chunk bulk_create_chunk Create a new chunk from an array of chunks.
-
#create_chunk(tr_dataset, create_chunk_data, opts = {}) ⇒ ReturnQueuedChunk
create_chunk create_chunk Create a new chunk.
-
#create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {}) ⇒ Array<(ReturnQueuedChunk, Integer, Hash)>
create_chunk create_chunk Create a new chunk.
-
#create_suggested_queries_handler(tr_dataset, suggested_queries_request, opts = {}) ⇒ SuggestedQueriesResponse
get_suggested_queries 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.
-
#create_suggested_queries_handler_with_http_info(tr_dataset, suggested_queries_request, opts = {}) ⇒ Array<(SuggestedQueriesResponse, Integer, Hash)>
get_suggested_queries 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.
-
#delete_chunk(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ nil
delete_chunk delete_chunk Delete a chunk by its id.
-
#delete_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {}) ⇒ nil
delete_chunk_by_tracking_id delete_chunk_by_tracking_id Delete a chunk by tracking_id.
-
#delete_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
delete_chunk_by_tracking_id delete_chunk_by_tracking_id Delete a chunk by tracking_id.
-
#delete_chunk_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ Array<(nil, Integer, Hash)>
delete_chunk delete_chunk Delete a chunk by its id.
-
#generate_off_chunks(tr_dataset, generate_chunks_request, opts = {}) ⇒ String
augmented_generation_from_chunks augmented_generation_from_chunks This endpoint exists as an alternative to the topic+message concept where our API handles chat memory.
-
#generate_off_chunks_with_http_info(tr_dataset, generate_chunks_request, opts = {}) ⇒ Array<(String, Integer, Hash)>
augmented_generation_from_chunks augmented_generation_from_chunks This endpoint exists as an alternative to the topic+message concept where our API handles chat memory.
-
#get_chunk_by_id(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ ChunkMetadata
get_chunk get_chunk Get a singular chunk by id.
-
#get_chunk_by_id_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
get_chunk get_chunk Get a singular chunk by id.
-
#get_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {}) ⇒ ChunkMetadata
get_chunk_by_tracking_id get_chunk_by_tracking_id Get a singular chunk by tracking_id.
-
#get_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
get_chunk_by_tracking_id get_chunk_by_tracking_id Get a singular chunk by tracking_id.
-
#get_recommended_chunks(tr_dataset, recommend_chunks_request, opts = {}) ⇒ Array<ChunkMetadataWithFileData>
get_recommended_chunks get_recommended_chunks Get recommendations of chunks similar to the chunks in the request.
-
#get_recommended_chunks_with_http_info(tr_dataset, recommend_chunks_request, opts = {}) ⇒ Array<(Array<ChunkMetadataWithFileData>, Integer, Hash)>
get_recommended_chunks get_recommended_chunks Get recommendations of chunks similar to the chunks in the request.
-
#initialize(api_client = ApiClient.default) ⇒ ChunkApi
constructor
A new instance of ChunkApi.
-
#search_chunk(tr_dataset, search_chunk_data, opts = {}) ⇒ SearchChunkQueryResponseBody
search search This route provides the primary search functionality for the API.
-
#search_chunk_with_http_info(tr_dataset, search_chunk_data, opts = {}) ⇒ Array<(SearchChunkQueryResponseBody, Integer, Hash)>
search search This route provides the primary search functionality for the API.
-
#update_chunk(tr_dataset, update_chunk_data, opts = {}) ⇒ nil
update_chunk update_chunk Update a chunk.
-
#update_chunk_by_tracking_id(tr_dataset, update_chunk_by_tracking_id_data, opts = {}) ⇒ nil
update_chunk_by_tracking_id update_chunk_by_tracking_id Update a chunk by tracking_id.
-
#update_chunk_by_tracking_id_with_http_info(tr_dataset, update_chunk_by_tracking_id_data, opts = {}) ⇒ Array<(nil, Integer, Hash)>
update_chunk_by_tracking_id update_chunk_by_tracking_id Update a chunk by tracking_id.
-
#update_chunk_with_http_info(tr_dataset, update_chunk_data, opts = {}) ⇒ Array<(nil, Integer, Hash)>
update_chunk update_chunk Update a chunk.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#bulk_create_chunk(tr_dataset, create_chunk_data, opts = {}) ⇒ ReturnQueuedChunk
bulk_create_chunk 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.
28 29 30 31 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 28 def bulk_create_chunk(tr_dataset, create_chunk_data, opts = {}) data, _status_code, _headers = bulk_create_chunk_with_http_info(tr_dataset, create_chunk_data, opts) data end |
#bulk_create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {}) ⇒ Array<(ReturnQueuedChunk, Integer, Hash)>
bulk_create_chunk 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.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 39 def bulk_create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.bulk_create_chunk ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.bulk_create_chunk" end # verify the required parameter 'create_chunk_data' is set if @api_client.config.client_side_validation && create_chunk_data.nil? fail ArgumentError, "Missing the required parameter 'create_chunk_data' when calling ChunkApi.bulk_create_chunk" end # resource path local_var_path = '/api/chunk/bulk' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_chunk_data) # return_type return_type = opts[:debug_return_type] || 'ReturnQueuedChunk' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.bulk_create_chunk", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#bulk_create_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_chunk(tr_dataset, create_chunk_data, opts = {}) ⇒ ReturnQueuedChunk
create_chunk 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.
103 104 105 106 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 103 def create_chunk(tr_dataset, create_chunk_data, opts = {}) data, _status_code, _headers = create_chunk_with_http_info(tr_dataset, create_chunk_data, opts) data end |
#create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {}) ⇒ Array<(ReturnQueuedChunk, Integer, Hash)>
create_chunk 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.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 114 def create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.create_chunk ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.create_chunk" end # verify the required parameter 'create_chunk_data' is set if @api_client.config.client_side_validation && create_chunk_data.nil? fail ArgumentError, "Missing the required parameter 'create_chunk_data' when calling ChunkApi.create_chunk" end # resource path local_var_path = '/api/chunk' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_chunk_data) # return_type return_type = opts[:debug_return_type] || 'ReturnQueuedChunk' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.create_chunk", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#create_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_suggested_queries_handler(tr_dataset, suggested_queries_request, opts = {}) ⇒ SuggestedQueriesResponse
get_suggested_queries 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.
178 179 180 181 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 178 def create_suggested_queries_handler(tr_dataset, suggested_queries_request, opts = {}) data, _status_code, _headers = create_suggested_queries_handler_with_http_info(tr_dataset, suggested_queries_request, opts) data end |
#create_suggested_queries_handler_with_http_info(tr_dataset, suggested_queries_request, opts = {}) ⇒ Array<(SuggestedQueriesResponse, Integer, Hash)>
get_suggested_queries 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.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 189 def create_suggested_queries_handler_with_http_info(tr_dataset, suggested_queries_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.create_suggested_queries_handler ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.create_suggested_queries_handler" end # verify the required parameter 'suggested_queries_request' is set if @api_client.config.client_side_validation && suggested_queries_request.nil? fail ArgumentError, "Missing the required parameter 'suggested_queries_request' when calling ChunkApi.create_suggested_queries_handler" end # resource path local_var_path = '/api/chunk/gen_suggestions' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(suggested_queries_request) # return_type return_type = opts[:debug_return_type] || 'SuggestedQueriesResponse' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.create_suggested_queries_handler", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#create_suggested_queries_handler\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_chunk(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ nil
delete_chunk 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.
254 255 256 257 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 254 def delete_chunk(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) delete_chunk_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts) nil end |
#delete_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {}) ⇒ nil
delete_chunk_by_tracking_id 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.
325 326 327 328 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 325 def delete_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {}) delete_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts) nil end |
#delete_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
delete_chunk_by_tracking_id 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.
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 336 def delete_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.delete_chunk_by_tracking_id ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.delete_chunk_by_tracking_id" end # verify the required parameter 'tracking_id' is set if @api_client.config.client_side_validation && tracking_id.nil? fail ArgumentError, "Missing the required parameter 'tracking_id' when calling ChunkApi.delete_chunk_by_tracking_id" end # resource path local_var_path = '/api/chunk/tracking_id/{tracking_id}'.sub('{' + 'tracking_id' + '}', CGI.escape(tracking_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.delete_chunk_by_tracking_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#delete_chunk_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_chunk_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ Array<(nil, Integer, Hash)>
delete_chunk 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.
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 266 def delete_chunk_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.delete_chunk ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.delete_chunk" end # verify the required parameter 'tracking_or_chunk' is set if @api_client.config.client_side_validation && tracking_or_chunk.nil? fail ArgumentError, "Missing the required parameter 'tracking_or_chunk' when calling ChunkApi.delete_chunk" end # resource path 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)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.delete_chunk", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#delete_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#generate_off_chunks(tr_dataset, generate_chunks_request, opts = {}) ⇒ String
augmented_generation_from_chunks 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.
395 396 397 398 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 395 def generate_off_chunks(tr_dataset, generate_chunks_request, opts = {}) data, _status_code, _headers = generate_off_chunks_with_http_info(tr_dataset, generate_chunks_request, opts) data end |
#generate_off_chunks_with_http_info(tr_dataset, generate_chunks_request, opts = {}) ⇒ Array<(String, Integer, Hash)>
augmented_generation_from_chunks 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.
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 406 def generate_off_chunks_with_http_info(tr_dataset, generate_chunks_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.generate_off_chunks ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.generate_off_chunks" end # verify the required parameter 'generate_chunks_request' is set if @api_client.config.client_side_validation && generate_chunks_request.nil? fail ArgumentError, "Missing the required parameter 'generate_chunks_request' when calling ChunkApi.generate_off_chunks" end # resource path local_var_path = '/api/chunk/generate' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_chunks_request) # return_type return_type = opts[:debug_return_type] || 'String' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.generate_off_chunks", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#generate_off_chunks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_chunk_by_id(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ ChunkMetadata
get_chunk get_chunk Get a singular chunk by id.
471 472 473 474 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 471 def get_chunk_by_id(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) data, _status_code, _headers = get_chunk_by_id_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts) data end |
#get_chunk_by_id_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
get_chunk get_chunk Get a singular chunk by id.
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 483 def get_chunk_by_id_with_http_info(tr_dataset, chunk_id, tracking_or_chunk, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.get_chunk_by_id ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.get_chunk_by_id" end # verify the required parameter 'tracking_or_chunk' is set if @api_client.config.client_side_validation && tracking_or_chunk.nil? fail ArgumentError, "Missing the required parameter 'tracking_or_chunk' when calling ChunkApi.get_chunk_by_id" end # resource path 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)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ChunkMetadata' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.get_chunk_by_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#get_chunk_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {}) ⇒ ChunkMetadata
get_chunk_by_tracking_id 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.
542 543 544 545 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 542 def get_chunk_by_tracking_id(tr_dataset, tracking_id, opts = {}) data, _status_code, _headers = get_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts) data end |
#get_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
get_chunk_by_tracking_id 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.
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 553 def get_chunk_by_tracking_id_with_http_info(tr_dataset, tracking_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.get_chunk_by_tracking_id ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.get_chunk_by_tracking_id" end # verify the required parameter 'tracking_id' is set if @api_client.config.client_side_validation && tracking_id.nil? fail ArgumentError, "Missing the required parameter 'tracking_id' when calling ChunkApi.get_chunk_by_tracking_id" end # resource path local_var_path = '/api/chunk/tracking_id/{tracking_id}'.sub('{' + 'tracking_id' + '}', CGI.escape(tracking_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ChunkMetadata' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.get_chunk_by_tracking_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#get_chunk_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_recommended_chunks(tr_dataset, recommend_chunks_request, opts = {}) ⇒ Array<ChunkMetadataWithFileData>
get_recommended_chunks 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.
612 613 614 615 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 612 def get_recommended_chunks(tr_dataset, recommend_chunks_request, opts = {}) data, _status_code, _headers = get_recommended_chunks_with_http_info(tr_dataset, recommend_chunks_request, opts) data end |
#get_recommended_chunks_with_http_info(tr_dataset, recommend_chunks_request, opts = {}) ⇒ Array<(Array<ChunkMetadataWithFileData>, Integer, Hash)>
get_recommended_chunks 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.
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 623 def get_recommended_chunks_with_http_info(tr_dataset, recommend_chunks_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.get_recommended_chunks ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.get_recommended_chunks" end # verify the required parameter 'recommend_chunks_request' is set if @api_client.config.client_side_validation && recommend_chunks_request.nil? fail ArgumentError, "Missing the required parameter 'recommend_chunks_request' when calling ChunkApi.get_recommended_chunks" end # resource path local_var_path = '/api/chunk/recommend' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(recommend_chunks_request) # return_type return_type = opts[:debug_return_type] || 'Array<ChunkMetadataWithFileData>' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.get_recommended_chunks", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#get_recommended_chunks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search_chunk(tr_dataset, search_chunk_data, opts = {}) ⇒ SearchChunkQueryResponseBody
search 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.
687 688 689 690 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 687 def search_chunk(tr_dataset, search_chunk_data, opts = {}) data, _status_code, _headers = search_chunk_with_http_info(tr_dataset, search_chunk_data, opts) data end |
#search_chunk_with_http_info(tr_dataset, search_chunk_data, opts = {}) ⇒ Array<(SearchChunkQueryResponseBody, Integer, Hash)>
search 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.
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 698 def search_chunk_with_http_info(tr_dataset, search_chunk_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.search_chunk ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.search_chunk" end # verify the required parameter 'search_chunk_data' is set if @api_client.config.client_side_validation && search_chunk_data.nil? fail ArgumentError, "Missing the required parameter 'search_chunk_data' when calling ChunkApi.search_chunk" end # resource path local_var_path = '/api/chunk/search' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(search_chunk_data) # return_type return_type = opts[:debug_return_type] || 'SearchChunkQueryResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.search_chunk", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#search_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_chunk(tr_dataset, update_chunk_data, opts = {}) ⇒ nil
update_chunk 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.
762 763 764 765 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 762 def update_chunk(tr_dataset, update_chunk_data, opts = {}) update_chunk_with_http_info(tr_dataset, update_chunk_data, opts) nil end |
#update_chunk_by_tracking_id(tr_dataset, update_chunk_by_tracking_id_data, opts = {}) ⇒ nil
update_chunk_by_tracking_id 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.
837 838 839 840 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 837 def update_chunk_by_tracking_id(tr_dataset, update_chunk_by_tracking_id_data, opts = {}) update_chunk_by_tracking_id_with_http_info(tr_dataset, update_chunk_by_tracking_id_data, opts) nil end |
#update_chunk_by_tracking_id_with_http_info(tr_dataset, update_chunk_by_tracking_id_data, opts = {}) ⇒ Array<(nil, Integer, Hash)>
update_chunk_by_tracking_id 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.
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 848 def update_chunk_by_tracking_id_with_http_info(tr_dataset, update_chunk_by_tracking_id_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.update_chunk_by_tracking_id ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.update_chunk_by_tracking_id" end # verify the required parameter 'update_chunk_by_tracking_id_data' is set if @api_client.config.client_side_validation && update_chunk_by_tracking_id_data.nil? fail ArgumentError, "Missing the required parameter 'update_chunk_by_tracking_id_data' when calling ChunkApi.update_chunk_by_tracking_id" end # resource path local_var_path = '/api/chunk/tracking_id/update' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_chunk_by_tracking_id_data) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.update_chunk_by_tracking_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#update_chunk_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_chunk_with_http_info(tr_dataset, update_chunk_data, opts = {}) ⇒ Array<(nil, Integer, Hash)>
update_chunk 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.
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 773 def update_chunk_with_http_info(tr_dataset, update_chunk_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.update_chunk ...' end # verify the required parameter 'tr_dataset' is set if @api_client.config.client_side_validation && tr_dataset.nil? fail ArgumentError, "Missing the required parameter 'tr_dataset' when calling ChunkApi.update_chunk" end # verify the required parameter 'update_chunk_data' is set if @api_client.config.client_side_validation && update_chunk_data.nil? fail ArgumentError, "Missing the required parameter 'update_chunk_data' when calling ChunkApi.update_chunk" end # resource path local_var_path = '/api/chunk/update' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'TR-Dataset'] = tr_dataset # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_chunk_data) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Cookie', 'ApiKey'] = opts.merge( :operation => :"ChunkApi.update_chunk", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChunkApi#update_chunk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |