Exception: Phronomy::LowConfidenceError

Inherits:
Error
  • Object
show all
Defined in:
lib/phronomy.rb

Overview

Raised by GeneratorVerifier#invoke when +raise_if_untrusted: true+ and the pipeline's combined confidence score falls below the configured threshold.

Examples:

rescue Phronomy::LowConfidenceError => e
  puts e.result.confidence   # => e.g. 0.45
  puts e.result.output       # best-effort answer despite low confidence

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ LowConfidenceError

Returns a new instance of LowConfidenceError.



38
39
40
41
# File 'lib/phronomy.rb', line 38

def initialize(result)
  @result = result
  super("Answer confidence #{result.confidence} is below the required threshold")
end

Instance Attribute Details

#resultPhronomy::GeneratorVerifier::Result (readonly)

Returns the untrusted result.

Returns:



36
37
38
# File 'lib/phronomy.rb', line 36

def result
  @result
end