Class: SmartCsvImport::Configuration
- Inherits:
-
Object
- Object
- SmartCsvImport::Configuration
- Defined in:
- lib/smart_csv_import/configuration.rb
Constant Summary collapse
- REVIEW_MODES =
%i[auto always skip].freeze
Instance Attribute Summary collapse
-
#async ⇒ Object
Returns the value of attribute async.
-
#bad_row_limit ⇒ Object
Returns the value of attribute bad_row_limit.
-
#batch_size ⇒ Object
Returns the value of attribute batch_size.
-
#chunk_size ⇒ Object
Returns the value of attribute chunk_size.
-
#confidence_threshold ⇒ Object
Returns the value of attribute confidence_threshold.
-
#default_strategy ⇒ Object
Returns the value of attribute default_strategy.
-
#embedding_model ⇒ Object
Returns the value of attribute embedding_model.
-
#field_size_limit ⇒ Object
Returns the value of attribute field_size_limit.
-
#llm_model ⇒ Object
Returns the value of attribute llm_model.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#nil_values_matching ⇒ Object
Returns the value of attribute nil_values_matching.
-
#review_mode ⇒ Object
Returns the value of attribute review_mode.
-
#storage_path ⇒ Object
Returns the value of attribute storage_path.
-
#value_hint_rows ⇒ Object
Returns the value of attribute value_hint_rows.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #nil_values_regexp ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/smart_csv_import/configuration.rb', line 20 def initialize @confidence_threshold = 0.80 @batch_size = 500 @storage_path = "tmp/smart_csv_import" @default_strategy = :vector @llm_model = "gpt-4o-mini" @embedding_model = "text-embedding-3-small" @async = false @value_hint_rows = 5 @field_size_limit = 1_048_576 @bad_row_limit = 0.10 @chunk_size = 1000 @review_mode = :skip @nil_values_matching = %w[#N/A #VALUE! #REF! #DIV/0! #NUM! #NAME? #NULL! NULL null N/A n/a nil Nil].freeze @logger = Logger.new($stdout) end |
Instance Attribute Details
#async ⇒ Object
Returns the value of attribute async.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def async @async end |
#bad_row_limit ⇒ Object
Returns the value of attribute bad_row_limit.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def bad_row_limit @bad_row_limit end |
#batch_size ⇒ Object
Returns the value of attribute batch_size.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def batch_size @batch_size end |
#chunk_size ⇒ Object
Returns the value of attribute chunk_size.
18 19 20 |
# File 'lib/smart_csv_import/configuration.rb', line 18 def chunk_size @chunk_size end |
#confidence_threshold ⇒ Object
Returns the value of attribute confidence_threshold.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def confidence_threshold @confidence_threshold end |
#default_strategy ⇒ Object
Returns the value of attribute default_strategy.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def default_strategy @default_strategy end |
#embedding_model ⇒ Object
Returns the value of attribute embedding_model.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def @embedding_model end |
#field_size_limit ⇒ Object
Returns the value of attribute field_size_limit.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def field_size_limit @field_size_limit end |
#llm_model ⇒ Object
Returns the value of attribute llm_model.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def llm_model @llm_model end |
#logger ⇒ Object
Returns the value of attribute logger.
18 19 20 |
# File 'lib/smart_csv_import/configuration.rb', line 18 def logger @logger end |
#nil_values_matching ⇒ Object
Returns the value of attribute nil_values_matching.
18 19 20 |
# File 'lib/smart_csv_import/configuration.rb', line 18 def nil_values_matching @nil_values_matching end |
#review_mode ⇒ Object
Returns the value of attribute review_mode.
18 19 20 |
# File 'lib/smart_csv_import/configuration.rb', line 18 def review_mode @review_mode end |
#storage_path ⇒ Object
Returns the value of attribute storage_path.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def storage_path @storage_path end |
#value_hint_rows ⇒ Object
Returns the value of attribute value_hint_rows.
7 8 9 |
# File 'lib/smart_csv_import/configuration.rb', line 7 def value_hint_rows @value_hint_rows end |
Instance Method Details
#nil_values_regexp ⇒ Object
47 48 49 50 51 |
# File 'lib/smart_csv_import/configuration.rb', line 47 def nil_values_regexp return nil if nil_values_matching.nil? || nil_values_matching.empty? Regexp.union(nil_values_matching.map { |v| /\A#{Regexp.escape(v)}\z/ }) end |