Class UserMessage

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

public class UserMessage extends Object implements ChatMessage
Represents a message from a user, typically an end user of the application.
  • Constructor Details

    • UserMessage

      public UserMessage(String text)
      Creates a UserMessage from a text.
      Parameters:
      text - the text.
    • UserMessage

      public UserMessage(String name, String text)
      Creates a UserMessage from a name and a text.
      Parameters:
      name - the name.
      text - the text.
    • UserMessage

      public UserMessage(Content... contents)
      Creates a UserMessage from contents.

      Will have a {code null} name.

      Parameters:
      contents - the contents.
    • UserMessage

      public UserMessage(String name, Content... contents)
      Creates a UserMessage from a name and contents.
      Parameters:
      name - the name.
      contents - the contents.
    • UserMessage

      public UserMessage(List<Content> contents)
      Creates a UserMessage from contents.

      Will have a {code null} name.

      Parameters:
      contents - the contents.
    • UserMessage

      public UserMessage(String name, List<Content> contents)
      Creates a UserMessage from a name and contents.
      Parameters:
      name - the name.
      contents - the contents.
  • Method Details