Class: Legion::Extensions::Llm::Inventory::ValueEvidence
- Inherits:
-
Data
- Object
- Data
- Legion::Extensions::Llm::Inventory::ValueEvidence
- Defined in:
- lib/legion/extensions/llm/inventory/evidence.rb
Overview
Evidence carrying a known scalar value (context limit, maximum output, embedding dimensions, tokenizer/estimator, immutable model revision) or an explicit :unknown. Each field uses a separate instance so one known field cannot make another field authoritative.
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#observed_at ⇒ Object
readonly
Returns the value of attribute observed_at.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(status:, source:, value: nil, observed_at: nil, metadata: {}) ⇒ ValueEvidence
constructor
A new instance of ValueEvidence.
- #known? ⇒ Boolean
- #unknown? ⇒ Boolean
Constructor Details
#initialize(status:, source:, value: nil, observed_at: nil, metadata: {}) ⇒ ValueEvidence
Returns a new instance of ValueEvidence.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 105 def initialize(status:, source:, value: nil, observed_at: nil, metadata: {}) Evidence.validate_evidence_status(status: status, allowed: Taxonomies::VALUE_EVIDENCE_STATES) Evidence.validate_evidence_source(source: source) Evidence.enforce_unknown_only_source!(status: status, source: source) case status when :known raise Errors::ValidationError, 'known ValueEvidence requires a non-nil value' if value.nil? when :unknown raise Errors::ValidationError, 'unknown ValueEvidence requires value: nil' unless value.nil? end copied_value = value.nil? ? nil : ImmutableValue.copy_and_freeze(value: value, field: :value) super( status: status, value: copied_value, source: source, observed_at: Evidence.normalize_observed_at(observed_at), metadata: ImmutableValue.copy_and_freeze(value: , field: :metadata) ) end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
104 105 106 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 104 def @metadata end |
#observed_at ⇒ Object (readonly)
Returns the value of attribute observed_at
104 105 106 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 104 def observed_at @observed_at end |
#source ⇒ Object (readonly)
Returns the value of attribute source
104 105 106 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 104 def source @source end |
#status ⇒ Object (readonly)
Returns the value of attribute status
104 105 106 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 104 def status @status end |
#value ⇒ Object (readonly)
Returns the value of attribute value
104 105 106 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 104 def value @value end |
Instance Method Details
#known? ⇒ Boolean
128 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 128 def known? = status == :known |
#unknown? ⇒ Boolean
129 |
# File 'lib/legion/extensions/llm/inventory/evidence.rb', line 129 def unknown? = status == :unknown |