Class: SolidAgents::Agents::Base

Inherits:
RubyLLM::Agent
  • Object
show all
Defined in:
app/solid_agents/agents/base.rb

Direct Known Subclasses

Alex, Betty, Chad, David, Eddy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(run:, context:, owner:) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
# File 'app/solid_agents/agents/base.rb', line 11

def initialize(run:, context:, owner:)
  @run = run
  @context = context
  @owner = owner.to_s
  super()
end

Instance Attribute Details

#context ⇒ Object (readonly)

Returns the value of attribute context.



9
10
11
# File 'app/solid_agents/agents/base.rb', line 9

def context
  @context
end

#owner ⇒ Object (readonly)

Returns the value of attribute owner.



9
10
11
# File 'app/solid_agents/agents/base.rb', line 9

def owner
  @owner
end

#run ⇒ Object (readonly)

Returns the value of attribute run.



9
10
11
# File 'app/solid_agents/agents/base.rb', line 9

def run
  @run
end

Instance Method Details

#call(prompt) ⇒ Object



18
19
20
# File 'app/solid_agents/agents/base.rb', line 18

def call(prompt)
  ask(prompt)
end

#instructions ⇒ Object



22
23
24
25
# File 'app/solid_agents/agents/base.rb', line 22

def instructions
  template_path = File.expand_path("../prompts/#{owner}/instructions.txt.erb", __dir__)
  ERB.new(File.read(template_path)).result(binding)
end