Class: Legion::Extensions::Llm::Thinking
- Inherits:
-
Object
- Object
- Legion::Extensions::Llm::Thinking
- Defined in:
- lib/legion/extensions/llm/thinking.rb,
lib/legion/extensions/llm/thinking.rb
Overview
Represents provider thinking output.
Defined Under Namespace
Classes: Config
Instance Attribute Summary collapse
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text: nil, signature: nil) ⇒ Thinking
constructor
A new instance of Thinking.
- #pretty_print(printer) ⇒ Object
Constructor Details
#initialize(text: nil, signature: nil) ⇒ Thinking
Returns a new instance of Thinking.
10 11 12 13 |
# File 'lib/legion/extensions/llm/thinking.rb', line 10 def initialize(text: nil, signature: nil) @text = text @signature = signature end |
Instance Attribute Details
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
8 9 10 |
# File 'lib/legion/extensions/llm/thinking.rb', line 8 def signature @signature end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
8 9 10 |
# File 'lib/legion/extensions/llm/thinking.rb', line 8 def text @text end |
Class Method Details
.build(text: nil, signature: nil) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/llm/thinking.rb', line 15 def self.build(text: nil, signature: nil) text = nil if text.is_a?(String) && text.empty? signature = nil if signature.is_a?(String) && signature.empty? return nil if text.nil? && signature.nil? new(text: text, signature: signature) end |
Instance Method Details
#pretty_print(printer) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/legion/extensions/llm/thinking.rb', line 24 def pretty_print(printer) printer.object_group(self) do printer.breakable printer.text 'text=' printer.pp text printer.comma_breakable printer.text 'signature=' printer.pp(signature ? '[REDACTED]' : nil) end end |