Class: ActionAI::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/action_ai/log_subscriber.rb

Overview

Action AI LogSubscriber

Implements the ActiveSupport::LogSubscriber for logging notifications when a prompt is executed.

Instance Method Summary collapse

Instance Method Details

#loggerObject

Use the logger configured for ActionAI::Agent.



22
23
24
# File 'lib/action_ai/log_subscriber.rb', line 22

def logger
  ActionAI::Agent.logger
end

#process(event) ⇒ Object

A prompt was processed.



12
13
14
15
16
17
18
# File 'lib/action_ai/log_subscriber.rb', line 12

def process(event)
  debug do
    agent  = event.payload[:agent]
    action = event.payload[:action]
    "#{agent}##{action}: executed prompt in #{event.duration.round(1)}ms"
  end
end