Class: Ask::Eval::Configuration
- Inherits:
-
Object
- Object
- Ask::Eval::Configuration
- Defined in:
- lib/ask/eval/configuration.rb
Instance Attribute Summary collapse
-
#default_judge ⇒ Object?
The default judge model to use for LLM-as-judge assertions.
-
#track_cost ⇒ Boolean
Whether to track token usage and costs.
-
#verbose ⇒ Boolean
Whether to print detailed output during evaluation.
Instance Method Summary collapse
-
#_accumulate_cost(cost) ⇒ Object
private
Internal: accumulate cost from a judge result.
-
#cost_report ⇒ Hash
Cost report summary.
-
#cost_tracker ⇒ Ask::Eval::CostTracker
The cost tracker instance.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset! ⇒ Object
Reset all configuration state.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
16 17 18 19 20 21 |
# File 'lib/ask/eval/configuration.rb', line 16 def initialize @default_judge = nil @verbose = false @track_cost = false @cost_tracker = CostTracker.new end |
Instance Attribute Details
#default_judge ⇒ Object?
Returns the default judge model to use for LLM-as-judge assertions. Can be a callable, an Ask::Provider instance, or a model string.
8 9 10 |
# File 'lib/ask/eval/configuration.rb', line 8 def default_judge @default_judge end |
#track_cost ⇒ Boolean
Returns whether to track token usage and costs.
14 15 16 |
# File 'lib/ask/eval/configuration.rb', line 14 def track_cost @track_cost end |
#verbose ⇒ Boolean
Returns whether to print detailed output during evaluation.
11 12 13 |
# File 'lib/ask/eval/configuration.rb', line 11 def verbose @verbose end |
Instance Method Details
#_accumulate_cost(cost) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Internal: accumulate cost from a judge result.
25 26 27 28 |
# File 'lib/ask/eval/configuration.rb', line 25 def _accumulate_cost(cost) return unless @track_cost && cost # CostTracker handles the recording via DSL methods end |
#cost_report ⇒ Hash
Returns cost report summary.
36 37 38 |
# File 'lib/ask/eval/configuration.rb', line 36 def cost_report cost_tracker.summary end |
#cost_tracker ⇒ Ask::Eval::CostTracker
Returns the cost tracker instance.
31 32 33 |
# File 'lib/ask/eval/configuration.rb', line 31 def cost_tracker @cost_tracker ||= CostTracker.new end |
#reset! ⇒ Object
Reset all configuration state.
41 42 43 44 45 46 |
# File 'lib/ask/eval/configuration.rb', line 41 def reset! @default_judge = nil @verbose = false @track_cost = false @cost_tracker = CostTracker.new end |