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
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 93 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
105 106 107 108 109 110 111 |
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 105 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
113 114 115 116 117 118 119 |
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 113 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 |