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



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

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



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

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



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

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