Class: Legion::Extensions::Llm::RegistryEventBuilder

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

Overview

Builds sanitized lex-llm registry envelopes for provider state. Parameterized by ‘provider_family` so each lex-llm-* gem can reuse this class without defining its own copy.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider_family:) ⇒ RegistryEventBuilder

Returns a new instance of RegistryEventBuilder.



14
15
16
# File 'lib/legion/extensions/llm/registry_event_builder.rb', line 14

def initialize(provider_family:)
  @provider_family = provider_family.to_s.downcase.to_sym
end

Instance Attribute Details

#provider_familyObject (readonly)

Returns the value of attribute provider_family.



12
13
14
# File 'lib/legion/extensions/llm/registry_event_builder.rb', line 12

def provider_family
  @provider_family
end

Instance Method Details

#model_available(model, readiness:) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/legion/extensions/llm/registry_event_builder.rb', line 28

def model_available(model, readiness:)
  registry_event_class.available(
    model_offering(model),
    runtime: ,
    health: model_health(readiness),
    metadata: (model)
  )
end

#readiness(readiness) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/legion/extensions/llm/registry_event_builder.rb', line 18

def readiness(readiness)
  registry_event_class.public_send(
    readiness[:ready] ? :available : :unavailable,
    provider_offering(readiness),
    runtime: ,
    health: readiness_health(readiness),
    metadata: (readiness)
  )
end