Class: Crimson::Message::System

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

Overview

A system-level message carrying instructions or context.

Instance Attribute Summary collapse

Attributes inherited from Base

#role

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ System

Returns a new instance of System.

Parameters:

  • content (String)


26
27
28
29
# File 'lib/crimson/message.rb', line 26

def initialize(content)
  super("system")
  @content = content
end

Instance Attribute Details

#contentString (readonly)

Returns the system message content.

Returns:

  • (String)

    the system message content



23
24
25
# File 'lib/crimson/message.rb', line 23

def content
  @content
end

Instance Method Details

#to_anthropic_hHash

Returns Anthropic-compatible representation.

Returns:

  • (Hash)

    Anthropic-compatible representation



37
38
39
# File 'lib/crimson/message.rb', line 37

def to_anthropic_h
  { type: "text", text: @content }
end

#to_openai_hHash

Returns OpenAI-compatible representation.

Returns:

  • (Hash)

    OpenAI-compatible representation



32
33
34
# File 'lib/crimson/message.rb', line 32

def to_openai_h
  { role: "system", content: @content }
end