Class: Legion::Extensions::Llm::Inventory::Identity::InstanceKey

Inherits:
Data
  • Object
show all
Defined in:
lib/legion/extensions/llm/inventory/identity.rb

Overview

A mandatory, immutable provider_family + instance_id pair. Provider family alone is never executable; two instances of the same provider are independent targets. See section 8.1.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider_family:, instance_id:) ⇒ InstanceKey

Returns a new instance of InstanceKey.



105
106
107
108
109
110
111
112
113
# File 'lib/legion/extensions/llm/inventory/identity.rb', line 105

def initialize(provider_family:, instance_id:)
  family = Identity.normalize_text(value: provider_family, field: :provider_family).downcase
  raise Errors::ValidationError, 'provider_family must match /\A[a-z][a-z0-9_]*\z/' unless family.match?(/\A[a-z][a-z0-9_]*\z/)

  instance = Identity.normalize_text(value: instance_id, field: :instance_id)
  raise Errors::ValidationError, 'instance_id must not be the reserved value "default"' if instance == 'default'

  super(provider_family: family.to_sym, instance_id: instance)
end

Instance Attribute Details

#instance_idObject (readonly)

Returns the value of attribute instance_id

Returns:

  • (Object)

    the current value of instance_id



104
105
106
# File 'lib/legion/extensions/llm/inventory/identity.rb', line 104

def instance_id
  @instance_id
end

#provider_familyObject (readonly)

Returns the value of attribute provider_family

Returns:

  • (Object)

    the current value of provider_family



104
105
106
# File 'lib/legion/extensions/llm/inventory/identity.rb', line 104

def provider_family
  @provider_family
end