Class: LLM::Function::CallGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/function/call_group.rb

Overview

The CallGroup class wraps an array of LLM::Function objects for sequential execution.

It provides the same basic interface as the concurrent group wrappers so callers can flow through spawn(strategy).wait uniformly, even when the selected strategy is direct calls.

Instance Method Summary collapse

Constructor Details

#initialize(functions) ⇒ LLM::Function::CallGroup

Parameters:



15
16
17
18
# File 'lib/llm/function/call_group.rb', line 15

def initialize(functions)
  @functions = functions
  @owner = nil
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/llm/function/call_group.rb', line 22

def alive?
  false
end

#interrupt!nil Also known as: cancel!

Returns:

  • (nil)


28
29
30
31
# File 'lib/llm/function/call_group.rb', line 28

def interrupt!
  @owner&.raise(LLM::Interrupt)
  nil
end

#waitArray<LLM::Function::Return> Also known as: value



36
37
38
39
40
41
# File 'lib/llm/function/call_group.rb', line 36

def wait
  @owner = Thread.current
  @functions.map(&:call)
ensure
  @owner = nil
end