Class: Riffer::StreamEvents::ReasoningDelta

Inherits:
Base
  • Object
show all
Defined in:
lib/riffer/stream_events/reasoning_delta.rb

Overview

Represents an incremental reasoning chunk during streaming.

Emitted when the LLM produces reasoning/thinking content incrementally. Only available with providers that support reasoning (e.g., OpenAI with reasoning option).

Instance Attribute Summary collapse

Attributes inherited from Base

#role

Instance Method Summary collapse

Constructor Details

#initialize(content, role: :assistant) ⇒ ReasoningDelta

Creates a new reasoning delta event.

content

String - the incremental reasoning content

role

Symbol - the message role (defaults to :assistant)



17
18
19
20
# File 'lib/riffer/stream_events/reasoning_delta.rb', line 17

def initialize(content, role: :assistant)
  super(role: role)
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

The incremental reasoning content.

Returns String.



11
12
13
# File 'lib/riffer/stream_events/reasoning_delta.rb', line 11

def content
  @content
end

Instance Method Details

#to_hObject

Converts the event to a hash.

Returns Hash with :role and :content keys.



25
26
27
# File 'lib/riffer/stream_events/reasoning_delta.rb', line 25

def to_h
  {role: @role, content: @content}
end