Class: FeatherAi::Result
- Inherits:
-
Object
- Object
- FeatherAi::Result
- Defined in:
- lib/feather_ai/result.rb
Overview
Immutable value object wrapping all identification output.
Instance Attribute Summary collapse
-
#candidates ⇒ Object
readonly
Returns the value of attribute candidates.
-
#common_name ⇒ Object
readonly
Returns the value of attribute common_name.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#consensus_models ⇒ Object
readonly
Returns the value of attribute consensus_models.
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#duration_ms ⇒ Object
readonly
Returns the value of attribute duration_ms.
-
#family ⇒ Object
readonly
Returns the value of attribute family.
-
#input_tokens ⇒ Object
readonly
Returns the value of attribute input_tokens.
-
#model_id ⇒ Object
readonly
Returns the value of attribute model_id.
-
#output_tokens ⇒ Object
readonly
Returns the value of attribute output_tokens.
-
#reasoning ⇒ Object
readonly
Returns the value of attribute reasoning.
-
#region_native ⇒ Object
readonly
Returns the value of attribute region_native.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#species ⇒ Object
readonly
Returns the value of attribute species.
Instance Method Summary collapse
- #confident? ⇒ Boolean
-
#initialize(attrs = {}) ⇒ Result
constructor
A new instance of Result.
- #photography_tips ⇒ Object
- #region_native? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Result
Returns a new instance of Result.
10 11 12 13 14 |
# File 'lib/feather_ai/result.rb', line 10 def initialize(attrs = {}) assign_identification_attrs(attrs) assign_photography_attrs(attrs) assign_observability_attrs(attrs) end |
Instance Attribute Details
#candidates ⇒ Object (readonly)
Returns the value of attribute candidates.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def candidates @candidates end |
#common_name ⇒ Object (readonly)
Returns the value of attribute common_name.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def common_name @common_name end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def confidence @confidence end |
#consensus_models ⇒ Object (readonly)
Returns the value of attribute consensus_models.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def consensus_models @consensus_models end |
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def cost @cost end |
#duration_ms ⇒ Object (readonly)
Returns the value of attribute duration_ms.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def duration_ms @duration_ms end |
#family ⇒ Object (readonly)
Returns the value of attribute family.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def family @family end |
#input_tokens ⇒ Object (readonly)
Returns the value of attribute input_tokens.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def input_tokens @input_tokens end |
#model_id ⇒ Object (readonly)
Returns the value of attribute model_id.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def model_id @model_id end |
#output_tokens ⇒ Object (readonly)
Returns the value of attribute output_tokens.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def output_tokens @output_tokens end |
#reasoning ⇒ Object (readonly)
Returns the value of attribute reasoning.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def reasoning @reasoning end |
#region_native ⇒ Object (readonly)
Returns the value of attribute region_native.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def region_native @region_native end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def source @source end |
#species ⇒ Object (readonly)
Returns the value of attribute species.
6 7 8 |
# File 'lib/feather_ai/result.rb', line 6 def species @species end |
Instance Method Details
#confident? ⇒ Boolean
16 17 18 |
# File 'lib/feather_ai/result.rb', line 16 def confident? @confidence == :high end |
#photography_tips ⇒ Object
24 25 26 27 28 29 |
# File 'lib/feather_ai/result.rb', line 24 def photography_tips return @photography_tips_data if defined?(@photography_tips_loaded) @photography_tips_loaded = true @photography_tips_data = @photography_tips_loader&.call end |
#region_native? ⇒ Boolean
20 21 22 |
# File 'lib/feather_ai/result.rb', line 20 def region_native? @region_native == true end |
#to_h ⇒ Object
31 32 33 34 35 |
# File 'lib/feather_ai/result.rb', line 31 def to_h identification_hash .merge(observability_hash) .merge(photography_hash) end |