carbon_ruby_sdk 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +100 -9
  4. data/lib/carbon_ruby_sdk/api/embeddings_api.rb +10 -2
  5. data/lib/carbon_ruby_sdk/api/files_api.rb +6 -2
  6. data/lib/carbon_ruby_sdk/api/integrations_api.rb +168 -19
  7. data/lib/carbon_ruby_sdk/models/authentication_property.rb +436 -0
  8. data/lib/carbon_ruby_sdk/models/chunks_and_embeddings.rb +1 -5
  9. data/lib/carbon_ruby_sdk/models/chunks_and_embeddings_upload_input.rb +24 -4
  10. data/lib/carbon_ruby_sdk/models/confluence_authentication.rb +254 -0
  11. data/lib/carbon_ruby_sdk/models/connect_data_source_input.rb +229 -0
  12. data/lib/carbon_ruby_sdk/models/connect_data_source_response.rb +230 -0
  13. data/lib/carbon_ruby_sdk/models/freskdesk_authentication.rb +244 -0
  14. data/lib/carbon_ruby_sdk/models/gitbook_authetication.rb +244 -0
  15. data/lib/carbon_ruby_sdk/models/gmail_sync_input.rb +15 -5
  16. data/lib/carbon_ruby_sdk/models/notion_authentication.rb +244 -0
  17. data/lib/carbon_ruby_sdk/models/o_auth_authentication.rb +244 -0
  18. data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +29 -4
  19. data/lib/carbon_ruby_sdk/models/organization_user_data_source_api.rb +11 -1
  20. data/lib/carbon_ruby_sdk/models/outh_url_response.rb +220 -0
  21. data/lib/carbon_ruby_sdk/models/outlook_sync_input.rb +15 -5
  22. data/lib/carbon_ruby_sdk/models/resync_file_query_input.rb +16 -5
  23. data/lib/carbon_ruby_sdk/models/s3_authentication.rb +244 -0
  24. data/lib/carbon_ruby_sdk/models/s3_file_sync_input.rb +14 -4
  25. data/lib/carbon_ruby_sdk/models/salesforce_authentication.rb +254 -0
  26. data/lib/carbon_ruby_sdk/models/sharepoint_authentication.rb +268 -0
  27. data/lib/carbon_ruby_sdk/models/simple_o_auth_data_sources.rb +41 -0
  28. data/lib/carbon_ruby_sdk/models/sitemap_scrape_request.rb +15 -0
  29. data/lib/carbon_ruby_sdk/models/sync_options.rb +322 -0
  30. data/lib/carbon_ruby_sdk/models/webscrape_request.rb +30 -0
  31. data/lib/carbon_ruby_sdk/models/zendesk_authentication.rb +244 -0
  32. data/lib/carbon_ruby_sdk/models/zotero_authentication.rb +272 -0
  33. data/lib/carbon_ruby_sdk/version.rb +1 -1
  34. data/lib/carbon_ruby_sdk.rb +16 -0
  35. data/spec/api/integrations_api_spec.rb +16 -1
  36. data/spec/models/authentication_property_spec.rb +112 -0
  37. data/spec/models/chunks_and_embeddings_upload_input_spec.rb +12 -0
  38. data/spec/models/confluence_authentication_spec.rb +46 -0
  39. data/spec/models/connect_data_source_input_spec.rb +34 -0
  40. data/spec/models/connect_data_source_response_spec.rb +34 -0
  41. data/spec/models/freskdesk_authentication_spec.rb +40 -0
  42. data/spec/models/gitbook_authetication_spec.rb +40 -0
  43. data/spec/models/gmail_sync_input_spec.rb +6 -0
  44. data/spec/models/notion_authentication_spec.rb +40 -0
  45. data/spec/models/o_auth_authentication_spec.rb +40 -0
  46. data/spec/models/o_auth_url_request_spec.rb +12 -0
  47. data/spec/models/organization_user_data_source_api_spec.rb +6 -0
  48. data/spec/models/outh_url_response_spec.rb +28 -0
  49. data/spec/models/outlook_sync_input_spec.rb +6 -0
  50. data/spec/models/resync_file_query_input_spec.rb +6 -0
  51. data/spec/models/s3_authentication_spec.rb +40 -0
  52. data/spec/models/s3_file_sync_input_spec.rb +6 -0
  53. data/spec/models/salesforce_authentication_spec.rb +46 -0
  54. data/spec/models/sharepoint_authentication_spec.rb +52 -0
  55. data/spec/models/simple_o_auth_data_sources_spec.rb +22 -0
  56. data/spec/models/sync_options_spec.rb +82 -0
  57. data/spec/models/zendesk_authentication_spec.rb +40 -0
  58. data/spec/models/zotero_authentication_spec.rb +52 -0
  59. metadata +50 -2
@@ -0,0 +1,436 @@
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 AuthenticationProperty
14
+ attr_accessor :source
15
+
16
+ attr_accessor :access_token
17
+
18
+ attr_accessor :refresh_token
19
+
20
+ attr_accessor :workspace_id
21
+
22
+ attr_accessor :tenant_name
23
+
24
+ attr_accessor :site_name
25
+
26
+ attr_accessor :subdomain
27
+
28
+ attr_accessor :access_token_secret
29
+
30
+ attr_accessor :username
31
+
32
+ attr_accessor :zotero_id
33
+
34
+ attr_accessor :organization_name
35
+
36
+ attr_accessor :domain
37
+
38
+ attr_accessor :api_key
39
+
40
+ attr_accessor :access_key
41
+
42
+ attr_accessor :access_key_secret
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'source' => :'source',
48
+ :'access_token' => :'access_token',
49
+ :'refresh_token' => :'refresh_token',
50
+ :'workspace_id' => :'workspace_id',
51
+ :'tenant_name' => :'tenant_name',
52
+ :'site_name' => :'site_name',
53
+ :'subdomain' => :'subdomain',
54
+ :'access_token_secret' => :'access_token_secret',
55
+ :'username' => :'username',
56
+ :'zotero_id' => :'zotero_id',
57
+ :'organization_name' => :'organization_name',
58
+ :'domain' => :'domain',
59
+ :'api_key' => :'api_key',
60
+ :'access_key' => :'access_key',
61
+ :'access_key_secret' => :'access_key_secret'
62
+ }
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'source' => :'Object',
74
+ :'access_token' => :'String',
75
+ :'refresh_token' => :'String',
76
+ :'workspace_id' => :'String',
77
+ :'tenant_name' => :'String',
78
+ :'site_name' => :'String',
79
+ :'subdomain' => :'String',
80
+ :'access_token_secret' => :'String',
81
+ :'username' => :'String',
82
+ :'zotero_id' => :'String',
83
+ :'organization_name' => :'String',
84
+ :'domain' => :'String',
85
+ :'api_key' => :'String',
86
+ :'access_key' => :'String',
87
+ :'access_key_secret' => :'String'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ :'source',
95
+ :'refresh_token',
96
+ ])
97
+ end
98
+
99
+ # List of class defined in anyOf (OpenAPI v3)
100
+ def self.openapi_any_of
101
+ [
102
+ :'ConfluenceAuthentication',
103
+ :'FreskdeskAuthentication',
104
+ :'GitbookAuthetication',
105
+ :'NotionAuthentication',
106
+ :'OAuthAuthentication',
107
+ :'S3Authentication',
108
+ :'SalesforceAuthentication',
109
+ :'SharepointAuthentication',
110
+ :'ZendeskAuthentication',
111
+ :'ZoteroAuthentication'
112
+ ]
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::AuthenticationProperty` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!self.class.attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::AuthenticationProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'source')
131
+ self.source = attributes[:'source']
132
+ end
133
+
134
+ if attributes.key?(:'access_token')
135
+ self.access_token = attributes[:'access_token']
136
+ end
137
+
138
+ if attributes.key?(:'refresh_token')
139
+ self.refresh_token = attributes[:'refresh_token']
140
+ end
141
+
142
+ if attributes.key?(:'workspace_id')
143
+ self.workspace_id = attributes[:'workspace_id']
144
+ end
145
+
146
+ if attributes.key?(:'tenant_name')
147
+ self.tenant_name = attributes[:'tenant_name']
148
+ end
149
+
150
+ if attributes.key?(:'site_name')
151
+ self.site_name = attributes[:'site_name']
152
+ end
153
+
154
+ if attributes.key?(:'subdomain')
155
+ self.subdomain = attributes[:'subdomain']
156
+ end
157
+
158
+ if attributes.key?(:'access_token_secret')
159
+ self.access_token_secret = attributes[:'access_token_secret']
160
+ end
161
+
162
+ if attributes.key?(:'username')
163
+ self.username = attributes[:'username']
164
+ end
165
+
166
+ if attributes.key?(:'zotero_id')
167
+ self.zotero_id = attributes[:'zotero_id']
168
+ end
169
+
170
+ if attributes.key?(:'organization_name')
171
+ self.organization_name = attributes[:'organization_name']
172
+ end
173
+
174
+ if attributes.key?(:'domain')
175
+ self.domain = attributes[:'domain']
176
+ end
177
+
178
+ if attributes.key?(:'api_key')
179
+ self.api_key = attributes[:'api_key']
180
+ end
181
+
182
+ if attributes.key?(:'access_key')
183
+ self.access_key = attributes[:'access_key']
184
+ end
185
+
186
+ if attributes.key?(:'access_key_secret')
187
+ self.access_key_secret = attributes[:'access_key_secret']
188
+ end
189
+ end
190
+
191
+ # Show invalid properties with the reasons. Usually used together with valid?
192
+ # @return Array for valid properties with the reasons
193
+ def list_invalid_properties
194
+ invalid_properties = Array.new
195
+ if @access_token.nil?
196
+ invalid_properties.push('invalid value for "access_token", access_token cannot be nil.')
197
+ end
198
+
199
+ if @workspace_id.nil?
200
+ invalid_properties.push('invalid value for "workspace_id", workspace_id cannot be nil.')
201
+ end
202
+
203
+ if @tenant_name.nil?
204
+ invalid_properties.push('invalid value for "tenant_name", tenant_name cannot be nil.')
205
+ end
206
+
207
+ if @site_name.nil?
208
+ invalid_properties.push('invalid value for "site_name", site_name cannot be nil.')
209
+ end
210
+
211
+ if @subdomain.nil?
212
+ invalid_properties.push('invalid value for "subdomain", subdomain cannot be nil.')
213
+ end
214
+
215
+ if @access_token_secret.nil?
216
+ invalid_properties.push('invalid value for "access_token_secret", access_token_secret cannot be nil.')
217
+ end
218
+
219
+ if @username.nil?
220
+ invalid_properties.push('invalid value for "username", username cannot be nil.')
221
+ end
222
+
223
+ if @zotero_id.nil?
224
+ invalid_properties.push('invalid value for "zotero_id", zotero_id cannot be nil.')
225
+ end
226
+
227
+ if @organization_name.nil?
228
+ invalid_properties.push('invalid value for "organization_name", organization_name cannot be nil.')
229
+ end
230
+
231
+ if @domain.nil?
232
+ invalid_properties.push('invalid value for "domain", domain cannot be nil.')
233
+ end
234
+
235
+ if @api_key.nil?
236
+ invalid_properties.push('invalid value for "api_key", api_key cannot be nil.')
237
+ end
238
+
239
+ if @access_key.nil?
240
+ invalid_properties.push('invalid value for "access_key", access_key cannot be nil.')
241
+ end
242
+
243
+ if @access_key_secret.nil?
244
+ invalid_properties.push('invalid value for "access_key_secret", access_key_secret cannot be nil.')
245
+ end
246
+
247
+ invalid_properties
248
+ end
249
+
250
+ # Check to see if the all the properties in the model are valid
251
+ # @return true if the model is valid
252
+ def valid?
253
+ return false if @access_token.nil?
254
+ return false if @workspace_id.nil?
255
+ return false if @tenant_name.nil?
256
+ return false if @site_name.nil?
257
+ return false if @subdomain.nil?
258
+ return false if @access_token_secret.nil?
259
+ return false if @username.nil?
260
+ return false if @zotero_id.nil?
261
+ return false if @organization_name.nil?
262
+ return false if @domain.nil?
263
+ return false if @api_key.nil?
264
+ return false if @access_key.nil?
265
+ return false if @access_key_secret.nil?
266
+ _any_of_found = false
267
+ self.class.openapi_any_of.each do |_class|
268
+ _any_of = Carbon.const_get(_class).build_from_hash(self.to_hash)
269
+ if _any_of.valid?
270
+ _any_of_found = true
271
+ end
272
+ end
273
+
274
+ if !_any_of_found
275
+ return false
276
+ end
277
+
278
+ true
279
+ end
280
+
281
+ # Checks equality by comparing each attribute.
282
+ # @param [Object] Object to be compared
283
+ def ==(o)
284
+ return true if self.equal?(o)
285
+ self.class == o.class &&
286
+ source == o.source &&
287
+ access_token == o.access_token &&
288
+ refresh_token == o.refresh_token &&
289
+ workspace_id == o.workspace_id &&
290
+ tenant_name == o.tenant_name &&
291
+ site_name == o.site_name &&
292
+ subdomain == o.subdomain &&
293
+ access_token_secret == o.access_token_secret &&
294
+ username == o.username &&
295
+ zotero_id == o.zotero_id &&
296
+ organization_name == o.organization_name &&
297
+ domain == o.domain &&
298
+ api_key == o.api_key &&
299
+ access_key == o.access_key &&
300
+ access_key_secret == o.access_key_secret
301
+ end
302
+
303
+ # @see the `==` method
304
+ # @param [Object] Object to be compared
305
+ def eql?(o)
306
+ self == o
307
+ end
308
+
309
+ # Calculates hash code according to all attributes.
310
+ # @return [Integer] Hash code
311
+ def hash
312
+ [source, access_token, refresh_token, workspace_id, tenant_name, site_name, subdomain, access_token_secret, username, zotero_id, organization_name, domain, api_key, access_key, access_key_secret].hash
313
+ end
314
+
315
+ # Builds the object from hash
316
+ # @param [Hash] attributes Model attributes in the form of hash
317
+ # @return [Object] Returns the model itself
318
+ def self.build_from_hash(attributes)
319
+ new.build_from_hash(attributes)
320
+ end
321
+
322
+ # Builds the object from hash
323
+ # @param [Hash] attributes Model attributes in the form of hash
324
+ # @return [Object] Returns the model itself
325
+ def build_from_hash(attributes)
326
+ return nil unless attributes.is_a?(Hash)
327
+ attributes = attributes.transform_keys(&:to_sym)
328
+ self.class.openapi_types.each_pair do |key, type|
329
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
330
+ self.send("#{key}=", nil)
331
+ elsif type =~ /\AArray<(.*)>/i
332
+ # check to ensure the input is an array given that the attribute
333
+ # is documented as an array but the input is not
334
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
335
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
336
+ end
337
+ elsif !attributes[self.class.attribute_map[key]].nil?
338
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
339
+ end
340
+ end
341
+
342
+ self
343
+ end
344
+
345
+ # Deserializes the data based on type
346
+ # @param string type Data type
347
+ # @param string value Value to be deserialized
348
+ # @return [Object] Deserialized data
349
+ def _deserialize(type, value)
350
+ case type.to_sym
351
+ when :Time
352
+ Time.parse(value)
353
+ when :Date
354
+ Date.parse(value)
355
+ when :String
356
+ value.to_s
357
+ when :Integer
358
+ value.to_i
359
+ when :Float
360
+ value.to_f
361
+ when :Boolean
362
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
363
+ true
364
+ else
365
+ false
366
+ end
367
+ when :Object
368
+ # generic object (usually a Hash), return directly
369
+ value
370
+ when /\AArray<(?<inner_type>.+)>\z/
371
+ inner_type = Regexp.last_match[:inner_type]
372
+ value.map { |v| _deserialize(inner_type, v) }
373
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
374
+ k_type = Regexp.last_match[:k_type]
375
+ v_type = Regexp.last_match[:v_type]
376
+ {}.tap do |hash|
377
+ value.each do |k, v|
378
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
379
+ end
380
+ end
381
+ else # model
382
+ # models (e.g. Pet) or oneOf
383
+ klass = Carbon.const_get(type)
384
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
385
+ end
386
+ end
387
+
388
+ # Returns the string representation of the object
389
+ # @return [String] String presentation of the object
390
+ def to_s
391
+ to_hash.to_s
392
+ end
393
+
394
+ # to_body is an alias to to_hash (backward compatibility)
395
+ # @return [Hash] Returns the object in the form of hash
396
+ def to_body
397
+ to_hash
398
+ end
399
+
400
+ # Returns the object in the form of hash
401
+ # @return [Hash] Returns the object in the form of hash
402
+ def to_hash
403
+ hash = {}
404
+ self.class.attribute_map.each_pair do |attr, param|
405
+ value = self.send(attr)
406
+ if value.nil?
407
+ is_nullable = self.class.openapi_nullable.include?(attr)
408
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
409
+ end
410
+
411
+ hash[param] = _to_hash(value)
412
+ end
413
+ hash
414
+ end
415
+
416
+ # Outputs non-array value in the form of hash
417
+ # For object, use to_hash. Otherwise, just return the value
418
+ # @param [Object] value Any valid value
419
+ # @return [Hash] Returns the value in the form of hash
420
+ def _to_hash(value)
421
+ if value.is_a?(Array)
422
+ value.compact.map { |v| _to_hash(v) }
423
+ elsif value.is_a?(Hash)
424
+ {}.tap do |hash|
425
+ value.each { |k, v| hash[k] = _to_hash(v) }
426
+ end
427
+ elsif value.respond_to? :to_hash
428
+ value.to_hash
429
+ else
430
+ value
431
+ end
432
+ end
433
+
434
+ end
435
+
436
+ end
@@ -44,6 +44,7 @@ module Carbon
44
44
  def self.openapi_nullable
45
45
  Set.new([
46
46
  :'chunk_number',
47
+ :'embedding'
47
48
  ])
48
49
  end
49
50
 
@@ -85,10 +86,6 @@ module Carbon
85
86
  invalid_properties.push('invalid value for "chunk", chunk cannot be nil.')
86
87
  end
87
88
 
88
- if @embedding.nil?
89
- invalid_properties.push('invalid value for "embedding", embedding cannot be nil.')
90
- end
91
-
92
89
  invalid_properties
93
90
  end
94
91
 
@@ -96,7 +93,6 @@ module Carbon
96
93
  # @return true if the model is valid
97
94
  def valid?
98
95
  return false if @chunk.nil?
99
- return false if @embedding.nil?
100
96
  true
101
97
  end
102
98
 
@@ -17,12 +17,18 @@ module Carbon
17
17
 
18
18
  attr_accessor :overwrite_existing
19
19
 
20
+ attr_accessor :chunks_only
21
+
22
+ attr_accessor :custom_credentials
23
+
20
24
  # Attribute mapping from ruby-style variable name to JSON key.
21
25
  def self.attribute_map
22
26
  {
23
27
  :'embedding_model' => :'embedding_model',
24
28
  :'chunks_and_embeddings' => :'chunks_and_embeddings',
25
- :'overwrite_existing' => :'overwrite_existing'
29
+ :'overwrite_existing' => :'overwrite_existing',
30
+ :'chunks_only' => :'chunks_only',
31
+ :'custom_credentials' => :'custom_credentials'
26
32
  }
27
33
  end
28
34
 
@@ -36,7 +42,9 @@ module Carbon
36
42
  {
37
43
  :'embedding_model' => :'EmbeddingGenerators',
38
44
  :'chunks_and_embeddings' => :'Array<SingleChunksAndEmbeddingsUploadInput>',
39
- :'overwrite_existing' => :'Boolean'
45
+ :'overwrite_existing' => :'Boolean',
46
+ :'chunks_only' => :'Boolean',
47
+ :'custom_credentials' => :'Object'
40
48
  }
41
49
  end
42
50
 
@@ -76,6 +84,16 @@ module Carbon
76
84
  else
77
85
  self.overwrite_existing = false
78
86
  end
87
+
88
+ if attributes.key?(:'chunks_only')
89
+ self.chunks_only = attributes[:'chunks_only']
90
+ else
91
+ self.chunks_only = false
92
+ end
93
+
94
+ if attributes.key?(:'custom_credentials')
95
+ self.custom_credentials = attributes[:'custom_credentials']
96
+ end
79
97
  end
80
98
 
81
99
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -108,7 +126,9 @@ module Carbon
108
126
  self.class == o.class &&
109
127
  embedding_model == o.embedding_model &&
110
128
  chunks_and_embeddings == o.chunks_and_embeddings &&
111
- overwrite_existing == o.overwrite_existing
129
+ overwrite_existing == o.overwrite_existing &&
130
+ chunks_only == o.chunks_only &&
131
+ custom_credentials == o.custom_credentials
112
132
  end
113
133
 
114
134
  # @see the `==` method
@@ -120,7 +140,7 @@ module Carbon
120
140
  # Calculates hash code according to all attributes.
121
141
  # @return [Integer] Hash code
122
142
  def hash
123
- [embedding_model, chunks_and_embeddings, overwrite_existing].hash
143
+ [embedding_model, chunks_and_embeddings, overwrite_existing, chunks_only, custom_credentials].hash
124
144
  end
125
145
 
126
146
  # Builds the object from hash