Class: Llm::Agents::Base

Inherits:
Object
  • Object
show all
Includes:
AttrReader
Defined in:
lib/llm/agents/base.rb

Direct Known Subclasses

Reviewer, TestDesigner, TestProgrammer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, config, logger) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
# File 'lib/llm/agents/base.rb', line 7

def initialize(name, config, logger)
  @name = name
  @config = config
  @agent_config = config.agents[name]
  @logger = logger
end

Instance Attribute Details

#agent_configObject (readonly)

Returns the value of attribute agent_config.



5
6
7
# File 'lib/llm/agents/base.rb', line 5

def agent_config
  @agent_config
end

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/llm/agents/base.rb', line 5

def config
  @config
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/llm/agents/base.rb', line 5

def name
  @name
end

Instance Method Details

#name_with_typeObject



14
15
16
# File 'lib/llm/agents/base.rb', line 14

def name_with_type
  "#{self.name}(#{self.agent_config.role})"
end

#say(message, color: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/llm/agents/base.rb', line 18

def say(message, color: nil)
  if color.nil?
    @logger.info("#{self.name}: #{message}".send(self.agent_config.color))
  else
    if color
      @logger.info("#{self.name}: #{message}".send(color))
    else
      @logger.info("#{self.name}: #{message}")
    end
  end
end