Class: Legion::Extensions::Llm::Inventory::ScopedRefresher::LegacyCoordinatorAdapter

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

Overview

One-way, post-commit projection of an already-committed new Snapshot into the old Legion::LLM::Inventory coordinator, for the mixed-version window only. It never rediscovers, selects, authorizes new state, or feeds an old fact back into the new Registry. See section 13.3.

Constant Summary collapse

HEALTHY_COMPAT =
{ circuit_state: :closed, denied: false, available: true, adjustment: 0 }.freeze
LEGACY_TYPES =
{ embed: :embedding, image: :image, transcribe: :audio, translate: :audio, speak: :audio }.freeze
LEGACY_CAPABILITIES =
{
  chat: :completion, stream_chat: :streaming, embed: :embedding, image: :image,
  transcribe: :audio_transcription, translate: :audio_transcription, speak: :audio_speech, moderate: :moderation
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(provider_family:, legacy_instance_ids_by_instance: {}) ⇒ LegacyCoordinatorAdapter

Returns a new instance of LegacyCoordinatorAdapter.



130
131
132
133
134
135
# File 'lib/legion/extensions/llm/inventory/scoped_refresher.rb', line 130

def initialize(provider_family:, legacy_instance_ids_by_instance: {})
  @provider_family = canonical_family(provider_family)
  @legacy_instance_ids = deep_freeze_legacy_ids(legacy_instance_ids_by_instance)
  @published_ids_by_instance = {}.freeze
  @mutex = Mutex.new
end

Instance Method Details

#sync_snapshot(snapshot:, instance_key:, mutation_reason:) ⇒ Object



137
138
139
140
141
142
# File 'lib/legion/extensions/llm/inventory/scoped_refresher.rb', line 137

def sync_snapshot(snapshot:, instance_key:, mutation_reason:)
  validate_inputs!(snapshot, instance_key, mutation_reason)
  return :not_loaded unless legacy_inventory_available?

  project(snapshot, instance_key)
end