Module: LlmCostTracker::Integrations::Anthropic::MessagesPatch

Defined in:
lib/llm_cost_tracker/integrations/anthropic.rb

Instance Method Summary collapse

Instance Method Details

#create(*args, **kwargs) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 83

def create(*args, **kwargs)
  LlmCostTracker::Integrations::Anthropic.wrap_blocking(
    args,
    kwargs,
    record: lambda do |message, request, latency_ms|
      LlmCostTracker::Integrations::Anthropic.record_message(
        message, request: request, latency_ms: latency_ms
      )
    end
  ) { super }
end

#stream(*args, **kwargs) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 95

def stream(*args, **kwargs)
  LlmCostTracker::Integrations::Anthropic.wrap_stream(
    args,
    kwargs,
    collector: ->(request) { LlmCostTracker::Integrations::Anthropic.stream_collector(request) }
  ) { super }
end

#stream_raw(*args, **kwargs) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 103

def stream_raw(*args, **kwargs)
  LlmCostTracker::Integrations::Anthropic.wrap_stream(
    args,
    kwargs,
    collector: ->(request) { LlmCostTracker::Integrations::Anthropic.stream_collector(request) }
  ) { super }
end