Class: Legion::Extensions::Llm::Inventory::CapabilityEvidence

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

Overview

Evidence that a provider instance supports (or is not known to support) a canonical capability. Config permission, absent fields, default_false, failed probes, and guesses must be constructed as :unknown, never :unsupported.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(capability:, status:, source:, observed_at: nil, metadata: {}) ⇒ CapabilityEvidence

Returns a new instance of CapabilityEvidence.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 78

def initialize(capability:, status:, source:, observed_at: nil, metadata: {})
  canonical_capability = Legion::Extensions::Llm::Capabilities.canonical(capability)
  raise Errors::ValidationError, "capability #{canonical_capability} is not canonical" unless Legion::Extensions::Llm::Capabilities::CANONICAL.include?(canonical_capability)

  Evidence.validate_evidence_status(status: status, allowed: Taxonomies::CAPABILITY_EVIDENCE_STATES)
  Evidence.validate_evidence_source(source: source)
  Evidence.enforce_unknown_only_source!(status: status, source: source)

  super(
    capability: canonical_capability,
    status: status,
    source: source,
    observed_at: Evidence.normalize_observed_at(observed_at),
    metadata: ImmutableValue.copy_and_freeze(value: , field: :metadata)
  )
end

Instance Attribute Details

#capabilityObject (readonly)

Returns the value of attribute capability

Returns:

  • (Object)

    the current value of capability



77
78
79
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 77

def capability
  @capability
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



77
78
79
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 77

def 
  @metadata
end

#observed_atObject (readonly)

Returns the value of attribute observed_at

Returns:

  • (Object)

    the current value of observed_at



77
78
79
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 77

def observed_at
  @observed_at
end

#sourceObject (readonly)

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



77
78
79
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 77

def source
  @source
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



77
78
79
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 77

def status
  @status
end

Instance Method Details

#supported?Boolean

Returns:

  • (Boolean)


95
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 95

def supported? = status == :supported

#unknown?Boolean

Returns:

  • (Boolean)


97
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 97

def unknown? = status == :unknown

#unsupported?Boolean

Returns:

  • (Boolean)


96
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 96

def unsupported? = status == :unsupported