carbon_ruby_sdk 0.2.33 → 0.2.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +159 -2
- data/lib/carbon_ruby_sdk/api/files_api.rb +6 -2
- data/lib/carbon_ruby_sdk/api/integrations_api.rb +310 -4
- data/lib/carbon_ruby_sdk/models/authentication_property.rb +32 -6
- data/lib/carbon_ruby_sdk/models/azure_blob_auth_request.rb +245 -0
- data/lib/carbon_ruby_sdk/models/azure_blob_file_sync_input.rb +379 -0
- data/lib/carbon_ruby_sdk/models/azure_blob_get_file_input.rb +226 -0
- data/lib/carbon_ruby_sdk/models/azure_blob_storage_authentication.rb +244 -0
- data/lib/carbon_ruby_sdk/models/data_source_type.rb +2 -1
- data/lib/carbon_ruby_sdk/models/data_source_type_nullable.rb +2 -1
- data/lib/carbon_ruby_sdk/models/external_file_sync_statuses.rb +2 -1
- data/lib/carbon_ruby_sdk/models/file_sync_config.rb +16 -4
- data/lib/carbon_ruby_sdk/models/file_sync_config_nullable.rb +16 -4
- data/lib/carbon_ruby_sdk/models/gitbook_connect_request.rb +14 -4
- data/lib/carbon_ruby_sdk/models/gitbook_sync_request.rb +15 -5
- data/lib/carbon_ruby_sdk/models/one_drive_authentication.rb +250 -0
- data/lib/carbon_ruby_sdk/models/resync_file_query_input.rb +16 -4
- data/lib/carbon_ruby_sdk/models/sharepoint_authentication.rb +1 -5
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +5 -0
- data/spec/api/integrations_api_spec.rb +24 -0
- data/spec/models/authentication_property_spec.rb +12 -0
- data/spec/models/azure_blob_auth_request_spec.rb +40 -0
- data/spec/models/azure_blob_file_sync_input_spec.rb +112 -0
- data/spec/models/azure_blob_get_file_input_spec.rb +34 -0
- data/spec/models/azure_blob_storage_authentication_spec.rb +40 -0
- data/spec/models/file_sync_config_nullable_spec.rb +6 -0
- data/spec/models/file_sync_config_spec.rb +6 -0
- data/spec/models/gitbook_connect_request_spec.rb +6 -0
- data/spec/models/gitbook_sync_request_spec.rb +6 -0
- data/spec/models/one_drive_authentication_spec.rb +46 -0
- data/spec/models/resync_file_query_input_spec.rb +6 -0
- metadata +169 -154
@@ -0,0 +1,245 @@
|
|
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 AzureBlobAuthRequest
|
14
|
+
attr_accessor :account_name
|
15
|
+
|
16
|
+
attr_accessor :account_key
|
17
|
+
|
18
|
+
attr_accessor :sync_source_items
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'account_name' => :'account_name',
|
24
|
+
:'account_key' => :'account_key',
|
25
|
+
:'sync_source_items' => :'sync_source_items'
|
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
|
+
:'account_name' => :'String',
|
38
|
+
:'account_key' => :'String',
|
39
|
+
:'sync_source_items' => :'Boolean'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::AzureBlobAuthRequest` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::AzureBlobAuthRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'account_name')
|
65
|
+
self.account_name = attributes[:'account_name']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'account_key')
|
69
|
+
self.account_key = attributes[:'account_key']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'sync_source_items')
|
73
|
+
self.sync_source_items = attributes[:'sync_source_items']
|
74
|
+
else
|
75
|
+
self.sync_source_items = true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
if @account_name.nil?
|
84
|
+
invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
|
85
|
+
end
|
86
|
+
|
87
|
+
if @account_key.nil?
|
88
|
+
invalid_properties.push('invalid value for "account_key", account_key cannot be nil.')
|
89
|
+
end
|
90
|
+
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
return false if @account_name.nil?
|
98
|
+
return false if @account_key.nil?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Checks equality by comparing each attribute.
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def ==(o)
|
105
|
+
return true if self.equal?(o)
|
106
|
+
self.class == o.class &&
|
107
|
+
account_name == o.account_name &&
|
108
|
+
account_key == o.account_key &&
|
109
|
+
sync_source_items == o.sync_source_items
|
110
|
+
end
|
111
|
+
|
112
|
+
# @see the `==` method
|
113
|
+
# @param [Object] Object to be compared
|
114
|
+
def eql?(o)
|
115
|
+
self == o
|
116
|
+
end
|
117
|
+
|
118
|
+
# Calculates hash code according to all attributes.
|
119
|
+
# @return [Integer] Hash code
|
120
|
+
def hash
|
121
|
+
[account_name, account_key, sync_source_items].hash
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def self.build_from_hash(attributes)
|
128
|
+
new.build_from_hash(attributes)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def build_from_hash(attributes)
|
135
|
+
return nil unless attributes.is_a?(Hash)
|
136
|
+
attributes = attributes.transform_keys(&:to_sym)
|
137
|
+
self.class.openapi_types.each_pair do |key, type|
|
138
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
139
|
+
self.send("#{key}=", nil)
|
140
|
+
elsif type =~ /\AArray<(.*)>/i
|
141
|
+
# check to ensure the input is an array given that the attribute
|
142
|
+
# is documented as an array but the input is not
|
143
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
145
|
+
end
|
146
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
147
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
self
|
152
|
+
end
|
153
|
+
|
154
|
+
# Deserializes the data based on type
|
155
|
+
# @param string type Data type
|
156
|
+
# @param string value Value to be deserialized
|
157
|
+
# @return [Object] Deserialized data
|
158
|
+
def _deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :Time
|
161
|
+
Time.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :Boolean
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when :Object
|
177
|
+
# generic object (usually a Hash), return directly
|
178
|
+
value
|
179
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
180
|
+
inner_type = Regexp.last_match[:inner_type]
|
181
|
+
value.map { |v| _deserialize(inner_type, v) }
|
182
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
183
|
+
k_type = Regexp.last_match[:k_type]
|
184
|
+
v_type = Regexp.last_match[:v_type]
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each do |k, v|
|
187
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
else # model
|
191
|
+
# models (e.g. Pet) or oneOf
|
192
|
+
klass = Carbon.const_get(type)
|
193
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# to_body is an alias to to_hash (backward compatibility)
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_body
|
206
|
+
to_hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the object in the form of hash
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_hash
|
212
|
+
hash = {}
|
213
|
+
self.class.attribute_map.each_pair do |attr, param|
|
214
|
+
value = self.send(attr)
|
215
|
+
if value.nil?
|
216
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
217
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
218
|
+
end
|
219
|
+
|
220
|
+
hash[param] = _to_hash(value)
|
221
|
+
end
|
222
|
+
hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Outputs non-array value in the form of hash
|
226
|
+
# For object, use to_hash. Otherwise, just return the value
|
227
|
+
# @param [Object] value Any valid value
|
228
|
+
# @return [Hash] Returns the value in the form of hash
|
229
|
+
def _to_hash(value)
|
230
|
+
if value.is_a?(Array)
|
231
|
+
value.compact.map { |v| _to_hash(v) }
|
232
|
+
elsif value.is_a?(Hash)
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
235
|
+
end
|
236
|
+
elsif value.respond_to? :to_hash
|
237
|
+
value.to_hash
|
238
|
+
else
|
239
|
+
value
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
@@ -0,0 +1,379 @@
|
|
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 AzureBlobFileSyncInput
|
14
|
+
attr_accessor :tags
|
15
|
+
|
16
|
+
attr_accessor :ids
|
17
|
+
|
18
|
+
attr_accessor :chunk_size
|
19
|
+
|
20
|
+
attr_accessor :chunk_overlap
|
21
|
+
|
22
|
+
attr_accessor :skip_embedding_generation
|
23
|
+
|
24
|
+
attr_accessor :embedding_model
|
25
|
+
|
26
|
+
attr_accessor :generate_sparse_vectors
|
27
|
+
|
28
|
+
attr_accessor :prepend_filename_to_chunks
|
29
|
+
|
30
|
+
# Number of objects per chunk. For csv, tsv, xlsx, and json files only.
|
31
|
+
attr_accessor :max_items_per_chunk
|
32
|
+
|
33
|
+
attr_accessor :set_page_as_boundary
|
34
|
+
|
35
|
+
attr_accessor :data_source_id
|
36
|
+
|
37
|
+
attr_accessor :request_id
|
38
|
+
|
39
|
+
attr_accessor :use_ocr
|
40
|
+
|
41
|
+
attr_accessor :parse_pdf_tables_with_ocr
|
42
|
+
|
43
|
+
attr_accessor :file_sync_config
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'tags' => :'tags',
|
49
|
+
:'ids' => :'ids',
|
50
|
+
:'chunk_size' => :'chunk_size',
|
51
|
+
:'chunk_overlap' => :'chunk_overlap',
|
52
|
+
:'skip_embedding_generation' => :'skip_embedding_generation',
|
53
|
+
:'embedding_model' => :'embedding_model',
|
54
|
+
:'generate_sparse_vectors' => :'generate_sparse_vectors',
|
55
|
+
:'prepend_filename_to_chunks' => :'prepend_filename_to_chunks',
|
56
|
+
:'max_items_per_chunk' => :'max_items_per_chunk',
|
57
|
+
:'set_page_as_boundary' => :'set_page_as_boundary',
|
58
|
+
:'data_source_id' => :'data_source_id',
|
59
|
+
:'request_id' => :'request_id',
|
60
|
+
:'use_ocr' => :'use_ocr',
|
61
|
+
:'parse_pdf_tables_with_ocr' => :'parse_pdf_tables_with_ocr',
|
62
|
+
:'file_sync_config' => :'file_sync_config'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns all the JSON keys this model knows about
|
67
|
+
def self.acceptable_attributes
|
68
|
+
attribute_map.values
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.openapi_types
|
73
|
+
{
|
74
|
+
:'tags' => :'Object',
|
75
|
+
:'ids' => :'Array<AzureBlobGetFileInput>',
|
76
|
+
:'chunk_size' => :'Integer',
|
77
|
+
:'chunk_overlap' => :'Integer',
|
78
|
+
:'skip_embedding_generation' => :'Boolean',
|
79
|
+
:'embedding_model' => :'EmbeddingGenerators',
|
80
|
+
:'generate_sparse_vectors' => :'Boolean',
|
81
|
+
:'prepend_filename_to_chunks' => :'Boolean',
|
82
|
+
:'max_items_per_chunk' => :'Integer',
|
83
|
+
:'set_page_as_boundary' => :'Boolean',
|
84
|
+
:'data_source_id' => :'Integer',
|
85
|
+
:'request_id' => :'String',
|
86
|
+
:'use_ocr' => :'Boolean',
|
87
|
+
:'parse_pdf_tables_with_ocr' => :'Boolean',
|
88
|
+
:'file_sync_config' => :'FileSyncConfigNullable'
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# List of attributes with nullable: true
|
93
|
+
def self.openapi_nullable
|
94
|
+
Set.new([
|
95
|
+
:'tags',
|
96
|
+
:'chunk_size',
|
97
|
+
:'chunk_overlap',
|
98
|
+
:'skip_embedding_generation',
|
99
|
+
:'generate_sparse_vectors',
|
100
|
+
:'prepend_filename_to_chunks',
|
101
|
+
:'max_items_per_chunk',
|
102
|
+
:'data_source_id',
|
103
|
+
:'request_id',
|
104
|
+
:'use_ocr',
|
105
|
+
:'parse_pdf_tables_with_ocr',
|
106
|
+
:'file_sync_config'
|
107
|
+
])
|
108
|
+
end
|
109
|
+
|
110
|
+
# Initializes the object
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
def initialize(attributes = {})
|
113
|
+
if (!attributes.is_a?(Hash))
|
114
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::AzureBlobFileSyncInput` initialize method"
|
115
|
+
end
|
116
|
+
|
117
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
118
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
119
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
120
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::AzureBlobFileSyncInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
121
|
+
end
|
122
|
+
h[k.to_sym] = v
|
123
|
+
}
|
124
|
+
|
125
|
+
if attributes.key?(:'tags')
|
126
|
+
self.tags = attributes[:'tags']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'ids')
|
130
|
+
if (value = attributes[:'ids']).is_a?(Array)
|
131
|
+
self.ids = value
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'chunk_size')
|
136
|
+
self.chunk_size = attributes[:'chunk_size']
|
137
|
+
else
|
138
|
+
self.chunk_size = 1500
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:'chunk_overlap')
|
142
|
+
self.chunk_overlap = attributes[:'chunk_overlap']
|
143
|
+
else
|
144
|
+
self.chunk_overlap = 20
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'skip_embedding_generation')
|
148
|
+
self.skip_embedding_generation = attributes[:'skip_embedding_generation']
|
149
|
+
else
|
150
|
+
self.skip_embedding_generation = false
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'embedding_model')
|
154
|
+
self.embedding_model = attributes[:'embedding_model']
|
155
|
+
else
|
156
|
+
self.embedding_model = 'OPENAI'
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'generate_sparse_vectors')
|
160
|
+
self.generate_sparse_vectors = attributes[:'generate_sparse_vectors']
|
161
|
+
else
|
162
|
+
self.generate_sparse_vectors = false
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.key?(:'prepend_filename_to_chunks')
|
166
|
+
self.prepend_filename_to_chunks = attributes[:'prepend_filename_to_chunks']
|
167
|
+
else
|
168
|
+
self.prepend_filename_to_chunks = false
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'max_items_per_chunk')
|
172
|
+
self.max_items_per_chunk = attributes[:'max_items_per_chunk']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.key?(:'set_page_as_boundary')
|
176
|
+
self.set_page_as_boundary = attributes[:'set_page_as_boundary']
|
177
|
+
else
|
178
|
+
self.set_page_as_boundary = false
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.key?(:'data_source_id')
|
182
|
+
self.data_source_id = attributes[:'data_source_id']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.key?(:'request_id')
|
186
|
+
self.request_id = attributes[:'request_id']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.key?(:'use_ocr')
|
190
|
+
self.use_ocr = attributes[:'use_ocr']
|
191
|
+
else
|
192
|
+
self.use_ocr = false
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.key?(:'parse_pdf_tables_with_ocr')
|
196
|
+
self.parse_pdf_tables_with_ocr = attributes[:'parse_pdf_tables_with_ocr']
|
197
|
+
else
|
198
|
+
self.parse_pdf_tables_with_ocr = false
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.key?(:'file_sync_config')
|
202
|
+
self.file_sync_config = attributes[:'file_sync_config']
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
207
|
+
# @return Array for valid properties with the reasons
|
208
|
+
def list_invalid_properties
|
209
|
+
invalid_properties = Array.new
|
210
|
+
if @ids.nil?
|
211
|
+
invalid_properties.push('invalid value for "ids", ids cannot be nil.')
|
212
|
+
end
|
213
|
+
|
214
|
+
invalid_properties
|
215
|
+
end
|
216
|
+
|
217
|
+
# Check to see if the all the properties in the model are valid
|
218
|
+
# @return true if the model is valid
|
219
|
+
def valid?
|
220
|
+
return false if @ids.nil?
|
221
|
+
true
|
222
|
+
end
|
223
|
+
|
224
|
+
# Checks equality by comparing each attribute.
|
225
|
+
# @param [Object] Object to be compared
|
226
|
+
def ==(o)
|
227
|
+
return true if self.equal?(o)
|
228
|
+
self.class == o.class &&
|
229
|
+
tags == o.tags &&
|
230
|
+
ids == o.ids &&
|
231
|
+
chunk_size == o.chunk_size &&
|
232
|
+
chunk_overlap == o.chunk_overlap &&
|
233
|
+
skip_embedding_generation == o.skip_embedding_generation &&
|
234
|
+
embedding_model == o.embedding_model &&
|
235
|
+
generate_sparse_vectors == o.generate_sparse_vectors &&
|
236
|
+
prepend_filename_to_chunks == o.prepend_filename_to_chunks &&
|
237
|
+
max_items_per_chunk == o.max_items_per_chunk &&
|
238
|
+
set_page_as_boundary == o.set_page_as_boundary &&
|
239
|
+
data_source_id == o.data_source_id &&
|
240
|
+
request_id == o.request_id &&
|
241
|
+
use_ocr == o.use_ocr &&
|
242
|
+
parse_pdf_tables_with_ocr == o.parse_pdf_tables_with_ocr &&
|
243
|
+
file_sync_config == o.file_sync_config
|
244
|
+
end
|
245
|
+
|
246
|
+
# @see the `==` method
|
247
|
+
# @param [Object] Object to be compared
|
248
|
+
def eql?(o)
|
249
|
+
self == o
|
250
|
+
end
|
251
|
+
|
252
|
+
# Calculates hash code according to all attributes.
|
253
|
+
# @return [Integer] Hash code
|
254
|
+
def hash
|
255
|
+
[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, request_id, use_ocr, parse_pdf_tables_with_ocr, file_sync_config].hash
|
256
|
+
end
|
257
|
+
|
258
|
+
# Builds the object from hash
|
259
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
260
|
+
# @return [Object] Returns the model itself
|
261
|
+
def self.build_from_hash(attributes)
|
262
|
+
new.build_from_hash(attributes)
|
263
|
+
end
|
264
|
+
|
265
|
+
# Builds the object from hash
|
266
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
267
|
+
# @return [Object] Returns the model itself
|
268
|
+
def build_from_hash(attributes)
|
269
|
+
return nil unless attributes.is_a?(Hash)
|
270
|
+
attributes = attributes.transform_keys(&:to_sym)
|
271
|
+
self.class.openapi_types.each_pair do |key, type|
|
272
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
273
|
+
self.send("#{key}=", nil)
|
274
|
+
elsif type =~ /\AArray<(.*)>/i
|
275
|
+
# check to ensure the input is an array given that the attribute
|
276
|
+
# is documented as an array but the input is not
|
277
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
278
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
279
|
+
end
|
280
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
281
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
self
|
286
|
+
end
|
287
|
+
|
288
|
+
# Deserializes the data based on type
|
289
|
+
# @param string type Data type
|
290
|
+
# @param string value Value to be deserialized
|
291
|
+
# @return [Object] Deserialized data
|
292
|
+
def _deserialize(type, value)
|
293
|
+
case type.to_sym
|
294
|
+
when :Time
|
295
|
+
Time.parse(value)
|
296
|
+
when :Date
|
297
|
+
Date.parse(value)
|
298
|
+
when :String
|
299
|
+
value.to_s
|
300
|
+
when :Integer
|
301
|
+
value.to_i
|
302
|
+
when :Float
|
303
|
+
value.to_f
|
304
|
+
when :Boolean
|
305
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
306
|
+
true
|
307
|
+
else
|
308
|
+
false
|
309
|
+
end
|
310
|
+
when :Object
|
311
|
+
# generic object (usually a Hash), return directly
|
312
|
+
value
|
313
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
314
|
+
inner_type = Regexp.last_match[:inner_type]
|
315
|
+
value.map { |v| _deserialize(inner_type, v) }
|
316
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
317
|
+
k_type = Regexp.last_match[:k_type]
|
318
|
+
v_type = Regexp.last_match[:v_type]
|
319
|
+
{}.tap do |hash|
|
320
|
+
value.each do |k, v|
|
321
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
else # model
|
325
|
+
# models (e.g. Pet) or oneOf
|
326
|
+
klass = Carbon.const_get(type)
|
327
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
# Returns the string representation of the object
|
332
|
+
# @return [String] String presentation of the object
|
333
|
+
def to_s
|
334
|
+
to_hash.to_s
|
335
|
+
end
|
336
|
+
|
337
|
+
# to_body is an alias to to_hash (backward compatibility)
|
338
|
+
# @return [Hash] Returns the object in the form of hash
|
339
|
+
def to_body
|
340
|
+
to_hash
|
341
|
+
end
|
342
|
+
|
343
|
+
# Returns the object in the form of hash
|
344
|
+
# @return [Hash] Returns the object in the form of hash
|
345
|
+
def to_hash
|
346
|
+
hash = {}
|
347
|
+
self.class.attribute_map.each_pair do |attr, param|
|
348
|
+
value = self.send(attr)
|
349
|
+
if value.nil?
|
350
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
351
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
352
|
+
end
|
353
|
+
|
354
|
+
hash[param] = _to_hash(value)
|
355
|
+
end
|
356
|
+
hash
|
357
|
+
end
|
358
|
+
|
359
|
+
# Outputs non-array value in the form of hash
|
360
|
+
# For object, use to_hash. Otherwise, just return the value
|
361
|
+
# @param [Object] value Any valid value
|
362
|
+
# @return [Hash] Returns the value in the form of hash
|
363
|
+
def _to_hash(value)
|
364
|
+
if value.is_a?(Array)
|
365
|
+
value.compact.map { |v| _to_hash(v) }
|
366
|
+
elsif value.is_a?(Hash)
|
367
|
+
{}.tap do |hash|
|
368
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
369
|
+
end
|
370
|
+
elsif value.respond_to? :to_hash
|
371
|
+
value.to_hash
|
372
|
+
else
|
373
|
+
value
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
end
|
378
|
+
|
379
|
+
end
|