Class: Legion::TTY::Background::LlmProbe

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/tty/background/llm_probe.rb

Instance Method Summary collapse

Constructor Details

#initialize(logger: nil) ⇒ LlmProbe

Returns a new instance of LlmProbe.



7
8
9
# File 'lib/legion/tty/background/llm_probe.rb', line 7

def initialize(logger: nil)
  @log = logger
end

Instance Method Details

#run_async(queue) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/legion/tty/background/llm_probe.rb', line 11

def run_async(queue)
  Thread.new do
    result = probe_providers
    queue.push({ data: result })
  rescue StandardError => e
    @log&.log('llm_probe', "error: #{e.message}")
    queue.push({ data: { providers: [], error: e.message } })
  end
end