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.



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

def initialize(thinking:, signature: nil, redacted: false)
  signature = Content.freeze_string(signature) if signature.is_a?(String)
  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



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

def redacted
  @redacted
end

#signatureObject (readonly)

Returns the value of attribute signature

Returns:

  • (Object)

    the current value of signature



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

def signature
  @signature
end

#thinkingObject (readonly)

Returns the value of attribute thinking

Returns:

  • (Object)

    the current value of thinking



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

def thinking
  @thinking
end

Instance Method Details

#redacted?Boolean

Returns:

  • (Boolean)


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

def redacted? = redacted

#to_hObject



43
44
45
46
47
48
# File 'lib/mistri/content.rb', line 43

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

#typeObject



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

def type = :thinking