Class: Legion::Extensions::Llm::Inventory::OfferingRecord
- Inherits:
-
Data
- Object
- Data
- Legion::Extensions::Llm::Inventory::OfferingRecord
- 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
-
#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_key ⇒ Object
readonly
Returns the value of attribute instance_key.
-
#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.
-
#offering_id ⇒ Object
readonly
Returns the value of attribute offering_id.
-
#operation_evidence ⇒ Object
readonly
Returns the value of attribute operation_evidence.
-
#provider_native_key ⇒ Object
readonly
Returns the value of attribute provider_native_key.
-
#publication_source ⇒ Object
readonly
Returns the value of attribute publication_source.
-
#quota_domains ⇒ Object
readonly
Returns the value of attribute quota_domains.
-
#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
- #capability_evidence_for(capability:) ⇒ Object
- #capability_status(capability:) ⇒ Object
-
#initialize(**kwargs) ⇒ OfferingRecord
constructor
A new instance of OfferingRecord.
- #operation_status(operation:) ⇒ Object
- #quota_domain(operation:) ⇒ Object
- #supported_operations ⇒ Object
- #unknown_operations ⇒ Object
- #unsupported_operations ⇒ Object
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_weight ⇒ Object (readonly)
Returns the value of attribute base_weight
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def base_weight @base_weight end |
#callable_handle ⇒ Object (readonly)
Returns the value of attribute callable_handle
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def callable_handle @callable_handle end |
#capability_evidence ⇒ Object (readonly)
Returns the value of attribute capability_evidence
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def capability_evidence @capability_evidence end |
#context_evidence ⇒ Object (readonly)
Returns the value of attribute context_evidence
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def context_evidence @context_evidence end |
#embedding_dimensions_evidence ⇒ Object (readonly)
Returns the value of attribute embedding_dimensions_evidence
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def @embedding_dimensions_evidence end |
#instance_key ⇒ Object (readonly)
Returns the value of attribute instance_key
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def instance_key @instance_key end |
#max_output_evidence ⇒ Object (readonly)
Returns the value of attribute max_output_evidence
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def max_output_evidence @max_output_evidence end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def @metadata end |
#model ⇒ Object (readonly)
Returns the value of attribute model
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def model @model end |
#model_revision_evidence ⇒ Object (readonly)
Returns the value of attribute 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_id ⇒ Object (readonly)
Returns the value of attribute offering_id
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def offering_id @offering_id end |
#operation_evidence ⇒ Object (readonly)
Returns the value of attribute operation_evidence
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def operation_evidence @operation_evidence end |
#provider_native_key ⇒ Object (readonly)
Returns the value of attribute 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_source ⇒ Object (readonly)
Returns the value of attribute publication_source
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def publication_source @publication_source end |
#quota_domains ⇒ Object (readonly)
Returns the value of attribute quota_domains
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def quota_domains @quota_domains end |
#tier ⇒ Object (readonly)
Returns the value of attribute tier
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def tier @tier end |
#tokenizer_evidence ⇒ Object (readonly)
Returns the value of attribute tokenizer_evidence
318 319 320 |
# File 'lib/legion/extensions/llm/inventory/records.rb', line 318 def tokenizer_evidence @tokenizer_evidence end |
#weight_inputs ⇒ Object (readonly)
Returns the value of attribute 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_operations ⇒ Object
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_operations ⇒ Object
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_operations ⇒ Object
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 |