Class: Crimson::Message::User
Overview
A user message.
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
The user message content.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(content) ⇒ User
constructor
A new instance of User.
-
#to_anthropic_h ⇒ Hash
Anthropic-compatible representation.
-
#to_openai_h ⇒ Hash
OpenAI-compatible representation.
Constructor Details
#initialize(content) ⇒ User
Returns a new instance of User.
48 49 50 51 |
# File 'lib/crimson/message.rb', line 48 def initialize(content) super("user") @content = content end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns the user message content.
45 46 47 |
# File 'lib/crimson/message.rb', line 45 def content @content end |
Instance Method Details
#to_anthropic_h ⇒ Hash
Returns Anthropic-compatible representation.
59 60 61 |
# File 'lib/crimson/message.rb', line 59 def to_anthropic_h { role: "user", content: @content } end |
#to_openai_h ⇒ Hash
Returns OpenAI-compatible representation.
54 55 56 |
# File 'lib/crimson/message.rb', line 54 def to_openai_h { role: "user", content: @content } end |