[]
        
(Showing Draft Content)

AIMessage

Class AIMessage

java.lang.Object
com.grapecity.documents.excel.AIMessage

public class AIMessage extends Object
Represents a message in a conversation with an AI model.

 AIMessage message = new AIMessage("user", "Summarize the sales report.");
 
  • Constructor Details

    • AIMessage

      public AIMessage(String role, String content)
      Initializes a new instance of the AIMessage class with the specified role and content.
      
       AIMessage message = new AIMessage("system", "Return concise answers.");
       
      Parameters:
      role - The role of the message. Common values: "system", "user"
      content - The content of the message.
  • Method Details

    • getRole

      public String getRole()
      Gets the role of the message. Common values: "system", "user"
      
       AIMessage message = new AIMessage("user", "Translate this text.");
       String role = message.getRole();
       
      Returns:
      The role of the message.
    • setRole

      public void setRole(String role)
      Sets the role of the message. Common values: "system", "user"
      
       AIMessage message = new AIMessage("system", "Return JSON.");
       message.setRole("user");
       
      Parameters:
      role - The role of the message. Common values are "system" and "user".
    • getContent

      public String getContent()
      Gets the content of the message.
      
       AIMessage message = new AIMessage("user", "Classify this text.");
       String content = message.getContent();
       
      Returns:
      The content of the message.
    • setContent

      public void setContent(String content)
      Sets the content of the message.
      
       AIMessage message = new AIMessage("user", "Analyze revenue.");
       message.setContent("Analyze expenses.");
       
      Parameters:
      content - The message content.