Class: Kreuzberg::Config::TokenReduction
- Inherits:
-
Object
- Object
- Kreuzberg::Config::TokenReduction
- Defined in:
- lib/kreuzberg/config.rb
Overview
Token reduction configuration
Constant Summary collapse
- VALID_MODES =
%w[off light moderate aggressive maximum].freeze
Instance Attribute Summary collapse
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#preserve_important_words ⇒ Object
readonly
Returns the value of attribute preserve_important_words.
Instance Method Summary collapse
-
#initialize(mode: 'off', preserve_important_words: true) ⇒ TokenReduction
constructor
A new instance of TokenReduction.
- #to_h ⇒ Object
Constructor Details
#initialize(mode: 'off', preserve_important_words: true) ⇒ TokenReduction
Returns a new instance of TokenReduction.
589 590 591 592 593 594 595 596 597 |
# File 'lib/kreuzberg/config.rb', line 589 def initialize(mode: 'off', preserve_important_words: true) @mode = mode.to_s @preserve_important_words = preserve_important_words ? true : false # Validate mode against known valid modes return if VALID_MODES.include?(@mode) raise ArgumentError, "Invalid token reduction mode: #{@mode}. Valid modes are: #{VALID_MODES.join(', ')}" end |
Instance Attribute Details
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
585 586 587 |
# File 'lib/kreuzberg/config.rb', line 585 def mode @mode end |
#preserve_important_words ⇒ Object (readonly)
Returns the value of attribute preserve_important_words.
585 586 587 |
# File 'lib/kreuzberg/config.rb', line 585 def preserve_important_words @preserve_important_words end |
Instance Method Details
#to_h ⇒ Object
599 600 601 602 603 604 |
# File 'lib/kreuzberg/config.rb', line 599 def to_h { mode: @mode, preserve_important_words: @preserve_important_words } end |