Class SystemMessage

java.lang.Object
dev.langchain4j.data.message.SystemMessage
All Implemented Interfaces:
ChatMessage

public class SystemMessage extends Object implements ChatMessage
Represents a system message, typically defined by a developer. This type of message usually provides instructions regarding the AI's actions, such as its behavior or response style.
  • Constructor Details

    • SystemMessage

      public SystemMessage(String text)
      Creates a new system message.
      Parameters:
      text - the message text.
  • Method Details

    • text

      public String text()
      Returns the message text.
      Specified by:
      text in interface ChatMessage
      Returns:
      the message text.
    • type

      public ChatMessageType type()
      Description copied from interface: ChatMessage
      The type of the message.
      Specified by:
      type in interface ChatMessage
      Returns:
      the type of the message
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static SystemMessage from(String text)
      Creates a new system message.
      Parameters:
      text - the message text.
      Returns:
      the system message.
    • systemMessage

      public static SystemMessage systemMessage(String text)
      Creates a new system message.
      Parameters:
      text - the message text.
      Returns:
      the system message.