Class: Mistri::Content::Thinking

Inherits:
Data
  • Object
show all
Defined in:
lib/mistri/content.rb

Overview

A model's reasoning. signature is the opaque payload a provider needs to replay the block on a later turn; redacted marks reasoning a safety filter hid, leaving only the signature.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(thinking:, signature: nil, redacted: false) ⇒ Thinking

Returns a new instance of Thinking.



31
32
33
# File 'lib/mistri/content.rb', line 31

def initialize(thinking:, signature: nil, redacted: false)
  super(thinking: Content.freeze_string(thinking), signature:, redacted:)
end

Instance Attribute Details

#redactedObject (readonly)

Returns the value of attribute redacted

Returns:

  • (Object)

    the current value of redacted



30
31
32
# File 'lib/mistri/content.rb', line 30

def redacted
  @redacted
end

#signatureObject (readonly)

Returns the value of attribute signature

Returns:

  • (Object)

    the current value of signature



30
31
32
# File 'lib/mistri/content.rb', line 30

def signature
  @signature
end

#thinkingObject (readonly)

Returns the value of attribute thinking

Returns:

  • (Object)

    the current value of thinking



30
31
32
# File 'lib/mistri/content.rb', line 30

def thinking
  @thinking
end

Instance Method Details

#redacted?Boolean

Returns:

  • (Boolean)


37
# File 'lib/mistri/content.rb', line 37

def redacted? = redacted

#to_hObject



39
40
41
42
43
44
# File 'lib/mistri/content.rb', line 39

def to_h
  h = { type: :thinking, thinking: }
  h[:signature] = signature if signature
  h[:redacted] = true if redacted
  h
end

#typeObject



35
# File 'lib/mistri/content.rb', line 35

def type = :thinking