Module: LlmCostTracker::Integrations::RubyLlm::ProviderPatch
- Defined in:
- lib/llm_cost_tracker/integrations/ruby_llm.rb
Instance Method Summary collapse
- #complete(*args, **kwargs) ⇒ Object
- #embed(*args, **kwargs) ⇒ Object
- #transcribe(*args, **kwargs) ⇒ Object
Instance Method Details
#complete(*args, **kwargs) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/llm_cost_tracker/integrations/ruby_llm.rb', line 133 def complete(*args, **kwargs, &) integration = LlmCostTracker::Integrations::RubyLlm request = integration.request_params(args, kwargs) started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) integration.enforce_budget! response = super integration.record_completion( self, response, request: request, latency_ms: integration.elapsed_ms(started_at), stream: integration.streaming_request?(request, has_block: block_given?) ) response end |
#embed(*args, **kwargs) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/llm_cost_tracker/integrations/ruby_llm.rb', line 149 def (*args, **kwargs) integration = LlmCostTracker::Integrations::RubyLlm request = integration.request_params(args, kwargs) started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) integration.enforce_budget! response = super integration.( self, response, request: request, latency_ms: integration.elapsed_ms(started_at) ) response end |
#transcribe(*args, **kwargs) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/llm_cost_tracker/integrations/ruby_llm.rb', line 164 def transcribe(*args, **kwargs) integration = LlmCostTracker::Integrations::RubyLlm request = integration.request_params(args, kwargs) started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) integration.enforce_budget! response = super integration.record_transcription( self, response, request: request, latency_ms: integration.elapsed_ms(started_at) ) response end |