Class: LlmCostTracker::Integrations::Anthropic::BatchResultsCapture

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/llm_cost_tracker/integrations/anthropic.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_stream) ⇒ BatchResultsCapture

Returns a new instance of BatchResultsCapture.



123
124
125
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 123

def initialize(raw_stream)
  @raw_stream = raw_stream
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



140
141
142
143
144
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 140

def method_missing(name, ...)
  return super unless @raw_stream.respond_to?(name)

  @raw_stream.public_send(name, ...)
end

Instance Method Details

#each(&block) ⇒ Object



127
128
129
130
131
132
133
134
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 127

def each(&block)
  return enum_for(:each) unless block

  @raw_stream.each do |response|
    LlmCostTracker::Integrations::Anthropic.record_batch_result(response)
    block.call(response)
  end
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/llm_cost_tracker/integrations/anthropic.rb', line 136

def respond_to_missing?(name, include_private = false)
  @raw_stream.respond_to?(name, include_private) || super
end