Class: Legion::Extensions::Llm::Inventory::OfferingRecord

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

Overview

A registry-owned offering with canonical identity, captured callable, and the write-time weight pair copied unchanged from its draft. Only Inventory::Publisher/Registry constructs it. See section 10.2.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ OfferingRecord

Returns a new instance of OfferingRecord.



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/legion/extensions/llm/inventory/records.rb', line 324

def initialize(**kwargs)
  RecordSupport.check_unknown_kwargs!(kwargs: kwargs, members: self.class.members)
  weight_inputs, base_weight = RecordSupport.validated_weight_pair(
    weight_inputs: kwargs[:weight_inputs], base_weight: kwargs[:base_weight]
  )
  instance_key = kwargs[:instance_key]
  callable_handle = kwargs[:callable_handle]
  raise Errors::ValidationError, 'instance_key must be an InstanceKey' unless instance_key.is_a?(Identity::InstanceKey)
  raise Errors::ValidationError, 'callable_handle must be a CallableHandle' unless callable_handle.is_a?(CallableHandle)

  native_key = Identity.normalize_text(value: kwargs[:provider_native_key], field: :provider_native_key)
  Identity.validate_offering_id!(value: kwargs[:offering_id], instance_key: instance_key, provider_native_key: native_key)

  super(
    offering_id: kwargs[:offering_id].dup.freeze,
    provider_native_key: native_key,
    instance_key: instance_key,
    model: Identity.normalize_text(value: kwargs[:model], field: :model),
    tier: Identity.normalize_enum(value: kwargs[:tier], field: :tier, allowed: Taxonomies::TIERS),
    operation_evidence: RecordSupport.validate_operation_evidence!(kwargs[:operation_evidence]),
    capability_evidence: RecordSupport.validate_capability_evidence!(kwargs[:capability_evidence]),
    quota_domains: RecordSupport.validate_quota_domains!(kwargs[:quota_domains]),
    metadata: RecordSupport.(value: kwargs[:metadata]),
    callable_handle: callable_handle,
    publication_source: RecordSupport.publication_source!(value: kwargs[:publication_source]),
    weight_inputs: weight_inputs,
    base_weight: base_weight,
    **RecordSupport.scalar_value_evidences(kwargs)
  )
end

Instance Attribute Details

#base_weightObject (readonly)

Returns the value of attribute base_weight

Returns:

  • (Object)

    the current value of base_weight



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def base_weight
  @base_weight
end

#callable_handleObject (readonly)

Returns the value of attribute callable_handle

Returns:

  • (Object)

    the current value of callable_handle



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def callable_handle
  @callable_handle
end

#capability_evidenceObject (readonly)

Returns the value of attribute capability_evidence

Returns:

  • (Object)

    the current value of capability_evidence



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def capability_evidence
  @capability_evidence
end

#context_evidenceObject (readonly)

Returns the value of attribute context_evidence

Returns:

  • (Object)

    the current value of context_evidence



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def context_evidence
  @context_evidence
end

#embedding_dimensions_evidenceObject (readonly)

Returns the value of attribute embedding_dimensions_evidence

Returns:

  • (Object)

    the current value of embedding_dimensions_evidence



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def embedding_dimensions_evidence
  @embedding_dimensions_evidence
end

#instance_keyObject (readonly)

Returns the value of attribute instance_key

Returns:

  • (Object)

    the current value of instance_key



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def instance_key
  @instance_key
end

#max_output_evidenceObject (readonly)

Returns the value of attribute max_output_evidence

Returns:

  • (Object)

    the current value of max_output_evidence



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def max_output_evidence
  @max_output_evidence
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def 
  @metadata
end

#modelObject (readonly)

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def model
  @model
end

#model_revision_evidenceObject (readonly)

Returns the value of attribute model_revision_evidence

Returns:

  • (Object)

    the current value of model_revision_evidence



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def model_revision_evidence
  @model_revision_evidence
end

#offering_idObject (readonly)

Returns the value of attribute offering_id

Returns:

  • (Object)

    the current value of offering_id



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def offering_id
  @offering_id
end

#operation_evidenceObject (readonly)

Returns the value of attribute operation_evidence

Returns:

  • (Object)

    the current value of operation_evidence



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def operation_evidence
  @operation_evidence
end

#provider_native_keyObject (readonly)

Returns the value of attribute provider_native_key

Returns:

  • (Object)

    the current value of provider_native_key



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def provider_native_key
  @provider_native_key
end

#publication_sourceObject (readonly)

Returns the value of attribute publication_source

Returns:

  • (Object)

    the current value of publication_source



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def publication_source
  @publication_source
end

#quota_domainsObject (readonly)

Returns the value of attribute quota_domains

Returns:

  • (Object)

    the current value of quota_domains



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def quota_domains
  @quota_domains
end

#tierObject (readonly)

Returns the value of attribute tier

Returns:

  • (Object)

    the current value of tier



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def tier
  @tier
end

#tokenizer_evidenceObject (readonly)

Returns the value of attribute tokenizer_evidence

Returns:

  • (Object)

    the current value of tokenizer_evidence



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def tokenizer_evidence
  @tokenizer_evidence
end

#weight_inputsObject (readonly)

Returns the value of attribute weight_inputs

Returns:

  • (Object)

    the current value of weight_inputs



318
319
320
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318

def weight_inputs
  @weight_inputs
end

Instance Method Details

#capability_evidence_for(capability:) ⇒ Object



371
372
373
# File 'lib/legion/extensions/llm/inventory/records.rb', line 371

def capability_evidence_for(capability:)
  capability_evidence[Legion::Extensions::Llm::Capabilities.canonical(capability)]
end

#capability_status(capability:) ⇒ Object



375
376
377
378
# File 'lib/legion/extensions/llm/inventory/records.rb', line 375

def capability_status(capability:)
  evidence = capability_evidence_for(capability: capability)
  evidence.nil? ? :unknown : evidence.status
end

#operation_status(operation:) ⇒ Object



367
368
369
# File 'lib/legion/extensions/llm/inventory/records.rb', line 367

def operation_status(operation:)
  operation_evidence.fetch(Taxonomies.normalize_operation(value: operation, allow_aliases: false)).status
end

#quota_domain(operation:) ⇒ Object



380
381
382
# File 'lib/legion/extensions/llm/inventory/records.rb', line 380

def quota_domain(operation:)
  quota_domains[Taxonomies.normalize_operation(value: operation, allow_aliases: false)]
end

#supported_operationsObject



355
356
357
# File 'lib/legion/extensions/llm/inventory/records.rb', line 355

def supported_operations
  operation_evidence.select { |_op, evidence| evidence.supported? }.keys.sort
end

#unknown_operationsObject



363
364
365
# File 'lib/legion/extensions/llm/inventory/records.rb', line 363

def unknown_operations
  operation_evidence.select { |_op, evidence| evidence.unknown? }.keys.sort
end

#unsupported_operationsObject



359
360
361
# File 'lib/legion/extensions/llm/inventory/records.rb', line 359

def unsupported_operations
  operation_evidence.select { |_op, evidence| evidence.unsupported? }.keys.sort
end