Class: LLM::Function::FiberGroup
- Inherits:
-
Object
- Object
- LLM::Function::FiberGroup
- Defined in:
- lib/llm/function/fiber_group.rb
Overview
The FiberGroup class wraps an array of Fiber objects that are running LLM::Function calls concurrently using raw fibers.
This class provides the same interface as ThreadGroup but uses raw fibers for lightweight concurrency without the async gem.
Instance Method Summary collapse
-
#initialize(fibers)
⇒ LLM::Function::FiberGroup constructor
Creates a new FiberGroup from an array of fiber objects.
-
#alive? ⇒
Boolean
Returns whether any fiber in the group is still alive.
-
#wait ⇒
Array<LLM::Function::Return> (also: #value)
Waits for all fibers in the group to finish and returns their Return values.
Constructor Details
#initialize(fibers) ⇒ LLM::Function::FiberGroup
Creates a new LLM::Function::FiberGroup from an array of fiber objects.
33 34 35 |
# File 'lib/llm/function/fiber_group.rb', line 33 def initialize(fibers) @fibers = fibers end |
Instance Method Details
#alive? ⇒ Boolean
Returns whether any fiber in the group is still alive.
This method checks if any of the fibers in the group are still running. It can be useful for monitoring concurrent tool execution without blocking.
58 59 60 |
# File 'lib/llm/function/fiber_group.rb', line 58 def alive? @fibers.any?(&:alive?) end |
#wait ⇒ Array<LLM::Function::Return> Also known as: value
83 84 85 86 87 88 |
# File 'lib/llm/function/fiber_group.rb', line 83 def wait @fibers.map do |fiber| fiber.resume if fiber.alive? fiber.value end end |