Module: RubyLLM::ToolConcurrency
- Defined in:
- lib/ruby_llm/tool_concurrency.rb
Overview
Runs multiple tool calls concurrently with Ruby’s built-in threads or optional fibers.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- MODES =
%i[threads fibers].freeze
Class Method Summary collapse
Class Method Details
.modes ⇒ Object
11 12 13 |
# File 'lib/ruby_llm/tool_concurrency.rb', line 11 def modes MODES end |
.run(mode, tool_calls, on_result: nil) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/ruby_llm/tool_concurrency.rb', line 19 def run(mode, tool_calls, on_result: nil, &) case mode when :threads run_with_threads(tool_calls, on_result:, &) when :fibers run_with_fibers(tool_calls, on_result:, &) end end |
.supported?(name) ⇒ Boolean
15 16 17 |
# File 'lib/ruby_llm/tool_concurrency.rb', line 15 def supported?(name) MODES.include?(name) end |