Class: Riffer::StreamEvents::ToolCallDelta
- Defined in:
- lib/riffer/stream_events/tool_call_delta.rb
Overview
Riffer::StreamEvents::ToolCallDelta represents an incremental tool call chunk during streaming.
Emitted when the LLM is building a tool call, containing partial argument data.
Instance Attribute Summary collapse
-
#arguments_delta ⇒ Object
readonly
The incremental arguments JSON fragment.
-
#item_id ⇒ Object
readonly
The tool call item identifier.
-
#name ⇒ Object
readonly
The tool name (may only be present in first delta).
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(item_id:, arguments_delta:, name: nil, role: :assistant) ⇒ ToolCallDelta
constructor
Creates a new tool call delta event.
-
#to_h ⇒ Object
Converts the event to a hash.
Constructor Details
#initialize(item_id:, arguments_delta:, name: nil, role: :assistant) ⇒ ToolCallDelta
Creates a new tool call delta event.
- item_id
-
String - the tool call item identifier
- name
-
String or nil - the tool name (may only be present in first delta)
- arguments_delta
-
String - the incremental arguments JSON fragment
- role
-
Symbol - the message role (defaults to :assistant)
22 23 24 25 26 27 |
# File 'lib/riffer/stream_events/tool_call_delta.rb', line 22 def initialize(item_id:, arguments_delta:, name: nil, role: :assistant) super(role: role) @item_id = item_id @name = name @arguments_delta = arguments_delta end |
Instance Attribute Details
#arguments_delta ⇒ Object (readonly)
The incremental arguments JSON fragment.
14 15 16 |
# File 'lib/riffer/stream_events/tool_call_delta.rb', line 14 def arguments_delta @arguments_delta end |
#item_id ⇒ Object (readonly)
The tool call item identifier.
8 9 10 |
# File 'lib/riffer/stream_events/tool_call_delta.rb', line 8 def item_id @item_id end |
#name ⇒ Object (readonly)
The tool name (may only be present in first delta).
11 12 13 |
# File 'lib/riffer/stream_events/tool_call_delta.rb', line 11 def name @name end |
Instance Method Details
#to_h ⇒ Object
Converts the event to a hash.
Returns Hash - the event data.
32 33 34 |
# File 'lib/riffer/stream_events/tool_call_delta.rb', line 32 def to_h {role: @role, item_id: @item_id, name: @name, arguments_delta: @arguments_delta}.compact end |