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
-
#create_chunk(tr_dataset, create_chunk_data, opts = {}) ⇒ ReturnQueuedChunk
Create or Upsert Chunk or Chunks Create or Upsert Chunk or Chunks Create a new chunk.
-
#create_chunk_with_http_info(tr_dataset, create_chunk_data, opts = {}) ⇒ Array<(ReturnQueuedChunk, Integer, Hash)>
Create or Upsert Chunk or Chunks Create or Upsert Chunk or Chunks Create a new chunk.
-
#create_suggested_queries_handler(tr_dataset, suggested_queries_request, opts = {}) ⇒ SuggestedQueriesResponse
Generate suggested queries Generate 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)>
Generate suggested queries Generate 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, 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, 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
RAG on Specified Chunks RAG on Specified 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)>
RAG on Specified Chunks RAG on Specified 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, opts = {}) ⇒ ChunkMetadata
Get Chunk By Id Get Chunk By Id Get a singular chunk by id.
-
#get_chunk_by_id_with_http_info(tr_dataset, chunk_id, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
Get Chunk By Id Get Chunk By Id 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_chunks_by_ids(tr_dataset, get_chunks_data, opts = {}) ⇒ Array<ChunkMetadata>
Get Chunks By Ids Get Chunks By Ids Get multiple chunks by multiple ids.
-
#get_chunks_by_ids_with_http_info(tr_dataset, get_chunks_data, opts = {}) ⇒ Array<(Array<ChunkMetadata>, Integer, Hash)>
Get Chunks By Ids Get Chunks By Ids Get multiple chunks by multiple ids.
-
#get_chunks_by_tracking_ids(tr_dataset, get_tracking_chunks_data, opts = {}) ⇒ ChunkMetadata
Get Chunks By TrackingIds Get Chunks By TrackingIds Get multiple chunks by ids.
-
#get_chunks_by_tracking_ids_with_http_info(tr_dataset, get_tracking_chunks_data, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
Get Chunks By TrackingIds Get Chunks By TrackingIds Get multiple chunks by ids.
-
#get_recommended_chunks(tr_dataset, recommend_chunks_request, opts = {}) ⇒ Array<ChunkMetadataWithScore>
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<ChunkMetadataWithScore>, 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_chunks(tr_dataset, search_chunk_data, opts = {}) ⇒ SearchChunkQueryResponseBody
Search Search This route provides the primary search functionality for the API.
-
#search_chunks_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
#create_chunk(tr_dataset, create_chunk_data, opts = {}) ⇒ ReturnQueuedChunk
Create or Upsert Chunk or Chunks Create or Upsert Chunk or Chunks 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. If uploading in bulk, the maximum amount of chunks that can be uploaded at once is 120 chunks.
28 29 30 31 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 28 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 or Upsert Chunk or Chunks Create or Upsert Chunk or Chunks 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. If uploading in bulk, the maximum amount of chunks that can be uploaded at once is 120 chunks.
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 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] || ['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
Generate suggested queries Generate 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.
103 104 105 106 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 103 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)>
Generate suggested queries Generate 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.
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_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] || ['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, 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.
178 179 180 181 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 178 def delete_chunk(tr_dataset, chunk_id, opts = {}) delete_chunk_with_http_info(tr_dataset, chunk_id, 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.
248 249 250 251 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 248 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.
259 260 261 262 263 264 265 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 259 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] || ['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, 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.
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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 189 def delete_chunk_with_http_info(tr_dataset, chunk_id, 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 'chunk_id' is set if @api_client.config.client_side_validation && chunk_id.nil? fail ArgumentError, "Missing the required parameter 'chunk_id' when calling ChunkApi.delete_chunk" end # resource path local_var_path = '/api/chunk/{chunk_id}'.sub('{' + 'chunk_id' + '}', CGI.escape(chunk_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] || ['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
RAG on Specified Chunks RAG on Specified 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.
318 319 320 321 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 318 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)>
RAG on Specified Chunks RAG on Specified 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.
329 330 331 332 333 334 335 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 329 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] || ['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, opts = {}) ⇒ ChunkMetadata
Get Chunk By Id Get Chunk By Id Get a singular chunk by id.
393 394 395 396 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 393 def get_chunk_by_id(tr_dataset, chunk_id, opts = {}) data, _status_code, _headers = get_chunk_by_id_with_http_info(tr_dataset, chunk_id, opts) data end |
#get_chunk_by_id_with_http_info(tr_dataset, chunk_id, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
Get Chunk By Id Get Chunk By Id Get a singular chunk by id.
404 405 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 404 def get_chunk_by_id_with_http_info(tr_dataset, chunk_id, 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 'chunk_id' is set if @api_client.config.client_side_validation && chunk_id.nil? fail ArgumentError, "Missing the required parameter 'chunk_id' when calling ChunkApi.get_chunk_by_id" end # resource path local_var_path = '/api/chunk/{chunk_id}'.sub('{' + 'chunk_id' + '}', CGI.escape(chunk_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] || ['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.
463 464 465 466 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 463 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.
474 475 476 477 478 479 480 481 482 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 474 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] || ['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_chunks_by_ids(tr_dataset, get_chunks_data, opts = {}) ⇒ Array<ChunkMetadata>
Get Chunks By Ids Get Chunks By Ids Get multiple chunks by multiple ids.
533 534 535 536 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 533 def get_chunks_by_ids(tr_dataset, get_chunks_data, opts = {}) data, _status_code, _headers = get_chunks_by_ids_with_http_info(tr_dataset, get_chunks_data, opts) data end |
#get_chunks_by_ids_with_http_info(tr_dataset, get_chunks_data, opts = {}) ⇒ Array<(Array<ChunkMetadata>, Integer, Hash)>
Get Chunks By Ids Get Chunks By Ids Get multiple chunks by multiple ids.
544 545 546 547 548 549 550 551 552 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 544 def get_chunks_by_ids_with_http_info(tr_dataset, get_chunks_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.get_chunks_by_ids ...' 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_chunks_by_ids" end # verify the required parameter 'get_chunks_data' is set if @api_client.config.client_side_validation && get_chunks_data.nil? fail ArgumentError, "Missing the required parameter 'get_chunks_data' when calling ChunkApi.get_chunks_by_ids" end # resource path local_var_path = '/api/chunks' # 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(get_chunks_data) # return_type return_type = opts[:debug_return_type] || 'Array<ChunkMetadata>' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"ChunkApi.get_chunks_by_ids", :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_chunks_by_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_chunks_by_tracking_ids(tr_dataset, get_tracking_chunks_data, opts = {}) ⇒ ChunkMetadata
Get Chunks By TrackingIds Get Chunks By TrackingIds Get multiple chunks by ids.
608 609 610 611 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 608 def get_chunks_by_tracking_ids(tr_dataset, get_tracking_chunks_data, opts = {}) data, _status_code, _headers = get_chunks_by_tracking_ids_with_http_info(tr_dataset, get_tracking_chunks_data, opts) data end |
#get_chunks_by_tracking_ids_with_http_info(tr_dataset, get_tracking_chunks_data, opts = {}) ⇒ Array<(ChunkMetadata, Integer, Hash)>
Get Chunks By TrackingIds Get Chunks By TrackingIds Get multiple chunks by ids.
619 620 621 622 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 619 def get_chunks_by_tracking_ids_with_http_info(tr_dataset, get_tracking_chunks_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.get_chunks_by_tracking_ids ...' 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_chunks_by_tracking_ids" end # verify the required parameter 'get_tracking_chunks_data' is set if @api_client.config.client_side_validation && get_tracking_chunks_data.nil? fail ArgumentError, "Missing the required parameter 'get_tracking_chunks_data' when calling ChunkApi.get_chunks_by_tracking_ids" end # resource path local_var_path = '/api/chunks/tracking' # 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(get_tracking_chunks_data) # return_type return_type = opts[:debug_return_type] || 'ChunkMetadata' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"ChunkApi.get_chunks_by_tracking_ids", :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_chunks_by_tracking_ids\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<ChunkMetadataWithScore>
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.
683 684 685 686 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 683 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<ChunkMetadataWithScore>, 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.
694 695 696 697 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 694 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<ChunkMetadataWithScore>' # auth_names auth_names = opts[:debug_auth_names] || ['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_chunks(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><mark>` tags for sub-sentence highlighting.
758 759 760 761 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 758 def search_chunks(tr_dataset, search_chunk_data, opts = {}) data, _status_code, _headers = search_chunks_with_http_info(tr_dataset, search_chunk_data, opts) data end |
#search_chunks_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><mark>` tags for sub-sentence highlighting.
769 770 771 772 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 769 def search_chunks_with_http_info(tr_dataset, search_chunk_data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChunkApi.search_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.search_chunks" 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_chunks" 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] || ['ApiKey'] = opts.merge( :operation => :"ChunkApi.search_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#search_chunks\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.
833 834 835 836 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 833 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.
908 909 910 911 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 908 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.
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 919 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] || ['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.
844 845 846 847 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 |
# File 'lib/trieve_ruby_client/api/chunk_api.rb', line 844 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' # 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] || ['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 |