Module: Ibex::LALR::ConflictSearchLimits

Included in:
ConflictSearch
Defined in:
lib/ibex/lalr/conflict_search_limits.rb

Overview

Validates search limits and measures sentences against the token budget.

Constant Summary collapse

DEFAULT_MAX_TOKENS =

: Integer

32
DEFAULT_MAX_CONFIGURATIONS =

: Integer

50_000

Class Method Summary collapse

Class Method Details

.validate!(max_tokens:, max_configurations:) ⇒ Object



11
12
13
14
# File 'lib/ibex/lalr/conflict_search_limits.rb', line 11

def self.validate!(max_tokens:, max_configurations:)
  validate_limit!(:max_tokens, max_tokens)
  validate_limit!(:max_configurations, max_configurations)
end

.validate_limit!(name, value) ⇒ Object

Raises:

  • (ArgumentError)


17
18
19
20
21
# File 'lib/ibex/lalr/conflict_search_limits.rb', line 17

def self.validate_limit!(name, value)
  return value if value.is_a?(Integer) && value.positive?

  raise ArgumentError, "#{name} must be a positive Integer"
end