Class: Legion::Extensions::Agentic::Defense::Bias::Helpers::BiasEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bias_type:, domain:, magnitude:, **opts) ⇒ BiasEvent

Returns a new instance of BiasEvent.



15
16
17
18
19
20
21
22
23
24
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 15

def initialize(bias_type:, domain:, magnitude:, **opts)
  @id                 = SecureRandom.uuid
  @bias_type          = bias_type
  @domain             = domain
  @magnitude          = magnitude
  @corrected          = opts.fetch(:corrected, false)
  @correction_applied = opts.fetch(:correction_applied, 0.0)
  @context            = opts.fetch(:context, {})
  @timestamp          = Time.now.utc
end

Instance Attribute Details

#bias_typeObject (readonly)

Returns the value of attribute bias_type.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def bias_type
  @bias_type
end

#contextObject (readonly)

Returns the value of attribute context.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def context
  @context
end

#correctedObject (readonly)

Returns the value of attribute corrected.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def corrected
  @corrected
end

#correction_appliedObject (readonly)

Returns the value of attribute correction_applied.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def correction_applied
  @correction_applied
end

#domainObject (readonly)

Returns the value of attribute domain.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def domain
  @domain
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def id
  @id
end

#magnitudeObject (readonly)

Returns the value of attribute magnitude.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def magnitude
  @magnitude
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



12
13
14
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 12

def timestamp
  @timestamp
end

Instance Method Details

#to_hObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/legion/extensions/agentic/defense/bias/helpers/bias_event.rb', line 26

def to_h
  {
    id:                 @id,
    bias_type:          @bias_type,
    domain:             @domain,
    magnitude:          @magnitude,
    corrected:          @corrected,
    correction_applied: @correction_applied,
    context:            @context,
    timestamp:          @timestamp
  }
end