Class: RubyLLM::Model::PricingTier

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/model/pricing_tier.rb

Overview

Stores non-zero pricing values for a single pricing tier.

Constant Summary collapse

ATTRIBUTES =
%i[
  input_per_million
  output_per_million
  cache_read_input_per_million
  cache_write_input_per_million
  cached_input_per_million
  cache_creation_input_per_million
  reasoning_output_per_million
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ PricingTier

Returns a new instance of PricingTier.



17
18
19
20
21
22
23
# File 'lib/ruby_llm/model/pricing_tier.rb', line 17

def initialize(data = {})
  @values = {}

  data.each do |key, value|
    @values[key.to_sym] = value if value && value != 0.0
  end
end

Instance Method Details

#[](key) ⇒ Object



35
36
37
# File 'lib/ruby_llm/model/pricing_tier.rb', line 35

def [](key)
  @values[key.to_sym]
end

#to_hObject



39
40
41
# File 'lib/ruby_llm/model/pricing_tier.rb', line 39

def to_h
  @values
end