Class: Rach::Message
- Inherits:
-
Object
- Object
- Rach::Message
- Defined in:
- lib/rach/message.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Instance Method Summary collapse
-
#initialize(content:, role: "user") ⇒ Message
constructor
A new instance of Message.
- #to_h ⇒ Object
Constructor Details
#initialize(content:, role: "user") ⇒ Message
Returns a new instance of Message.
5 6 7 8 |
# File 'lib/rach/message.rb', line 5 def initialize(content:, role: "user") @content = content @role = role end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/rach/message.rb', line 3 def content @content end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
3 4 5 |
# File 'lib/rach/message.rb', line 3 def role @role end |
Instance Method Details
#to_h ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rach/message.rb', line 10 def to_h { role: role, content: content } end |