carbon_ruby_sdk 0.2.16 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +16 -20
  3. data/README.md +28 -7
  4. data/lib/carbon_ruby_sdk/api/embeddings_api.rb +6 -2
  5. data/lib/carbon_ruby_sdk/api/files_api.rb +15 -4
  6. data/lib/carbon_ruby_sdk/api/integrations_api.rb +8 -8
  7. data/lib/carbon_ruby_sdk/models/file_sync_config.rb +11 -1
  8. data/lib/carbon_ruby_sdk/models/file_sync_config_nullable.rb +11 -1
  9. data/lib/carbon_ruby_sdk/models/get_embedding_documents_body.rb +18 -5
  10. data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +2 -2
  11. data/lib/carbon_ruby_sdk/models/object_type.rb +42 -0
  12. data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_filters.rb +18 -5
  13. data/lib/carbon_ruby_sdk/models/sent_webhook_payload.rb +276 -0
  14. data/lib/carbon_ruby_sdk/models/sent_webhook_payload_object.rb +235 -0
  15. data/lib/carbon_ruby_sdk/models/sent_webhook_payload_object_additional_information.rb +101 -0
  16. data/lib/carbon_ruby_sdk/models/sent_webhook_payload_object_object_id.rb +103 -0
  17. data/lib/carbon_ruby_sdk/models/sent_webhook_request_body.rb +215 -0
  18. data/lib/carbon_ruby_sdk/models/sync_files_request.rb +1 -1
  19. data/lib/carbon_ruby_sdk/models/sync_options.rb +1 -1
  20. data/lib/carbon_ruby_sdk/models/transcription_service.rb +36 -0
  21. data/lib/carbon_ruby_sdk/models/transcription_service_nullable.rb +36 -0
  22. data/lib/carbon_ruby_sdk/models/upload_file_from_url_input.rb +11 -1
  23. data/lib/carbon_ruby_sdk/version.rb +1 -1
  24. data/lib/carbon_ruby_sdk.rb +8 -0
  25. data/spec/api/files_api_spec.rb +1 -0
  26. data/spec/models/file_sync_config_nullable_spec.rb +6 -0
  27. data/spec/models/file_sync_config_spec.rb +6 -0
  28. data/spec/models/get_embedding_documents_body_spec.rb +6 -0
  29. data/spec/models/object_type_spec.rb +22 -0
  30. data/spec/models/organization_user_files_to_sync_filters_spec.rb +6 -0
  31. data/spec/models/sent_webhook_payload_object_additional_information_spec.rb +25 -0
  32. data/spec/models/sent_webhook_payload_object_object_id_spec.rb +25 -0
  33. data/spec/models/sent_webhook_payload_object_spec.rb +40 -0
  34. data/spec/models/sent_webhook_payload_spec.rb +50 -0
  35. data/spec/models/sent_webhook_request_body_spec.rb +28 -0
  36. data/spec/models/transcription_service_nullable_spec.rb +22 -0
  37. data/spec/models/transcription_service_spec.rb +22 -0
  38. data/spec/models/upload_file_from_url_input_spec.rb +6 -0
  39. metadata +27 -3
@@ -61,6 +61,9 @@ module Carbon
61
61
 
62
62
  attr_accessor :rerank
63
63
 
64
+ # Filter files based on their type at the source (for example help center tickets and articles)
65
+ attr_accessor :file_types_at_source
66
+
64
67
  # Attribute mapping from ruby-style variable name to JSON key.
65
68
  def self.attribute_map
66
69
  {
@@ -81,7 +84,8 @@ module Carbon
81
84
  :'embedding_model' => :'embedding_model',
82
85
  :'include_file_level_metadata' => :'include_file_level_metadata',
83
86
  :'high_accuracy' => :'high_accuracy',
84
- :'rerank' => :'rerank'
87
+ :'rerank' => :'rerank',
88
+ :'file_types_at_source' => :'file_types_at_source'
85
89
  }
86
90
  end
87
91
 
@@ -110,7 +114,8 @@ module Carbon
110
114
  :'embedding_model' => :'EmbeddingGeneratorsNullable',
111
115
  :'include_file_level_metadata' => :'Boolean',
112
116
  :'high_accuracy' => :'Boolean',
113
- :'rerank' => :'RerankParamsNullable'
117
+ :'rerank' => :'RerankParamsNullable',
118
+ :'file_types_at_source' => :'Array<HelpdeskFileTypes>'
114
119
  }
115
120
  end
116
121
 
@@ -131,7 +136,8 @@ module Carbon
131
136
  :'embedding_model',
132
137
  :'include_file_level_metadata',
133
138
  :'high_accuracy',
134
- :'rerank'
139
+ :'rerank',
140
+ :'file_types_at_source'
135
141
  ])
136
142
  end
137
143
 
@@ -237,6 +243,12 @@ module Carbon
237
243
  if attributes.key?(:'rerank')
238
244
  self.rerank = attributes[:'rerank']
239
245
  end
246
+
247
+ if attributes.key?(:'file_types_at_source')
248
+ if (value = attributes[:'file_types_at_source']).is_a?(Array)
249
+ self.file_types_at_source = value
250
+ end
251
+ end
240
252
  end
241
253
 
242
254
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -322,7 +334,8 @@ module Carbon
322
334
  embedding_model == o.embedding_model &&
323
335
  include_file_level_metadata == o.include_file_level_metadata &&
324
336
  high_accuracy == o.high_accuracy &&
325
- rerank == o.rerank
337
+ rerank == o.rerank &&
338
+ file_types_at_source == o.file_types_at_source
326
339
  end
327
340
 
328
341
  # @see the `==` method
@@ -334,7 +347,7 @@ module Carbon
334
347
  # Calculates hash code according to all attributes.
335
348
  # @return [Integer] Hash code
336
349
  def hash
337
- [tags, query, query_vector, k, file_ids, parent_file_ids, include_all_children, tags_v2, include_tags, include_vectors, include_raw_file, hybrid_search, hybrid_search_tuning_parameters, media_type, embedding_model, include_file_level_metadata, high_accuracy, rerank].hash
350
+ [tags, query, query_vector, k, file_ids, parent_file_ids, include_all_children, tags_v2, include_tags, include_vectors, include_raw_file, hybrid_search, hybrid_search_tuning_parameters, media_type, embedding_model, include_file_level_metadata, high_accuracy, rerank, file_types_at_source].hash
338
351
  end
339
352
 
340
353
  # Builds the object from hash
@@ -61,7 +61,7 @@ module Carbon
61
61
 
62
62
  attr_accessor :parse_pdf_tables_with_ocr
63
63
 
64
- # Enable integration's file picker for sources that support it. Supported sources: BOX, ONEDRIVE, DROPBOX, SHAREPOINT, GOOGLE_DRIVE
64
+ # Enable integration's file picker for sources that support it. Supported sources: BOX, DROPBOX, GOOGLE_DRIVE, ONEDRIVE, SHAREPOINT
65
65
  attr_accessor :enable_file_picker
66
66
 
67
67
  # Enabling this flag will fetch all available content from the source to be listed via list items endpoint
@@ -279,7 +279,7 @@ module Carbon
279
279
  if attributes.key?(:'request_id')
280
280
  self.request_id = attributes[:'request_id']
281
281
  else
282
- self.request_id = 'e5fd53f8-ed96-474a-ba66-1fc1948facdf'
282
+ self.request_id = 'c4055754-ba2d-4f57-a990-6e990abbbd90'
283
283
  end
284
284
 
285
285
  if attributes.key?(:'use_ocr')
@@ -0,0 +1,42 @@
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 ObjectType
14
+ CHUNK_LIST = "CHUNK_LIST".freeze
15
+ DATA_SOURCE = "DATA_SOURCE".freeze
16
+ FILE = "FILE".freeze
17
+ FILE_LIST = "FILE_LIST".freeze
18
+ NONE = "NONE".freeze
19
+ ORGANIZATION_USER = "ORGANIZATION_USER".freeze
20
+ UPLOAD_REQUEST_ID = "UPLOAD_REQUEST_ID".freeze
21
+ WEBPAGE = "WEBPAGE".freeze
22
+
23
+ def self.all_vars
24
+ @all_vars ||= [CHUNK_LIST, DATA_SOURCE, FILE, FILE_LIST, NONE, ORGANIZATION_USER, UPLOAD_REQUEST_ID, WEBPAGE].freeze
25
+ end
26
+
27
+ # Builds the enum from string
28
+ # @param [String] The enum value in the form of the string
29
+ # @return [String] The enum value
30
+ def self.build_from_hash(value)
31
+ new.build_from_hash(value)
32
+ end
33
+
34
+ # Builds the enum from string
35
+ # @param [String] The enum value in the form of the string
36
+ # @return [String] The enum value
37
+ def build_from_hash(value)
38
+ return value if ObjectType.all_vars.include?(value)
39
+ raise "Invalid ENUM value #{value} for class #ObjectType"
40
+ end
41
+ end
42
+ end
@@ -59,6 +59,9 @@ module Carbon
59
59
  # The external URLs of the files. The query will return files with these external URLs.
60
60
  attr_accessor :external_urls
61
61
 
62
+ # Filter files based on their type at the source (for example help center tickets and articles)
63
+ attr_accessor :file_types_at_source
64
+
62
65
  # Attribute mapping from ruby-style variable name to JSON key.
63
66
  def self.attribute_map
64
67
  {
@@ -78,7 +81,8 @@ module Carbon
78
81
  :'request_ids' => :'request_ids',
79
82
  :'sync_error_message' => :'sync_error_message',
80
83
  :'include_containers' => :'include_containers',
81
- :'external_urls' => :'external_urls'
84
+ :'external_urls' => :'external_urls',
85
+ :'file_types_at_source' => :'file_types_at_source'
82
86
  }
83
87
  end
84
88
 
@@ -106,7 +110,8 @@ module Carbon
106
110
  :'request_ids' => :'Array<String>',
107
111
  :'sync_error_message' => :'String',
108
112
  :'include_containers' => :'Boolean',
109
- :'external_urls' => :'Array<String>'
113
+ :'external_urls' => :'Array<String>',
114
+ :'file_types_at_source' => :'Array<HelpdeskFileTypes>'
110
115
  }
111
116
  end
112
117
 
@@ -127,7 +132,8 @@ module Carbon
127
132
  :'request_ids',
128
133
  :'sync_error_message',
129
134
  :'include_containers',
130
- :'external_urls'
135
+ :'external_urls',
136
+ :'file_types_at_source'
131
137
  ])
132
138
  end
133
139
 
@@ -235,6 +241,12 @@ module Carbon
235
241
  self.external_urls = value
236
242
  end
237
243
  end
244
+
245
+ if attributes.key?(:'file_types_at_source')
246
+ if (value = attributes[:'file_types_at_source']).is_a?(Array)
247
+ self.file_types_at_source = value
248
+ end
249
+ end
238
250
  end
239
251
 
240
252
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -286,7 +298,8 @@ module Carbon
286
298
  request_ids == o.request_ids &&
287
299
  sync_error_message == o.sync_error_message &&
288
300
  include_containers == o.include_containers &&
289
- external_urls == o.external_urls
301
+ external_urls == o.external_urls &&
302
+ file_types_at_source == o.file_types_at_source
290
303
  end
291
304
 
292
305
  # @see the `==` method
@@ -298,7 +311,7 @@ module Carbon
298
311
  # Calculates hash code according to all attributes.
299
312
  # @return [Integer] Hash code
300
313
  def hash
301
- [tags, source, name, tags_v2, ids, external_file_ids, sync_statuses, parent_file_ids, organization_user_data_source_id, embedding_generators, root_files_only, include_all_children, non_synced_only, request_ids, sync_error_message, include_containers, external_urls].hash
314
+ [tags, source, name, tags_v2, ids, external_file_ids, sync_statuses, parent_file_ids, organization_user_data_source_id, embedding_generators, root_files_only, include_all_children, non_synced_only, request_ids, sync_error_message, include_containers, external_urls, file_types_at_source].hash
302
315
  end
303
316
 
304
317
  # Builds the object from hash
@@ -0,0 +1,276 @@
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 SentWebhookPayload
14
+ attr_accessor :webhook_type
15
+
16
+ attr_accessor :customer_id
17
+
18
+ attr_accessor :timestamp
19
+
20
+ attr_accessor :object
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'webhook_type' => :'webhook_type',
48
+ :'customer_id' => :'customer_id',
49
+ :'timestamp' => :'timestamp',
50
+ :'object' => :'object'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'webhook_type' => :'String',
63
+ :'customer_id' => :'String',
64
+ :'timestamp' => :'String',
65
+ :'object' => :'SentWebhookPayloadObject'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::SentWebhookPayload` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::SentWebhookPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'webhook_type')
91
+ self.webhook_type = attributes[:'webhook_type']
92
+ end
93
+
94
+ if attributes.key?(:'customer_id')
95
+ self.customer_id = attributes[:'customer_id']
96
+ end
97
+
98
+ if attributes.key?(:'timestamp')
99
+ self.timestamp = attributes[:'timestamp']
100
+ end
101
+
102
+ if attributes.key?(:'object')
103
+ self.object = attributes[:'object']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ webhook_type_validator = EnumAttributeValidator.new('String', ["ADD", "ALL_UPLOADED_FILES_QUEUED", "CANCEL", "CHECKUP", "DATA_SOURCE_READY", "FILES_CREATED", "FILES_SKIPPED", "FILE_DELETED", "FILE_ERROR", "FILE_READY", "FILE_STATISTICS_AGGREGATED", "FILE_SYNC_LIMIT_REACHED", "ORGANIZATION_USER_DELETED", "RATE_LIMIT_ERROR", "REVOKE", "SPARSE_VECTOR_QUEUE_STATUS", "UPDATE", "WEBPAGE_ERROR", "WEBPAGE_READY", "WEBSCRAPE_URLS_READY"])
118
+ return false unless webhook_type_validator.valid?(@webhook_type)
119
+ true
120
+ end
121
+
122
+ # Custom attribute writer method checking allowed values (enum).
123
+ # @param [Object] webhook_type Object to be assigned
124
+ def webhook_type=(webhook_type)
125
+ validator = EnumAttributeValidator.new('String', ["ADD", "ALL_UPLOADED_FILES_QUEUED", "CANCEL", "CHECKUP", "DATA_SOURCE_READY", "FILES_CREATED", "FILES_SKIPPED", "FILE_DELETED", "FILE_ERROR", "FILE_READY", "FILE_STATISTICS_AGGREGATED", "FILE_SYNC_LIMIT_REACHED", "ORGANIZATION_USER_DELETED", "RATE_LIMIT_ERROR", "REVOKE", "SPARSE_VECTOR_QUEUE_STATUS", "UPDATE", "WEBPAGE_ERROR", "WEBPAGE_READY", "WEBSCRAPE_URLS_READY"])
126
+ unless validator.valid?(webhook_type)
127
+ fail ArgumentError, "invalid value for \"webhook_type\", must be one of #{validator.allowable_values}."
128
+ end
129
+ @webhook_type = webhook_type
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ webhook_type == o.webhook_type &&
138
+ customer_id == o.customer_id &&
139
+ timestamp == o.timestamp &&
140
+ object == o.object
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [webhook_type, customer_id, timestamp, object].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ new.build_from_hash(attributes)
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ attributes = attributes.transform_keys(&:to_sym)
168
+ self.class.openapi_types.each_pair do |key, type|
169
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
170
+ self.send("#{key}=", nil)
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
175
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
176
+ end
177
+ elsif !attributes[self.class.attribute_map[key]].nil?
178
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
179
+ end
180
+ end
181
+
182
+ self
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def _deserialize(type, value)
190
+ case type.to_sym
191
+ when :Time
192
+ Time.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :Boolean
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ # models (e.g. Pet) or oneOf
223
+ klass = Carbon.const_get(type)
224
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ if value.nil?
247
+ is_nullable = self.class.openapi_nullable.include?(attr)
248
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
249
+ end
250
+
251
+ hash[param] = _to_hash(value)
252
+ end
253
+ hash
254
+ end
255
+
256
+ # Outputs non-array value in the form of hash
257
+ # For object, use to_hash. Otherwise, just return the value
258
+ # @param [Object] value Any valid value
259
+ # @return [Hash] Returns the value in the form of hash
260
+ def _to_hash(value)
261
+ if value.is_a?(Array)
262
+ value.compact.map { |v| _to_hash(v) }
263
+ elsif value.is_a?(Hash)
264
+ {}.tap do |hash|
265
+ value.each { |k, v| hash[k] = _to_hash(v) }
266
+ end
267
+ elsif value.respond_to? :to_hash
268
+ value.to_hash
269
+ else
270
+ value
271
+ end
272
+ end
273
+
274
+ end
275
+
276
+ end