Class: AgUiProtocol::Core::Events::ToolCallChunkEvent
- Inherits:
-
BaseEvent
- Object
- Types::Model
- BaseEvent
- AgUiProtocol::Core::Events::ToolCallChunkEvent
- Defined in:
- lib/ag_ui_protocol/core/events.rb
Overview
Convenience event for tool calls without manually emitting ‘ToolCallStartEvent`/`ToolCallEndEvent`.
“‘ruby
event = AgUiProtocol::Core::Events::ToolCallChunkEvent.new(
tool_call_id: "tc1",
tool_call_name: "search",
delta: "{\"q\":\"AG-UI\"}"
)
“‘
Behavior:
-
Convenience: Consumers may expand chunk sequences into the standard start/args/end triad (the JS/TS client does this automatically).
-
First chunk requirements: Include both ‘tool_call_id` and `tool_call_name` on the first chunk.
-
Streaming: Subsequent chunks with the same ‘tool_call_id` correspond to args pieces; completion triggers an implied end in clients that perform expansion.
Instance Attribute Summary collapse
-
#delta ⇒ Object
readonly
Returns the value of attribute delta.
-
#parent_message_id ⇒ Object
readonly
Returns the value of attribute parent_message_id.
-
#tool_call_id ⇒ Object
readonly
Returns the value of attribute tool_call_id.
-
#tool_call_name ⇒ Object
readonly
Returns the value of attribute tool_call_name.
Attributes inherited from BaseEvent
Instance Method Summary collapse
-
#initialize(tool_call_id: nil, tool_call_name: nil, parent_message_id: nil, delta: nil, timestamp: nil, raw_event: nil) ⇒ ToolCallChunkEvent
constructor
A new instance of ToolCallChunkEvent.
- #to_h ⇒ Object
Methods inherited from Types::Model
Constructor Details
#initialize(tool_call_id: nil, tool_call_name: nil, parent_message_id: nil, delta: nil, timestamp: nil, raw_event: nil) ⇒ ToolCallChunkEvent
Returns a new instance of ToolCallChunkEvent.
465 466 467 468 469 470 471 |
# File 'lib/ag_ui_protocol/core/events.rb', line 465 def initialize(tool_call_id: nil, tool_call_name: nil, parent_message_id: nil, delta: nil, timestamp: nil, raw_event: nil) super(type: EventType::TOOL_CALL_CHUNK, timestamp: , raw_event: raw_event) @tool_call_id = tool_call_id @tool_call_name = tool_call_name @parent_message_id = @delta = delta end |
Instance Attribute Details
#delta ⇒ Object (readonly)
Returns the value of attribute delta.
447 448 449 |
# File 'lib/ag_ui_protocol/core/events.rb', line 447 def delta @delta end |
#parent_message_id ⇒ Object (readonly)
Returns the value of attribute parent_message_id.
444 445 446 |
# File 'lib/ag_ui_protocol/core/events.rb', line 444 def @parent_message_id end |
#tool_call_id ⇒ Object (readonly)
Returns the value of attribute tool_call_id.
438 439 440 |
# File 'lib/ag_ui_protocol/core/events.rb', line 438 def tool_call_id @tool_call_id end |
#tool_call_name ⇒ Object (readonly)
Returns the value of attribute tool_call_name.
441 442 443 |
# File 'lib/ag_ui_protocol/core/events.rb', line 441 def tool_call_name @tool_call_name end |
Instance Method Details
#to_h ⇒ Object
474 475 476 477 478 479 480 481 |
# File 'lib/ag_ui_protocol/core/events.rb', line 474 def to_h super.merge( tool_call_id: @tool_call_id, tool_call_name: @tool_call_name, parent_message_id: @parent_message_id, delta: @delta ) end |