Class: AgUiProtocol::Core::Events::TextMessageStartEvent
- Inherits:
-
BaseEvent
- Object
- Types::Model
- BaseEvent
- AgUiProtocol::Core::Events::TextMessageStartEvent
- Defined in:
- lib/ag_ui_protocol/core/events.rb
Overview
Signals the start of a text message.
“‘ruby
event = AgUiProtocol::Core::Events::TextMessageStartEvent.new(
message_id: "m1",
)
“‘
Instance Attribute Summary collapse
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Attributes inherited from BaseEvent
Instance Method Summary collapse
-
#initialize(message_id:, role: "assistant", timestamp: nil, raw_event: nil) ⇒ TextMessageStartEvent
constructor
A new instance of TextMessageStartEvent.
- #to_h ⇒ Object
Methods inherited from Types::Model
Constructor Details
#initialize(message_id:, role: "assistant", timestamp: nil, raw_event: nil) ⇒ TextMessageStartEvent
Returns a new instance of TextMessageStartEvent.
148 149 150 151 152 153 154 |
# File 'lib/ag_ui_protocol/core/events.rb', line 148 def initialize(message_id:, role: "assistant", timestamp: nil, raw_event: nil) raise ArgumentError, "role must be one of #{TEXT_MESSAGE_ROLE_VALUES.join(", ")}, got #{role}" unless TEXT_MESSAGE_ROLE_VALUES.include?(role) super(type: EventType::TEXT_MESSAGE_START, timestamp: , raw_event: raw_event) @message_id = @role = role end |
Instance Attribute Details
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
138 139 140 |
# File 'lib/ag_ui_protocol/core/events.rb', line 138 def @message_id end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
141 142 143 |
# File 'lib/ag_ui_protocol/core/events.rb', line 141 def role @role end |
Instance Method Details
#to_h ⇒ Object
157 158 159 |
# File 'lib/ag_ui_protocol/core/events.rb', line 157 def to_h super.merge(message_id: @message_id, role: @role) end |