Class CustomMessage

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

public class CustomMessage extends Object implements ChatMessage
Represents a custom message. Can be used only with ChatLanguageModel implementations that support this type of message.
  • Constructor Details

    • CustomMessage

      public CustomMessage(Map<String,Object> attributes)
      Creates a new custom message.
      Parameters:
      attributes - the message attributes.
  • Method Details

    • attributes

      public Map<String,Object> attributes()
      Returns the message attributes.
      Returns:
      the message attributes.
    • 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
    • text

      public String text()
      Description copied from interface: ChatMessage
      The text of the message.
      Specified by:
      text in interface ChatMessage
      Returns:
      the text 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 CustomMessage from(Map<String,Object> attributes)
      Creates a new custom message.
      Parameters:
      attributes - the message attributes.
      Returns:
      the custom message.
    • customMessage

      public static CustomMessage customMessage(Map<String,Object> attributes)
      Creates a new custom message.
      Parameters:
      attributes - the message attributes.
      Returns:
      the custom message.