Class: AgentHarness::Api::RubyLlmChatAdapter::UsageInstrumenter

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_harness/api/ruby_llm_chat_adapter.rb

Overview

Retains only accounting instrumentation; other events may contain request content and are intentionally discarded.

Instance Method Summary collapse

Constructor Details

#initialize(callback, provider_usage) ⇒ UsageInstrumenter

Returns a new instance of UsageInstrumenter.



126
127
128
129
# File 'lib/agent_harness/api/ruby_llm_chat_adapter.rb', line 126

def initialize(callback, provider_usage)
  @callback = callback
  @provider_usage = provider_usage
end

Instance Method Details

#instrument(name, payload) {|payload| ... } ⇒ Object

Yields:

  • (payload)


131
132
133
134
# File 'lib/agent_harness/api/ruby_llm_chat_adapter.rb', line 131

def instrument(name, payload)
  @callback.call(normalize(payload)) if name == "usage.ruby_llm"
  yield(payload) if block_given?
end