Class: Riffer::StreamEvents::ToolCallDelta

Inherits:
Base
  • Object
show all
Defined in:
lib/riffer/stream_events/tool_call_delta.rb,
sig/generated/riffer/stream_events/tool_call_delta.rbs

Overview

Represents an incremental tool call chunk (partial argument data) during streaming.

Instance Attribute Summary collapse

Attributes inherited from Base

#role

Instance Method Summary collapse

Constructor Details

#initialize(item_id:, arguments_delta:, name: nil, role: :assistant) ⇒ ToolCallDelta

-- : (item_id: String, arguments_delta: String, ?name: String?, ?role: Symbol) -> void

Parameters:

  • item_id: (String)
  • arguments_delta: (String)
  • name: (String, nil) (defaults to: nil)
  • role: (Symbol) (defaults to: :assistant)


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

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_deltaString (readonly)

The incremental arguments JSON fragment.

Returns:

  • (String)


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

def arguments_delta
  @arguments_delta
end

#item_idString (readonly)

The tool call item identifier.

Returns:

  • (String)


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

def item_id
  @item_id
end

#nameString? (readonly)

The tool name (may only be present in first delta).

Returns:

  • (String, nil)


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

def name
  @name
end

Instance Method Details

#to_hHash[Symbol, untyped]

-- : () -> Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


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

def to_h
  {role: @role, item_id: @item_id, name: @name, arguments_delta: @arguments_delta}.compact
end