Class: Rach::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/rach/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'lib/rach/message.rb', line 3

def content
  @content
end

#roleObject (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_hObject



10
11
12
13
14
15
# File 'lib/rach/message.rb', line 10

def to_h
  {
    role: role,
    content: content
  }
end