Method: ActiveAgent::GenerationJob#perform

Defined in:
lib/active_agent/generation_job.rb

#perform(agent, agent_method, generation_method, args:, kwargs: nil, params: nil) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/active_agent/generation_job.rb', line 21

def perform(agent, agent_method, generation_method, args:, kwargs: nil, params: nil)
  agent_class = params ? agent.constantize.with(params) : agent.constantize
  prompt = if kwargs
    agent_class.public_send(agent_method, *args, **kwargs)
  else
    agent_class.public_send(agent_method, *args)
  end
  prompt.send(generation_method)
end