Class: FeatherAi::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/feather_ai/result.rb

Overview

Immutable value object wrapping all identification output.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#candidatesObject (readonly)

Returns the value of attribute candidates.



6
7
8
# File 'lib/feather_ai/result.rb', line 6

def candidates
  @candidates
end

#common_nameObject (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

#confidenceObject (readonly)

Returns the value of attribute confidence.



6
7
8
# File 'lib/feather_ai/result.rb', line 6

def confidence
  @confidence
end

#consensus_modelsObject (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

#costObject (readonly)

Returns the value of attribute cost.



6
7
8
# File 'lib/feather_ai/result.rb', line 6

def cost
  @cost
end

#duration_msObject (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

#familyObject (readonly)

Returns the value of attribute family.



6
7
8
# File 'lib/feather_ai/result.rb', line 6

def family
  @family
end

#input_tokensObject (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_idObject (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_tokensObject (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

#reasoningObject (readonly)

Returns the value of attribute reasoning.



6
7
8
# File 'lib/feather_ai/result.rb', line 6

def reasoning
  @reasoning
end

#region_nativeObject (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

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/feather_ai/result.rb', line 6

def source
  @source
end

#speciesObject (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

Returns:

  • (Boolean)


16
17
18
# File 'lib/feather_ai/result.rb', line 16

def confident?
  @confidence == :high
end

#photography_tipsObject



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

Returns:

  • (Boolean)


20
21
22
# File 'lib/feather_ai/result.rb', line 20

def region_native?
  @region_native == true
end

#to_hObject



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