Module: Legion::Extensions::Llm::Bedrock::Provider::ModelCatalogHelpers

Included in:
Legion::Extensions::Llm::Bedrock::Provider
Defined in:
lib/legion/extensions/llm/bedrock/provider/model_catalog_helpers.rb

Overview

Model catalog (provider-native model facts) and health/readiness helpers.

Offering production is the discovery actor's writer path (OfferingDraft + Registry publication, 07 C1); the base read path discover_offerings serves the activated inventory offerings from the Registry snapshot (07 C5). The legacy ModelOffering production chain is deleted with the 0.8.0 contract cut.

Instance Method Summary collapse

Instance Method Details

#health(live: false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/legion/extensions/llm/bedrock/provider/model_catalog_helpers.rb', line 16

def health(live: false)
  baseline = {
    provider: :bedrock,
    region: region,
    configured: true,
    ready: true,
    live: live,
    credentials: credential_source
  }
  unless live
    log.debug { "bedrock.provider.health: offline check (region=#{region})" }
    return baseline.merge(checked: false)
  end

  log.info { "bedrock.provider.health: live check (region=#{region})" }
  bedrock_client.list_foundation_models
  log.info { 'bedrock.provider.health: live check passed' }
  baseline.merge(checked: true)
rescue StandardError => e
  handle_exception(e, level: :warn, handled: true, operation: 'bedrock.provider.health')
  baseline.merge(checked: true, ready: false, error: e.class.name, message: e.message)
end

#readiness(live: false) ⇒ Object



39
40
41
42
43
# File 'lib/legion/extensions/llm/bedrock/provider/model_catalog_helpers.rb', line 39

def readiness(live: false)
  log.debug { "bedrock.provider.readiness: checking (live=#{live})" }
  health(live: live).merge(local: false, remote: true, api_base: api_base,
                           endpoints: endpoint_manifest)
end