Class OpenAIChatMessage

java.lang.Object
com.developer.nefarious.zjoule.plugin.chat.openai.OpenAIChatMessage
All Implemented Interfaces:
IChatMessage

public class OpenAIChatMessage extends Object implements IChatMessage
Represents a chat message exchanged with the OpenAI model. The OpenAIChatMessage class implements IChatMessage and encapsulates the role and content of a message in the chat context.
  • Constructor Details

    • OpenAIChatMessage

      public OpenAIChatMessage()
      Default constructor for creating an empty OpenAIChatMessage.
    • OpenAIChatMessage

      public OpenAIChatMessage(Role role, String content)
      Constructs a new OpenAIChatMessage with the specified role and content.
      Parameters:
      role - the role of the message (e.g., Role.USER, Role.SYSTEM).
      content - the content of the message.
  • Method Details

    • getContent

      public String getContent()
      Retrieves the content of the message.
      Returns:
      the content of the message as a String.
    • getMessage

      public String getMessage()
      Retrieves the message content. This is the implementation of the IChatMessage.getMessage() method.
      Specified by:
      getMessage in interface IChatMessage
      Returns:
      the message content as a String.
    • getRole

      public Role getRole()
      Retrieves the role associated with the message. This is the implementation of the IChatMessage.getRole() method.
      Specified by:
      getRole in interface IChatMessage
      Returns:
      the role of the message as a Role.
    • setContent

      public void setContent(String content)
      Sets the content of the message.
      Parameters:
      content - the new content of the message.
    • setRole

      public void setRole(Role role)
      Sets the role of the message.
      Parameters:
      role - the new role of the message (e.g., Role.USER, Role.SYSTEM).