carbon_ruby_sdk 0.1.5 → 0.1.7

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