Class: Llm::Agents::Base
- Inherits:
-
Object
- Object
- Llm::Agents::Base
- Includes:
- AttrReader
- Defined in:
- lib/llm/agents/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#agent_config ⇒ Object
readonly
Returns the value of attribute agent_config.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, config, logger) ⇒ Base
constructor
A new instance of Base.
- #name_with_type ⇒ Object
- #say(message, color: nil) ⇒ Object
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_config ⇒ Object (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 |
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/llm/agents/base.rb', line 5 def config @config end |
#name ⇒ Object (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_type ⇒ Object
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(, color: nil) if color.nil? @logger.info("#{self.name}: #{}".send(self.agent_config.color)) else if color @logger.info("#{self.name}: #{}".send(color)) else @logger.info("#{self.name}: #{}") end end end |