Class: Ghostest::Config::Agent

Inherits:
Object
  • Object
show all
Includes:
AttrReader
Defined in:
lib/ghostest/config/agent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, hash, global_config) ⇒ Agent

Returns a new instance of Agent.



8
9
10
11
12
13
14
15
# File 'lib/ghostest/config/agent.rb', line 8

def initialize(name, hash, global_config)
  @global_config = global_config
  @name = name
  @role = hash[:role] || raise(ConfigError.new("Agent role is required"))

  @system_prompt = hash[:system_prompt] || raise(ConfigError.new("Agent system_prompt is required"))
  @color = hash[:color] || raise(ConfigError.new("Agent color is required"))
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



6
7
8
# File 'lib/ghostest/config/agent.rb', line 6

def color
  @color
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/ghostest/config/agent.rb', line 6

def name
  @name
end

#occupationObject (readonly)

Returns the value of attribute occupation.



6
7
8
# File 'lib/ghostest/config/agent.rb', line 6

def occupation
  @occupation
end

#roleObject (readonly)

Returns the value of attribute role.



6
7
8
# File 'lib/ghostest/config/agent.rb', line 6

def role
  @role
end

#system_promptObject (readonly)

Returns the value of attribute system_prompt.



6
7
8
# File 'lib/ghostest/config/agent.rb', line 6

def system_prompt
  @system_prompt
end

Instance Method Details

#role_klassObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ghostest/config/agent.rb', line 17

def role_klass
  case @role.to_sym
  when :test_designer
    return Llm::Agents::TestDesigner
  when :test_programmer
    return Llm::Agents::TestProgrammer
  when :reviewer
    return Llm::Agents::Reviewer
  else
    raise ConfigError.new("Unknown agent role #{@role}")
  end
end