Class: RubyLLM::Model::Pricing
- Inherits:
-
Object
- Object
- RubyLLM::Model::Pricing
- Defined in:
- lib/ruby_llm/model/pricing.rb
Overview
A collection that manages and provides access to different categories of pricing information
Constant Summary collapse
- CATEGORIES =
%i[text_tokens images audio_tokens embeddings].freeze
Instance Method Summary collapse
- #audio_tokens ⇒ Object
- #embeddings ⇒ Object
- #images ⇒ Object
-
#initialize(data) ⇒ Pricing
constructor
A new instance of Pricing.
- #text_tokens ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ Pricing
Returns a new instance of Pricing.
9 10 11 12 13 14 15 |
# File 'lib/ruby_llm/model/pricing.rb', line 9 def initialize(data) @data = {} CATEGORIES.each do |category| @data[category] = PricingCategory.new(data[category]) if data[category] && !empty_pricing?(data[category]) end end |
Instance Method Details
#audio_tokens ⇒ Object
25 26 27 |
# File 'lib/ruby_llm/model/pricing.rb', line 25 def audio_tokens category(:audio_tokens) end |
#embeddings ⇒ Object
29 30 31 |
# File 'lib/ruby_llm/model/pricing.rb', line 29 def category(:embeddings) end |
#images ⇒ Object
21 22 23 |
# File 'lib/ruby_llm/model/pricing.rb', line 21 def images category(:images) end |
#text_tokens ⇒ Object
17 18 19 |
# File 'lib/ruby_llm/model/pricing.rb', line 17 def text_tokens category(:text_tokens) end |
#to_h ⇒ Object
33 34 35 |
# File 'lib/ruby_llm/model/pricing.rb', line 33 def to_h @data.transform_values(&:to_h) end |