Class: Legion::CLI::Chat::Tools::KnowledgeStats

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/legion/cli/chat/tools/knowledge_stats.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/knowledge_stats.rb', line 25

def execute
  data = fetch_stats
  return "Apollo error: #{data[:error]}" if data[:error]

  format_stats(data)
rescue Errno::ECONNREFUSED
  'Apollo unavailable (daemon not running).'
rescue StandardError => e
  Legion::Logging.warn("KnowledgeStats#execute failed: #{e.message}") if defined?(Legion::Logging)
  "Error fetching knowledge stats: #{e.message}"
end