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.



91
92
93
94
# File 'lib/phronomy.rb', line 91

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:



89
90
91
# File 'lib/phronomy.rb', line 89

def result
  @result
end