Class: Legion::Extensions::Llm::Inventory::LaneRecord
- Inherits:
-
Data
- Object
- Data
- Legion::Extensions::Llm::Inventory::LaneRecord
- Defined in:
- lib/legion/extensions/llm/inventory/records.rb
Overview
An executable lane: the ONE stored inventory unit, keyed by the
5-tuple id tier:provider_family:instance_id:type:model. Derived by
the registry from one supported operation of an OfferingDraft, with
its write-time weight pair copied unchanged. The 5 tuple is composed
at validation from the record's own fields; there is no separate
offering id (D2 — in the one bucket an offering IS a lane).
See section 10.3.
Instance Attribute Summary collapse
-
#base_weight ⇒ Object
readonly
Returns the value of attribute base_weight.
-
#callable_handle ⇒ Object
readonly
Returns the value of attribute callable_handle.
-
#capability_evidence ⇒ Object
readonly
Returns the value of attribute capability_evidence.
-
#context_evidence ⇒ Object
readonly
Returns the value of attribute context_evidence.
-
#embedding_dimensions_evidence ⇒ Object
readonly
Returns the value of attribute embedding_dimensions_evidence.
-
#instance_id ⇒ Object
readonly
Returns the value of attribute instance_id.
-
#instance_key ⇒ Object
readonly
Returns the value of attribute instance_key.
-
#lane_id ⇒ Object
readonly
Returns the value of attribute lane_id.
-
#max_output_evidence ⇒ Object
readonly
Returns the value of attribute max_output_evidence.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#model_revision_evidence ⇒ Object
readonly
Returns the value of attribute model_revision_evidence.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#provider_family ⇒ Object
readonly
Returns the value of attribute provider_family.
-
#publication_source ⇒ Object
readonly
Returns the value of attribute publication_source.
-
#quota_domain ⇒ Object
readonly
Returns the value of attribute quota_domain.
-
#tier ⇒ Object
readonly
Returns the value of attribute tier.
-
#tokenizer_evidence ⇒ Object
readonly
Returns the value of attribute tokenizer_evidence.
-
#weight_inputs ⇒ Object
readonly
Returns the value of attribute weight_inputs.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ LaneRecord
constructor
A new instance of LaneRecord.
Constructor Details
#initialize(**kwargs) ⇒ LaneRecord
Returns a new instance of LaneRecord.
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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 328 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) family = RecordSupport.normalize_provider_family(value: kwargs[:provider_family]) resolved_instance = Identity.normalize_text(value: kwargs[:instance_id], field: :instance_id) unless family == instance_key.provider_family && resolved_instance == instance_key.instance_id raise Errors::ValidationError, 'provider_family and instance_id must equal instance_key' end canonical_tier = Identity.normalize_enum(value: kwargs[:tier], field: :tier, allowed: Taxonomies::TIERS) canonical_model = Identity.normalize_text(value: kwargs[:model], field: :model) canonical_operation = Taxonomies.normalize_operation(value: kwargs[:operation]) Identity.validate_lane_id!(value: kwargs[:lane_id]) expected_lane_id = Identity.compose_lane_id( tier: canonical_tier, provider_family: family, instance_id: resolved_instance, type: Taxonomies.lane_type_for(operation: canonical_operation), model: canonical_model ) raise Errors::ValidationError, 'lane_id does not reproduce from its identity fields' \ unless kwargs[:lane_id].to_s == expected_lane_id super( lane_id: kwargs[:lane_id].to_s.dup.freeze, instance_key: instance_key, provider_family: family, instance_id: resolved_instance, model: canonical_model, tier: canonical_tier, operation: canonical_operation, capability_evidence: RecordSupport.validate_capability_evidence!(kwargs[:capability_evidence]), quota_domain: kwargs[:quota_domain].nil? ? nil : RecordSupport.validate_quota_domain_value!(value: kwargs[:quota_domain], field: :quota_domain), 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_weight ⇒ Object (readonly)
Returns the value of attribute base_weight
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def base_weight @base_weight end |
#callable_handle ⇒ Object (readonly)
Returns the value of attribute callable_handle
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def callable_handle @callable_handle end |
#capability_evidence ⇒ Object (readonly)
Returns the value of attribute capability_evidence
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def capability_evidence @capability_evidence end |
#context_evidence ⇒ Object (readonly)
Returns the value of attribute context_evidence
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def context_evidence @context_evidence end |
#embedding_dimensions_evidence ⇒ Object (readonly)
Returns the value of attribute embedding_dimensions_evidence
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def @embedding_dimensions_evidence end |
#instance_id ⇒ Object (readonly)
Returns the value of attribute instance_id
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def instance_id @instance_id end |
#instance_key ⇒ Object (readonly)
Returns the value of attribute instance_key
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def instance_key @instance_key end |
#lane_id ⇒ Object (readonly)
Returns the value of attribute lane_id
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def lane_id @lane_id end |
#max_output_evidence ⇒ Object (readonly)
Returns the value of attribute max_output_evidence
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def max_output_evidence @max_output_evidence end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def @metadata end |
#model ⇒ Object (readonly)
Returns the value of attribute model
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def model @model end |
#model_revision_evidence ⇒ Object (readonly)
Returns the value of attribute model_revision_evidence
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def model_revision_evidence @model_revision_evidence end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def operation @operation end |
#provider_family ⇒ Object (readonly)
Returns the value of attribute provider_family
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def provider_family @provider_family end |
#publication_source ⇒ Object (readonly)
Returns the value of attribute publication_source
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def publication_source @publication_source end |
#quota_domain ⇒ Object (readonly)
Returns the value of attribute quota_domain
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def quota_domain @quota_domain end |
#tier ⇒ Object (readonly)
Returns the value of attribute tier
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def tier @tier end |
#tokenizer_evidence ⇒ Object (readonly)
Returns the value of attribute tokenizer_evidence
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def tokenizer_evidence @tokenizer_evidence end |
#weight_inputs ⇒ Object (readonly)
Returns the value of attribute weight_inputs
322 323 324 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 322 def weight_inputs @weight_inputs end |