carbon_ruby_sdk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +11 -0
  3. data/Gemfile.lock +89 -0
  4. data/README.md +2325 -0
  5. data/Rakefile +10 -0
  6. data/carbon_ruby_sdk.gemspec +39 -0
  7. data/header.png +0 -0
  8. data/lib/carbon_ruby_sdk/api/auth_api.rb +177 -0
  9. data/lib/carbon_ruby_sdk/api/data_sources_api.rb +217 -0
  10. data/lib/carbon_ruby_sdk/api/embeddings_api.rb +565 -0
  11. data/lib/carbon_ruby_sdk/api/files_api.rb +1526 -0
  12. data/lib/carbon_ruby_sdk/api/health_api.rb +92 -0
  13. data/lib/carbon_ruby_sdk/api/integrations_api.rb +2201 -0
  14. data/lib/carbon_ruby_sdk/api/organizations_api.rb +92 -0
  15. data/lib/carbon_ruby_sdk/api/users_api.rb +209 -0
  16. data/lib/carbon_ruby_sdk/api/utilities_api.rb +710 -0
  17. data/lib/carbon_ruby_sdk/api/webhooks_api.rb +296 -0
  18. data/lib/carbon_ruby_sdk/api_client.rb +436 -0
  19. data/lib/carbon_ruby_sdk/api_client_custom.rb +14 -0
  20. data/lib/carbon_ruby_sdk/api_error.rb +53 -0
  21. data/lib/carbon_ruby_sdk/configuration.rb +354 -0
  22. data/lib/carbon_ruby_sdk/models/add_webhook_props.rb +220 -0
  23. data/lib/carbon_ruby_sdk/models/body_create_upload_file_uploadfile_post.rb +220 -0
  24. data/lib/carbon_ruby_sdk/models/chunk_properties.rb +248 -0
  25. data/lib/carbon_ruby_sdk/models/chunk_properties_nullable.rb +248 -0
  26. data/lib/carbon_ruby_sdk/models/chunks_and_embeddings.rb +246 -0
  27. data/lib/carbon_ruby_sdk/models/chunks_and_embeddings_upload_input.rb +247 -0
  28. data/lib/carbon_ruby_sdk/models/data_source_last_sync_actions.rb +38 -0
  29. data/lib/carbon_ruby_sdk/models/data_source_sync_statuses.rb +38 -0
  30. data/lib/carbon_ruby_sdk/models/data_source_type.rb +76 -0
  31. data/lib/carbon_ruby_sdk/models/data_source_type_nullable.rb +76 -0
  32. data/lib/carbon_ruby_sdk/models/delete_files_query_input.rb +252 -0
  33. data/lib/carbon_ruby_sdk/models/directory_item.rb +266 -0
  34. data/lib/carbon_ruby_sdk/models/document_response.rb +328 -0
  35. data/lib/carbon_ruby_sdk/models/document_response_list.rb +222 -0
  36. data/lib/carbon_ruby_sdk/models/embedding_and_chunk.rb +256 -0
  37. data/lib/carbon_ruby_sdk/models/embedding_generators.rb +43 -0
  38. data/lib/carbon_ruby_sdk/models/embedding_generators_nullable.rb +43 -0
  39. data/lib/carbon_ruby_sdk/models/embedding_properties.rb +226 -0
  40. data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_filters.rb +232 -0
  41. data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_order_by_columns.rb +37 -0
  42. data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_query_input.rb +262 -0
  43. data/lib/carbon_ruby_sdk/models/embeddings_and_chunks_response.rb +236 -0
  44. data/lib/carbon_ruby_sdk/models/external_file_sync_statuses.rb +43 -0
  45. data/lib/carbon_ruby_sdk/models/external_source_item.rb +420 -0
  46. data/lib/carbon_ruby_sdk/models/fetch_urls_response.rb +236 -0
  47. data/lib/carbon_ruby_sdk/models/file_content_types.rb +36 -0
  48. data/lib/carbon_ruby_sdk/models/file_content_types_nullable.rb +36 -0
  49. data/lib/carbon_ruby_sdk/models/file_formats.rb +76 -0
  50. data/lib/carbon_ruby_sdk/models/file_formats_nullable.rb +76 -0
  51. data/lib/carbon_ruby_sdk/models/file_statistics.rb +256 -0
  52. data/lib/carbon_ruby_sdk/models/file_statistics_nullable.rb +256 -0
  53. data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +316 -0
  54. data/lib/carbon_ruby_sdk/models/generic_success_response.rb +220 -0
  55. data/lib/carbon_ruby_sdk/models/get_embedding_documents_body.rb +416 -0
  56. data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +234 -0
  57. data/lib/carbon_ruby_sdk/models/gitbook_sync_request.rb +336 -0
  58. data/lib/carbon_ruby_sdk/models/gmail_sync_input.rb +301 -0
  59. data/lib/carbon_ruby_sdk/models/http_validation_error.rb +217 -0
  60. data/lib/carbon_ruby_sdk/models/hybrid_search_tuning_params.rb +234 -0
  61. data/lib/carbon_ruby_sdk/models/hybrid_search_tuning_params_nullable.rb +235 -0
  62. data/lib/carbon_ruby_sdk/models/list_data_source_items_request.rb +239 -0
  63. data/lib/carbon_ruby_sdk/models/list_data_source_items_response.rb +236 -0
  64. data/lib/carbon_ruby_sdk/models/list_request.rb +230 -0
  65. data/lib/carbon_ruby_sdk/models/list_response.rb +222 -0
  66. data/lib/carbon_ruby_sdk/models/location_property_inner.rb +226 -0
  67. data/lib/carbon_ruby_sdk/models/modify_user_configuration_input.rb +234 -0
  68. data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +362 -0
  69. data/lib/carbon_ruby_sdk/models/order_dir.rb +36 -0
  70. data/lib/carbon_ruby_sdk/models/organization_response.rb +362 -0
  71. data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +380 -0
  72. data/lib/carbon_ruby_sdk/models/organization_user_data_source_filters.rb +238 -0
  73. data/lib/carbon_ruby_sdk/models/organization_user_data_source_order_by_columns.rb +36 -0
  74. data/lib/carbon_ruby_sdk/models/organization_user_data_source_query_input.rb +246 -0
  75. data/lib/carbon_ruby_sdk/models/organization_user_data_source_response.rb +236 -0
  76. data/lib/carbon_ruby_sdk/models/organization_user_file_tag_create.rb +236 -0
  77. data/lib/carbon_ruby_sdk/models/organization_user_file_tags_remove.rb +236 -0
  78. data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_filters.rb +330 -0
  79. data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_order_by_types.rb +39 -0
  80. data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_query_input.rb +276 -0
  81. data/lib/carbon_ruby_sdk/models/outlook_sync_input.rb +313 -0
  82. data/lib/carbon_ruby_sdk/models/pagination.rb +228 -0
  83. data/lib/carbon_ruby_sdk/models/presigned_url_response.rb +220 -0
  84. data/lib/carbon_ruby_sdk/models/rank_property.rb +226 -0
  85. data/lib/carbon_ruby_sdk/models/raw_text_input.rb +295 -0
  86. data/lib/carbon_ruby_sdk/models/raw_transcript_property_inner_value.rb +226 -0
  87. data/lib/carbon_ruby_sdk/models/resync_file_query_input.rb +240 -0
  88. data/lib/carbon_ruby_sdk/models/revoke_access_token_input.rb +220 -0
  89. data/lib/carbon_ruby_sdk/models/rss_feed_input.rb +301 -0
  90. data/lib/carbon_ruby_sdk/models/s3_auth_request.rb +234 -0
  91. data/lib/carbon_ruby_sdk/models/s3_file_sync_input.rb +313 -0
  92. data/lib/carbon_ruby_sdk/models/s3_get_file_input.rb +226 -0
  93. data/lib/carbon_ruby_sdk/models/single_chunks_and_embeddings_upload_input.rb +256 -0
  94. data/lib/carbon_ruby_sdk/models/sitemap_scrape_request.rb +361 -0
  95. data/lib/carbon_ruby_sdk/models/source_property.rb +226 -0
  96. data/lib/carbon_ruby_sdk/models/sync_directory_request.rb +220 -0
  97. data/lib/carbon_ruby_sdk/models/sync_files_request.rb +328 -0
  98. data/lib/carbon_ruby_sdk/models/tags.rb +232 -0
  99. data/lib/carbon_ruby_sdk/models/tags1.rb +230 -0
  100. data/lib/carbon_ruby_sdk/models/text_embedding_generators.rb +42 -0
  101. data/lib/carbon_ruby_sdk/models/token_response.rb +234 -0
  102. data/lib/carbon_ruby_sdk/models/upload_file_from_url_input.rb +326 -0
  103. data/lib/carbon_ruby_sdk/models/user_file.rb +524 -0
  104. data/lib/carbon_ruby_sdk/models/user_files_v2.rb +236 -0
  105. data/lib/carbon_ruby_sdk/models/user_request_content.rb +220 -0
  106. data/lib/carbon_ruby_sdk/models/user_response.rb +354 -0
  107. data/lib/carbon_ruby_sdk/models/validation_error.rb +250 -0
  108. data/lib/carbon_ruby_sdk/models/webhook.rb +290 -0
  109. data/lib/carbon_ruby_sdk/models/webhook_filters.rb +218 -0
  110. data/lib/carbon_ruby_sdk/models/webhook_no_key.rb +276 -0
  111. data/lib/carbon_ruby_sdk/models/webhook_order_by_columns.rb +36 -0
  112. data/lib/carbon_ruby_sdk/models/webhook_query_input.rb +246 -0
  113. data/lib/carbon_ruby_sdk/models/webhook_query_response.rb +236 -0
  114. data/lib/carbon_ruby_sdk/models/webscrape_request.rb +375 -0
  115. data/lib/carbon_ruby_sdk/models/white_labeling_response.rb +234 -0
  116. data/lib/carbon_ruby_sdk/models/youtube_transcript_response.rb +252 -0
  117. data/lib/carbon_ruby_sdk/version.rb +11 -0
  118. data/lib/carbon_ruby_sdk.rb +207 -0
  119. data/spec/api/auth_api_spec.rb +50 -0
  120. data/spec/api/data_sources_api_spec.rb +51 -0
  121. data/spec/api/embeddings_api_spec.rb +63 -0
  122. data/spec/api/files_api_spec.rb +178 -0
  123. data/spec/api/health_api_spec.rb +39 -0
  124. data/spec/api/integrations_api_spec.rb +226 -0
  125. data/spec/api/organizations_api_spec.rb +39 -0
  126. data/spec/api/users_api_spec.rb +51 -0
  127. data/spec/api/utilities_api_spec.rb +102 -0
  128. data/spec/api/webhooks_api_spec.rb +62 -0
  129. data/spec/api_client_spec.rb +191 -0
  130. data/spec/configuration_spec.rb +38 -0
  131. data/spec/getting_started_spec.rb +196 -0
  132. data/spec/models/add_webhook_props_spec.rb +28 -0
  133. data/spec/models/body_create_upload_file_uploadfile_post_spec.rb +28 -0
  134. data/spec/models/chunk_properties_nullable_spec.rb +40 -0
  135. data/spec/models/chunk_properties_spec.rb +40 -0
  136. data/spec/models/chunks_and_embeddings_spec.rb +40 -0
  137. data/spec/models/chunks_and_embeddings_upload_input_spec.rb +40 -0
  138. data/spec/models/data_source_last_sync_actions_spec.rb +22 -0
  139. data/spec/models/data_source_sync_statuses_spec.rb +22 -0
  140. data/spec/models/data_source_type_nullable_spec.rb +22 -0
  141. data/spec/models/data_source_type_spec.rb +22 -0
  142. data/spec/models/delete_files_query_input_spec.rb +46 -0
  143. data/spec/models/directory_item_spec.rb +46 -0
  144. data/spec/models/document_response_list_spec.rb +28 -0
  145. data/spec/models/document_response_spec.rb +88 -0
  146. data/spec/models/embedding_and_chunk_spec.rb +46 -0
  147. data/spec/models/embedding_generators_nullable_spec.rb +22 -0
  148. data/spec/models/embedding_generators_spec.rb +22 -0
  149. data/spec/models/embedding_properties_spec.rb +34 -0
  150. data/spec/models/embeddings_and_chunks_filters_spec.rb +34 -0
  151. data/spec/models/embeddings_and_chunks_order_by_columns_spec.rb +22 -0
  152. data/spec/models/embeddings_and_chunks_query_input_spec.rb +52 -0
  153. data/spec/models/embeddings_and_chunks_response_spec.rb +34 -0
  154. data/spec/models/external_file_sync_statuses_spec.rb +22 -0
  155. data/spec/models/external_source_item_spec.rb +124 -0
  156. data/spec/models/fetch_urls_response_spec.rb +34 -0
  157. data/spec/models/file_content_types_nullable_spec.rb +22 -0
  158. data/spec/models/file_content_types_spec.rb +22 -0
  159. data/spec/models/file_formats_nullable_spec.rb +22 -0
  160. data/spec/models/file_formats_spec.rb +22 -0
  161. data/spec/models/file_statistics_nullable_spec.rb +52 -0
  162. data/spec/models/file_statistics_spec.rb +52 -0
  163. data/spec/models/fresh_desk_connect_request_spec.rb +76 -0
  164. data/spec/models/generic_success_response_spec.rb +28 -0
  165. data/spec/models/get_embedding_documents_body_spec.rb +106 -0
  166. data/spec/models/gitbook_connect_request_spec.rb +34 -0
  167. data/spec/models/gitbook_sync_request_spec.rb +76 -0
  168. data/spec/models/gmail_sync_input_spec.rb +70 -0
  169. data/spec/models/http_validation_error_spec.rb +28 -0
  170. data/spec/models/hybrid_search_tuning_params_nullable_spec.rb +34 -0
  171. data/spec/models/hybrid_search_tuning_params_spec.rb +34 -0
  172. data/spec/models/list_data_source_items_request_spec.rb +40 -0
  173. data/spec/models/list_data_source_items_response_spec.rb +34 -0
  174. data/spec/models/list_request_spec.rb +34 -0
  175. data/spec/models/list_response_spec.rb +28 -0
  176. data/spec/models/location_property_inner_spec.rb +22 -0
  177. data/spec/models/modify_user_configuration_input_spec.rb +34 -0
  178. data/spec/models/o_auth_url_request_spec.rb +106 -0
  179. data/spec/models/order_dir_spec.rb +22 -0
  180. data/spec/models/organization_response_spec.rb +94 -0
  181. data/spec/models/organization_user_data_source_api_spec.rb +100 -0
  182. data/spec/models/organization_user_data_source_filters_spec.rb +40 -0
  183. data/spec/models/organization_user_data_source_order_by_columns_spec.rb +22 -0
  184. data/spec/models/organization_user_data_source_query_input_spec.rb +46 -0
  185. data/spec/models/organization_user_data_source_response_spec.rb +34 -0
  186. data/spec/models/organization_user_file_tag_create_spec.rb +34 -0
  187. data/spec/models/organization_user_file_tags_remove_spec.rb +34 -0
  188. data/spec/models/organization_user_files_to_sync_filters_spec.rb +88 -0
  189. data/spec/models/organization_user_files_to_sync_order_by_types_spec.rb +22 -0
  190. data/spec/models/organization_user_files_to_sync_query_input_spec.rb +64 -0
  191. data/spec/models/outlook_sync_input_spec.rb +76 -0
  192. data/spec/models/pagination_spec.rb +34 -0
  193. data/spec/models/presigned_url_response_spec.rb +28 -0
  194. data/spec/models/rank_property_spec.rb +22 -0
  195. data/spec/models/raw_text_input_spec.rb +70 -0
  196. data/spec/models/raw_transcript_property_inner_value_spec.rb +22 -0
  197. data/spec/models/resync_file_query_input_spec.rb +40 -0
  198. data/spec/models/revoke_access_token_input_spec.rb +28 -0
  199. data/spec/models/rss_feed_input_spec.rb +70 -0
  200. data/spec/models/s3_auth_request_spec.rb +34 -0
  201. data/spec/models/s3_file_sync_input_spec.rb +76 -0
  202. data/spec/models/s3_get_file_input_spec.rb +34 -0
  203. data/spec/models/single_chunks_and_embeddings_upload_input_spec.rb +46 -0
  204. data/spec/models/sitemap_scrape_request_spec.rb +100 -0
  205. data/spec/models/source_property_spec.rb +22 -0
  206. data/spec/models/sync_directory_request_spec.rb +28 -0
  207. data/spec/models/sync_files_request_spec.rb +82 -0
  208. data/spec/models/tags1_spec.rb +22 -0
  209. data/spec/models/tags_spec.rb +22 -0
  210. data/spec/models/text_embedding_generators_spec.rb +22 -0
  211. data/spec/models/token_response_spec.rb +34 -0
  212. data/spec/models/upload_file_from_url_input_spec.rb +88 -0
  213. data/spec/models/user_file_spec.rb +190 -0
  214. data/spec/models/user_files_v2_spec.rb +34 -0
  215. data/spec/models/user_request_content_spec.rb +28 -0
  216. data/spec/models/user_response_spec.rb +88 -0
  217. data/spec/models/validation_error_spec.rb +40 -0
  218. data/spec/models/webhook_filters_spec.rb +28 -0
  219. data/spec/models/webhook_no_key_spec.rb +52 -0
  220. data/spec/models/webhook_order_by_columns_spec.rb +22 -0
  221. data/spec/models/webhook_query_input_spec.rb +46 -0
  222. data/spec/models/webhook_query_response_spec.rb +34 -0
  223. data/spec/models/webhook_spec.rb +58 -0
  224. data/spec/models/webscrape_request_spec.rb +106 -0
  225. data/spec/models/white_labeling_response_spec.rb +34 -0
  226. data/spec/models/youtube_transcript_response_spec.rb +46 -0
  227. data/spec/spec_helper.rb +107 -0
  228. metadata +440 -0
@@ -0,0 +1,1526 @@
1
+ =begin
2
+ #Carbon
3
+
4
+ #Connect external data to LLMs, no matter the source.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'cgi'
10
+
11
+ module Carbon
12
+ class FilesApi
13
+ attr_accessor :api_client
14
+
15
+ def initialize(api_client = ApiClient.default)
16
+ @api_client = api_client
17
+ end
18
+
19
+ # Create File Tags
20
+ #
21
+ # A tag is a key-value pair that can be added to a file. This pair can then be used
22
+ # for searches (e.g. embedding searches) in order to narrow down the scope of the search.
23
+ # A file can have any number of tags. The following are reserved keys that cannot be used:
24
+ # - db_embedding_id
25
+ # - organization_id
26
+ # - user_id
27
+ # - organization_user_file_id
28
+ #
29
+ # Carbon currently supports two data types for tag values - `string` and `list<string>`.
30
+ # Keys can only be `string`. If values other than `string` and `list<string>` are used,
31
+ # they're automatically converted to strings (e.g. 4 will become "4").
32
+ #
33
+ # @param tags [Hash<String, Tags1>]
34
+ # @param organization_user_file_id [Integer]
35
+ # @param body [OrganizationUserFileTagCreate]
36
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
37
+ def create_user_file_tags(tags:, organization_user_file_id:, extra: {})
38
+ _body = {}
39
+ _body[:tags] = tags if tags != SENTINEL
40
+ _body[:organization_user_file_id] = organization_user_file_id if organization_user_file_id != SENTINEL
41
+ organization_user_file_tag_create = _body
42
+ api_response = create_user_file_tags_with_http_info_impl(organization_user_file_tag_create, extra)
43
+ api_response.data
44
+ end
45
+
46
+ # Create File Tags
47
+ #
48
+ # A tag is a key-value pair that can be added to a file. This pair can then be used
49
+ # for searches (e.g. embedding searches) in order to narrow down the scope of the search.
50
+ # A file can have any number of tags. The following are reserved keys that cannot be used:
51
+ # - db_embedding_id
52
+ # - organization_id
53
+ # - user_id
54
+ # - organization_user_file_id
55
+ #
56
+ # Carbon currently supports two data types for tag values - `string` and `list<string>`.
57
+ # Keys can only be `string`. If values other than `string` and `list<string>` are used,
58
+ # they're automatically converted to strings (e.g. 4 will become "4").
59
+ #
60
+ # @param tags [Hash<String, Tags1>]
61
+ # @param organization_user_file_id [Integer]
62
+ # @param body [OrganizationUserFileTagCreate]
63
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
64
+ def create_user_file_tags_with_http_info(tags:, organization_user_file_id:, extra: {})
65
+ _body = {}
66
+ _body[:tags] = tags if tags != SENTINEL
67
+ _body[:organization_user_file_id] = organization_user_file_id if organization_user_file_id != SENTINEL
68
+ organization_user_file_tag_create = _body
69
+ create_user_file_tags_with_http_info_impl(organization_user_file_tag_create, extra)
70
+ end
71
+
72
+ # Create File Tags
73
+ # A tag is a key-value pair that can be added to a file. This pair can then be used for searches (e.g. embedding searches) in order to narrow down the scope of the search. A file can have any number of tags. The following are reserved keys that cannot be used: - db_embedding_id - organization_id - user_id - organization_user_file_id Carbon currently supports two data types for tag values - `string` and `list<string>`. Keys can only be `string`. If values other than `string` and `list<string>` are used, they're automatically converted to strings (e.g. 4 will become \"4\").
74
+ # @param organization_user_file_tag_create [OrganizationUserFileTagCreate]
75
+ # @param [Hash] opts the optional parameters
76
+ # @return [UserFile]
77
+ private def create_user_file_tags_impl(organization_user_file_tag_create, opts = {})
78
+ data, _status_code, _headers = create_user_file_tags_with_http_info(organization_user_file_tag_create, opts)
79
+ data
80
+ end
81
+
82
+ # Create File Tags
83
+ # A tag is a key-value pair that can be added to a file. This pair can then be used for searches (e.g. embedding searches) in order to narrow down the scope of the search. A file can have any number of tags. The following are reserved keys that cannot be used: - db_embedding_id - organization_id - user_id - organization_user_file_id Carbon currently supports two data types for tag values - &#x60;string&#x60; and &#x60;list&lt;string&gt;&#x60;. Keys can only be &#x60;string&#x60;. If values other than &#x60;string&#x60; and &#x60;list&lt;string&gt;&#x60; are used, they&#39;re automatically converted to strings (e.g. 4 will become \&quot;4\&quot;).
84
+ # @param organization_user_file_tag_create [OrganizationUserFileTagCreate]
85
+ # @param [Hash] opts the optional parameters
86
+ # @return [APIResponse] data is UserFile, status code, headers and response
87
+ private def create_user_file_tags_with_http_info_impl(organization_user_file_tag_create, opts = {})
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug 'Calling API: FilesApi.create_user_file_tags ...'
90
+ end
91
+ # verify the required parameter 'organization_user_file_tag_create' is set
92
+ if @api_client.config.client_side_validation && organization_user_file_tag_create.nil?
93
+ fail ArgumentError, "Missing the required parameter 'organization_user_file_tag_create' when calling FilesApi.create_user_file_tags"
94
+ end
95
+ # resource path
96
+ local_var_path = '/create_user_file_tags'
97
+
98
+ # query parameters
99
+ query_params = opts[:query_params] || {}
100
+
101
+ # header parameters
102
+ header_params = opts[:header_params] || {}
103
+ # HTTP header 'Accept' (if needed)
104
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
105
+ # HTTP header 'Content-Type'
106
+ content_type = @api_client.select_header_content_type(['application/json'])
107
+ if !content_type.nil?
108
+ header_params['Content-Type'] = content_type
109
+ end
110
+
111
+ # form parameters
112
+ form_params = opts[:form_params] || {}
113
+
114
+ # http body (model)
115
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(organization_user_file_tag_create)
116
+
117
+ # return_type
118
+ return_type = opts[:debug_return_type] || 'UserFile'
119
+
120
+ # auth_names
121
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
122
+
123
+ new_options = opts.merge(
124
+ :operation => :"FilesApi.create_user_file_tags",
125
+ :header_params => header_params,
126
+ :query_params => query_params,
127
+ :form_params => form_params,
128
+ :body => post_body,
129
+ :auth_names => auth_names,
130
+ :return_type => return_type
131
+ )
132
+
133
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
134
+ if @api_client.config.debugging
135
+ @api_client.config.logger.debug "API called: FilesApi#create_user_file_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
136
+ end
137
+ APIResponse::new(data, status_code, headers, response)
138
+ end
139
+
140
+
141
+ # Delete File Endpoint
142
+ #
143
+ # @param file_id [Integer]
144
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
145
+ def delete(file_id:, extra: {})
146
+ api_response = delete_with_http_info_impl(file_id, extra)
147
+ api_response.data
148
+ end
149
+
150
+ # Delete File Endpoint
151
+ #
152
+ # @param file_id [Integer]
153
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
154
+ def delete_with_http_info(file_id:, extra: {})
155
+ delete_with_http_info_impl(file_id, extra)
156
+ end
157
+
158
+ # Delete File Endpoint
159
+ # @param file_id [Integer]
160
+ # @param [Hash] opts the optional parameters
161
+ # @return [GenericSuccessResponse]
162
+ private def delete_impl(file_id, opts = {})
163
+ data, _status_code, _headers = delete_with_http_info(file_id, opts)
164
+ data
165
+ end
166
+
167
+ # Delete File Endpoint
168
+ # @param file_id [Integer]
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [APIResponse] data is GenericSuccessResponse, status code, headers and response
171
+ private def delete_with_http_info_impl(file_id, opts = {})
172
+ if @api_client.config.debugging
173
+ @api_client.config.logger.debug 'Calling API: FilesApi.delete ...'
174
+ end
175
+ # verify the required parameter 'file_id' is set
176
+ if @api_client.config.client_side_validation && file_id.nil?
177
+ fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.delete"
178
+ end
179
+ # resource path
180
+ local_var_path = '/deletefile/{file_id}'.sub('{' + 'file_id' + '}', CGI.escape(file_id.to_s))
181
+
182
+ # query parameters
183
+ query_params = opts[:query_params] || {}
184
+
185
+ # header parameters
186
+ header_params = opts[:header_params] || {}
187
+ # HTTP header 'Accept' (if needed)
188
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
189
+
190
+ # form parameters
191
+ form_params = opts[:form_params] || {}
192
+
193
+ # http body (model)
194
+ post_body = opts[:debug_body]
195
+
196
+ # return_type
197
+ return_type = opts[:debug_return_type] || 'GenericSuccessResponse'
198
+
199
+ # auth_names
200
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
201
+
202
+ new_options = opts.merge(
203
+ :operation => :"FilesApi.delete",
204
+ :header_params => header_params,
205
+ :query_params => query_params,
206
+ :form_params => form_params,
207
+ :body => post_body,
208
+ :auth_names => auth_names,
209
+ :return_type => return_type
210
+ )
211
+
212
+ data, status_code, headers, response = @api_client.call_api(:DELETE, local_var_path, new_options)
213
+ if @api_client.config.debugging
214
+ @api_client.config.logger.debug "API called: FilesApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
215
+ end
216
+ APIResponse::new(data, status_code, headers, response)
217
+ end
218
+
219
+
220
+ # Delete File Tags
221
+ #
222
+ # @param tags [Array<String>]
223
+ # @param organization_user_file_id [Integer]
224
+ # @param body [OrganizationUserFileTagsRemove]
225
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
226
+ def delete_file_tags(tags:, organization_user_file_id:, extra: {})
227
+ _body = {}
228
+ _body[:tags] = tags if tags != SENTINEL
229
+ _body[:organization_user_file_id] = organization_user_file_id if organization_user_file_id != SENTINEL
230
+ organization_user_file_tags_remove = _body
231
+ api_response = delete_file_tags_with_http_info_impl(organization_user_file_tags_remove, extra)
232
+ api_response.data
233
+ end
234
+
235
+ # Delete File Tags
236
+ #
237
+ # @param tags [Array<String>]
238
+ # @param organization_user_file_id [Integer]
239
+ # @param body [OrganizationUserFileTagsRemove]
240
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
241
+ def delete_file_tags_with_http_info(tags:, organization_user_file_id:, extra: {})
242
+ _body = {}
243
+ _body[:tags] = tags if tags != SENTINEL
244
+ _body[:organization_user_file_id] = organization_user_file_id if organization_user_file_id != SENTINEL
245
+ organization_user_file_tags_remove = _body
246
+ delete_file_tags_with_http_info_impl(organization_user_file_tags_remove, extra)
247
+ end
248
+
249
+ # Delete File Tags
250
+ # @param organization_user_file_tags_remove [OrganizationUserFileTagsRemove]
251
+ # @param [Hash] opts the optional parameters
252
+ # @return [UserFile]
253
+ private def delete_file_tags_impl(organization_user_file_tags_remove, opts = {})
254
+ data, _status_code, _headers = delete_file_tags_with_http_info(organization_user_file_tags_remove, opts)
255
+ data
256
+ end
257
+
258
+ # Delete File Tags
259
+ # @param organization_user_file_tags_remove [OrganizationUserFileTagsRemove]
260
+ # @param [Hash] opts the optional parameters
261
+ # @return [APIResponse] data is UserFile, status code, headers and response
262
+ private def delete_file_tags_with_http_info_impl(organization_user_file_tags_remove, opts = {})
263
+ if @api_client.config.debugging
264
+ @api_client.config.logger.debug 'Calling API: FilesApi.delete_file_tags ...'
265
+ end
266
+ # verify the required parameter 'organization_user_file_tags_remove' is set
267
+ if @api_client.config.client_side_validation && organization_user_file_tags_remove.nil?
268
+ fail ArgumentError, "Missing the required parameter 'organization_user_file_tags_remove' when calling FilesApi.delete_file_tags"
269
+ end
270
+ # resource path
271
+ local_var_path = '/delete_user_file_tags'
272
+
273
+ # query parameters
274
+ query_params = opts[:query_params] || {}
275
+
276
+ # header parameters
277
+ header_params = opts[:header_params] || {}
278
+ # HTTP header 'Accept' (if needed)
279
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
280
+ # HTTP header 'Content-Type'
281
+ content_type = @api_client.select_header_content_type(['application/json'])
282
+ if !content_type.nil?
283
+ header_params['Content-Type'] = content_type
284
+ end
285
+
286
+ # form parameters
287
+ form_params = opts[:form_params] || {}
288
+
289
+ # http body (model)
290
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(organization_user_file_tags_remove)
291
+
292
+ # return_type
293
+ return_type = opts[:debug_return_type] || 'UserFile'
294
+
295
+ # auth_names
296
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
297
+
298
+ new_options = opts.merge(
299
+ :operation => :"FilesApi.delete_file_tags",
300
+ :header_params => header_params,
301
+ :query_params => query_params,
302
+ :form_params => form_params,
303
+ :body => post_body,
304
+ :auth_names => auth_names,
305
+ :return_type => return_type
306
+ )
307
+
308
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug "API called: FilesApi#delete_file_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
311
+ end
312
+ APIResponse::new(data, status_code, headers, response)
313
+ end
314
+
315
+
316
+ # Delete Files Endpoint
317
+ #
318
+ # @param file_ids [Array<Integer>]
319
+ # @param sync_statuses [Array<ExternalFileSyncStatuses>]
320
+ # @param delete_non_synced_only [Boolean]
321
+ # @param send_webhook [Boolean]
322
+ # @param body [DeleteFilesQueryInput]
323
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
324
+ def delete_many(file_ids: SENTINEL, sync_statuses: SENTINEL, delete_non_synced_only: false, send_webhook: false, extra: {})
325
+ _body = {}
326
+ _body[:file_ids] = file_ids if file_ids != SENTINEL
327
+ _body[:sync_statuses] = sync_statuses if sync_statuses != SENTINEL
328
+ _body[:delete_non_synced_only] = delete_non_synced_only if delete_non_synced_only != SENTINEL
329
+ _body[:send_webhook] = send_webhook if send_webhook != SENTINEL
330
+ delete_files_query_input = _body
331
+ api_response = delete_many_with_http_info_impl(delete_files_query_input, extra)
332
+ api_response.data
333
+ end
334
+
335
+ # Delete Files Endpoint
336
+ #
337
+ # @param file_ids [Array<Integer>]
338
+ # @param sync_statuses [Array<ExternalFileSyncStatuses>]
339
+ # @param delete_non_synced_only [Boolean]
340
+ # @param send_webhook [Boolean]
341
+ # @param body [DeleteFilesQueryInput]
342
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
343
+ def delete_many_with_http_info(file_ids: SENTINEL, sync_statuses: SENTINEL, delete_non_synced_only: false, send_webhook: false, extra: {})
344
+ _body = {}
345
+ _body[:file_ids] = file_ids if file_ids != SENTINEL
346
+ _body[:sync_statuses] = sync_statuses if sync_statuses != SENTINEL
347
+ _body[:delete_non_synced_only] = delete_non_synced_only if delete_non_synced_only != SENTINEL
348
+ _body[:send_webhook] = send_webhook if send_webhook != SENTINEL
349
+ delete_files_query_input = _body
350
+ delete_many_with_http_info_impl(delete_files_query_input, extra)
351
+ end
352
+
353
+ # Delete Files Endpoint
354
+ # @param delete_files_query_input [DeleteFilesQueryInput]
355
+ # @param [Hash] opts the optional parameters
356
+ # @return [GenericSuccessResponse]
357
+ private def delete_many_impl(delete_files_query_input, opts = {})
358
+ data, _status_code, _headers = delete_many_with_http_info(delete_files_query_input, opts)
359
+ data
360
+ end
361
+
362
+ # Delete Files Endpoint
363
+ # @param delete_files_query_input [DeleteFilesQueryInput]
364
+ # @param [Hash] opts the optional parameters
365
+ # @return [APIResponse] data is GenericSuccessResponse, status code, headers and response
366
+ private def delete_many_with_http_info_impl(delete_files_query_input, opts = {})
367
+ if @api_client.config.debugging
368
+ @api_client.config.logger.debug 'Calling API: FilesApi.delete_many ...'
369
+ end
370
+ # verify the required parameter 'delete_files_query_input' is set
371
+ if @api_client.config.client_side_validation && delete_files_query_input.nil?
372
+ fail ArgumentError, "Missing the required parameter 'delete_files_query_input' when calling FilesApi.delete_many"
373
+ end
374
+ # resource path
375
+ local_var_path = '/delete_files'
376
+
377
+ # query parameters
378
+ query_params = opts[:query_params] || {}
379
+
380
+ # header parameters
381
+ header_params = opts[:header_params] || {}
382
+ # HTTP header 'Accept' (if needed)
383
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
384
+ # HTTP header 'Content-Type'
385
+ content_type = @api_client.select_header_content_type(['application/json'])
386
+ if !content_type.nil?
387
+ header_params['Content-Type'] = content_type
388
+ end
389
+
390
+ # form parameters
391
+ form_params = opts[:form_params] || {}
392
+
393
+ # http body (model)
394
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(delete_files_query_input)
395
+
396
+ # return_type
397
+ return_type = opts[:debug_return_type] || 'GenericSuccessResponse'
398
+
399
+ # auth_names
400
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
401
+
402
+ new_options = opts.merge(
403
+ :operation => :"FilesApi.delete_many",
404
+ :header_params => header_params,
405
+ :query_params => query_params,
406
+ :form_params => form_params,
407
+ :body => post_body,
408
+ :auth_names => auth_names,
409
+ :return_type => return_type
410
+ )
411
+
412
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
413
+ if @api_client.config.debugging
414
+ @api_client.config.logger.debug "API called: FilesApi#delete_many\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
415
+ end
416
+ APIResponse::new(data, status_code, headers, response)
417
+ end
418
+
419
+
420
+ # Parsed File
421
+ #
422
+ # This route is deprecated. Use `/user_files_v2` instead.
423
+ #
424
+ # @param file_id [Integer]
425
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
426
+ def get_parsed_file(file_id:, extra: {})
427
+ api_response = get_parsed_file_with_http_info_impl(file_id, extra)
428
+ api_response.data
429
+ end
430
+
431
+ # Parsed File
432
+ #
433
+ # This route is deprecated. Use `/user_files_v2` instead.
434
+ #
435
+ # @param file_id [Integer]
436
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
437
+ def get_parsed_file_with_http_info(file_id:, extra: {})
438
+ get_parsed_file_with_http_info_impl(file_id, extra)
439
+ end
440
+
441
+ # Parsed File
442
+ # This route is deprecated. Use `/user_files_v2` instead.
443
+ # @param file_id [Integer]
444
+ # @param [Hash] opts the optional parameters
445
+ # @return [PresignedURLResponse]
446
+ private def get_parsed_file_impl(file_id, opts = {})
447
+ data, _status_code, _headers = get_parsed_file_with_http_info(file_id, opts)
448
+ data
449
+ end
450
+
451
+ # Parsed File
452
+ # This route is deprecated. Use &#x60;/user_files_v2&#x60; instead.
453
+ # @param file_id [Integer]
454
+ # @param [Hash] opts the optional parameters
455
+ # @return [APIResponse] data is PresignedURLResponse, status code, headers and response
456
+ private def get_parsed_file_with_http_info_impl(file_id, opts = {})
457
+ if @api_client.config.debugging
458
+ @api_client.config.logger.debug 'Calling API: FilesApi.get_parsed_file ...'
459
+ end
460
+ # verify the required parameter 'file_id' is set
461
+ if @api_client.config.client_side_validation && file_id.nil?
462
+ fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.get_parsed_file"
463
+ end
464
+ # resource path
465
+ local_var_path = '/parsed_file/{file_id}'.sub('{' + 'file_id' + '}', CGI.escape(file_id.to_s))
466
+
467
+ # query parameters
468
+ query_params = opts[:query_params] || {}
469
+
470
+ # header parameters
471
+ header_params = opts[:header_params] || {}
472
+ # HTTP header 'Accept' (if needed)
473
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
474
+
475
+ # form parameters
476
+ form_params = opts[:form_params] || {}
477
+
478
+ # http body (model)
479
+ post_body = opts[:debug_body]
480
+
481
+ # return_type
482
+ return_type = opts[:debug_return_type] || 'PresignedURLResponse'
483
+
484
+ # auth_names
485
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
486
+
487
+ new_options = opts.merge(
488
+ :operation => :"FilesApi.get_parsed_file",
489
+ :header_params => header_params,
490
+ :query_params => query_params,
491
+ :form_params => form_params,
492
+ :body => post_body,
493
+ :auth_names => auth_names,
494
+ :return_type => return_type
495
+ )
496
+
497
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
498
+ if @api_client.config.debugging
499
+ @api_client.config.logger.debug "API called: FilesApi#get_parsed_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
500
+ end
501
+ APIResponse::new(data, status_code, headers, response)
502
+ end
503
+
504
+
505
+ # Raw File
506
+ #
507
+ # This route is deprecated. Use `/user_files_v2` instead.
508
+ #
509
+ # @param file_id [Integer]
510
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
511
+ def get_raw_file(file_id:, extra: {})
512
+ api_response = get_raw_file_with_http_info_impl(file_id, extra)
513
+ api_response.data
514
+ end
515
+
516
+ # Raw File
517
+ #
518
+ # This route is deprecated. Use `/user_files_v2` instead.
519
+ #
520
+ # @param file_id [Integer]
521
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
522
+ def get_raw_file_with_http_info(file_id:, extra: {})
523
+ get_raw_file_with_http_info_impl(file_id, extra)
524
+ end
525
+
526
+ # Raw File
527
+ # This route is deprecated. Use `/user_files_v2` instead.
528
+ # @param file_id [Integer]
529
+ # @param [Hash] opts the optional parameters
530
+ # @return [PresignedURLResponse]
531
+ private def get_raw_file_impl(file_id, opts = {})
532
+ data, _status_code, _headers = get_raw_file_with_http_info(file_id, opts)
533
+ data
534
+ end
535
+
536
+ # Raw File
537
+ # This route is deprecated. Use &#x60;/user_files_v2&#x60; instead.
538
+ # @param file_id [Integer]
539
+ # @param [Hash] opts the optional parameters
540
+ # @return [APIResponse] data is PresignedURLResponse, status code, headers and response
541
+ private def get_raw_file_with_http_info_impl(file_id, opts = {})
542
+ if @api_client.config.debugging
543
+ @api_client.config.logger.debug 'Calling API: FilesApi.get_raw_file ...'
544
+ end
545
+ # verify the required parameter 'file_id' is set
546
+ if @api_client.config.client_side_validation && file_id.nil?
547
+ fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.get_raw_file"
548
+ end
549
+ # resource path
550
+ local_var_path = '/raw_file/{file_id}'.sub('{' + 'file_id' + '}', CGI.escape(file_id.to_s))
551
+
552
+ # query parameters
553
+ query_params = opts[:query_params] || {}
554
+
555
+ # header parameters
556
+ header_params = opts[:header_params] || {}
557
+ # HTTP header 'Accept' (if needed)
558
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
559
+
560
+ # form parameters
561
+ form_params = opts[:form_params] || {}
562
+
563
+ # http body (model)
564
+ post_body = opts[:debug_body]
565
+
566
+ # return_type
567
+ return_type = opts[:debug_return_type] || 'PresignedURLResponse'
568
+
569
+ # auth_names
570
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
571
+
572
+ new_options = opts.merge(
573
+ :operation => :"FilesApi.get_raw_file",
574
+ :header_params => header_params,
575
+ :query_params => query_params,
576
+ :form_params => form_params,
577
+ :body => post_body,
578
+ :auth_names => auth_names,
579
+ :return_type => return_type
580
+ )
581
+
582
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
583
+ if @api_client.config.debugging
584
+ @api_client.config.logger.debug "API called: FilesApi#get_raw_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
585
+ end
586
+ APIResponse::new(data, status_code, headers, response)
587
+ end
588
+
589
+
590
+ # User Files V2
591
+ #
592
+ # For pre-filtering documents, using `tags_v2` is preferred to using `tags` (which is now deprecated). If both `tags_v2`
593
+ # and `tags` are specified, `tags` is ignored. `tags_v2` enables
594
+ # building complex filters through the use of "AND", "OR", and negation logic. Take the below input as an example:
595
+ # ```json
596
+ # {
597
+ # "OR": [
598
+ # {
599
+ # "key": "subject",
600
+ # "value": "holy-bible",
601
+ # "negate": false
602
+ # },
603
+ # {
604
+ # "key": "person-of-interest",
605
+ # "value": "jesus christ",
606
+ # "negate": false
607
+ # },
608
+ # {
609
+ # "key": "genre",
610
+ # "value": "religion",
611
+ # "negate": true
612
+ # }
613
+ # {
614
+ # "AND": [
615
+ # {
616
+ # "key": "subject",
617
+ # "value": "tao-te-ching",
618
+ # "negate": false
619
+ # },
620
+ # {
621
+ # "key": "author",
622
+ # "value": "lao-tzu",
623
+ # "negate": false
624
+ # }
625
+ # ]
626
+ # }
627
+ # ]
628
+ # }
629
+ # ```
630
+ # In this case, files will be filtered such that:
631
+ # 1. "subject" = "holy-bible" OR
632
+ # 2. "person-of-interest" = "jesus christ" OR
633
+ # 3. "genre" != "religion" OR
634
+ # 4. "subject" = "tao-te-ching" AND "author" = "lao-tzu"
635
+ #
636
+ # Note that the top level of the query must be either an "OR" or "AND" array. Currently, nesting is limited to 3.
637
+ # For tag blocks (those with "key", "value", and "negate" keys), the following typing rules apply:
638
+ # 1. "key" isn't optional and must be a `string`
639
+ # 2. "value" isn't optional and can be `any` or list[`any`]
640
+ # 3. "negate" is optional and must be `true` or `false`. If present and `true`, then the filter block is negated in
641
+ # the resulting query. It is `false` by default.
642
+ #
643
+ # @param pagination [Pagination]
644
+ # @param order_by [OrganizationUserFilesToSyncOrderByTypes]
645
+ # @param order_dir [OrderDir]
646
+ # @param filters [OrganizationUserFilesToSyncFilters]
647
+ # @param include_raw_file [Boolean]
648
+ # @param include_parsed_text_file [Boolean]
649
+ # @param include_additional_files [Boolean]
650
+ # @param body [OrganizationUserFilesToSyncQueryInput]
651
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
652
+ def query_user_files(pagination: SENTINEL, order_by: 'updated_at', order_dir: 'asc', filters: SENTINEL, include_raw_file: SENTINEL, include_parsed_text_file: SENTINEL, include_additional_files: SENTINEL, extra: {})
653
+ _body = {}
654
+ _body[:pagination] = pagination if pagination != SENTINEL
655
+ _body[:order_by] = order_by if order_by != SENTINEL
656
+ _body[:order_dir] = order_dir if order_dir != SENTINEL
657
+ _body[:filters] = filters if filters != SENTINEL
658
+ _body[:include_raw_file] = include_raw_file if include_raw_file != SENTINEL
659
+ _body[:include_parsed_text_file] = include_parsed_text_file if include_parsed_text_file != SENTINEL
660
+ _body[:include_additional_files] = include_additional_files if include_additional_files != SENTINEL
661
+ organization_user_files_to_sync_query_input = _body
662
+ api_response = query_user_files_with_http_info_impl(organization_user_files_to_sync_query_input, extra)
663
+ api_response.data
664
+ end
665
+
666
+ # User Files V2
667
+ #
668
+ # For pre-filtering documents, using `tags_v2` is preferred to using `tags` (which is now deprecated). If both `tags_v2`
669
+ # and `tags` are specified, `tags` is ignored. `tags_v2` enables
670
+ # building complex filters through the use of "AND", "OR", and negation logic. Take the below input as an example:
671
+ # ```json
672
+ # {
673
+ # "OR": [
674
+ # {
675
+ # "key": "subject",
676
+ # "value": "holy-bible",
677
+ # "negate": false
678
+ # },
679
+ # {
680
+ # "key": "person-of-interest",
681
+ # "value": "jesus christ",
682
+ # "negate": false
683
+ # },
684
+ # {
685
+ # "key": "genre",
686
+ # "value": "religion",
687
+ # "negate": true
688
+ # }
689
+ # {
690
+ # "AND": [
691
+ # {
692
+ # "key": "subject",
693
+ # "value": "tao-te-ching",
694
+ # "negate": false
695
+ # },
696
+ # {
697
+ # "key": "author",
698
+ # "value": "lao-tzu",
699
+ # "negate": false
700
+ # }
701
+ # ]
702
+ # }
703
+ # ]
704
+ # }
705
+ # ```
706
+ # In this case, files will be filtered such that:
707
+ # 1. "subject" = "holy-bible" OR
708
+ # 2. "person-of-interest" = "jesus christ" OR
709
+ # 3. "genre" != "religion" OR
710
+ # 4. "subject" = "tao-te-ching" AND "author" = "lao-tzu"
711
+ #
712
+ # Note that the top level of the query must be either an "OR" or "AND" array. Currently, nesting is limited to 3.
713
+ # For tag blocks (those with "key", "value", and "negate" keys), the following typing rules apply:
714
+ # 1. "key" isn't optional and must be a `string`
715
+ # 2. "value" isn't optional and can be `any` or list[`any`]
716
+ # 3. "negate" is optional and must be `true` or `false`. If present and `true`, then the filter block is negated in
717
+ # the resulting query. It is `false` by default.
718
+ #
719
+ # @param pagination [Pagination]
720
+ # @param order_by [OrganizationUserFilesToSyncOrderByTypes]
721
+ # @param order_dir [OrderDir]
722
+ # @param filters [OrganizationUserFilesToSyncFilters]
723
+ # @param include_raw_file [Boolean]
724
+ # @param include_parsed_text_file [Boolean]
725
+ # @param include_additional_files [Boolean]
726
+ # @param body [OrganizationUserFilesToSyncQueryInput]
727
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
728
+ def query_user_files_with_http_info(pagination: SENTINEL, order_by: 'updated_at', order_dir: 'asc', filters: SENTINEL, include_raw_file: SENTINEL, include_parsed_text_file: SENTINEL, include_additional_files: SENTINEL, extra: {})
729
+ _body = {}
730
+ _body[:pagination] = pagination if pagination != SENTINEL
731
+ _body[:order_by] = order_by if order_by != SENTINEL
732
+ _body[:order_dir] = order_dir if order_dir != SENTINEL
733
+ _body[:filters] = filters if filters != SENTINEL
734
+ _body[:include_raw_file] = include_raw_file if include_raw_file != SENTINEL
735
+ _body[:include_parsed_text_file] = include_parsed_text_file if include_parsed_text_file != SENTINEL
736
+ _body[:include_additional_files] = include_additional_files if include_additional_files != SENTINEL
737
+ organization_user_files_to_sync_query_input = _body
738
+ query_user_files_with_http_info_impl(organization_user_files_to_sync_query_input, extra)
739
+ end
740
+
741
+ # User Files V2
742
+ # For pre-filtering documents, using `tags_v2` is preferred to using `tags` (which is now deprecated). If both `tags_v2` and `tags` are specified, `tags` is ignored. `tags_v2` enables building complex filters through the use of \"AND\", \"OR\", and negation logic. Take the below input as an example: ```json { \"OR\": [ { \"key\": \"subject\", \"value\": \"holy-bible\", \"negate\": false }, { \"key\": \"person-of-interest\", \"value\": \"jesus christ\", \"negate\": false }, { \"key\": \"genre\", \"value\": \"religion\", \"negate\": true } { \"AND\": [ { \"key\": \"subject\", \"value\": \"tao-te-ching\", \"negate\": false }, { \"key\": \"author\", \"value\": \"lao-tzu\", \"negate\": false } ] } ] } ``` In this case, files will be filtered such that: 1. \"subject\" = \"holy-bible\" OR 2. \"person-of-interest\" = \"jesus christ\" OR 3. \"genre\" != \"religion\" OR 4. \"subject\" = \"tao-te-ching\" AND \"author\" = \"lao-tzu\" Note that the top level of the query must be either an \"OR\" or \"AND\" array. Currently, nesting is limited to 3. For tag blocks (those with \"key\", \"value\", and \"negate\" keys), the following typing rules apply: 1. \"key\" isn't optional and must be a `string` 2. \"value\" isn't optional and can be `any` or list[`any`] 3. \"negate\" is optional and must be `true` or `false`. If present and `true`, then the filter block is negated in the resulting query. It is `false` by default.
743
+ # @param organization_user_files_to_sync_query_input [OrganizationUserFilesToSyncQueryInput]
744
+ # @param [Hash] opts the optional parameters
745
+ # @return [UserFilesV2]
746
+ private def query_user_files_impl(organization_user_files_to_sync_query_input, opts = {})
747
+ data, _status_code, _headers = query_user_files_with_http_info(organization_user_files_to_sync_query_input, opts)
748
+ data
749
+ end
750
+
751
+ # User Files V2
752
+ # For pre-filtering documents, using &#x60;tags_v2&#x60; is preferred to using &#x60;tags&#x60; (which is now deprecated). If both &#x60;tags_v2&#x60; and &#x60;tags&#x60; are specified, &#x60;tags&#x60; is ignored. &#x60;tags_v2&#x60; enables building complex filters through the use of \&quot;AND\&quot;, \&quot;OR\&quot;, and negation logic. Take the below input as an example: &#x60;&#x60;&#x60;json { \&quot;OR\&quot;: [ { \&quot;key\&quot;: \&quot;subject\&quot;, \&quot;value\&quot;: \&quot;holy-bible\&quot;, \&quot;negate\&quot;: false }, { \&quot;key\&quot;: \&quot;person-of-interest\&quot;, \&quot;value\&quot;: \&quot;jesus christ\&quot;, \&quot;negate\&quot;: false }, { \&quot;key\&quot;: \&quot;genre\&quot;, \&quot;value\&quot;: \&quot;religion\&quot;, \&quot;negate\&quot;: true } { \&quot;AND\&quot;: [ { \&quot;key\&quot;: \&quot;subject\&quot;, \&quot;value\&quot;: \&quot;tao-te-ching\&quot;, \&quot;negate\&quot;: false }, { \&quot;key\&quot;: \&quot;author\&quot;, \&quot;value\&quot;: \&quot;lao-tzu\&quot;, \&quot;negate\&quot;: false } ] } ] } &#x60;&#x60;&#x60; In this case, files will be filtered such that: 1. \&quot;subject\&quot; &#x3D; \&quot;holy-bible\&quot; OR 2. \&quot;person-of-interest\&quot; &#x3D; \&quot;jesus christ\&quot; OR 3. \&quot;genre\&quot; !&#x3D; \&quot;religion\&quot; OR 4. \&quot;subject\&quot; &#x3D; \&quot;tao-te-ching\&quot; AND \&quot;author\&quot; &#x3D; \&quot;lao-tzu\&quot; Note that the top level of the query must be either an \&quot;OR\&quot; or \&quot;AND\&quot; array. Currently, nesting is limited to 3. For tag blocks (those with \&quot;key\&quot;, \&quot;value\&quot;, and \&quot;negate\&quot; keys), the following typing rules apply: 1. \&quot;key\&quot; isn&#39;t optional and must be a &#x60;string&#x60; 2. \&quot;value\&quot; isn&#39;t optional and can be &#x60;any&#x60; or list[&#x60;any&#x60;] 3. \&quot;negate\&quot; is optional and must be &#x60;true&#x60; or &#x60;false&#x60;. If present and &#x60;true&#x60;, then the filter block is negated in the resulting query. It is &#x60;false&#x60; by default.
753
+ # @param organization_user_files_to_sync_query_input [OrganizationUserFilesToSyncQueryInput]
754
+ # @param [Hash] opts the optional parameters
755
+ # @return [APIResponse] data is UserFilesV2, status code, headers and response
756
+ private def query_user_files_with_http_info_impl(organization_user_files_to_sync_query_input, opts = {})
757
+ if @api_client.config.debugging
758
+ @api_client.config.logger.debug 'Calling API: FilesApi.query_user_files ...'
759
+ end
760
+ # verify the required parameter 'organization_user_files_to_sync_query_input' is set
761
+ if @api_client.config.client_side_validation && organization_user_files_to_sync_query_input.nil?
762
+ fail ArgumentError, "Missing the required parameter 'organization_user_files_to_sync_query_input' when calling FilesApi.query_user_files"
763
+ end
764
+ # resource path
765
+ local_var_path = '/user_files_v2'
766
+
767
+ # query parameters
768
+ query_params = opts[:query_params] || {}
769
+
770
+ # header parameters
771
+ header_params = opts[:header_params] || {}
772
+ # HTTP header 'Accept' (if needed)
773
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
774
+ # HTTP header 'Content-Type'
775
+ content_type = @api_client.select_header_content_type(['application/json'])
776
+ if !content_type.nil?
777
+ header_params['Content-Type'] = content_type
778
+ end
779
+
780
+ # form parameters
781
+ form_params = opts[:form_params] || {}
782
+
783
+ # http body (model)
784
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(organization_user_files_to_sync_query_input)
785
+
786
+ # return_type
787
+ return_type = opts[:debug_return_type] || 'UserFilesV2'
788
+
789
+ # auth_names
790
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
791
+
792
+ new_options = opts.merge(
793
+ :operation => :"FilesApi.query_user_files",
794
+ :header_params => header_params,
795
+ :query_params => query_params,
796
+ :form_params => form_params,
797
+ :body => post_body,
798
+ :auth_names => auth_names,
799
+ :return_type => return_type
800
+ )
801
+
802
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
803
+ if @api_client.config.debugging
804
+ @api_client.config.logger.debug "API called: FilesApi#query_user_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
805
+ end
806
+ APIResponse::new(data, status_code, headers, response)
807
+ end
808
+
809
+
810
+ # User Files
811
+ #
812
+ # This route is deprecated. Use `/user_files_v2` instead.
813
+ #
814
+ # @param pagination [Pagination]
815
+ # @param order_by [OrganizationUserFilesToSyncOrderByTypes]
816
+ # @param order_dir [OrderDir]
817
+ # @param filters [OrganizationUserFilesToSyncFilters]
818
+ # @param include_raw_file [Boolean]
819
+ # @param include_parsed_text_file [Boolean]
820
+ # @param include_additional_files [Boolean]
821
+ # @param body [OrganizationUserFilesToSyncQueryInput]
822
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
823
+ def query_user_files_deprecated(pagination: SENTINEL, order_by: 'updated_at', order_dir: 'asc', filters: SENTINEL, include_raw_file: SENTINEL, include_parsed_text_file: SENTINEL, include_additional_files: SENTINEL, extra: {})
824
+ _body = {}
825
+ _body[:pagination] = pagination if pagination != SENTINEL
826
+ _body[:order_by] = order_by if order_by != SENTINEL
827
+ _body[:order_dir] = order_dir if order_dir != SENTINEL
828
+ _body[:filters] = filters if filters != SENTINEL
829
+ _body[:include_raw_file] = include_raw_file if include_raw_file != SENTINEL
830
+ _body[:include_parsed_text_file] = include_parsed_text_file if include_parsed_text_file != SENTINEL
831
+ _body[:include_additional_files] = include_additional_files if include_additional_files != SENTINEL
832
+ organization_user_files_to_sync_query_input = _body
833
+ api_response = query_user_files_deprecated_with_http_info_impl(organization_user_files_to_sync_query_input, extra)
834
+ api_response.data
835
+ end
836
+
837
+ # User Files
838
+ #
839
+ # This route is deprecated. Use `/user_files_v2` instead.
840
+ #
841
+ # @param pagination [Pagination]
842
+ # @param order_by [OrganizationUserFilesToSyncOrderByTypes]
843
+ # @param order_dir [OrderDir]
844
+ # @param filters [OrganizationUserFilesToSyncFilters]
845
+ # @param include_raw_file [Boolean]
846
+ # @param include_parsed_text_file [Boolean]
847
+ # @param include_additional_files [Boolean]
848
+ # @param body [OrganizationUserFilesToSyncQueryInput]
849
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
850
+ def query_user_files_deprecated_with_http_info(pagination: SENTINEL, order_by: 'updated_at', order_dir: 'asc', filters: SENTINEL, include_raw_file: SENTINEL, include_parsed_text_file: SENTINEL, include_additional_files: SENTINEL, extra: {})
851
+ _body = {}
852
+ _body[:pagination] = pagination if pagination != SENTINEL
853
+ _body[:order_by] = order_by if order_by != SENTINEL
854
+ _body[:order_dir] = order_dir if order_dir != SENTINEL
855
+ _body[:filters] = filters if filters != SENTINEL
856
+ _body[:include_raw_file] = include_raw_file if include_raw_file != SENTINEL
857
+ _body[:include_parsed_text_file] = include_parsed_text_file if include_parsed_text_file != SENTINEL
858
+ _body[:include_additional_files] = include_additional_files if include_additional_files != SENTINEL
859
+ organization_user_files_to_sync_query_input = _body
860
+ query_user_files_deprecated_with_http_info_impl(organization_user_files_to_sync_query_input, extra)
861
+ end
862
+
863
+ # User Files
864
+ # This route is deprecated. Use `/user_files_v2` instead.
865
+ # @param organization_user_files_to_sync_query_input [OrganizationUserFilesToSyncQueryInput]
866
+ # @param [Hash] opts the optional parameters
867
+ # @return [Array<UserFile>]
868
+ private def query_user_files_deprecated_impl(organization_user_files_to_sync_query_input, opts = {})
869
+ data, _status_code, _headers = query_user_files_deprecated_with_http_info(organization_user_files_to_sync_query_input, opts)
870
+ data
871
+ end
872
+
873
+ # User Files
874
+ # This route is deprecated. Use &#x60;/user_files_v2&#x60; instead.
875
+ # @param organization_user_files_to_sync_query_input [OrganizationUserFilesToSyncQueryInput]
876
+ # @param [Hash] opts the optional parameters
877
+ # @return [APIResponse] data is Array<UserFile>, status code, headers and response
878
+ private def query_user_files_deprecated_with_http_info_impl(organization_user_files_to_sync_query_input, opts = {})
879
+ if @api_client.config.debugging
880
+ @api_client.config.logger.debug 'Calling API: FilesApi.query_user_files_deprecated ...'
881
+ end
882
+ # verify the required parameter 'organization_user_files_to_sync_query_input' is set
883
+ if @api_client.config.client_side_validation && organization_user_files_to_sync_query_input.nil?
884
+ fail ArgumentError, "Missing the required parameter 'organization_user_files_to_sync_query_input' when calling FilesApi.query_user_files_deprecated"
885
+ end
886
+ # resource path
887
+ local_var_path = '/user_files'
888
+
889
+ # query parameters
890
+ query_params = opts[:query_params] || {}
891
+
892
+ # header parameters
893
+ header_params = opts[:header_params] || {}
894
+ # HTTP header 'Accept' (if needed)
895
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
896
+ # HTTP header 'Content-Type'
897
+ content_type = @api_client.select_header_content_type(['application/json'])
898
+ if !content_type.nil?
899
+ header_params['Content-Type'] = content_type
900
+ end
901
+
902
+ # form parameters
903
+ form_params = opts[:form_params] || {}
904
+
905
+ # http body (model)
906
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(organization_user_files_to_sync_query_input)
907
+
908
+ # return_type
909
+ return_type = opts[:debug_return_type] || 'Array<UserFile>'
910
+
911
+ # auth_names
912
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
913
+
914
+ new_options = opts.merge(
915
+ :operation => :"FilesApi.query_user_files_deprecated",
916
+ :header_params => header_params,
917
+ :query_params => query_params,
918
+ :form_params => form_params,
919
+ :body => post_body,
920
+ :auth_names => auth_names,
921
+ :return_type => return_type
922
+ )
923
+
924
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
925
+ if @api_client.config.debugging
926
+ @api_client.config.logger.debug "API called: FilesApi#query_user_files_deprecated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
927
+ end
928
+ APIResponse::new(data, status_code, headers, response)
929
+ end
930
+
931
+
932
+ # Resync File
933
+ #
934
+ # @param file_id [Integer]
935
+ # @param chunk_size [Integer]
936
+ # @param chunk_overlap [Integer]
937
+ # @param body [ResyncFileQueryInput]
938
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
939
+ def resync(file_id:, chunk_size: SENTINEL, chunk_overlap: SENTINEL, extra: {})
940
+ _body = {}
941
+ _body[:file_id] = file_id if file_id != SENTINEL
942
+ _body[:chunk_size] = chunk_size if chunk_size != SENTINEL
943
+ _body[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
944
+ resync_file_query_input = _body
945
+ api_response = resync_with_http_info_impl(resync_file_query_input, extra)
946
+ api_response.data
947
+ end
948
+
949
+ # Resync File
950
+ #
951
+ # @param file_id [Integer]
952
+ # @param chunk_size [Integer]
953
+ # @param chunk_overlap [Integer]
954
+ # @param body [ResyncFileQueryInput]
955
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
956
+ def resync_with_http_info(file_id:, chunk_size: SENTINEL, chunk_overlap: SENTINEL, extra: {})
957
+ _body = {}
958
+ _body[:file_id] = file_id if file_id != SENTINEL
959
+ _body[:chunk_size] = chunk_size if chunk_size != SENTINEL
960
+ _body[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
961
+ resync_file_query_input = _body
962
+ resync_with_http_info_impl(resync_file_query_input, extra)
963
+ end
964
+
965
+ # Resync File
966
+ # @param resync_file_query_input [ResyncFileQueryInput]
967
+ # @param [Hash] opts the optional parameters
968
+ # @return [UserFile]
969
+ private def resync_impl(resync_file_query_input, opts = {})
970
+ data, _status_code, _headers = resync_with_http_info(resync_file_query_input, opts)
971
+ data
972
+ end
973
+
974
+ # Resync File
975
+ # @param resync_file_query_input [ResyncFileQueryInput]
976
+ # @param [Hash] opts the optional parameters
977
+ # @return [APIResponse] data is UserFile, status code, headers and response
978
+ private def resync_with_http_info_impl(resync_file_query_input, opts = {})
979
+ if @api_client.config.debugging
980
+ @api_client.config.logger.debug 'Calling API: FilesApi.resync ...'
981
+ end
982
+ # verify the required parameter 'resync_file_query_input' is set
983
+ if @api_client.config.client_side_validation && resync_file_query_input.nil?
984
+ fail ArgumentError, "Missing the required parameter 'resync_file_query_input' when calling FilesApi.resync"
985
+ end
986
+ # resource path
987
+ local_var_path = '/resync_file'
988
+
989
+ # query parameters
990
+ query_params = opts[:query_params] || {}
991
+
992
+ # header parameters
993
+ header_params = opts[:header_params] || {}
994
+ # HTTP header 'Accept' (if needed)
995
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
996
+ # HTTP header 'Content-Type'
997
+ content_type = @api_client.select_header_content_type(['application/json'])
998
+ if !content_type.nil?
999
+ header_params['Content-Type'] = content_type
1000
+ end
1001
+
1002
+ # form parameters
1003
+ form_params = opts[:form_params] || {}
1004
+
1005
+ # http body (model)
1006
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(resync_file_query_input)
1007
+
1008
+ # return_type
1009
+ return_type = opts[:debug_return_type] || 'UserFile'
1010
+
1011
+ # auth_names
1012
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
1013
+
1014
+ new_options = opts.merge(
1015
+ :operation => :"FilesApi.resync",
1016
+ :header_params => header_params,
1017
+ :query_params => query_params,
1018
+ :form_params => form_params,
1019
+ :body => post_body,
1020
+ :auth_names => auth_names,
1021
+ :return_type => return_type
1022
+ )
1023
+
1024
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1025
+ if @api_client.config.debugging
1026
+ @api_client.config.logger.debug "API called: FilesApi#resync\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1027
+ end
1028
+ APIResponse::new(data, status_code, headers, response)
1029
+ end
1030
+
1031
+
1032
+ # Create Upload File
1033
+ #
1034
+ # This endpoint is used to directly upload local files to Carbon. The `POST` request should be a multipart form request.
1035
+ # Note that the `set_page_as_boundary` query parameter is applicable only to PDFs for now. When this value is set,
1036
+ # PDF chunks are at most one page long. Additional information can be retrieved for each chunk, however, namely the coordinates
1037
+ # of the bounding box around the chunk (this can be used for things like text highlighting). Following is a description
1038
+ # of all possible query parameters:
1039
+ # - `chunk_size`: the chunk size (in tokens) applied when splitting the document
1040
+ # - `chunk_overlap`: the chunk overlap (in tokens) applied when splitting the document
1041
+ # - `skip_embedding_generation`: whether or not to skip the generation of chunks and embeddings
1042
+ # - `set_page_as_boundary`: described above
1043
+ # - `embedding_model`: the model used to generate embeddings for the document chunks
1044
+ # - `use_ocr`: whether or not to use OCR as a preprocessing step prior to generating chunks (only valid for PDFs currently)
1045
+ # - `generate_sparse_vectors`: whether or not to generate sparse vectors for the file. Required for hybrid search.
1046
+ # - `prepend_filename_to_chunks`: whether or not to prepend the filename to the chunk text
1047
+ #
1048
+ #
1049
+ # Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's
1050
+ # multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0.
1051
+ # The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query
1052
+ # parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing
1053
+ # embedding queries, embeddings from files that used the specified model will be considered in the query.
1054
+ # For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with
1055
+ # `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is
1056
+ # specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that
1057
+ # the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not**
1058
+ # set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
1059
+ #
1060
+ # @param file [File]
1061
+ # @param chunk_size [Integer] Chunk size in tiktoken tokens to be used when processing file.
1062
+ # @param chunk_overlap [Integer] Chunk overlap in tiktoken tokens to be used when processing file.
1063
+ # @param skip_embedding_generation [Boolean] Flag to control whether or not embeddings should be generated and stored when processing file.
1064
+ # @param set_page_as_boundary [Boolean] Flag to control whether or not to set the a page's worth of content as the maximum amount of content that can appear in a chunk. Only valid for PDFs. See description route description for more information.
1065
+ # @param embedding_model [TextEmbeddingGenerators] Embedding model that will be used to embed file chunks.
1066
+ # @param use_ocr [Boolean] Whether or not to use OCR when processing files. Only valid for PDFs. Useful for documents with tables, images, and/or scanned text.
1067
+ # @param generate_sparse_vectors [Boolean] Whether or not to generate sparse vectors for the file. This is *required* for the file to be a candidate for hybrid search.
1068
+ # @param prepend_filename_to_chunks [Boolean] Whether or not to prepend the file's name to chunks.
1069
+ # @param max_items_per_chunk [Integer] Number of objects per chunk. For json files only.
1070
+ # @param body [BodyCreateUploadFileUploadfilePost]
1071
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1072
+ def upload(file:, chunk_size: SENTINEL, chunk_overlap: SENTINEL, skip_embedding_generation: false, set_page_as_boundary: false, embedding_model: SENTINEL, use_ocr: false, generate_sparse_vectors: false, prepend_filename_to_chunks: false, max_items_per_chunk: SENTINEL, extra: {})
1073
+ _body = {}
1074
+ _body[:file] = file if file != SENTINEL
1075
+ body_create_upload_file_uploadfile_post = _body
1076
+ extra[:chunk_size] = chunk_size if chunk_size != SENTINEL
1077
+ extra[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
1078
+ extra[:skip_embedding_generation] = skip_embedding_generation if skip_embedding_generation != SENTINEL
1079
+ extra[:set_page_as_boundary] = set_page_as_boundary if set_page_as_boundary != SENTINEL
1080
+ extra[:embedding_model] = embedding_model if embedding_model != SENTINEL
1081
+ extra[:use_ocr] = use_ocr if use_ocr != SENTINEL
1082
+ extra[:generate_sparse_vectors] = generate_sparse_vectors if generate_sparse_vectors != SENTINEL
1083
+ extra[:prepend_filename_to_chunks] = prepend_filename_to_chunks if prepend_filename_to_chunks != SENTINEL
1084
+ extra[:max_items_per_chunk] = max_items_per_chunk if max_items_per_chunk != SENTINEL
1085
+ api_response = upload_with_http_info_impl(file, body_create_upload_file_uploadfile_post, extra)
1086
+ api_response.data
1087
+ end
1088
+
1089
+ # Create Upload File
1090
+ #
1091
+ # This endpoint is used to directly upload local files to Carbon. The `POST` request should be a multipart form request.
1092
+ # Note that the `set_page_as_boundary` query parameter is applicable only to PDFs for now. When this value is set,
1093
+ # PDF chunks are at most one page long. Additional information can be retrieved for each chunk, however, namely the coordinates
1094
+ # of the bounding box around the chunk (this can be used for things like text highlighting). Following is a description
1095
+ # of all possible query parameters:
1096
+ # - `chunk_size`: the chunk size (in tokens) applied when splitting the document
1097
+ # - `chunk_overlap`: the chunk overlap (in tokens) applied when splitting the document
1098
+ # - `skip_embedding_generation`: whether or not to skip the generation of chunks and embeddings
1099
+ # - `set_page_as_boundary`: described above
1100
+ # - `embedding_model`: the model used to generate embeddings for the document chunks
1101
+ # - `use_ocr`: whether or not to use OCR as a preprocessing step prior to generating chunks (only valid for PDFs currently)
1102
+ # - `generate_sparse_vectors`: whether or not to generate sparse vectors for the file. Required for hybrid search.
1103
+ # - `prepend_filename_to_chunks`: whether or not to prepend the filename to the chunk text
1104
+ #
1105
+ #
1106
+ # Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's
1107
+ # multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0.
1108
+ # The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query
1109
+ # parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing
1110
+ # embedding queries, embeddings from files that used the specified model will be considered in the query.
1111
+ # For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with
1112
+ # `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is
1113
+ # specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that
1114
+ # the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not**
1115
+ # set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
1116
+ #
1117
+ # @param file [File]
1118
+ # @param chunk_size [Integer] Chunk size in tiktoken tokens to be used when processing file.
1119
+ # @param chunk_overlap [Integer] Chunk overlap in tiktoken tokens to be used when processing file.
1120
+ # @param skip_embedding_generation [Boolean] Flag to control whether or not embeddings should be generated and stored when processing file.
1121
+ # @param set_page_as_boundary [Boolean] Flag to control whether or not to set the a page's worth of content as the maximum amount of content that can appear in a chunk. Only valid for PDFs. See description route description for more information.
1122
+ # @param embedding_model [TextEmbeddingGenerators] Embedding model that will be used to embed file chunks.
1123
+ # @param use_ocr [Boolean] Whether or not to use OCR when processing files. Only valid for PDFs. Useful for documents with tables, images, and/or scanned text.
1124
+ # @param generate_sparse_vectors [Boolean] Whether or not to generate sparse vectors for the file. This is *required* for the file to be a candidate for hybrid search.
1125
+ # @param prepend_filename_to_chunks [Boolean] Whether or not to prepend the file's name to chunks.
1126
+ # @param max_items_per_chunk [Integer] Number of objects per chunk. For json files only.
1127
+ # @param body [BodyCreateUploadFileUploadfilePost]
1128
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1129
+ def upload_with_http_info(file:, chunk_size: SENTINEL, chunk_overlap: SENTINEL, skip_embedding_generation: false, set_page_as_boundary: false, embedding_model: SENTINEL, use_ocr: false, generate_sparse_vectors: false, prepend_filename_to_chunks: false, max_items_per_chunk: SENTINEL, extra: {})
1130
+ _body = {}
1131
+ _body[:file] = file if file != SENTINEL
1132
+ body_create_upload_file_uploadfile_post = _body
1133
+ extra[:chunk_size] = chunk_size if chunk_size != SENTINEL
1134
+ extra[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
1135
+ extra[:skip_embedding_generation] = skip_embedding_generation if skip_embedding_generation != SENTINEL
1136
+ extra[:set_page_as_boundary] = set_page_as_boundary if set_page_as_boundary != SENTINEL
1137
+ extra[:embedding_model] = embedding_model if embedding_model != SENTINEL
1138
+ extra[:use_ocr] = use_ocr if use_ocr != SENTINEL
1139
+ extra[:generate_sparse_vectors] = generate_sparse_vectors if generate_sparse_vectors != SENTINEL
1140
+ extra[:prepend_filename_to_chunks] = prepend_filename_to_chunks if prepend_filename_to_chunks != SENTINEL
1141
+ extra[:max_items_per_chunk] = max_items_per_chunk if max_items_per_chunk != SENTINEL
1142
+ upload_with_http_info_impl(file, body_create_upload_file_uploadfile_post, extra)
1143
+ end
1144
+
1145
+ # Create Upload File
1146
+ # This endpoint is used to directly upload local files to Carbon. The `POST` request should be a multipart form request. Note that the `set_page_as_boundary` query parameter is applicable only to PDFs for now. When this value is set, PDF chunks are at most one page long. Additional information can be retrieved for each chunk, however, namely the coordinates of the bounding box around the chunk (this can be used for things like text highlighting). Following is a description of all possible query parameters: - `chunk_size`: the chunk size (in tokens) applied when splitting the document - `chunk_overlap`: the chunk overlap (in tokens) applied when splitting the document - `skip_embedding_generation`: whether or not to skip the generation of chunks and embeddings - `set_page_as_boundary`: described above - `embedding_model`: the model used to generate embeddings for the document chunks - `use_ocr`: whether or not to use OCR as a preprocessing step prior to generating chunks (only valid for PDFs currently) - `generate_sparse_vectors`: whether or not to generate sparse vectors for the file. Required for hybrid search. - `prepend_filename_to_chunks`: whether or not to prepend the filename to the chunk text Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0. The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing embedding queries, embeddings from files that used the specified model will be considered in the query. For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not** set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
1147
+ # @param file [File]
1148
+ # @param body_create_upload_file_uploadfile_post [BodyCreateUploadFileUploadfilePost]
1149
+ # @param [Hash] opts the optional parameters
1150
+ # @option opts [Integer] :chunk_size Chunk size in tiktoken tokens to be used when processing file.
1151
+ # @option opts [Integer] :chunk_overlap Chunk overlap in tiktoken tokens to be used when processing file.
1152
+ # @option opts [Boolean] :skip_embedding_generation Flag to control whether or not embeddings should be generated and stored when processing file. (default to false)
1153
+ # @option opts [Boolean] :set_page_as_boundary Flag to control whether or not to set the a page's worth of content as the maximum amount of content that can appear in a chunk. Only valid for PDFs. See description route description for more information. (default to false)
1154
+ # @option opts [TextEmbeddingGenerators] :embedding_model Embedding model that will be used to embed file chunks.
1155
+ # @option opts [Boolean] :use_ocr Whether or not to use OCR when processing files. Only valid for PDFs. Useful for documents with tables, images, and/or scanned text. (default to false)
1156
+ # @option opts [Boolean] :generate_sparse_vectors Whether or not to generate sparse vectors for the file. This is *required* for the file to be a candidate for hybrid search. (default to false)
1157
+ # @option opts [Boolean] :prepend_filename_to_chunks Whether or not to prepend the file's name to chunks. (default to false)
1158
+ # @option opts [Integer] :max_items_per_chunk Number of objects per chunk. For json files only.
1159
+ # @return [UserFile]
1160
+ private def upload_impl(file, body_create_upload_file_uploadfile_post, opts = {})
1161
+ data, _status_code, _headers = upload_with_http_info(file, body_create_upload_file_uploadfile_post, opts)
1162
+ data
1163
+ end
1164
+
1165
+ # Create Upload File
1166
+ # This endpoint is used to directly upload local files to Carbon. The &#x60;POST&#x60; request should be a multipart form request. Note that the &#x60;set_page_as_boundary&#x60; query parameter is applicable only to PDFs for now. When this value is set, PDF chunks are at most one page long. Additional information can be retrieved for each chunk, however, namely the coordinates of the bounding box around the chunk (this can be used for things like text highlighting). Following is a description of all possible query parameters: - &#x60;chunk_size&#x60;: the chunk size (in tokens) applied when splitting the document - &#x60;chunk_overlap&#x60;: the chunk overlap (in tokens) applied when splitting the document - &#x60;skip_embedding_generation&#x60;: whether or not to skip the generation of chunks and embeddings - &#x60;set_page_as_boundary&#x60;: described above - &#x60;embedding_model&#x60;: the model used to generate embeddings for the document chunks - &#x60;use_ocr&#x60;: whether or not to use OCR as a preprocessing step prior to generating chunks (only valid for PDFs currently) - &#x60;generate_sparse_vectors&#x60;: whether or not to generate sparse vectors for the file. Required for hybrid search. - &#x60;prepend_filename_to_chunks&#x60;: whether or not to prepend the filename to the chunk text Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI&#39;s multimodal model; for text, we support OpenAI&#39;s &#x60;text-embedding-ada-002&#x60; and Cohere&#39;s embed-multilingual-v3.0. The model can be specified via the &#x60;embedding_model&#x60; parameter (in the POST body for &#x60;/embeddings&#x60;, and a query parameter in &#x60;/uploadfile&#x60;). If no model is supplied, the &#x60;text-embedding-ada-002&#x60; is used by default. When performing embedding queries, embeddings from files that used the specified model will be considered in the query. For example, if files A and B have embeddings generated with &#x60;OPENAI&#x60;, and files C and D have embeddings generated with &#x60;COHERE_MULTILINGUAL_V3&#x60;, then by default, queries will only consider files A and B. If &#x60;COHERE_MULTILINGUAL_V3&#x60; is specified as the &#x60;embedding_model&#x60; in &#x60;/embeddings&#x60;, then only files C and D will be considered. Make sure that the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not** set &#x60;VERTEX_MULTIMODAL&#x60; as an &#x60;embedding_model&#x60;. This model is used automatically by Carbon when it detects an image file.
1167
+ # @param file [File]
1168
+ # @param body_create_upload_file_uploadfile_post [BodyCreateUploadFileUploadfilePost]
1169
+ # @param [Hash] opts the optional parameters
1170
+ # @option opts [Integer] :chunk_size Chunk size in tiktoken tokens to be used when processing file.
1171
+ # @option opts [Integer] :chunk_overlap Chunk overlap in tiktoken tokens to be used when processing file.
1172
+ # @option opts [Boolean] :skip_embedding_generation Flag to control whether or not embeddings should be generated and stored when processing file. (default to false)
1173
+ # @option opts [Boolean] :set_page_as_boundary Flag to control whether or not to set the a page's worth of content as the maximum amount of content that can appear in a chunk. Only valid for PDFs. See description route description for more information. (default to false)
1174
+ # @option opts [TextEmbeddingGenerators] :embedding_model Embedding model that will be used to embed file chunks.
1175
+ # @option opts [Boolean] :use_ocr Whether or not to use OCR when processing files. Only valid for PDFs. Useful for documents with tables, images, and/or scanned text. (default to false)
1176
+ # @option opts [Boolean] :generate_sparse_vectors Whether or not to generate sparse vectors for the file. This is *required* for the file to be a candidate for hybrid search. (default to false)
1177
+ # @option opts [Boolean] :prepend_filename_to_chunks Whether or not to prepend the file's name to chunks. (default to false)
1178
+ # @option opts [Integer] :max_items_per_chunk Number of objects per chunk. For json files only.
1179
+ # @return [APIResponse] data is UserFile, status code, headers and response
1180
+ private def upload_with_http_info_impl(file, body_create_upload_file_uploadfile_post, opts = {})
1181
+ if @api_client.config.debugging
1182
+ @api_client.config.logger.debug 'Calling API: FilesApi.upload ...'
1183
+ end
1184
+ # verify the required parameter 'file' is set
1185
+ if @api_client.config.client_side_validation && file.nil?
1186
+ fail ArgumentError, "Missing the required parameter 'file' when calling FilesApi.upload"
1187
+ end
1188
+ # verify the required parameter 'body_create_upload_file_uploadfile_post' is set
1189
+ if @api_client.config.client_side_validation && body_create_upload_file_uploadfile_post.nil?
1190
+ fail ArgumentError, "Missing the required parameter 'body_create_upload_file_uploadfile_post' when calling FilesApi.upload"
1191
+ end
1192
+ # resource path
1193
+ local_var_path = '/uploadfile'
1194
+
1195
+ # query parameters
1196
+ query_params = opts[:query_params] || {}
1197
+ query_params[:'chunk_size'] = opts[:'chunk_size'] if !opts[:'chunk_size'].nil?
1198
+ query_params[:'chunk_overlap'] = opts[:'chunk_overlap'] if !opts[:'chunk_overlap'].nil?
1199
+ query_params[:'skip_embedding_generation'] = opts[:'skip_embedding_generation'] if !opts[:'skip_embedding_generation'].nil?
1200
+ query_params[:'set_page_as_boundary'] = opts[:'set_page_as_boundary'] if !opts[:'set_page_as_boundary'].nil?
1201
+ query_params[:'embedding_model'] = opts[:'embedding_model'] if !opts[:'embedding_model'].nil?
1202
+ query_params[:'use_ocr'] = opts[:'use_ocr'] if !opts[:'use_ocr'].nil?
1203
+ query_params[:'generate_sparse_vectors'] = opts[:'generate_sparse_vectors'] if !opts[:'generate_sparse_vectors'].nil?
1204
+ query_params[:'prepend_filename_to_chunks'] = opts[:'prepend_filename_to_chunks'] if !opts[:'prepend_filename_to_chunks'].nil?
1205
+ query_params[:'max_items_per_chunk'] = opts[:'max_items_per_chunk'] if !opts[:'max_items_per_chunk'].nil?
1206
+
1207
+ # header parameters
1208
+ header_params = opts[:header_params] || {}
1209
+ # HTTP header 'Accept' (if needed)
1210
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1211
+ # HTTP header 'Content-Type'
1212
+ content_type = @api_client.select_header_content_type(['multipart/form-data'])
1213
+ if !content_type.nil?
1214
+ header_params['Content-Type'] = content_type
1215
+ end
1216
+
1217
+ # form parameters
1218
+ form_params = opts[:form_params] || {}
1219
+ form_params['file'] = file
1220
+
1221
+ # http body (model)
1222
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body_create_upload_file_uploadfile_post)
1223
+
1224
+ # return_type
1225
+ return_type = opts[:debug_return_type] || 'UserFile'
1226
+
1227
+ # auth_names
1228
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
1229
+
1230
+ new_options = opts.merge(
1231
+ :operation => :"FilesApi.upload",
1232
+ :header_params => header_params,
1233
+ :query_params => query_params,
1234
+ :form_params => form_params,
1235
+ :body => post_body,
1236
+ :auth_names => auth_names,
1237
+ :return_type => return_type
1238
+ )
1239
+
1240
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1241
+ if @api_client.config.debugging
1242
+ @api_client.config.logger.debug "API called: FilesApi#upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1243
+ end
1244
+ APIResponse::new(data, status_code, headers, response)
1245
+ end
1246
+
1247
+
1248
+ # Create Upload File From Url
1249
+ #
1250
+ # @param url [String]
1251
+ # @param file_name [String]
1252
+ # @param chunk_size [Integer]
1253
+ # @param chunk_overlap [Integer]
1254
+ # @param skip_embedding_generation [Boolean]
1255
+ # @param set_page_as_boundary [Boolean]
1256
+ # @param embedding_model [EmbeddingGenerators]
1257
+ # @param generate_sparse_vectors [Boolean]
1258
+ # @param use_textract [Boolean]
1259
+ # @param prepend_filename_to_chunks [Boolean]
1260
+ # @param max_items_per_chunk [Integer]
1261
+ # @param body [UploadFileFromUrlInput]
1262
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1263
+ def upload_from_url(url:, file_name: SENTINEL, chunk_size: SENTINEL, chunk_overlap: SENTINEL, skip_embedding_generation: false, set_page_as_boundary: false, embedding_model: 'OPENAI', generate_sparse_vectors: false, use_textract: false, prepend_filename_to_chunks: false, max_items_per_chunk: SENTINEL, extra: {})
1264
+ _body = {}
1265
+ _body[:url] = url if url != SENTINEL
1266
+ _body[:file_name] = file_name if file_name != SENTINEL
1267
+ _body[:chunk_size] = chunk_size if chunk_size != SENTINEL
1268
+ _body[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
1269
+ _body[:skip_embedding_generation] = skip_embedding_generation if skip_embedding_generation != SENTINEL
1270
+ _body[:set_page_as_boundary] = set_page_as_boundary if set_page_as_boundary != SENTINEL
1271
+ _body[:embedding_model] = embedding_model if embedding_model != SENTINEL
1272
+ _body[:generate_sparse_vectors] = generate_sparse_vectors if generate_sparse_vectors != SENTINEL
1273
+ _body[:use_textract] = use_textract if use_textract != SENTINEL
1274
+ _body[:prepend_filename_to_chunks] = prepend_filename_to_chunks if prepend_filename_to_chunks != SENTINEL
1275
+ _body[:max_items_per_chunk] = max_items_per_chunk if max_items_per_chunk != SENTINEL
1276
+ upload_file_from_url_input = _body
1277
+ api_response = upload_from_url_with_http_info_impl(upload_file_from_url_input, extra)
1278
+ api_response.data
1279
+ end
1280
+
1281
+ # Create Upload File From Url
1282
+ #
1283
+ # @param url [String]
1284
+ # @param file_name [String]
1285
+ # @param chunk_size [Integer]
1286
+ # @param chunk_overlap [Integer]
1287
+ # @param skip_embedding_generation [Boolean]
1288
+ # @param set_page_as_boundary [Boolean]
1289
+ # @param embedding_model [EmbeddingGenerators]
1290
+ # @param generate_sparse_vectors [Boolean]
1291
+ # @param use_textract [Boolean]
1292
+ # @param prepend_filename_to_chunks [Boolean]
1293
+ # @param max_items_per_chunk [Integer]
1294
+ # @param body [UploadFileFromUrlInput]
1295
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1296
+ def upload_from_url_with_http_info(url:, file_name: SENTINEL, chunk_size: SENTINEL, chunk_overlap: SENTINEL, skip_embedding_generation: false, set_page_as_boundary: false, embedding_model: 'OPENAI', generate_sparse_vectors: false, use_textract: false, prepend_filename_to_chunks: false, max_items_per_chunk: SENTINEL, extra: {})
1297
+ _body = {}
1298
+ _body[:url] = url if url != SENTINEL
1299
+ _body[:file_name] = file_name if file_name != SENTINEL
1300
+ _body[:chunk_size] = chunk_size if chunk_size != SENTINEL
1301
+ _body[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
1302
+ _body[:skip_embedding_generation] = skip_embedding_generation if skip_embedding_generation != SENTINEL
1303
+ _body[:set_page_as_boundary] = set_page_as_boundary if set_page_as_boundary != SENTINEL
1304
+ _body[:embedding_model] = embedding_model if embedding_model != SENTINEL
1305
+ _body[:generate_sparse_vectors] = generate_sparse_vectors if generate_sparse_vectors != SENTINEL
1306
+ _body[:use_textract] = use_textract if use_textract != SENTINEL
1307
+ _body[:prepend_filename_to_chunks] = prepend_filename_to_chunks if prepend_filename_to_chunks != SENTINEL
1308
+ _body[:max_items_per_chunk] = max_items_per_chunk if max_items_per_chunk != SENTINEL
1309
+ upload_file_from_url_input = _body
1310
+ upload_from_url_with_http_info_impl(upload_file_from_url_input, extra)
1311
+ end
1312
+
1313
+ # Create Upload File From Url
1314
+ # @param upload_file_from_url_input [UploadFileFromUrlInput]
1315
+ # @param [Hash] opts the optional parameters
1316
+ # @return [UserFile]
1317
+ private def upload_from_url_impl(upload_file_from_url_input, opts = {})
1318
+ data, _status_code, _headers = upload_from_url_with_http_info(upload_file_from_url_input, opts)
1319
+ data
1320
+ end
1321
+
1322
+ # Create Upload File From Url
1323
+ # @param upload_file_from_url_input [UploadFileFromUrlInput]
1324
+ # @param [Hash] opts the optional parameters
1325
+ # @return [APIResponse] data is UserFile, status code, headers and response
1326
+ private def upload_from_url_with_http_info_impl(upload_file_from_url_input, opts = {})
1327
+ if @api_client.config.debugging
1328
+ @api_client.config.logger.debug 'Calling API: FilesApi.upload_from_url ...'
1329
+ end
1330
+ # verify the required parameter 'upload_file_from_url_input' is set
1331
+ if @api_client.config.client_side_validation && upload_file_from_url_input.nil?
1332
+ fail ArgumentError, "Missing the required parameter 'upload_file_from_url_input' when calling FilesApi.upload_from_url"
1333
+ end
1334
+ # resource path
1335
+ local_var_path = '/upload_file_from_url'
1336
+
1337
+ # query parameters
1338
+ query_params = opts[:query_params] || {}
1339
+
1340
+ # header parameters
1341
+ header_params = opts[:header_params] || {}
1342
+ # HTTP header 'Accept' (if needed)
1343
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1344
+ # HTTP header 'Content-Type'
1345
+ content_type = @api_client.select_header_content_type(['application/json'])
1346
+ if !content_type.nil?
1347
+ header_params['Content-Type'] = content_type
1348
+ end
1349
+
1350
+ # form parameters
1351
+ form_params = opts[:form_params] || {}
1352
+
1353
+ # http body (model)
1354
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(upload_file_from_url_input)
1355
+
1356
+ # return_type
1357
+ return_type = opts[:debug_return_type] || 'UserFile'
1358
+
1359
+ # auth_names
1360
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
1361
+
1362
+ new_options = opts.merge(
1363
+ :operation => :"FilesApi.upload_from_url",
1364
+ :header_params => header_params,
1365
+ :query_params => query_params,
1366
+ :form_params => form_params,
1367
+ :body => post_body,
1368
+ :auth_names => auth_names,
1369
+ :return_type => return_type
1370
+ )
1371
+
1372
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1373
+ if @api_client.config.debugging
1374
+ @api_client.config.logger.debug "API called: FilesApi#upload_from_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1375
+ end
1376
+ APIResponse::new(data, status_code, headers, response)
1377
+ end
1378
+
1379
+
1380
+ # Create Raw Text
1381
+ #
1382
+ # Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's
1383
+ # multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0.
1384
+ # The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query
1385
+ # parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing
1386
+ # embedding queries, embeddings from files that used the specified model will be considered in the query.
1387
+ # For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with
1388
+ # `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is
1389
+ # specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that
1390
+ # the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not**
1391
+ # set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
1392
+ #
1393
+ # @param contents [String]
1394
+ # @param name [String]
1395
+ # @param chunk_size [Integer]
1396
+ # @param chunk_overlap [Integer]
1397
+ # @param skip_embedding_generation [Boolean]
1398
+ # @param overwrite_file_id [Integer]
1399
+ # @param embedding_model [EmbeddingGeneratorsNullable]
1400
+ # @param generate_sparse_vectors [Boolean]
1401
+ # @param body [RawTextInput]
1402
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1403
+ def upload_text(contents:, name: SENTINEL, chunk_size: SENTINEL, chunk_overlap: SENTINEL, skip_embedding_generation: false, overwrite_file_id: SENTINEL, embedding_model: 'OPENAI', generate_sparse_vectors: false, extra: {})
1404
+ _body = {}
1405
+ _body[:contents] = contents if contents != SENTINEL
1406
+ _body[:name] = name if name != SENTINEL
1407
+ _body[:chunk_size] = chunk_size if chunk_size != SENTINEL
1408
+ _body[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
1409
+ _body[:skip_embedding_generation] = skip_embedding_generation if skip_embedding_generation != SENTINEL
1410
+ _body[:overwrite_file_id] = overwrite_file_id if overwrite_file_id != SENTINEL
1411
+ _body[:embedding_model] = embedding_model if embedding_model != SENTINEL
1412
+ _body[:generate_sparse_vectors] = generate_sparse_vectors if generate_sparse_vectors != SENTINEL
1413
+ raw_text_input = _body
1414
+ api_response = upload_text_with_http_info_impl(raw_text_input, extra)
1415
+ api_response.data
1416
+ end
1417
+
1418
+ # Create Raw Text
1419
+ #
1420
+ # Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's
1421
+ # multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0.
1422
+ # The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query
1423
+ # parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing
1424
+ # embedding queries, embeddings from files that used the specified model will be considered in the query.
1425
+ # For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with
1426
+ # `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is
1427
+ # specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that
1428
+ # the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not**
1429
+ # set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
1430
+ #
1431
+ # @param contents [String]
1432
+ # @param name [String]
1433
+ # @param chunk_size [Integer]
1434
+ # @param chunk_overlap [Integer]
1435
+ # @param skip_embedding_generation [Boolean]
1436
+ # @param overwrite_file_id [Integer]
1437
+ # @param embedding_model [EmbeddingGeneratorsNullable]
1438
+ # @param generate_sparse_vectors [Boolean]
1439
+ # @param body [RawTextInput]
1440
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
1441
+ def upload_text_with_http_info(contents:, name: SENTINEL, chunk_size: SENTINEL, chunk_overlap: SENTINEL, skip_embedding_generation: false, overwrite_file_id: SENTINEL, embedding_model: 'OPENAI', generate_sparse_vectors: false, extra: {})
1442
+ _body = {}
1443
+ _body[:contents] = contents if contents != SENTINEL
1444
+ _body[:name] = name if name != SENTINEL
1445
+ _body[:chunk_size] = chunk_size if chunk_size != SENTINEL
1446
+ _body[:chunk_overlap] = chunk_overlap if chunk_overlap != SENTINEL
1447
+ _body[:skip_embedding_generation] = skip_embedding_generation if skip_embedding_generation != SENTINEL
1448
+ _body[:overwrite_file_id] = overwrite_file_id if overwrite_file_id != SENTINEL
1449
+ _body[:embedding_model] = embedding_model if embedding_model != SENTINEL
1450
+ _body[:generate_sparse_vectors] = generate_sparse_vectors if generate_sparse_vectors != SENTINEL
1451
+ raw_text_input = _body
1452
+ upload_text_with_http_info_impl(raw_text_input, extra)
1453
+ end
1454
+
1455
+ # Create Raw Text
1456
+ # Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0. The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing embedding queries, embeddings from files that used the specified model will be considered in the query. For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not** set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
1457
+ # @param raw_text_input [RawTextInput]
1458
+ # @param [Hash] opts the optional parameters
1459
+ # @return [UserFile]
1460
+ private def upload_text_impl(raw_text_input, opts = {})
1461
+ data, _status_code, _headers = upload_text_with_http_info(raw_text_input, opts)
1462
+ data
1463
+ end
1464
+
1465
+ # Create Raw Text
1466
+ # Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI&#39;s multimodal model; for text, we support OpenAI&#39;s &#x60;text-embedding-ada-002&#x60; and Cohere&#39;s embed-multilingual-v3.0. The model can be specified via the &#x60;embedding_model&#x60; parameter (in the POST body for &#x60;/embeddings&#x60;, and a query parameter in &#x60;/uploadfile&#x60;). If no model is supplied, the &#x60;text-embedding-ada-002&#x60; is used by default. When performing embedding queries, embeddings from files that used the specified model will be considered in the query. For example, if files A and B have embeddings generated with &#x60;OPENAI&#x60;, and files C and D have embeddings generated with &#x60;COHERE_MULTILINGUAL_V3&#x60;, then by default, queries will only consider files A and B. If &#x60;COHERE_MULTILINGUAL_V3&#x60; is specified as the &#x60;embedding_model&#x60; in &#x60;/embeddings&#x60;, then only files C and D will be considered. Make sure that the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not** set &#x60;VERTEX_MULTIMODAL&#x60; as an &#x60;embedding_model&#x60;. This model is used automatically by Carbon when it detects an image file.
1467
+ # @param raw_text_input [RawTextInput]
1468
+ # @param [Hash] opts the optional parameters
1469
+ # @return [APIResponse] data is UserFile, status code, headers and response
1470
+ private def upload_text_with_http_info_impl(raw_text_input, opts = {})
1471
+ if @api_client.config.debugging
1472
+ @api_client.config.logger.debug 'Calling API: FilesApi.upload_text ...'
1473
+ end
1474
+ # verify the required parameter 'raw_text_input' is set
1475
+ if @api_client.config.client_side_validation && raw_text_input.nil?
1476
+ fail ArgumentError, "Missing the required parameter 'raw_text_input' when calling FilesApi.upload_text"
1477
+ end
1478
+ # resource path
1479
+ local_var_path = '/upload_text'
1480
+
1481
+ # query parameters
1482
+ query_params = opts[:query_params] || {}
1483
+
1484
+ # header parameters
1485
+ header_params = opts[:header_params] || {}
1486
+ # HTTP header 'Accept' (if needed)
1487
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1488
+ # HTTP header 'Content-Type'
1489
+ content_type = @api_client.select_header_content_type(['application/json'])
1490
+ if !content_type.nil?
1491
+ header_params['Content-Type'] = content_type
1492
+ end
1493
+
1494
+ # form parameters
1495
+ form_params = opts[:form_params] || {}
1496
+
1497
+ # http body (model)
1498
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(raw_text_input)
1499
+
1500
+ # return_type
1501
+ return_type = opts[:debug_return_type] || 'UserFile'
1502
+
1503
+ # auth_names
1504
+ auth_names = opts[:debug_auth_names] || ['accessToken', 'apiKey', 'customerId']
1505
+
1506
+ new_options = opts.merge(
1507
+ :operation => :"FilesApi.upload_text",
1508
+ :header_params => header_params,
1509
+ :query_params => query_params,
1510
+ :form_params => form_params,
1511
+ :body => post_body,
1512
+ :auth_names => auth_names,
1513
+ :return_type => return_type
1514
+ )
1515
+
1516
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1517
+ if @api_client.config.debugging
1518
+ @api_client.config.logger.debug "API called: FilesApi#upload_text\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1519
+ end
1520
+ APIResponse::new(data, status_code, headers, response)
1521
+ end
1522
+ end
1523
+
1524
+ # top-level client access to avoid having the user to insantiate their own API instances
1525
+ Files = FilesApi::new
1526
+ end