Class: Bristow::Agencies::Supervisor
- Inherits:
-
Bristow::Agency
- Object
- Bristow::Agency
- Bristow::Agencies::Supervisor
- Defined in:
- lib/bristow/agencies/supervisor.rb
Instance Attribute Summary collapse
-
#supervisor ⇒ Object
readonly
Returns the value of attribute supervisor.
Instance Method Summary collapse
- #chat(messages, &block) ⇒ Object
-
#initialize(agents: self.class.agents.dup, custom_instructions: self.class.custom_instructions, termination: Bristow::Terminations::MaxMessages.new(100)) ⇒ Supervisor
constructor
A new instance of Supervisor.
Methods inherited from Bristow::Agency
Methods included from Sgetter
Constructor Details
#initialize(agents: self.class.agents.dup, custom_instructions: self.class.custom_instructions, termination: Bristow::Terminations::MaxMessages.new(100)) ⇒ Supervisor
Returns a new instance of Supervisor.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bristow/agencies/supervisor.rb', line 8 def initialize(agents: self.class.agents.dup, custom_instructions: self.class.custom_instructions, termination: Bristow::Terminations::MaxMessages.new(100)) @custom_instructions = custom_instructions @agents = agents @termination = termination @supervisor = Agents::Supervisor.new( child_agents: agents, agency: self, custom_instructions: custom_instructions, termination: termination ) end |
Instance Attribute Details
#supervisor ⇒ Object (readonly)
Returns the value of attribute supervisor.
4 5 6 |
# File 'lib/bristow/agencies/supervisor.rb', line 4 def supervisor @supervisor end |
Instance Method Details
#chat(messages, &block) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/bristow/agencies/supervisor.rb', line 20 def chat(, &block) raise "Supervisor not set" unless supervisor # Convert string message to proper format = [{ role: "user", content: }] if .is_a?(String) supervisor.chat(, &block) end |