Class: MockServer::LLM::Usage
- Inherits:
-
Object
- Object
- MockServer::LLM::Usage
- Defined in:
- lib/mockserver/llm.rb
Overview
Usage
Instance Method Summary collapse
-
#initialize ⇒ Usage
constructor
A new instance of Usage.
- #to_h ⇒ Hash
- #with_input_tokens(input_tokens) ⇒ self
- #with_output_tokens(output_tokens) ⇒ self
Constructor Details
#initialize ⇒ Usage
Returns a new instance of Usage.
109 110 111 112 |
# File 'lib/mockserver/llm.rb', line 109 def initialize @input_tokens = nil @output_tokens = nil end |
Instance Method Details
#to_h ⇒ Hash
135 136 137 |
# File 'lib/mockserver/llm.rb', line 135 def to_h LLM.omit_nil('inputTokens' => @input_tokens, 'outputTokens' => @output_tokens) end |
#with_input_tokens(input_tokens) ⇒ self
115 116 117 118 119 120 121 122 |
# File 'lib/mockserver/llm.rb', line 115 def with_input_tokens(input_tokens) if !input_tokens.nil? && input_tokens.negative? raise ArgumentError, 'inputTokens must be >= 0' end @input_tokens = input_tokens self end |
#with_output_tokens(output_tokens) ⇒ self
125 126 127 128 129 130 131 132 |
# File 'lib/mockserver/llm.rb', line 125 def with_output_tokens(output_tokens) if !output_tokens.nil? && output_tokens.negative? raise ArgumentError, 'outputTokens must be >= 0' end @output_tokens = output_tokens self end |