Class: Legion::Extensions::Llm::Ollama::Actor::DiscoveryRefresh

Inherits:
Actors::Every
  • Object
show all
Includes:
Logging::Helper
Defined in:
lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb

Constant Summary collapse

REFRESH_INTERVAL =
1800

Instance Method Summary collapse

Instance Method Details

#check_subtask?Boolean

Returns:

  • (Boolean)


25
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 25

def check_subtask?  = false

#generate_task?Boolean

Returns:

  • (Boolean)


26
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 26

def generate_task?  = false

#manualObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 34

def manual
  log.debug('[ollama][discovery_refresh] refreshing model list')
  return unless defined?(Legion::LLM::Discovery)

  Legion::LLM::Discovery.run
  if defined?(Legion::LLM::Router) && Legion::LLM::Router.respond_to?(:populate_auto_rules)
    Legion::LLM::Router.populate_auto_rules(Legion::LLM::Discovery.discovered_instances)
  end
  if defined?(Legion::LLM::Inventory) && Legion::LLM::Inventory.respond_to?(:invalidate_offerings_cache!)
    Legion::LLM::Inventory.invalidate_offerings_cache!
  end
rescue StandardError => e
  handle_exception(e, level: :warn, handled: true, operation: 'ollama.actor.discovery_refresh')
end

#run_now?Boolean

Returns:

  • (Boolean)


23
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 23

def run_now?        = true

#runner_classObject



21
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 21

def runner_class    = self.class

#runner_functionObject



22
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 22

def runner_function = 'manual'

#timeObject



28
29
30
31
32
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 28

def time
  return REFRESH_INTERVAL unless defined?(Legion::Settings)

  Legion::Settings.dig(:extensions, :llm, :ollama, :discovery_interval) || REFRESH_INTERVAL
end

#use_runner?Boolean

Returns:

  • (Boolean)


24
# File 'lib/legion/extensions/llm/ollama/actors/discovery_refresh.rb', line 24

def use_runner?     = false