Module: LlmCostTracker::Integrations::Anthropic::MessagesPatch
- Defined in:
- lib/llm_cost_tracker/integrations/anthropic.rb
Instance Method Summary collapse
- #create(*args, **kwargs) ⇒ Object
- #stream(*args, **kwargs) ⇒ Object
- #stream_raw(*args, **kwargs) ⇒ Object
Instance Method Details
#create(*args, **kwargs) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 128 def create(*args, **kwargs) started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) LlmCostTracker::Integrations::Anthropic.enforce_budget! = super LlmCostTracker::Integrations::Anthropic.( , request: LlmCostTracker::Integrations::Anthropic.request_params(args, kwargs), latency_ms: LlmCostTracker::Integrations::Anthropic.elapsed_ms(started_at) ) end |
#stream(*args, **kwargs) ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 140 def stream(*args, **kwargs) request = LlmCostTracker::Integrations::Anthropic.request_params(args, kwargs) collector = LlmCostTracker::Integrations::Anthropic.stream_collector(request) LlmCostTracker::Integrations::Anthropic.enforce_budget! stream = super LlmCostTracker::Integrations::Anthropic.track_stream(stream, collector: collector) end |
#stream_raw(*args, **kwargs) ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 148 def stream_raw(*args, **kwargs) request = LlmCostTracker::Integrations::Anthropic.request_params(args, kwargs) collector = LlmCostTracker::Integrations::Anthropic.stream_collector(request) LlmCostTracker::Integrations::Anthropic.enforce_budget! stream = super LlmCostTracker::Integrations::Anthropic.track_stream(stream, collector: collector) end |