Class: Riffer::StreamEvents::ToolCallDone

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

Overview

Riffer::StreamEvents::ToolCallDone represents a completed tool call during streaming.

Emitted when the LLM has finished building a tool call with complete arguments.

Instance Attribute Summary collapse

Attributes inherited from Base

#role

Instance Method Summary collapse

Constructor Details

#initialize(item_id:, call_id:, name:, arguments:, role: :assistant) ⇒ ToolCallDone

Creates a new tool call done event.

item_id

String - the tool call item identifier

call_id

String - the call identifier for response matching

name

String - the tool name

arguments

String - the complete arguments JSON string

role

Symbol - the message role (defaults to :assistant)



26
27
28
29
30
31
32
# File 'lib/riffer/stream_events/tool_call_done.rb', line 26

def initialize(item_id:, call_id:, name:, arguments:, role: :assistant)
  super(role: role)
  @item_id = item_id
  @call_id = call_id
  @name = name
  @arguments = arguments
end

Instance Attribute Details

#argumentsObject (readonly)

The complete arguments JSON string.



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

def arguments
  @arguments
end

#call_idObject (readonly)

The call identifier for response matching.



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

def call_id
  @call_id
end

#item_idObject (readonly)

The tool call item identifier.



8
9
10
# File 'lib/riffer/stream_events/tool_call_done.rb', line 8

def item_id
  @item_id
end

#nameObject (readonly)

The tool name.



14
15
16
# File 'lib/riffer/stream_events/tool_call_done.rb', line 14

def name
  @name
end

Instance Method Details

#to_hObject

Converts the event to a hash.

Returns Hash - the event data.



37
38
39
# File 'lib/riffer/stream_events/tool_call_done.rb', line 37

def to_h
  {role: @role, item_id: @item_id, call_id: @call_id, name: @name, arguments: @arguments}
end