Class: RubyLLM::Model::PricingCategory
- Inherits:
-
Object
- Object
- RubyLLM::Model::PricingCategory
- Defined in:
- lib/ruby_llm/model/pricing_category.rb
Overview
Represents pricing tiers for different usage categories (standard and batch)
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#standard ⇒ Object
readonly
Returns the value of attribute standard.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #cache_read_input ⇒ Object (also: #cached_input)
- #cache_write_input ⇒ Object (also: #cache_creation_input)
-
#initialize(data = {}) ⇒ PricingCategory
constructor
A new instance of PricingCategory.
- #input ⇒ Object
- #output ⇒ Object
- #reasoning_output ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ PricingCategory
Returns a new instance of PricingCategory.
9 10 11 12 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 9 def initialize(data = {}) @standard = PricingTier.new(data[:standard] || {}) unless empty_tier?(data[:standard]) @batch = PricingTier.new(data[:batch] || {}) unless empty_tier?(data[:batch]) end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
7 8 9 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 7 def batch @batch end |
#standard ⇒ Object (readonly)
Returns the value of attribute standard.
7 8 9 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 7 def standard @standard end |
Instance Method Details
#[](key) ⇒ Object
37 38 39 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 37 def [](key) key == :batch ? batch : standard end |
#cache_read_input ⇒ Object Also known as: cached_input
22 23 24 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 22 def cache_read_input standard&.cache_read_input_per_million || standard&.cached_input_per_million end |
#cache_write_input ⇒ Object Also known as: cache_creation_input
26 27 28 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 26 def cache_write_input standard&.cache_write_input_per_million || standard&.cache_creation_input_per_million end |
#input ⇒ Object
14 15 16 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 14 def input standard&.input_per_million end |
#output ⇒ Object
18 19 20 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 18 def output standard&.output_per_million end |
#reasoning_output ⇒ Object
30 31 32 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 30 def reasoning_output standard&.reasoning_output_per_million end |
#to_h ⇒ Object
41 42 43 44 45 46 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 41 def to_h result = {} result[:standard] = standard.to_h if standard result[:batch] = batch.to_h if batch result end |