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

Parameters:

  • 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 (String) (defaults to: "assistant")

    the message role (defaults to “assistant”)



17
18
19
20
21
22
23
# File 'lib/riffer/stream_events/tool_call_done.rb', line 17

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)



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

def arguments
  @arguments
end

#call_idObject (readonly)



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

def call_id
  @call_id
end

#item_idObject (readonly)



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

def item_id
  @item_id
end

#nameObject (readonly)



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

def name
  @name
end

Instance Method Details

#to_hHash

Converts the event to a hash

Returns:

  • (Hash)

    the event data



27
28
29
# File 'lib/riffer/stream_events/tool_call_done.rb', line 27

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