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
- #cached_input ⇒ Object
-
#initialize(data = {}) ⇒ PricingCategory
constructor
A new instance of PricingCategory.
- #input ⇒ Object
- #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
26 27 28 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 26 def [](key) key == :batch ? batch : standard end |
#cached_input ⇒ Object
22 23 24 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 22 def cached_input standard&.cached_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 |
#to_h ⇒ Object
30 31 32 33 34 35 |
# File 'lib/ruby_llm/model/pricing_category.rb', line 30 def to_h result = {} result[:standard] = standard.to_h if standard result[:batch] = batch.to_h if batch result end |