Class: Legion::Extensions::Llm::Bedrock::RegistryPublisher

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

Overview

Best-effort publisher for Bedrock provider availability events.

Constant Summary collapse

APP_ID =
'lex-llm-bedrock'

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/bedrock/registry_publisher.rb', line 13

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

Instance Method Details

#publish_offerings_async(offerings, readiness:) ⇒ Object



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

def publish_offerings_async(offerings, readiness:)
  log.debug do
    "bedrock.registry_publisher.publish_offerings_async: scheduling #{Array(offerings).size} offerings"
  end
  schedule do
    Array(offerings).each do |offering|
      publish_event(@builder.offering_available(offering, readiness:))
    end
  end
end

#publish_readiness_async(readiness) ⇒ Object



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

def publish_readiness_async(readiness)
  log.debug { 'bedrock.registry_publisher.publish_readiness_async: scheduling readiness event' }
  schedule { publish_event(@builder.readiness(readiness)) }
end