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,416 @@
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 'date'
10
+ require 'time'
11
+
12
+ module Carbon
13
+ class GetEmbeddingDocumentsBody
14
+ # A set of tags to limit the search to. Deprecated and may be removed in the future.
15
+ attr_accessor :tags
16
+
17
+ # Query for which to get related chunks and embeddings.
18
+ attr_accessor :query
19
+
20
+ # Optional query vector for which to get related chunks and embeddings. It must have been generated by the same model used to generate the embeddings across which the search is being conducted. Cannot provide both `query` and `query_vector`.
21
+ attr_accessor :query_vector
22
+
23
+ # Number of related chunks to return.
24
+ attr_accessor :k
25
+
26
+ # Optional list of file IDs to limit the search to
27
+ attr_accessor :file_ids
28
+
29
+ # Optional list of parent file IDs to limit the search to. A parent file describes a file to which another file belongs (e.g. a folder)
30
+ attr_accessor :parent_file_ids
31
+
32
+ # A set of tags to limit the search to. Use this instead of `tags`, which is deprecated.
33
+ attr_accessor :tags_v2
34
+
35
+ # Flag to control whether or not to include tags for each chunk in the response.
36
+ attr_accessor :include_tags
37
+
38
+ # Flag to control whether or not to include embedding vectors in the response.
39
+ attr_accessor :include_vectors
40
+
41
+ # Flag to control whether or not to include a signed URL to the raw file containing each chunk in the response.
42
+ attr_accessor :include_raw_file
43
+
44
+ # Flag to control whether or not to perform hybrid search.
45
+ attr_accessor :hybrid_search
46
+
47
+ attr_accessor :hybrid_search_tuning_parameters
48
+
49
+ # Used to filter the kind of files (e.g. `TEXT` or `IMAGE`) over which to perform the search. Also plays a role in determining what embedding model is used to embed the query. If `IMAGE` is chosen as the media type, then the embedding model used will be an embedding model that is not text-only, *regardless* of what value is passed for `embedding_model`.
50
+ attr_accessor :media_type
51
+
52
+ attr_accessor :embedding_model
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'tags' => :'tags',
58
+ :'query' => :'query',
59
+ :'query_vector' => :'query_vector',
60
+ :'k' => :'k',
61
+ :'file_ids' => :'file_ids',
62
+ :'parent_file_ids' => :'parent_file_ids',
63
+ :'tags_v2' => :'tags_v2',
64
+ :'include_tags' => :'include_tags',
65
+ :'include_vectors' => :'include_vectors',
66
+ :'include_raw_file' => :'include_raw_file',
67
+ :'hybrid_search' => :'hybrid_search',
68
+ :'hybrid_search_tuning_parameters' => :'hybrid_search_tuning_parameters',
69
+ :'media_type' => :'media_type',
70
+ :'embedding_model' => :'embedding_model'
71
+ }
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'tags' => :'Hash<String, Tags1>',
83
+ :'query' => :'String',
84
+ :'query_vector' => :'Array<Float>',
85
+ :'k' => :'Integer',
86
+ :'file_ids' => :'Array<Integer>',
87
+ :'parent_file_ids' => :'Array<Integer>',
88
+ :'tags_v2' => :'Object',
89
+ :'include_tags' => :'Boolean',
90
+ :'include_vectors' => :'Boolean',
91
+ :'include_raw_file' => :'Boolean',
92
+ :'hybrid_search' => :'Boolean',
93
+ :'hybrid_search_tuning_parameters' => :'HybridSearchTuningParamsNullable',
94
+ :'media_type' => :'FileContentTypesNullable',
95
+ :'embedding_model' => :'EmbeddingGeneratorsNullable'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ :'tags',
103
+ :'query_vector',
104
+ :'file_ids',
105
+ :'parent_file_ids',
106
+ :'tags_v2',
107
+ :'include_tags',
108
+ :'include_vectors',
109
+ :'include_raw_file',
110
+ :'hybrid_search',
111
+ :'hybrid_search_tuning_parameters',
112
+ :'media_type',
113
+ :'embedding_model'
114
+ ])
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::GetEmbeddingDocumentsBody` initialize method"
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!self.class.attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::GetEmbeddingDocumentsBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'tags')
133
+ if (value = attributes[:'tags']).is_a?(Hash)
134
+ self.tags = value
135
+ end
136
+ end
137
+
138
+ if attributes.key?(:'query')
139
+ self.query = attributes[:'query']
140
+ end
141
+
142
+ if attributes.key?(:'query_vector')
143
+ if (value = attributes[:'query_vector']).is_a?(Array)
144
+ self.query_vector = value
145
+ end
146
+ end
147
+
148
+ if attributes.key?(:'k')
149
+ self.k = attributes[:'k']
150
+ end
151
+
152
+ if attributes.key?(:'file_ids')
153
+ if (value = attributes[:'file_ids']).is_a?(Array)
154
+ self.file_ids = value
155
+ end
156
+ end
157
+
158
+ if attributes.key?(:'parent_file_ids')
159
+ if (value = attributes[:'parent_file_ids']).is_a?(Array)
160
+ self.parent_file_ids = value
161
+ end
162
+ end
163
+
164
+ if attributes.key?(:'tags_v2')
165
+ self.tags_v2 = attributes[:'tags_v2']
166
+ end
167
+
168
+ if attributes.key?(:'include_tags')
169
+ self.include_tags = attributes[:'include_tags']
170
+ end
171
+
172
+ if attributes.key?(:'include_vectors')
173
+ self.include_vectors = attributes[:'include_vectors']
174
+ end
175
+
176
+ if attributes.key?(:'include_raw_file')
177
+ self.include_raw_file = attributes[:'include_raw_file']
178
+ end
179
+
180
+ if attributes.key?(:'hybrid_search')
181
+ self.hybrid_search = attributes[:'hybrid_search']
182
+ end
183
+
184
+ if attributes.key?(:'hybrid_search_tuning_parameters')
185
+ self.hybrid_search_tuning_parameters = attributes[:'hybrid_search_tuning_parameters']
186
+ end
187
+
188
+ if attributes.key?(:'media_type')
189
+ self.media_type = attributes[:'media_type']
190
+ else
191
+ self.media_type = 'TEXT'
192
+ end
193
+
194
+ if attributes.key?(:'embedding_model')
195
+ self.embedding_model = attributes[:'embedding_model']
196
+ else
197
+ self.embedding_model = 'OPENAI'
198
+ end
199
+ end
200
+
201
+ # Show invalid properties with the reasons. Usually used together with valid?
202
+ # @return Array for valid properties with the reasons
203
+ def list_invalid_properties
204
+ invalid_properties = Array.new
205
+ if @query.nil?
206
+ invalid_properties.push('invalid value for "query", query cannot be nil.')
207
+ end
208
+
209
+ if @query.to_s.length < 1
210
+ invalid_properties.push('invalid value for "query", the character length must be great than or equal to 1.')
211
+ end
212
+
213
+ if @k.nil?
214
+ invalid_properties.push('invalid value for "k", k cannot be nil.')
215
+ end
216
+
217
+ if @k < 1
218
+ invalid_properties.push('invalid value for "k", must be greater than or equal to 1.')
219
+ end
220
+
221
+ invalid_properties
222
+ end
223
+
224
+ # Check to see if the all the properties in the model are valid
225
+ # @return true if the model is valid
226
+ def valid?
227
+ return false if @query.nil?
228
+ return false if @query.to_s.length < 1
229
+ return false if @k.nil?
230
+ return false if @k < 1
231
+ true
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] query Value to be assigned
236
+ def query=(query)
237
+ if query.nil?
238
+ fail ArgumentError, 'query cannot be nil'
239
+ end
240
+
241
+ if query.to_s.length < 1
242
+ fail ArgumentError, 'invalid value for "query", the character length must be great than or equal to 1.'
243
+ end
244
+
245
+ @query = query
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] k Value to be assigned
250
+ def k=(k)
251
+ if k.nil?
252
+ fail ArgumentError, 'k cannot be nil'
253
+ end
254
+
255
+ if k < 1
256
+ fail ArgumentError, 'invalid value for "k", must be greater than or equal to 1.'
257
+ end
258
+
259
+ @k = k
260
+ end
261
+
262
+ # Checks equality by comparing each attribute.
263
+ # @param [Object] Object to be compared
264
+ def ==(o)
265
+ return true if self.equal?(o)
266
+ self.class == o.class &&
267
+ tags == o.tags &&
268
+ query == o.query &&
269
+ query_vector == o.query_vector &&
270
+ k == o.k &&
271
+ file_ids == o.file_ids &&
272
+ parent_file_ids == o.parent_file_ids &&
273
+ tags_v2 == o.tags_v2 &&
274
+ include_tags == o.include_tags &&
275
+ include_vectors == o.include_vectors &&
276
+ include_raw_file == o.include_raw_file &&
277
+ hybrid_search == o.hybrid_search &&
278
+ hybrid_search_tuning_parameters == o.hybrid_search_tuning_parameters &&
279
+ media_type == o.media_type &&
280
+ embedding_model == o.embedding_model
281
+ end
282
+
283
+ # @see the `==` method
284
+ # @param [Object] Object to be compared
285
+ def eql?(o)
286
+ self == o
287
+ end
288
+
289
+ # Calculates hash code according to all attributes.
290
+ # @return [Integer] Hash code
291
+ def hash
292
+ [tags, query, query_vector, k, file_ids, parent_file_ids, tags_v2, include_tags, include_vectors, include_raw_file, hybrid_search, hybrid_search_tuning_parameters, media_type, embedding_model].hash
293
+ end
294
+
295
+ # Builds the object from hash
296
+ # @param [Hash] attributes Model attributes in the form of hash
297
+ # @return [Object] Returns the model itself
298
+ def self.build_from_hash(attributes)
299
+ new.build_from_hash(attributes)
300
+ end
301
+
302
+ # Builds the object from hash
303
+ # @param [Hash] attributes Model attributes in the form of hash
304
+ # @return [Object] Returns the model itself
305
+ def build_from_hash(attributes)
306
+ return nil unless attributes.is_a?(Hash)
307
+ attributes = attributes.transform_keys(&:to_sym)
308
+ self.class.openapi_types.each_pair do |key, type|
309
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
310
+ self.send("#{key}=", nil)
311
+ elsif type =~ /\AArray<(.*)>/i
312
+ # check to ensure the input is an array given that the attribute
313
+ # is documented as an array but the input is not
314
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
315
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
316
+ end
317
+ elsif !attributes[self.class.attribute_map[key]].nil?
318
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
319
+ end
320
+ end
321
+
322
+ self
323
+ end
324
+
325
+ # Deserializes the data based on type
326
+ # @param string type Data type
327
+ # @param string value Value to be deserialized
328
+ # @return [Object] Deserialized data
329
+ def _deserialize(type, value)
330
+ case type.to_sym
331
+ when :Time
332
+ Time.parse(value)
333
+ when :Date
334
+ Date.parse(value)
335
+ when :String
336
+ value.to_s
337
+ when :Integer
338
+ value.to_i
339
+ when :Float
340
+ value.to_f
341
+ when :Boolean
342
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
343
+ true
344
+ else
345
+ false
346
+ end
347
+ when :Object
348
+ # generic object (usually a Hash), return directly
349
+ value
350
+ when /\AArray<(?<inner_type>.+)>\z/
351
+ inner_type = Regexp.last_match[:inner_type]
352
+ value.map { |v| _deserialize(inner_type, v) }
353
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
354
+ k_type = Regexp.last_match[:k_type]
355
+ v_type = Regexp.last_match[:v_type]
356
+ {}.tap do |hash|
357
+ value.each do |k, v|
358
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
359
+ end
360
+ end
361
+ else # model
362
+ # models (e.g. Pet) or oneOf
363
+ klass = Carbon.const_get(type)
364
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
365
+ end
366
+ end
367
+
368
+ # Returns the string representation of the object
369
+ # @return [String] String presentation of the object
370
+ def to_s
371
+ to_hash.to_s
372
+ end
373
+
374
+ # to_body is an alias to to_hash (backward compatibility)
375
+ # @return [Hash] Returns the object in the form of hash
376
+ def to_body
377
+ to_hash
378
+ end
379
+
380
+ # Returns the object in the form of hash
381
+ # @return [Hash] Returns the object in the form of hash
382
+ def to_hash
383
+ hash = {}
384
+ self.class.attribute_map.each_pair do |attr, param|
385
+ value = self.send(attr)
386
+ if value.nil?
387
+ is_nullable = self.class.openapi_nullable.include?(attr)
388
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
389
+ end
390
+
391
+ hash[param] = _to_hash(value)
392
+ end
393
+ hash
394
+ end
395
+
396
+ # Outputs non-array value in the form of hash
397
+ # For object, use to_hash. Otherwise, just return the value
398
+ # @param [Object] value Any valid value
399
+ # @return [Hash] Returns the value in the form of hash
400
+ def _to_hash(value)
401
+ if value.is_a?(Array)
402
+ value.compact.map { |v| _to_hash(v) }
403
+ elsif value.is_a?(Hash)
404
+ {}.tap do |hash|
405
+ value.each { |k, v| hash[k] = _to_hash(v) }
406
+ end
407
+ elsif value.respond_to? :to_hash
408
+ value.to_hash
409
+ else
410
+ value
411
+ end
412
+ end
413
+
414
+ end
415
+
416
+ end
@@ -0,0 +1,234 @@
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 'date'
10
+ require 'time'
11
+
12
+ module Carbon
13
+ class GitbookConnectRequest
14
+ attr_accessor :organization
15
+
16
+ attr_accessor :access_token
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'organization' => :'organization',
22
+ :'access_token' => :'access_token'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'organization' => :'String',
35
+ :'access_token' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::GitbookConnectRequest` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::GitbookConnectRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'organization')
61
+ self.organization = attributes[:'organization']
62
+ end
63
+
64
+ if attributes.key?(:'access_token')
65
+ self.access_token = attributes[:'access_token']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @organization.nil?
74
+ invalid_properties.push('invalid value for "organization", organization cannot be nil.')
75
+ end
76
+
77
+ if @access_token.nil?
78
+ invalid_properties.push('invalid value for "access_token", access_token cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @organization.nil?
88
+ return false if @access_token.nil?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ organization == o.organization &&
98
+ access_token == o.access_token
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [organization, access_token].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = Carbon.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end