Class: LLM::Function::Sequential::Group
- Defined in:
- lib/llm/function/sequential/group.rb
Overview
Wraps an array of LLM::Function objects for sequential
execution. Provides the same interface as concurrent group
wrappers so callers can flow through spawn(strategy).wait
uniformly.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(functions) ⇒ Group
constructor
A new instance of Group.
- #interrupt! ⇒ nil (also: #cancel!)
- #spawn ⇒ nil
- #wait ⇒ Array<LLM::Function::Return> (also: #value)
Constructor Details
#initialize(functions) ⇒ Group
Returns a new instance of Group.
12 13 14 15 |
# File 'lib/llm/function/sequential/group.rb', line 12 def initialize(functions) @functions = functions @owner = nil end |
Instance Method Details
#alive? ⇒ Boolean
26 27 28 |
# File 'lib/llm/function/sequential/group.rb', line 26 def alive? false end |
#interrupt! ⇒ nil Also known as: cancel!
32 33 34 35 |
# File 'lib/llm/function/sequential/group.rb', line 32 def interrupt! @owner&.raise(LLM::Interrupt) nil end |
#spawn ⇒ nil
19 20 21 22 |
# File 'lib/llm/function/sequential/group.rb', line 19 def spawn # no-op — execution happens in wait nil end |
#wait ⇒ Array<LLM::Function::Return> Also known as: value
40 41 42 43 44 45 |
# File 'lib/llm/function/sequential/group.rb', line 40 def wait @owner = Thread.current @functions.map(&:call) ensure @owner = nil end |