Class: AgUiProtocol::Core::Events::ToolCallResultEvent
- Inherits:
-
BaseEvent
- Object
- Types::Model
- BaseEvent
- AgUiProtocol::Core::Events::ToolCallResultEvent
- Defined in:
- lib/ag_ui_protocol/core/events.rb
Overview
Provides the result of a tool call execution.
“‘ruby
event = AgUiProtocol::Core::Events::ToolCallResultEvent.new(
message_id: "m1",
tool_call_id: "tc1",
content: "ok"
)
“‘
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#tool_call_id ⇒ Object
readonly
Returns the value of attribute tool_call_id.
Attributes inherited from BaseEvent
Instance Method Summary collapse
-
#initialize(message_id:, tool_call_id:, content:, role: nil, timestamp: nil, raw_event: nil) ⇒ ToolCallResultEvent
constructor
A new instance of ToolCallResultEvent.
- #to_h ⇒ Object
Methods inherited from Types::Model
Constructor Details
#initialize(message_id:, tool_call_id:, content:, role: nil, timestamp: nil, raw_event: nil) ⇒ ToolCallResultEvent
Returns a new instance of ToolCallResultEvent.
525 526 527 528 529 530 531 532 533 |
# File 'lib/ag_ui_protocol/core/events.rb', line 525 def initialize(message_id:, tool_call_id:, content:, role: nil, timestamp: nil, raw_event: nil) raise ArgumentError, "role must be tool, got #{role}" if !role.nil? && role != "tool" super(type: EventType::TOOL_CALL_RESULT, timestamp: , raw_event: raw_event) @message_id = @tool_call_id = tool_call_id @content = content @role = role end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
504 505 506 |
# File 'lib/ag_ui_protocol/core/events.rb', line 504 def content @content end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
498 499 500 |
# File 'lib/ag_ui_protocol/core/events.rb', line 498 def @message_id end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
507 508 509 |
# File 'lib/ag_ui_protocol/core/events.rb', line 507 def role @role end |
#tool_call_id ⇒ Object (readonly)
Returns the value of attribute tool_call_id.
501 502 503 |
# File 'lib/ag_ui_protocol/core/events.rb', line 501 def tool_call_id @tool_call_id end |
Instance Method Details
#to_h ⇒ Object
536 537 538 539 540 541 542 543 |
# File 'lib/ag_ui_protocol/core/events.rb', line 536 def to_h super.merge( message_id: @message_id, tool_call_id: @tool_call_id, content: @content, role: @role ) end |