Class: Legion::Extensions::Llm::Vllm::RegistryPublisher

Inherits:
Object
  • Object
show all
Includes:
Logging::Helper
Defined in:
lib/legion/extensions/llm/vllm/registry_publisher.rb

Overview

Best-effort publisher for vLLM provider availability events.

Constant Summary collapse

APP_ID =
'lex-llm-vllm'

Instance Method Summary collapse

Constructor Details

#initialize(builder: RegistryEventBuilder.new) ⇒ RegistryPublisher

Returns a new instance of RegistryPublisher.



13
14
15
# File 'lib/legion/extensions/llm/vllm/registry_publisher.rb', line 13

def initialize(builder: RegistryEventBuilder.new)
  @builder = builder
end

Instance Method Details

#publish_models_async(models, readiness:) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/legion/extensions/llm/vllm/registry_publisher.rb', line 22

def publish_models_async(models, readiness:)
  log.info { "publishing #{Array(models).size} model event(s) to llm.registry" }
  schedule do
    Array(models).each do |model|
      publish_event(@builder.model_available(model, readiness:))
    end
  end
end

#publish_readiness_async(readiness) ⇒ Object



17
18
19
20
# File 'lib/legion/extensions/llm/vllm/registry_publisher.rb', line 17

def publish_readiness_async(readiness)
  log.info { 'publishing readiness event to llm.registry' }
  schedule { publish_event(@builder.readiness(readiness)) }
end