carbon_ruby_sdk 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +56 -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 +72 -19
  7. data/lib/carbon_ruby_sdk/models/chunks_and_embeddings.rb +1 -5
  8. data/lib/carbon_ruby_sdk/models/chunks_and_embeddings_upload_input.rb +24 -4
  9. data/lib/carbon_ruby_sdk/models/embedding_generators.rb +6 -1
  10. data/lib/carbon_ruby_sdk/models/embedding_generators_nullable.rb +6 -1
  11. data/lib/carbon_ruby_sdk/models/file_formats.rb +1 -6
  12. data/lib/carbon_ruby_sdk/models/file_formats_nullable.rb +1 -6
  13. data/lib/carbon_ruby_sdk/models/gmail_sync_input.rb +15 -5
  14. data/lib/carbon_ruby_sdk/models/o_auth_url_request.rb +29 -4
  15. data/lib/carbon_ruby_sdk/models/outh_url_response.rb +220 -0
  16. data/lib/carbon_ruby_sdk/models/outlook_sync_input.rb +15 -5
  17. data/lib/carbon_ruby_sdk/models/resync_file_query_input.rb +16 -5
  18. data/lib/carbon_ruby_sdk/models/s3_file_sync_input.rb +14 -4
  19. data/lib/carbon_ruby_sdk/version.rb +1 -1
  20. data/lib/carbon_ruby_sdk.rb +1 -0
  21. data/spec/api/integrations_api_spec.rb +5 -1
  22. data/spec/models/chunks_and_embeddings_upload_input_spec.rb +12 -0
  23. data/spec/models/gmail_sync_input_spec.rb +6 -0
  24. data/spec/models/o_auth_url_request_spec.rb +12 -0
  25. data/spec/models/outh_url_response_spec.rb +28 -0
  26. data/spec/models/outlook_sync_input_spec.rb +6 -0
  27. data/spec/models/resync_file_query_input_spec.rb +6 -0
  28. data/spec/models/s3_file_sync_input_spec.rb +6 -0
  29. metadata +5 -2
@@ -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
@@ -13,6 +13,11 @@ module Carbon
13
13
  class EmbeddingGenerators
14
14
  OPENAI = "OPENAI".freeze
15
15
  AZURE_OPENAI = "AZURE_OPENAI".freeze
16
+ AZURE_ADA_LARGE_256 = "AZURE_ADA_LARGE_256".freeze
17
+ AZURE_ADA_LARGE_1024 = "AZURE_ADA_LARGE_1024".freeze
18
+ AZURE_ADA_LARGE_3072 = "AZURE_ADA_LARGE_3072".freeze
19
+ AZURE_ADA_SMALL_512 = "AZURE_ADA_SMALL_512".freeze
20
+ AZURE_ADA_SMALL_1536 = "AZURE_ADA_SMALL_1536".freeze
16
21
  COHERE_MULTILINGUAL_V3 = "COHERE_MULTILINGUAL_V3".freeze
17
22
  VERTEX_MULTIMODAL = "VERTEX_MULTIMODAL".freeze
18
23
  OPENAI_ADA_LARGE_256 = "OPENAI_ADA_LARGE_256".freeze
@@ -22,7 +27,7 @@ module Carbon
22
27
  OPENAI_ADA_SMALL_1536 = "OPENAI_ADA_SMALL_1536".freeze
23
28
 
24
29
  def self.all_vars
25
- @all_vars ||= [OPENAI, AZURE_OPENAI, COHERE_MULTILINGUAL_V3, VERTEX_MULTIMODAL, OPENAI_ADA_LARGE_256, OPENAI_ADA_LARGE_1024, OPENAI_ADA_LARGE_3072, OPENAI_ADA_SMALL_512, OPENAI_ADA_SMALL_1536].freeze
30
+ @all_vars ||= [OPENAI, AZURE_OPENAI, AZURE_ADA_LARGE_256, AZURE_ADA_LARGE_1024, AZURE_ADA_LARGE_3072, AZURE_ADA_SMALL_512, AZURE_ADA_SMALL_1536, COHERE_MULTILINGUAL_V3, VERTEX_MULTIMODAL, OPENAI_ADA_LARGE_256, OPENAI_ADA_LARGE_1024, OPENAI_ADA_LARGE_3072, OPENAI_ADA_SMALL_512, OPENAI_ADA_SMALL_1536].freeze
26
31
  end
27
32
 
28
33
  # Builds the enum from string
@@ -13,6 +13,11 @@ module Carbon
13
13
  class EmbeddingGeneratorsNullable
14
14
  OPENAI = "OPENAI".freeze
15
15
  AZURE_OPENAI = "AZURE_OPENAI".freeze
16
+ AZURE_ADA_LARGE_256 = "AZURE_ADA_LARGE_256".freeze
17
+ AZURE_ADA_LARGE_1024 = "AZURE_ADA_LARGE_1024".freeze
18
+ AZURE_ADA_LARGE_3072 = "AZURE_ADA_LARGE_3072".freeze
19
+ AZURE_ADA_SMALL_512 = "AZURE_ADA_SMALL_512".freeze
20
+ AZURE_ADA_SMALL_1536 = "AZURE_ADA_SMALL_1536".freeze
16
21
  COHERE_MULTILINGUAL_V3 = "COHERE_MULTILINGUAL_V3".freeze
17
22
  VERTEX_MULTIMODAL = "VERTEX_MULTIMODAL".freeze
18
23
  OPENAI_ADA_LARGE_256 = "OPENAI_ADA_LARGE_256".freeze
@@ -22,7 +27,7 @@ module Carbon
22
27
  OPENAI_ADA_SMALL_1536 = "OPENAI_ADA_SMALL_1536".freeze
23
28
 
24
29
  def self.all_vars
25
- @all_vars ||= [OPENAI, AZURE_OPENAI, COHERE_MULTILINGUAL_V3, VERTEX_MULTIMODAL, OPENAI_ADA_LARGE_256, OPENAI_ADA_LARGE_1024, OPENAI_ADA_LARGE_3072, OPENAI_ADA_SMALL_512, OPENAI_ADA_SMALL_1536].freeze
30
+ @all_vars ||= [OPENAI, AZURE_OPENAI, AZURE_ADA_LARGE_256, AZURE_ADA_LARGE_1024, AZURE_ADA_LARGE_3072, AZURE_ADA_SMALL_512, AZURE_ADA_SMALL_1536, COHERE_MULTILINGUAL_V3, VERTEX_MULTIMODAL, OPENAI_ADA_LARGE_256, OPENAI_ADA_LARGE_1024, OPENAI_ADA_LARGE_3072, OPENAI_ADA_SMALL_512, OPENAI_ADA_SMALL_1536].freeze
26
31
  end
27
32
 
28
33
  # Builds the enum from string
@@ -22,19 +22,14 @@ module Carbon
22
22
  RTF = "RTF".freeze
23
23
  JSON = "JSON".freeze
24
24
  NOTION = "NOTION".freeze
25
- GOOGLE_DRIVE = "GOOGLE_DRIVE".freeze
26
25
  GOOGLE_DOCS = "GOOGLE_DOCS".freeze
27
26
  GOOGLE_SHEETS = "GOOGLE_SHEETS".freeze
28
27
  GOOGLE_SLIDES = "GOOGLE_SLIDES".freeze
29
28
  INTERCOM = "INTERCOM".freeze
30
- DROPBOX = "DROPBOX".freeze
31
- ONEDRIVE = "ONEDRIVE".freeze
32
- SHAREPOINT = "SHAREPOINT".freeze
33
29
  CONFLUENCE = "CONFLUENCE".freeze
34
30
  RSS_FEED = "RSS_FEED".freeze
35
31
  GMAIL = "GMAIL".freeze
36
32
  OUTLOOK = "OUTLOOK".freeze
37
- BOX = "BOX".freeze
38
33
  ZENDESK = "ZENDESK".freeze
39
34
  FRESHDESK = "FRESHDESK".freeze
40
35
  WEB_SCRAPE = "WEB_SCRAPE".freeze
@@ -55,7 +50,7 @@ module Carbon
55
50
  WEBM = "WEBM".freeze
56
51
 
57
52
  def self.all_vars
58
- @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, NOTION, GOOGLE_DRIVE, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, DROPBOX, ONEDRIVE, SHAREPOINT, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, BOX, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, JPG, PNG, MP3, MP4, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, WEBM].freeze
53
+ @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, JPG, PNG, MP3, MP4, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, WEBM].freeze
59
54
  end
60
55
 
61
56
  # Builds the enum from string
@@ -22,19 +22,14 @@ module Carbon
22
22
  RTF = "RTF".freeze
23
23
  JSON = "JSON".freeze
24
24
  NOTION = "NOTION".freeze
25
- GOOGLE_DRIVE = "GOOGLE_DRIVE".freeze
26
25
  GOOGLE_DOCS = "GOOGLE_DOCS".freeze
27
26
  GOOGLE_SHEETS = "GOOGLE_SHEETS".freeze
28
27
  GOOGLE_SLIDES = "GOOGLE_SLIDES".freeze
29
28
  INTERCOM = "INTERCOM".freeze
30
- DROPBOX = "DROPBOX".freeze
31
- ONEDRIVE = "ONEDRIVE".freeze
32
- SHAREPOINT = "SHAREPOINT".freeze
33
29
  CONFLUENCE = "CONFLUENCE".freeze
34
30
  RSS_FEED = "RSS_FEED".freeze
35
31
  GMAIL = "GMAIL".freeze
36
32
  OUTLOOK = "OUTLOOK".freeze
37
- BOX = "BOX".freeze
38
33
  ZENDESK = "ZENDESK".freeze
39
34
  FRESHDESK = "FRESHDESK".freeze
40
35
  WEB_SCRAPE = "WEB_SCRAPE".freeze
@@ -55,7 +50,7 @@ module Carbon
55
50
  WEBM = "WEBM".freeze
56
51
 
57
52
  def self.all_vars
58
- @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, NOTION, GOOGLE_DRIVE, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, DROPBOX, ONEDRIVE, SHAREPOINT, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, BOX, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, JPG, PNG, MP3, MP4, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, WEBM].freeze
53
+ @all_vars ||= [TXT, CSV, TSV, PDF, DOCX, PPTX, XLSX, MD, RTF, JSON, NOTION, GOOGLE_DOCS, GOOGLE_SHEETS, GOOGLE_SLIDES, INTERCOM, CONFLUENCE, RSS_FEED, GMAIL, OUTLOOK, ZENDESK, FRESHDESK, WEB_SCRAPE, GITBOOK, SALESFORCE, JPG, PNG, MP3, MP4, MP2, AAC, WAV, FLAC, PCM, M4_A, OGG, OPUS, WEBM].freeze
59
54
  end
60
55
 
61
56
  # Builds the enum from string
@@ -27,6 +27,8 @@ module Carbon
27
27
 
28
28
  attr_accessor :prepend_filename_to_chunks
29
29
 
30
+ attr_accessor :data_source_id
31
+
30
32
  # Attribute mapping from ruby-style variable name to JSON key.
31
33
  def self.attribute_map
32
34
  {
@@ -37,7 +39,8 @@ module Carbon
37
39
  :'skip_embedding_generation' => :'skip_embedding_generation',
38
40
  :'embedding_model' => :'embedding_model',
39
41
  :'generate_sparse_vectors' => :'generate_sparse_vectors',
40
- :'prepend_filename_to_chunks' => :'prepend_filename_to_chunks'
42
+ :'prepend_filename_to_chunks' => :'prepend_filename_to_chunks',
43
+ :'data_source_id' => :'data_source_id'
41
44
  }
42
45
  end
43
46
 
@@ -56,7 +59,8 @@ module Carbon
56
59
  :'skip_embedding_generation' => :'Boolean',
57
60
  :'embedding_model' => :'EmbeddingGenerators',
58
61
  :'generate_sparse_vectors' => :'Boolean',
59
- :'prepend_filename_to_chunks' => :'Boolean'
62
+ :'prepend_filename_to_chunks' => :'Boolean',
63
+ :'data_source_id' => :'Integer'
60
64
  }
61
65
  end
62
66
 
@@ -68,7 +72,8 @@ module Carbon
68
72
  :'chunk_overlap',
69
73
  :'skip_embedding_generation',
70
74
  :'generate_sparse_vectors',
71
- :'prepend_filename_to_chunks'
75
+ :'prepend_filename_to_chunks',
76
+ :'data_source_id'
72
77
  ])
73
78
  end
74
79
 
@@ -130,6 +135,10 @@ module Carbon
130
135
  else
131
136
  self.prepend_filename_to_chunks = false
132
137
  end
138
+
139
+ if attributes.key?(:'data_source_id')
140
+ self.data_source_id = attributes[:'data_source_id']
141
+ end
133
142
  end
134
143
 
135
144
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -162,7 +171,8 @@ module Carbon
162
171
  skip_embedding_generation == o.skip_embedding_generation &&
163
172
  embedding_model == o.embedding_model &&
164
173
  generate_sparse_vectors == o.generate_sparse_vectors &&
165
- prepend_filename_to_chunks == o.prepend_filename_to_chunks
174
+ prepend_filename_to_chunks == o.prepend_filename_to_chunks &&
175
+ data_source_id == o.data_source_id
166
176
  end
167
177
 
168
178
  # @see the `==` method
@@ -174,7 +184,7 @@ module Carbon
174
184
  # Calculates hash code according to all attributes.
175
185
  # @return [Integer] Hash code
176
186
  def hash
177
- [tags, filters, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks].hash
187
+ [tags, filters, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, generate_sparse_vectors, prepend_filename_to_chunks, data_source_id].hash
178
188
  end
179
189
 
180
190
  # Builds the object from hash
@@ -41,10 +41,17 @@ module Carbon
41
41
 
42
42
  attr_accessor :salesforce_domain
43
43
 
44
+ # Used to specify whether Carbon should attempt to sync all your files automatically when authorization is complete. This is only supported for a subset of connectors and will be ignored for the rest. Supported connectors: Intercom, Zendesk, Gitbook, Confluence, Salesforce, Freshdesk
44
45
  attr_accessor :sync_files_on_connection
45
46
 
46
47
  attr_accessor :set_page_as_boundary
47
48
 
49
+ # Used to specify a data source to sync from if you have multiple connected. It can be skipped if you only have one data source of that type connected or are connecting a new account.
50
+ attr_accessor :data_source_id
51
+
52
+ # Used to connect a new data source. If not specified, we will attempt to create a sync URL for an existing data source based on type and ID.
53
+ attr_accessor :connecting_new_account
54
+
48
55
  # Attribute mapping from ruby-style variable name to JSON key.
49
56
  def self.attribute_map
50
57
  {
@@ -64,7 +71,9 @@ module Carbon
64
71
  :'max_items_per_chunk' => :'max_items_per_chunk',
65
72
  :'salesforce_domain' => :'salesforce_domain',
66
73
  :'sync_files_on_connection' => :'sync_files_on_connection',
67
- :'set_page_as_boundary' => :'set_page_as_boundary'
74
+ :'set_page_as_boundary' => :'set_page_as_boundary',
75
+ :'data_source_id' => :'data_source_id',
76
+ :'connecting_new_account' => :'connecting_new_account'
68
77
  }
69
78
  end
70
79
 
@@ -92,7 +101,9 @@ module Carbon
92
101
  :'max_items_per_chunk' => :'Integer',
93
102
  :'salesforce_domain' => :'String',
94
103
  :'sync_files_on_connection' => :'Boolean',
95
- :'set_page_as_boundary' => :'Boolean'
104
+ :'set_page_as_boundary' => :'Boolean',
105
+ :'data_source_id' => :'Integer',
106
+ :'connecting_new_account' => :'Boolean'
96
107
  }
97
108
  end
98
109
 
@@ -114,6 +125,8 @@ module Carbon
114
125
  :'max_items_per_chunk',
115
126
  :'salesforce_domain',
116
127
  :'sync_files_on_connection',
128
+ :'data_source_id',
129
+ :'connecting_new_account'
117
130
  ])
118
131
  end
119
132
 
@@ -215,6 +228,16 @@ module Carbon
215
228
  else
216
229
  self.set_page_as_boundary = false
217
230
  end
231
+
232
+ if attributes.key?(:'data_source_id')
233
+ self.data_source_id = attributes[:'data_source_id']
234
+ end
235
+
236
+ if attributes.key?(:'connecting_new_account')
237
+ self.connecting_new_account = attributes[:'connecting_new_account']
238
+ else
239
+ self.connecting_new_account = false
240
+ end
218
241
  end
219
242
 
220
243
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -256,7 +279,9 @@ module Carbon
256
279
  max_items_per_chunk == o.max_items_per_chunk &&
257
280
  salesforce_domain == o.salesforce_domain &&
258
281
  sync_files_on_connection == o.sync_files_on_connection &&
259
- set_page_as_boundary == o.set_page_as_boundary
282
+ set_page_as_boundary == o.set_page_as_boundary &&
283
+ data_source_id == o.data_source_id &&
284
+ connecting_new_account == o.connecting_new_account
260
285
  end
261
286
 
262
287
  # @see the `==` method
@@ -268,7 +293,7 @@ module Carbon
268
293
  # Calculates hash code according to all attributes.
269
294
  # @return [Integer] Hash code
270
295
  def hash
271
- [tags, scope, service, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, zendesk_subdomain, microsoft_tenant, sharepoint_site_name, confluence_subdomain, generate_sparse_vectors, prepend_filename_to_chunks, max_items_per_chunk, salesforce_domain, sync_files_on_connection, set_page_as_boundary].hash
296
+ [tags, scope, service, chunk_size, chunk_overlap, skip_embedding_generation, embedding_model, zendesk_subdomain, microsoft_tenant, sharepoint_site_name, confluence_subdomain, generate_sparse_vectors, prepend_filename_to_chunks, max_items_per_chunk, salesforce_domain, sync_files_on_connection, set_page_as_boundary, data_source_id, connecting_new_account].hash
272
297
  end
273
298
 
274
299
  # Builds the object from hash
@@ -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