Sha256: 64ac2a1ac1eb9ee5452a153425764fa0626826d9687d4dc189694cf76a7ad142
Contents?: true
Size: 496 Bytes
Versions: 2
Compression:
Stored size: 496 Bytes
Contents
module Bristow class Agency attr_reader :agents def initialize(agents: []) @agents = agents end def chat(messages, &block) raise NotImplementedError, "Agency#chat must be implemented by a subclass" end def find_agent(name) agents.find { |agent| agent.name == name } end protected def call_agent(agent, messages, &block) response = agent.chat(messages, &block) response.last # Return just the last message end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bristow-0.2.1 | lib/bristow/agency.rb |
bristow-0.2.0 | lib/bristow/agency.rb |