Class: OmniAI::Chat::Thinking
- Defined in:
- lib/omniai/chat/thinking.rb
Overview
Represents thinking/reasoning content from a model.
Instance Attribute Summary collapse
-
#metadata ⇒ Hash
Provider-specific metadata (e.g., Anthropic’s signature).
- #thinking ⇒ String
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(thinking = nil, metadata: {}) ⇒ Thinking
constructor
A new instance of Thinking.
- #inspect ⇒ String
- #serialize(context: nil, direction: nil) ⇒ Hash
- #summarize ⇒ String
Methods inherited from Content
Constructor Details
#initialize(thinking = nil, metadata: {}) ⇒ Thinking
Returns a new instance of Thinking.
15 16 17 18 19 |
# File 'lib/omniai/chat/thinking.rb', line 15 def initialize(thinking = nil, metadata: {}) super() @thinking = thinking @metadata = || {} end |
Instance Attribute Details
#metadata ⇒ Hash
Returns Provider-specific metadata (e.g., Anthropic’s signature).
11 12 13 |
# File 'lib/omniai/chat/thinking.rb', line 11 def @metadata end |
#thinking ⇒ String
8 9 10 |
# File 'lib/omniai/chat/thinking.rb', line 8 def thinking @thinking end |
Class Method Details
.deserialize(data, context: nil) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/omniai/chat/thinking.rb', line 33 def self.deserialize(data, context: nil) deserialize = context&.deserializer(:thinking) return deserialize.call(data, context:) if deserialize new(data["thinking"]) end |
Instance Method Details
#inspect ⇒ String
22 23 24 |
# File 'lib/omniai/chat/thinking.rb', line 22 def inspect "#<#{self.class} thinking=#{@thinking.inspect}>" end |
#serialize(context: nil, direction: nil) ⇒ Hash
44 45 46 47 48 49 |
# File 'lib/omniai/chat/thinking.rb', line 44 def serialize(context: nil, direction: nil) # rubocop:disable Lint/UnusedMethodArgument serializer = context&.serializer(:thinking) return serializer.call(self, context:) if serializer { type: "thinking", thinking: @thinking } end |
#summarize ⇒ String
27 28 29 |
# File 'lib/omniai/chat/thinking.rb', line 27 def summarize @thinking end |