Class: Crimson::Message::System
Overview
A system-level message carrying instructions or context.
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
The system message content.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(content) ⇒ System
constructor
A new instance of System.
-
#to_anthropic_h ⇒ Hash
Anthropic-compatible representation.
-
#to_openai_h ⇒ Hash
OpenAI-compatible representation.
Constructor Details
#initialize(content) ⇒ System
Returns a new instance of System.
26 27 28 29 |
# File 'lib/crimson/message.rb', line 26 def initialize(content) super("system") @content = content end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns the system message content.
23 24 25 |
# File 'lib/crimson/message.rb', line 23 def content @content end |
Instance Method Details
#to_anthropic_h ⇒ Hash
Returns Anthropic-compatible representation.
37 38 39 |
# File 'lib/crimson/message.rb', line 37 def to_anthropic_h { type: "text", text: @content } end |
#to_openai_h ⇒ Hash
Returns OpenAI-compatible representation.
32 33 34 |
# File 'lib/crimson/message.rb', line 32 def to_openai_h { role: "system", content: @content } end |