Class: RosettAi::Quorum::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/quorum/dispatcher.rb

Overview

Dispatches a prompt to multiple engine executors in parallel.

Uses Thread (not Ractor) because the anthropic gem and Net::HTTP are not Ractor-safe. Thread is sufficient for I/O-bound API calls.

Instance Method Summary collapse

Instance Method Details

#dispatch(prompt, executors) ⇒ Hash<String, Hash>

Dispatch a prompt to the given executors.

Parameters:

  • prompt (String)

    the analysis prompt

  • executors (Hash<String, Object>)

    engine_name => executor pairs

Returns:

  • (Hash<String, Hash>)

    engine_name => error:, elapsed:



18
19
20
21
# File 'lib/rosett_ai/quorum/dispatcher.rb', line 18

def dispatch(prompt, executors)
  threads = spawn_threads(prompt, executors)
  collect_thread_results(threads)
end