Class: Botiasloop::Conversation::Message
- Inherits:
-
Object
- Object
- Botiasloop::Conversation::Message
- Defined in:
- lib/botiasloop/conversation.rb
Overview
Message model nested within Conversation namespace
Instance Method Summary collapse
-
#to_hash ⇒ Hash
Convert message to hash for API compatibility.
-
#validate ⇒ Object
Validations.
Instance Method Details
#to_hash ⇒ Hash
Convert message to hash for API compatibility
27 28 29 30 31 32 33 34 35 |
# File 'lib/botiasloop/conversation.rb', line 27 def to_hash { role: role, content: content, input_tokens: input_tokens || 0, output_tokens: output_tokens || 0, timestamp: .iso8601 } end |
#validate ⇒ Object
Validations
20 21 22 23 |
# File 'lib/botiasloop/conversation.rb', line 20 def validate super validates_presence i[conversation_id role content] end |