carbon_ruby_sdk 0.1.11 → 0.1.13

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/README.md +28 -2
  4. data/lib/carbon_ruby_sdk/api/integrations_api.rb +66 -22
  5. data/lib/carbon_ruby_sdk/models/embedding_and_chunk.rb +15 -5
  6. data/lib/carbon_ruby_sdk/models/external_source_item.rb +11 -1
  7. data/lib/carbon_ruby_sdk/models/fresh_desk_connect_request.rb +15 -5
  8. data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +15 -5
  9. data/lib/carbon_ruby_sdk/models/gitbook_sync_request.rb +15 -5
  10. data/lib/carbon_ruby_sdk/models/gmail_sync_input.rb +15 -5
  11. data/lib/carbon_ruby_sdk/models/list_data_source_items_request.rb +11 -1
  12. data/lib/carbon_ruby_sdk/models/list_items_filters.rb +250 -0
  13. data/lib/carbon_ruby_sdk/models/list_items_filters_nullable.rb +250 -0
  14. data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +16 -5
  15. data/lib/carbon_ruby_sdk/models/organization_user_files_to_sync_filters.rb +32 -4
  16. data/lib/carbon_ruby_sdk/models/outlook_sync_input.rb +15 -5
  17. data/lib/carbon_ruby_sdk/models/rss_feed_input.rb +15 -5
  18. data/lib/carbon_ruby_sdk/models/s3_file_sync_input.rb +15 -5
  19. data/lib/carbon_ruby_sdk/models/sync_files_request.rb +14 -4
  20. data/lib/carbon_ruby_sdk/models/user_file.rb +11 -1
  21. data/lib/carbon_ruby_sdk/version.rb +1 -1
  22. data/lib/carbon_ruby_sdk.rb +2 -0
  23. data/spec/models/embedding_and_chunk_spec.rb +6 -0
  24. data/spec/models/external_source_item_spec.rb +6 -0
  25. data/spec/models/fresh_desk_connect_request_spec.rb +6 -0
  26. data/spec/models/gitbook_connect_request_spec.rb +6 -0
  27. data/spec/models/gitbook_sync_request_spec.rb +6 -0
  28. data/spec/models/gmail_sync_input_spec.rb +6 -0
  29. data/spec/models/list_data_source_items_request_spec.rb +6 -0
  30. data/spec/models/list_items_filters_nullable_spec.rb +46 -0
  31. data/spec/models/list_items_filters_spec.rb +46 -0
  32. data/spec/models/o_auth_url_request_spec.rb +6 -0
  33. data/spec/models/organization_user_files_to_sync_filters_spec.rb +6 -0
  34. data/spec/models/outlook_sync_input_spec.rb +6 -0
  35. data/spec/models/rss_feed_input_spec.rb +6 -0
  36. data/spec/models/s3_file_sync_input_spec.rb +6 -0
  37. data/spec/models/sync_files_request_spec.rb +6 -0
  38. data/spec/models/user_file_spec.rb +6 -0
  39. metadata +9 -3
@@ -31,6 +31,8 @@ module Carbon
31
31
 
32
32
  attr_accessor :sync_files_on_connection
33
33
 
34
+ attr_accessor :request_id
35
+
34
36
  # Attribute mapping from ruby-style variable name to JSON key.
35
37
  def self.attribute_map
36
38
  {
@@ -43,7 +45,8 @@ module Carbon
43
45
  :'embedding_model' => :'embedding_model',
44
46
  :'generate_sparse_vectors' => :'generate_sparse_vectors',
45
47
  :'prepend_filename_to_chunks' => :'prepend_filename_to_chunks',
46
- :'sync_files_on_connection' => :'sync_files_on_connection'
48
+ :'sync_files_on_connection' => :'sync_files_on_connection',
49
+ :'request_id' => :'request_id'
47
50
  }
48
51
  end
49
52
 
@@ -64,7 +67,8 @@ module Carbon
64
67
  :'embedding_model' => :'EmbeddingGenerators',
65
68
  :'generate_sparse_vectors' => :'Boolean',
66
69
  :'prepend_filename_to_chunks' => :'Boolean',
67
- :'sync_files_on_connection' => :'Boolean'
70
+ :'sync_files_on_connection' => :'Boolean',
71
+ :'request_id' => :'String'
68
72
  }
69
73
  end
70
74
 
@@ -77,7 +81,8 @@ module Carbon
77
81
  :'skip_embedding_generation',
78
82
  :'generate_sparse_vectors',
79
83
  :'prepend_filename_to_chunks',
80
- :'sync_files_on_connection'
84
+ :'sync_files_on_connection',
85
+ :'request_id'
81
86
  ])
82
87
  end
83
88
 
@@ -149,6 +154,10 @@ module Carbon
149
154
  else
150
155
  self.sync_files_on_connection = true
151
156
  end
157
+
158
+ if attributes.key?(:'request_id')
159
+ self.request_id = attributes[:'request_id']
160
+ end
152
161
  end
153
162
 
154
163
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -188,7 +197,8 @@ module Carbon
188
197
  embedding_model == o.embedding_model &&
189
198
  generate_sparse_vectors == o.generate_sparse_vectors &&
190
199
  prepend_filename_to_chunks == o.prepend_filename_to_chunks &&
191
- sync_files_on_connection == o.sync_files_on_connection
200
+ sync_files_on_connection == o.sync_files_on_connection &&
201
+ request_id == o.request_id
192
202
  end
193
203
 
194
204
  # @see the `==` method
@@ -200,7 +210,7 @@ module Carbon
200
210
  # Calculates hash code according to all attributes.
201
211
  # @return [Integer] Hash code
202
212
  def hash
203
- [tags, organization, access_token, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, sync_files_on_connection].hash
213
+ [tags, organization, access_token, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, sync_files_on_connection, request_id].hash
204
214
  end
205
215
 
206
216
  # Builds the object from hash
@@ -29,6 +29,8 @@ module Carbon
29
29
 
30
30
  attr_accessor :prepend_filename_to_chunks
31
31
 
32
+ attr_accessor :request_id
33
+
32
34
  # Attribute mapping from ruby-style variable name to JSON key.
33
35
  def self.attribute_map
34
36
  {
@@ -40,7 +42,8 @@ module Carbon
40
42
  :'skip_embedding_generation' => :'skip_embedding_generation',
41
43
  :'embedding_model' => :'embedding_model',
42
44
  :'generate_sparse_vectors' => :'generate_sparse_vectors',
43
- :'prepend_filename_to_chunks' => :'prepend_filename_to_chunks'
45
+ :'prepend_filename_to_chunks' => :'prepend_filename_to_chunks',
46
+ :'request_id' => :'request_id'
44
47
  }
45
48
  end
46
49
 
@@ -60,7 +63,8 @@ module Carbon
60
63
  :'skip_embedding_generation' => :'Boolean',
61
64
  :'embedding_model' => :'EmbeddingGenerators',
62
65
  :'generate_sparse_vectors' => :'Boolean',
63
- :'prepend_filename_to_chunks' => :'Boolean'
66
+ :'prepend_filename_to_chunks' => :'Boolean',
67
+ :'request_id' => :'String'
64
68
  }
65
69
  end
66
70
 
@@ -72,7 +76,8 @@ module Carbon
72
76
  :'chunk_overlap',
73
77
  :'skip_embedding_generation',
74
78
  :'generate_sparse_vectors',
75
- :'prepend_filename_to_chunks'
79
+ :'prepend_filename_to_chunks',
80
+ :'request_id'
76
81
  ])
77
82
  end
78
83
 
@@ -140,6 +145,10 @@ module Carbon
140
145
  else
141
146
  self.prepend_filename_to_chunks = false
142
147
  end
148
+
149
+ if attributes.key?(:'request_id')
150
+ self.request_id = attributes[:'request_id']
151
+ end
143
152
  end
144
153
 
145
154
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -197,7 +206,8 @@ module Carbon
197
206
  skip_embedding_generation == o.skip_embedding_generation &&
198
207
  embedding_model == o.embedding_model &&
199
208
  generate_sparse_vectors == o.generate_sparse_vectors &&
200
- prepend_filename_to_chunks == o.prepend_filename_to_chunks
209
+ prepend_filename_to_chunks == o.prepend_filename_to_chunks &&
210
+ request_id == o.request_id
201
211
  end
202
212
 
203
213
  # @see the `==` method
@@ -209,7 +219,7 @@ module Carbon
209
219
  # Calculates hash code according to all attributes.
210
220
  # @return [Integer] Hash code
211
221
  def hash
212
- [tags, space_ids, data_source_id, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks].hash
222
+ [tags, space_ids, data_source_id, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, request_id].hash
213
223
  end
214
224
 
215
225
  # Builds the object from hash
@@ -29,6 +29,8 @@ module Carbon
29
29
 
30
30
  attr_accessor :data_source_id
31
31
 
32
+ attr_accessor :request_id
33
+
32
34
  # Attribute mapping from ruby-style variable name to JSON key.
33
35
  def self.attribute_map
34
36
  {
@@ -40,7 +42,8 @@ module Carbon
40
42
  :'embedding_model' => :'embedding_model',
41
43
  :'generate_sparse_vectors' => :'generate_sparse_vectors',
42
44
  :'prepend_filename_to_chunks' => :'prepend_filename_to_chunks',
43
- :'data_source_id' => :'data_source_id'
45
+ :'data_source_id' => :'data_source_id',
46
+ :'request_id' => :'request_id'
44
47
  }
45
48
  end
46
49
 
@@ -60,7 +63,8 @@ module Carbon
60
63
  :'embedding_model' => :'EmbeddingGenerators',
61
64
  :'generate_sparse_vectors' => :'Boolean',
62
65
  :'prepend_filename_to_chunks' => :'Boolean',
63
- :'data_source_id' => :'Integer'
66
+ :'data_source_id' => :'Integer',
67
+ :'request_id' => :'String'
64
68
  }
65
69
  end
66
70
 
@@ -73,7 +77,8 @@ module Carbon
73
77
  :'skip_embedding_generation',
74
78
  :'generate_sparse_vectors',
75
79
  :'prepend_filename_to_chunks',
76
- :'data_source_id'
80
+ :'data_source_id',
81
+ :'request_id'
77
82
  ])
78
83
  end
79
84
 
@@ -139,6 +144,10 @@ module Carbon
139
144
  if attributes.key?(:'data_source_id')
140
145
  self.data_source_id = attributes[:'data_source_id']
141
146
  end
147
+
148
+ if attributes.key?(:'request_id')
149
+ self.request_id = attributes[:'request_id']
150
+ end
142
151
  end
143
152
 
144
153
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -172,7 +181,8 @@ module Carbon
172
181
  embedding_model == o.embedding_model &&
173
182
  generate_sparse_vectors == o.generate_sparse_vectors &&
174
183
  prepend_filename_to_chunks == o.prepend_filename_to_chunks &&
175
- data_source_id == o.data_source_id
184
+ data_source_id == o.data_source_id &&
185
+ request_id == o.request_id
176
186
  end
177
187
 
178
188
  # @see the `==` method
@@ -184,7 +194,7 @@ module Carbon
184
194
  # Calculates hash code according to all attributes.
185
195
  # @return [Integer] Hash code
186
196
  def hash
187
- [tags, filters, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, data_source_id].hash
197
+ [tags, filters, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, data_source_id, request_id].hash
188
198
  end
189
199
 
190
200
  # Builds the object from hash
@@ -15,6 +15,8 @@ module Carbon
15
15
 
16
16
  attr_accessor :parent_id
17
17
 
18
+ attr_accessor :filters
19
+
18
20
  attr_accessor :pagination
19
21
 
20
22
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -22,6 +24,7 @@ module Carbon
22
24
  {
23
25
  :'data_source_id' => :'data_source_id',
24
26
  :'parent_id' => :'parent_id',
27
+ :'filters' => :'filters',
25
28
  :'pagination' => :'pagination'
26
29
  }
27
30
  end
@@ -36,6 +39,7 @@ module Carbon
36
39
  {
37
40
  :'data_source_id' => :'Integer',
38
41
  :'parent_id' => :'String',
42
+ :'filters' => :'ListItemsFiltersNullable',
39
43
  :'pagination' => :'Pagination'
40
44
  }
41
45
  end
@@ -44,6 +48,7 @@ module Carbon
44
48
  def self.openapi_nullable
45
49
  Set.new([
46
50
  :'parent_id',
51
+ :'filters',
47
52
  ])
48
53
  end
49
54
 
@@ -70,6 +75,10 @@ module Carbon
70
75
  self.parent_id = attributes[:'parent_id']
71
76
  end
72
77
 
78
+ if attributes.key?(:'filters')
79
+ self.filters = attributes[:'filters']
80
+ end
81
+
73
82
  if attributes.key?(:'pagination')
74
83
  self.pagination = attributes[:'pagination']
75
84
  end
@@ -100,6 +109,7 @@ module Carbon
100
109
  self.class == o.class &&
101
110
  data_source_id == o.data_source_id &&
102
111
  parent_id == o.parent_id &&
112
+ filters == o.filters &&
103
113
  pagination == o.pagination
104
114
  end
105
115
 
@@ -112,7 +122,7 @@ module Carbon
112
122
  # Calculates hash code according to all attributes.
113
123
  # @return [Integer] Hash code
114
124
  def hash
115
- [data_source_id, parent_id, pagination].hash
125
+ [data_source_id, parent_id, filters, pagination].hash
116
126
  end
117
127
 
118
128
  # Builds the object from hash
@@ -0,0 +1,250 @@
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 ListItemsFilters
14
+ attr_accessor :external_ids
15
+
16
+ attr_accessor :ids
17
+
18
+ attr_accessor :name
19
+
20
+ attr_accessor :root_files_only
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'external_ids' => :'external_ids',
26
+ :'ids' => :'ids',
27
+ :'name' => :'name',
28
+ :'root_files_only' => :'root_files_only'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'external_ids' => :'Array<String>',
41
+ :'ids' => :'Array<Integer>',
42
+ :'name' => :'String',
43
+ :'root_files_only' => :'Boolean'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'external_ids',
51
+ :'ids',
52
+ :'name',
53
+ :'root_files_only'
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::ListItemsFilters` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::ListItemsFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'external_ids')
73
+ if (value = attributes[:'external_ids']).is_a?(Array)
74
+ self.external_ids = value
75
+ end
76
+ end
77
+
78
+ if attributes.key?(:'ids')
79
+ if (value = attributes[:'ids']).is_a?(Array)
80
+ self.ids = value
81
+ end
82
+ end
83
+
84
+ if attributes.key?(:'name')
85
+ self.name = attributes[:'name']
86
+ end
87
+
88
+ if attributes.key?(:'root_files_only')
89
+ self.root_files_only = attributes[:'root_files_only']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ external_ids == o.external_ids &&
112
+ ids == o.ids &&
113
+ name == o.name &&
114
+ root_files_only == o.root_files_only
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [external_ids, ids, name, root_files_only].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ new.build_from_hash(attributes)
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
144
+ self.send("#{key}=", nil)
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = Carbon.const_get(type)
198
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end