Class: OrchestraAI::Orchestra
- Inherits:
-
Object
- Object
- OrchestraAI::Orchestra
- Defined in:
- lib/orchestra_ai/orchestra.rb
Class Attribute Summary collapse
-
.instruments ⇒ Object
readonly
Returns the value of attribute instruments.
Class Method Summary collapse
Class Attribute Details
.instruments ⇒ Object (readonly)
Returns the value of attribute instruments.
6 7 8 |
# File 'lib/orchestra_ai/orchestra.rb', line 6 def instruments @instruments end |
Class Method Details
.instrument(klass) ⇒ Object
8 9 10 11 |
# File 'lib/orchestra_ai/orchestra.rb', line 8 def instrument(klass) @instruments ||= [] @instruments << klass end |
.play(message, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/orchestra_ai/orchestra.rb', line 13 def play(, &block) results = [] loop do creation = Step::CreateTask.new( instruments: instruments.map(&:new), message:, block:, results: ) creation.perform task = creation.task result = task.result results << result if creation.[:continuation].to_s == "false" break end end summarize = Step::Summarize.new( results:, block: ) summarize.perform end |