Class: Legion::CLI::Chat::Tools::GenerateInsights

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/legion/cli/chat/tools/generate_insights.rb

Constant Summary collapse

DEFAULT_PORT =
4567
DEFAULT_HOST =
'127.0.0.1'

Instance Method Summary collapse

Instance Method Details

#executeObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/legion/cli/chat/tools/generate_insights.rb', line 25

def execute
  sections = gather_sections
  return 'Legion daemon not running (cannot reach API).' if sections.values.all?(&:nil?)

  format_insights(sections)
rescue Errno::ECONNREFUSED
  'Legion daemon not running (cannot reach API).'
rescue StandardError => e
  Legion::Logging.warn("GenerateInsights#execute failed: #{e.message}") if defined?(Legion::Logging)
  "Error generating insights: #{e.message}"
end