Class: AgentCliRuntime::NormalizedUsage

Inherits:
Data
  • Object
show all
Defined in:
lib/agent_cli_runtime/values.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input: nil, output: nil, cache_read: nil, cache_write: nil, reasoning: nil, cost: nil) ⇒ NormalizedUsage

Returns a new instance of NormalizedUsage.



450
451
452
453
454
455
456
457
458
459
460
# File 'lib/agent_cli_runtime/values.rb', line 450

def initialize(input: nil, output: nil, cache_read: nil, cache_write: nil,
               reasoning: nil, cost: nil)
  super(
    input: number(input, :input, integer: true),
    output: number(output, :output, integer: true),
    cache_read: number(cache_read, :cache_read, integer: true),
    cache_write: number(cache_write, :cache_write, integer: true),
    reasoning: number(reasoning, :reasoning, integer: true),
    cost: number(cost, :cost, integer: false)
  )
end

Instance Attribute Details

#cache_readObject (readonly)

Returns the value of attribute cache_read

Returns:

  • (Object)

    the current value of cache_read



447
448
449
# File 'lib/agent_cli_runtime/values.rb', line 447

def cache_read
  @cache_read
end

#cache_writeObject (readonly)

Returns the value of attribute cache_write

Returns:

  • (Object)

    the current value of cache_write



447
448
449
# File 'lib/agent_cli_runtime/values.rb', line 447

def cache_write
  @cache_write
end

#costObject (readonly)

Returns the value of attribute cost

Returns:

  • (Object)

    the current value of cost



447
448
449
# File 'lib/agent_cli_runtime/values.rb', line 447

def cost
  @cost
end

#inputObject (readonly)

Returns the value of attribute input

Returns:

  • (Object)

    the current value of input



447
448
449
# File 'lib/agent_cli_runtime/values.rb', line 447

def input
  @input
end

#outputObject (readonly)

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



447
448
449
# File 'lib/agent_cli_runtime/values.rb', line 447

def output
  @output
end

#reasoningObject (readonly)

Returns the value of attribute reasoning

Returns:

  • (Object)

    the current value of reasoning



447
448
449
# File 'lib/agent_cli_runtime/values.rb', line 447

def reasoning
  @reasoning
end

Instance Method Details

#cachedObject



462
463
464
465
466
# File 'lib/agent_cli_runtime/values.rb', line 462

def cached
  return nil if cache_read.nil? || cache_write.nil?

  cache_read + cache_write
end