Class: Raif::Messages::AssistantMessage
- Inherits:
-
Object
- Object
- Raif::Messages::AssistantMessage
- Defined in:
- lib/raif/messages.rb
Overview
Assistant role message
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Class Method Summary collapse
-
.from_h(hash) ⇒ AssistantMessage
Deserialize from a hash.
Instance Method Summary collapse
-
#initialize(content:) ⇒ AssistantMessage
constructor
A new instance of AssistantMessage.
-
#to_h ⇒ Hash
Hash representation for JSONB storage and LLM APIs.
Constructor Details
#initialize(content:) ⇒ AssistantMessage
Returns a new instance of AssistantMessage.
58 59 60 |
# File 'lib/raif/messages.rb', line 58 def initialize(content:) @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
55 56 57 |
# File 'lib/raif/messages.rb', line 55 def content @content end |
Class Method Details
.from_h(hash) ⇒ AssistantMessage
Deserialize from a hash
70 71 72 |
# File 'lib/raif/messages.rb', line 70 def self.from_h(hash) new(content: hash["content"]) end |
Instance Method Details
#to_h ⇒ Hash
Returns Hash representation for JSONB storage and LLM APIs.
63 64 65 |
# File 'lib/raif/messages.rb', line 63 def to_h { "role" => "assistant", "content" => content } end |