Class: Legion::Extensions::Llm::Transport::Messages::RegistryEvent

Inherits:
Transport::Message
  • Object
show all
Defined in:
lib/legion/extensions/llm/transport/messages/registry_event.rb

Overview

Publishes lex-llm RegistryEvent envelopes to the shared llm.registry exchange. Accepts a ‘provider_family` for constructing the app_id and routing key.

Instance Method Summary collapse

Constructor Details

#initialize(event:, provider_family: nil, **options) ⇒ RegistryEvent

Returns a new instance of RegistryEvent.



15
16
17
18
# File 'lib/legion/extensions/llm/transport/messages/registry_event.rb', line 15

def initialize(event:, provider_family: nil, **options)
  @provider_family = provider_family
  super(**event.to_h.merge(options))
end

Instance Method Details

#app_idObject



32
33
34
# File 'lib/legion/extensions/llm/transport/messages/registry_event.rb', line 32

def app_id
  @options[:app_id] || "lex-llm-#{@provider_family || 'unknown'}"
end

#exchangeObject



20
21
22
# File 'lib/legion/extensions/llm/transport/messages/registry_event.rb', line 20

def exchange
  Exchanges::LlmRegistry
end

#persistentObject

rubocop:disable Naming/PredicateMethod



36
37
38
# File 'lib/legion/extensions/llm/transport/messages/registry_event.rb', line 36

def persistent # rubocop:disable Naming/PredicateMethod
  false
end

#routing_keyObject



24
25
26
# File 'lib/legion/extensions/llm/transport/messages/registry_event.rb', line 24

def routing_key
  @options[:routing_key] || "llm.registry.#{@options.fetch(:event_type)}"
end

#typeObject



28
29
30
# File 'lib/legion/extensions/llm/transport/messages/registry_event.rb', line 28

def type
  'llm.registry.event'
end