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 and captured callable. 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.



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/legion/extensions/llm/inventory/records.rb', line 281

def initialize(**kwargs)
  RecordSupport.check_unknown_kwargs!(kwargs: kwargs, members: self.class.members)
  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]),
    **RecordSupport.scalar_value_evidences(kwargs)
  )
end

Instance Attribute Details

#callable_handleObject (readonly)

Returns the value of attribute callable_handle

Returns:

  • (Object)

    the current value of callable_handle



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def callable_handle
  @callable_handle
end

#capability_evidenceObject (readonly)

Returns the value of attribute capability_evidence

Returns:

  • (Object)

    the current value of capability_evidence



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def capability_evidence
  @capability_evidence
end

#context_evidenceObject (readonly)

Returns the value of attribute context_evidence

Returns:

  • (Object)

    the current value of context_evidence



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

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



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

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



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

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



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def max_output_evidence
  @max_output_evidence
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def 
  @metadata
end

#modelObject (readonly)

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

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



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

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



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def offering_id
  @offering_id
end

#operation_evidenceObject (readonly)

Returns the value of attribute operation_evidence

Returns:

  • (Object)

    the current value of operation_evidence



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

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



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

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



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def publication_source
  @publication_source
end

#quota_domainsObject (readonly)

Returns the value of attribute quota_domains

Returns:

  • (Object)

    the current value of quota_domains



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def quota_domains
  @quota_domains
end

#tierObject (readonly)

Returns the value of attribute tier

Returns:

  • (Object)

    the current value of tier



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def tier
  @tier
end

#tokenizer_evidenceObject (readonly)

Returns the value of attribute tokenizer_evidence

Returns:

  • (Object)

    the current value of tokenizer_evidence



275
276
277
# File 'lib/legion/extensions/llm/inventory/records.rb', line 275

def tokenizer_evidence
  @tokenizer_evidence
end

Instance Method Details

#capability_evidence_for(capability:) ⇒ Object



323
324
325
# File 'lib/legion/extensions/llm/inventory/records.rb', line 323

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

#capability_status(capability:) ⇒ Object



327
328
329
330
# File 'lib/legion/extensions/llm/inventory/records.rb', line 327

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

#operation_status(operation:) ⇒ Object



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

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

#quota_domain(operation:) ⇒ Object



332
333
334
# File 'lib/legion/extensions/llm/inventory/records.rb', line 332

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

#supported_operationsObject



307
308
309
# File 'lib/legion/extensions/llm/inventory/records.rb', line 307

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

#unknown_operationsObject



315
316
317
# File 'lib/legion/extensions/llm/inventory/records.rb', line 315

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

#unsupported_operationsObject



311
312
313
# File 'lib/legion/extensions/llm/inventory/records.rb', line 311

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