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
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/llm_cost_tracker/integrations/ruby_llm.rb', line 123 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
139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/llm_cost_tracker/integrations/ruby_llm.rb', line 139 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
154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/llm_cost_tracker/integrations/ruby_llm.rb', line 154 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 |