Class: Lemans::Results::Usage

Inherits:
Data
  • Object
show all
Defined in:
lib/lemans/results/usage.rb

Overview

What a trial spent. Cache tokens count separately, and the cost carries its own provenance — $0.00 is the figure most in need of auditing.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cached_tokensObject (readonly)

Returns the value of attribute cached_tokens

Returns:

  • (Object)

    the current value of cached_tokens



7
8
9
# File 'lib/lemans/results/usage.rb', line 7

def cached_tokens
  @cached_tokens
end

#cost_sourceObject (readonly)

Returns the value of attribute cost_source

Returns:

  • (Object)

    the current value of cost_source



7
8
9
# File 'lib/lemans/results/usage.rb', line 7

def cost_source
  @cost_source
end

#cost_usdObject (readonly)

Returns the value of attribute cost_usd

Returns:

  • (Object)

    the current value of cost_usd



7
8
9
# File 'lib/lemans/results/usage.rb', line 7

def cost_usd
  @cost_usd
end

#input_tokensObject (readonly)

Returns the value of attribute input_tokens

Returns:

  • (Object)

    the current value of input_tokens



7
8
9
# File 'lib/lemans/results/usage.rb', line 7

def input_tokens
  @input_tokens
end

#output_tokensObject (readonly)

Returns the value of attribute output_tokens

Returns:

  • (Object)

    the current value of output_tokens



7
8
9
# File 'lib/lemans/results/usage.rb', line 7

def output_tokens
  @output_tokens
end

#stepsObject (readonly)

Returns the value of attribute steps

Returns:

  • (Object)

    the current value of steps



7
8
9
# File 'lib/lemans/results/usage.rb', line 7

def steps
  @steps
end

Class Method Details

.zeroObject



8
9
10
# File 'lib/lemans/results/usage.rb', line 8

def self.zero
  new(input_tokens: 0, output_tokens: 0, cached_tokens: 0, cost_usd: 0.0, steps: 0, cost_source: CostSource.none)
end

Instance Method Details

#to_hObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/lemans/results/usage.rb', line 12

def to_h
  {
    input_tokens: input_tokens,
    output_tokens: output_tokens,
    cached_tokens: cached_tokens,
    cost_usd: cost_usd,
    steps: steps,
    cost_source: cost_source&.to_h
  }
end